Articles will not import from ModX

Hi folks,

I have just successfully upgraded a site to ModX 3.0.5 from the latest version of 2.8. The upgrade went smoothly. I had not used Articles before the upgrade, however, I had installed Articles 1.7.11. Post-upgrade, I installed the latest version of Articles (2.0.0-beta), but ran into some problems, so I did a complete uninstall/delete of Articles and a new clean install of 2.0.0-beta.

I was able to create the Articles container with no problem, but when I attempt to import content from another container into Articles, I get an error that says, “[Articles] could not load import service!”

The error log reports these two errors (consistently):

[2024-07-23 11:05:35] (ERROR @ /home/my_server/public_html/folder_name/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 667) Could not load class: modAction from mysql.modaction
[2024-07-23 11:05:35] (ERROR @ /home/my_server/public_html/folder_name/core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 787) modAction::load() is not a valid static method.

(I was getting other errors in the log whenever I accessed the Package Installer, but it turned out I needed to uninstall and reinstall Taglister and that problem went away.)

I had deleted all traces of the previous version of Articles before I installed 2.0.0-beta again from scratch, but perhaps there remain some artifacts from that (that I cannot find) and some dependencies/compatibility issues?

I’ve run out of ideas, so any suggestions that might point me in the right direction would be really helpful. I’m generally quite resourceful, but in this case I’m stumped. It may be something obvious, but I’ve lost the plot.

Thanks!
Michael

The class modAction doesn’t exist in MODX 3 anymore:

Not sure why it’s still used in the code.


Replace the code

$action = $this->modx->getObject('modAction', [
	'namespace' => 'core',
	'controller' => 'resource/update',
]);
if ($action) {
	$this->editAction = $action->get('id');
}
else {
	$this->editAction = 'resource/update';
}

with just $this->editAction = 'resource/update'; to get rid of the error messages.

1 Like

This seems to be a bug.
The code still looks for a file core/components/articles/model/articles/import/articlesimportmodx.class.php.
That was the path in the version for MODX 2. It looks like the file is now located in core/components/articles/src/Model/Import/ArticlesImportModx.php.

So maybe try replacing the code here

with this instead

$modelPath = $this->modx->getOption('articles.core_path',null,$this->modx->getOption('core_path').'components/articles/') . 'src/Model/';
$servicePath = $modelPath . 'Import/ArticlesImport' . ucfirst(strtolower($serviceName)) . '.php';
1 Like

Thank you! This is helpful, and the errors have stopped. However, now that I (presumably) have Articles fit for ModX 3.0.5, when I convert a container to an Articles Container and then attempt to import the resources into Articles, it hangs indefinitely and ultimately nothing gets imported.

Any idea what might be the cause of that? At first I was going to report there are no further errors (in the manager log), but there ARE a couple of new ones on the Articles container page, and they’re the same. Where the articles inside the container would normally appear (when they’re there at all), and on the Template Variables tab, there’s this error:

"A server error prevented this grid's content from loading. Refer to your browser's console, manager logs, and/or php server logs for more information."

My php error log is empty.

EDIT: And now I am actually seeing some new errors in the ModX error log:

[2024-07-23 13:19:43] (ERROR @ /Users/.../core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 332) Instantiated a derived class MODX\Revolution\modDocument that is not a subclass of the requested class Articles\Model\ArticlesContainer
[2024-07-23 13:23:15] (ERROR @ /Users/.../core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 667) Could not load class: Quip from quip
[2024-07-23 13:23:15] (ERROR @ /Users/.../core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 1273) Problem getting service quip, instance of class Quip, from path /Users/.../core/components/quip/model/quip/
[2024-07-23 13:23:15] (ERROR @ /Users/.../core/vendor/xpdo/xpdo/src/xPDO/Om/xPDOObject.php : 227) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 ORDER BY `modResource`.`pagetitle` ASC LIMIT 20' at line 1
)

It looks like this import function was never tested at all in the MODX3 version of the extra.

In this line

$this->modx->articles seems to be null.
Replace the line with

$this->service = new $className(new \Articles\Articles($this->modx),$this,$this->getProperties());

And also replace this line (in ArticlesImportModx.php)

with

use MODX\Revolution\modResource;

You’re a HERO! This, plus the recommended edits to PHP files in your previous post, totally worked. Import successful! THANK YOU.

Michael

Is Quip working for you? I remember reading that it hadn’t been updated for MODX 3.

Quip is still not updated for MODX 3.
But it has been removed as a dependency from Articles.
In the code there are still some references to Quip, but if comments aren’t enabled, it’s probably fine.

Thanks for the info!

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.