modxcms / Articles

Blog Custom Resource Type for MODX
17 stars 31 forks source link

Articles Extra Fails to Update #159

Open visualgui opened 2 years ago

visualgui commented 2 years ago

Bug report

Summary

Pages created with Articles Extra are completely broken when upgraded to MODX 3.0.0

Step to reproduce

Tried to update Article Extra, but it failed.

Observed behavior

Could not download and create transport package with signature: articles-2.0.0-alpha1

Expected behavior

Here’s the failure message: “Could not download and create transport package with signature: articles-2.0.0-alpha1”

Environment

Articles version 1.7.13-pl

muzzwood commented 2 years ago

Hi @visualgui,

JoshuaLuckers commented 2 years ago

@rthrash might there be something wrong with the package at the providers side? It's the second time someone reported this issue.

jaygilmore commented 2 years ago

@JoshuaLuckers If the package was created correctly and the uploaded transport.zip was not corrupt it should work. We'd have all sorts of complaints if there were something wrong with the Extras repo. We'd need more info from the environment and any errors displayed in the log, php log or other logs per @muzzwood's ask.

Also, I'd like to hear more about what this means, @visualgui "Pages created with Articles Extra are completely broken"?

muzzwood commented 2 years ago

@jaygilmore @JoshuaLuckers I just tried installing 2.0.0-alpha1 from the MODX repo and got the same error. The error actually appears when trying to download it, rather than when trying to install it.

The POST response is:

{"success":false,"message":"Could not download and create transport package with signature: articles-2.0.0-alpha1","total":0,"data":[],"object":[]}

Screenshot 2022-04-12 at 20-40-32 Package Management MODX Revolution

Also, I'd like to hear more about what this means, @visualgui "Pages created with Articles Extra are completely broken"?

I'm guessing that means that pages aren't showing/loading in the tree since it won't be the 3.x compatible version. (wrong class_key)

Error log shows:

[2022-04-12 20:48:20] (ERROR @ /www/core/src/Revolution/Transport/modTransportPackage.php : 432) PHP warning: fopen(No URL!?revolution_version=Revolution-3.0.0-pl): Failed to open stream: No such file or directory
[2022-04-12 20:48:20] (ERROR @ /www/core/src/Revolution/Transport/modTransportPackage.php : 447) Could not open file for reading: No URL!?revolution_version=Revolution-3.0.0-pl
[2022-04-12 20:48:20] (ERROR @ /www/core/src/Revolution/Transport/modTransportPackage.php : 778) PHP warning: Undefined array key "host"
[2022-04-12 20:48:20] (ERROR @ /www/core/src/Revolution/Transport/modTransportPackage.php : 787) PHP warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known
[2022-04-12 20:48:20] (ERROR @ /www/core/src/Revolution/Transport/modTransportPackage.php : 787) PHP warning: fsockopen(): Unable to connect to :80 (php_network_getaddresses: getaddrinfo failed: Name or service not known)
[2022-04-12 20:48:20] (ERROR @ /www/core/src/Revolution/Transport/modTransportPackage.php : 790) Could not retrieve from No URL!?revolution_version=Revolution-3.0.0-pl
[2022-04-12 20:48:20] (ERROR @ /www/core/src/Revolution/Transport/modTransportPackage.php : 499) MODX could not download the file. You must enable allow_url_fopen, cURL or fsockopen to use remote transport packaging.

The above is on a MODX Cloud instance running MODX 3.0.0-pl with PHP 8.0. (also downgraded to PHP 7.4, same thing)

I can confirm that uploading the package and installing it that way works on the same instance.

@visualgui until this is sorted, you can download the package from here: https://github.com/modxcms/Articles/blob/develop-3x/_packages/articles-2.0.0-alpha1.transport.zip

visualgui commented 2 years ago

@jaygilmore, the pages were not loading at all, and as @muzzwood pointed out, the directory that has the articles disappeared from the tree.

@muzzwood, Unfortunately I did not update to 1.8 before I upgrade to MODX 3.0.0. I am running on MODX Cloud instance with PHP 7.3.

I tried to upload the package you mentioned and this is the error log:

`Console running... Attempting to install package with signature: articles-2.0.0-alpha1 Package found...now preparing to install. Grabbing package workspace... Workspace environment initiated, now installing package... Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.container_ids ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.default_container_template ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.default_article_template ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.default_article_sort_field ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.article_show_longtitle ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.mgr_date_format ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.mgr_time_format ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnPageNotFound ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnManagerPageInit ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnDocPublished ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnDocUnPublished ) Attempting to preserve files at /paas/c0791/www/core/components/articles into archive /paas/c0791/www/core/packages/articles-2.0.0-alpha1/MODX/Revolution/modCategory/89fe338d1dd974236e901a8b7f7ea7d2.0.preserved.zip Attempting to preserve files at /paas/c0791/www/assets/components/articles into archive /paas/c0791/www/core/packages/articles-2.0.0-alpha1/MODX/Revolution/modCategory/89fe338d1dd974236e901a8b7f7ea7d2.1.preserved.zip Installing dependency archivist v1.2.4 (or higher)...

muzzwood commented 2 years ago

Thanks for reporting back @visualgui

Did the installation complete, or did it fail? Or just stop there?

visualgui commented 2 years ago

@muzzwood It stopped the first time. I just tried it again and it is now successfully installed. The pages now loaded, but get a 404. The articles in the tree is still missing.

jaygilmore commented 2 years ago

@visualgui are there any console errors? Is it possible of stuck browser cache? I'm referring to the issue of the missing Resource from the tree.

muzzwood commented 2 years ago

@visualgui Delete your cache if you can.

Otherwise, I wonder if the dbfields resolver failed for some reason: https://github.com/modxcms/Articles/blob/develop-3x/_build/resolvers/dbfields.resolver.php

If you're able to use PHPMyAdmin (or similar) to look at your database, have a look at the class_key column in the modx_site_content table and see if any rows have a value of Article or ArticlesContainer. Those should have been updated to Articles\Model\Article and Articles\Model\ArticlesContainer.

visualgui commented 2 years ago

@jaygilmore, yes there were console errors, but I didn't save it. Is it being saved somewhere else I can grab?

@muzzwood, I cleared the cached and it is still not showing up.

Unrelated topic: Is it safe to switch back from PHP 8.0 to 7.4 on MODX Cloud? When I switched from 7.4 to 8.0, the entire site went down so I had to switch it back. It looks like everything seem to work fine, but I wonder if I screwed up something.

jaygilmore commented 2 years ago

@visualgui you can switch back to 7.4. It will not cause any issues. Once you get Articles working, I'd try and figure out what Extras you have installed that are causing the site to fail on 8. PHP 7.4 is supported only until December 2022. PHP 8.1 will be available on the new platforms in Cloud in the coming weeks.

Console errors are ephemeral (unless you turn on retention) as they are generated by the browser while the operations are running and until you access a new URI. It is possible to set persistent logging to on in most browser dev tools.

visualgui commented 2 years ago

Thanks @jaygilmore. That’s reassuring.

JoshuaLuckers commented 2 years ago

@JoshuaLuckers If the package was created correctly and the uploaded transport.zip was not corrupt it should work. We'd have all sorts of complaints if there were something wrong with the Extras repo. We'd need more info from the environment and any errors displayed in the log, php log or other logs per @muzzwood's ask.

I believe everything went fine with uploading the package. The only thing I did notice was that I didn't get an confirmation email about the new version being approved. For the 1.8 release I did get an email. That's why I was thinking maybe it's something in that area.

muzzwood commented 2 years ago

Hi @visualgui, When you get a chance could you check your MODX error log after attempting to load the resource tree, and see if it has any related errors there?

Mark-H commented 2 years ago

Looks like the installation error is due to a no longer valid require statement during the tagLister install, no? actually I think I'm reading it wrong.

visualgui commented 2 years ago

@muzzwood, I cleared the cache and refreshed the tree. Still no articles directory and nothing in the error log.

I reinstalled articles extra, here's the console errors:

`Console running... Attempting to install package with signature: articles-2.0.0-alpha1 Package found...now preparing to install. Grabbing package workspace... Workspace environment initiated, now installing package... Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.container_ids ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.default_container_template ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.default_article_template ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.default_article_sort_field ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.article_show_longtitle ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.mgr_date_format ) Skipping vehicle object of class MODX\Revolution\modSystemSetting (data object exists and cannot be upgraded); criteria: Array ( [key] => articles.mgr_time_format ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnPageNotFound ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnManagerPageInit ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnDocPublished ) Skipping vehicle object of class MODX\Revolution\modPluginEvent (data object exists and cannot be upgraded); criteria: Array ( [pluginid] => 255 [event] => OnDocUnPublished ) Attempting to preserve files at /paas/c0791/www/core/components/articles into archive /paas/c0791/www/core/packages/articles-2.0.0-alpha1/MODX/Revolution/modCategory/89fe338d1dd974236e901a8b7f7ea7d2.0.preserved.zip Attempting to preserve files at /paas/c0791/www/assets/components/articles into archive /paas/c0791/www/core/packages/articles-2.0.0-alpha1/MODX/Revolution/modCategory/89fe338d1dd974236e901a8b7f7ea7d2.1.preserved.zip Installing dependency archivist v1.2.4 (or higher)...

JoshuaLuckers commented 2 years ago

@jaygilmore Editing the current listing and re-uploading the Transport Package File solved the "package could not be downloaded" issue.

jaygilmore commented 2 years ago

@JoshuaLuckers That's really odd. Do you recall any issue other than the lack of email?

JoshuaLuckers commented 2 years ago

@JoshuaLuckers That's really odd. Do you recall any issue other than the lack of email?

It sure is, maybe I did upload a corrupt file or the wrong one.

JosteinAndersen commented 2 years ago

FYI: I had the same problem ( “Could not download and create transport package with signature: articles-2.0.0-alpha1”), but after upgrading MODx to 3.0.1, it was installed.

Unrelated to this issue, I have some other ones, but will have to investigate and sort out if it's bugs or me who hasn't configurated everything properly.

I'm test running everything on Kubuntu 20.04.4 with Apache 2.4.41, PHP 7.4.3, and MariaDB 10.3.34.

visualgui commented 2 years ago

I upgraded the test site to MODX 3.0.1, Article to 2.0.0-alpha1, and PHP 8.0. The contain in the tree shows up, but the UI is still not displayed correctly. The articles are still not there.

Screen Shot 2022-05-03 at 10 52 25 AM
muzzwood commented 2 years ago

😮 That I have not seen before! Are you using any custom manager templates by any chance? Make sure to delete the cache files in core/cache/ and also try using a private/incognito window to make sure it's not anything cached in your browser.


Edit: Actually, I just updated to 3.0.1 and I'm getting the same thing. I think there was some reworking on resource panels in the core and that messed up the articles resources.

As a quick fix (until the next release), open up the file:

/assets/components/articles/js/container/update.js

and comment out line 58 e.g. //,width: 400 then save the file and try reloading the page.

https://github.com/modxcms/Articles/blob/develop-3x/assets/components/articles/js/container/update.js#L58

muzzwood commented 2 years ago

@visualgui Try putting the following in a temporary snippet, add it to a page then run it once. This should fix the articles not loading - if the problem is what I think it is.

<?php

/**
 * @var MODX\Revolution\modX $modx
 */
$keys = [
    'Article' => 'Articles\Model\Article',
    'ArticlesContainer' => 'Articles\Model\ArticlesContainer'
];

foreach ($keys as $old => $new) {
    $sql = "
        UPDATE modx_site_content 
        SET class_key = :new_key
        WHERE class_key = :old_key
    ";
    $c = new \xPDO\Om\xPDOCriteria($modx, $sql, [
        ':old_key' => $old,
        ':new_key' => $new
    ]);
    if ($c->stmt) {
        $c->stmt->execute();
    }
}

return 'Done!';
visualgui commented 2 years ago

@muzzwood, I tried your code, but it didn’t work.

I think it might have to do with this template. The following line, in particular, broke the page: [[*content2:isnot=``:then=[[content2]]:else=[[content]]]]

I wonder if something changed from 2.8 to 3.0.

Here's the live page: https://ho8tajk7.modx.dev/pubs/papers/

muzzwood commented 2 years ago

@muzzwood, I tried your code, but it didn’t work.

Do you mean the fix for the container layout, or the SQL query?

I think it might have to do with this template. The following line, in particular, broke the page: [[*content2:isnot=:then= `[[*content2]]:else=[[*content]]]]`

I wonder if something changed from 2.8 to 3.0.

Here's the live page: https://ho8tajk7.modx.dev/pubs/papers/

Yeah the way placeholders work changed a bit in MODX 3. Try calling the tags uncached with an exclamation mark. e.g. [[! The default Articles templates have been adjusted but you would need to adjust any custom ones you are using.