modmore / VersionX

Resource & Element Versioning Extra for MODX Revolution (supports 2.2 and up). Extends the core in a future-proof manner to keep copies of every change to resources, templates, template variables, chunks, snippets and plugins.
https://modmore.com/extras/versionx/
40 stars 20 forks source link

The migrate script only converts resources #134

Open SnowCreative opened 5 months ago

SnowCreative commented 5 months ago

I ran migrate.php after updating a site. All the resource data was converted to the new format, but no data for chunks, templates, snippets, TVs, or plugins was converted.

Additionally, the error log is filled with errors like this: PHP warning: Undefined array key "pagecolumns" So the names of TVs show up as undefined array keys. I assume this is when it is converting resources, not other objects. No other errors get displayed.

MODX 3.0.4, VersionX 3.1.0

muzzwood commented 5 months ago

Hmm that's odd. So there are no errors shown in the command line when you run the script?

Also. what line number are those warnings coming from?

SnowCreative commented 5 months ago

Line 178.

But, I just deleted all the converted data and reinstalled the plugin and reran the migration script. All the other objects got converted this time.

I've noticed with several different plugins that I have to install them twice in MODX 3. The installation mostly goes fine, but there is an error message saying that a class name is in use. On the second installation, that message goes away. For VersionX this is the error: PHP warning: Cannot declare class modPlugin, because the name is already in use.

So maybe the problem was an incomplete installation? I still get the undefined array key errors, though.

muzzwood commented 5 months ago

OK so line 178 probably needs to be changed to something like:

$beforeValue = !empty($prevItems[$key]) ? normalizeValue($prevItems[$key]) : '';

in order to stop that warning.


Is this a migration that's going from MODX 2.x to 3.x in addition to VersionX 2.x to 3.x? If so, it's possible that's throwing something unexpected into the mix.

SnowCreative commented 5 months ago

Is this a migration that's going from MODX 2.x to 3.x in addition to VersionX 2.x to 3.x?

The site was converted to 2.x to 3.x a while ago.