PrevJuly 2014 Core Updates
Switch to CKEditor, new default site profile and API additions. More
4 August 2014 by Ryan Cramer 0 Comments
This feature is to answer the question of how to migrate field changes more easily. With this new feature, migrating field changes or additions is as easy as copying and pasting some text (literally!) – here's how it works:
Behind the scenes, when creating an export, ProcessWire converts internal references for resources like pages and templates to external references to make them cross-site portable. To put that another way, the IDs of resources don't have to match up between the two sites. This opens up the ability to migrate fields between completely different sites.
Importing doesn't have to be an all-or-nothing operation. When performing a field export/import, there is always a chance that some expected resource or module isn't available on the importing site. But this is not a fatal error to the import tool. Instead, it will let you continue to import the fields (and properties of those fields) that you decide. This gives you the ability to complete any remaining configuration on your own.
Like everything in ProcessWire, it's also API accessible. If you are interested in that side of it, see the new Exportable interface, which lets you assume any classes implementing it to havegetExportData()
and setImportData(array $data)
methods:
$item->getExportData()
takes no arguments and returns an array of portable data ready for import somewhere else.$item->setImportData($data)
accepts $data
array as it's only argument and populates the $item
with that data. It returns an array indexed by property name of everything that changed, along with the old value, new value and any error messages or warnings that accompanied it.If you want to commit the changes, all you need to do is $item->save()
.
The field export/import is actually just the first in a series of upcoming updates enabling more simple migration of configuration data in ProcessWire. Coming next will be the same exact tool, but for migrating templates (including related field assignments/fieldgroups).
There has been interest among some in keeping field and template changes under version control, so we will also be providing a module that mirrors every change to a field/template to JSON files (which will also be supported by the import tools).
When you use $session->set('foo', 'bar')
you are setting the property named "foo" within the same namespace as anything else that might be using $session
to remember values. If another process happens to set its own value for "foo", you've got a name collision.
Admittedly, name collisions aren't likely just because most people setting session variables are making them a whole lot more specific than "foo". But the truth is you really shouldn't have to think about stuff like that.
This week we've added session namespace support so that you can optionally specify a namespace that your value should live within. This ensures that you won't have the potential for name collisions in session variables. Here's how you use it:
$session->set($this, 'foo', 'bar');
$bar = $session->get($this, 'foo');
When given an object instance (like $this
) or your own namespace (string), the values you set are only accessible within that namespace. If you later call $session->get('foo')
, you won't get the value you set before, because your namespace wasn't specified. Of course, the non-namespace syntax works as it always has, so this is all backwards compatible.
27 July 2014 1
Switch to CKEditor, new default site profile and API additions. More
12 August 2014
CKEditor updates, how to install a CKEditor plugin, new module installation options and more! More