pulsejet / memories

Fast, modern and advanced photo management suite. Runs as a Nextcloud app.
https://memories.gallery
GNU Affero General Public License v3.0
3.1k stars 82 forks source link

Unable to upgrade to 5.5.2, unable to enable 5.5.2 version #851

Closed pyyhttu closed 11 months ago

pyyhttu commented 11 months ago

Describe the bug Received notification in web frontend Memories 5.5.2 was available , so I tried to update it. That failed and was captured to admin page logs as:

[index] Error: Exception: json_decode(): Argument #1 ($json) must be of type string, null given in file '/var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/Version505000Date20230821044807.php' line 99 at <<closure>>

0. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/AppFramework/App.php line 183
   OC\AppFramework\Http\Dispatcher->dispatch()
1. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/Route/Router.php line 315
   OC\AppFramework\App::main()
2. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/base.php line 1068
   OC\Route\Router->match()
3. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/index.php line 36
   OC::handleRequest()

Caused by:

TypeError: json_decode(): Argument #1 ($json) must be of type string, null given at <<closure>>

 0. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/Version505000Date20230821044807.php line 99
    json_decode()
 1. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/DB/MigrationService.php line 537
    OCA\Memories\Migration\Version505000Date20230821044807->postSchemaChange()
 2. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/DB/MigrationService.php line 417
    OC\DB\MigrationService->executeStep()
 3. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/Installer.php line 153
    OC\DB\MigrationService->migrate()
 4. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php line 451
    OC\Installer->installApp()
 5. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Settings\Controller\AppSettingsController->enableApps()
 6. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController()
 7. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch()
 8. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main()
 9. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/base.php line 1068
    OC\Route\Router->match()
10. /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/index.php line 36
    OC::handleRequest()

POST /nextcloud/index.php/settings/apps/enable
from <IP redacted> by pyyhttu at 2023-10-07T17:22:43+00:00

I then tried to update it from prompt with php8.2 occ app:update --all but memories wasn't even registered for updating, which was strange:

php8.2 occ app:update --all
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
cfg_share_links new version available: 4.2.0
cfg_share_links updated

To Reproduce

I can reproduce this by also removing the app with php8.2 occ app:remove memories:

memories disabled
memories 0 removed

and when trying to reinstall with php8.2 occ app:enable memories:

An unhandled exception has been thrown:
TypeError: json_decode(): Argument #1 ($json) must be of type string, null given in /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/Version505000Date20230821044807.php:99
Stack trace:
#0 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/Version505000Date20230821044807.php(99): json_decode()
#1 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/DB/MigrationService.php(539): OCA\Memories\Migration\Version505000Date20230821044807->postSchemaChange()
#2 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/DB/MigrationService.php(417): OC\DB\MigrationService->executeStep()
#3 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/Installer.php(153): OC\DB\MigrationService->migrate()
#4 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/core/Command/App/Enable.php(111): OC\Installer->installApp()
#5 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/core/Command/App/Enable.php(81): OC\Core\Command\App\Enable->enableApp()
#6 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OC\Core\Command\App\Enable->execute()
#7 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#8 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#9 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#10 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#11 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/console.php(100): OC\Console\Application->run()
#12 /siilo/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/occ(11): require_once('...')

Memories remains disabled and in version 5.5.1:

php8.2 occ app:list


[...]
Disabled:
  - camerarawpreviews: 0.8.2 (installed 0.8.2)
  - comments: 1.17.0 (installed 1.10.0)
  - dashboard: 7.7.0 (installed 7.0.0)
  - encryption: 2.15.0
  - federation: 1.17.0 (installed 1.10.1)
  - files_external: 1.19.0 (installed 1.8.0)
  - files_pdfviewer: 2.8.0 (installed 2.0.1)
  - files_rightclick: 1.6.0 (installed 0.17.0)
  - firstrunwizard: 2.16.0 (installed 2.8.0)
  - health: 1.6.2 (installed 1.6.2)
  - memories: 5.5.1 (installed 5.4.1)

Platform:

pulsejet commented 11 months ago

[index] Error: Exception: json_decode(): Argument #1 ($json) must be of type string, null given in file '/var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/Version505000Date20230821044807.php' line 99 at <<closure>>

Something weird happening here. Line 99 doesn't even have a json_decode with 5.5.2 anymore. Try going straight to 5.5.3 instead (also maybe a reboot).

pulsejet commented 11 months ago

/var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/Version505000Date20230821044807.php

Can you check the contents of this file; what's at line 99?

pyyhttu commented 11 months ago

Can you check the contents of this file; what's at line 99?

Can't. This is shared hosting and am getting:

nano '/var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/Version505000Date20230821044807.php'

[ Directory '/var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration' does not exist ]

as

cd '/var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/'
-bash: cd: /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/: Permission denied

Try going straight to 5.5.3 instead (also maybe a reboot).

Can't reboot either, as shared hosting. Unless you mean by reboot I should do reset?

pulsejet commented 11 months ago

It seems like your php files are stuck at the 5.5.1 versions for some reason. You can try waiting for the Nextcloud app cache to expire, then it should suggest upgrading to 5.5.3. Otherwise just uninstall the app completely, then wait until 5.5.3 shows up in the store and install that (won't affect the database)

pyyhttu commented 11 months ago

Otherwise just uninstall the app completely,

Completely, you mean by occ app:remove memories?

I'll try that once the cache expires and report back.

pulsejet commented 11 months ago

Completely, you mean by occ app:remove memories?

Yeah, that or the app store. Basically need to get the php files deleted

pyyhttu commented 11 months ago

Basically need to get the php files deleted

Thanks for the clarification, because then I need to request write access to delete those files from my hosting, because now:

cd '/var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/' -bash: cd: /var/www/6/pyyhttu/sites/pyyhttu-siilo.kapsi.fi/www/nextcloud/apps/memories/lib/Migration/: Permission denied

pulsejet commented 11 months ago

That's really weird, you should probably ask the hosting what's going on. All files in Nextcloud should be accessible by the web user ideally, and removing the app should completely delete anything in that folder

pyyhttu commented 11 months ago

Web front notified this morning 5.5.3 is available, and cache was expired. I managed to do successfully both php occ app remove memories and php occ app install memories, which this time resulted in:

memories 5.5.3 installed
memories enabled

I've also forced re-indexing with php occ memories:index -f as post-upgrade step as recommended per changelogs. Inspecting the logs and functionality, I see everything working now.

Should this happen again, I've requested yesterday from admins access to /var/www/ so I can perhaps help you more next time.

Thanks for the support and great software!

pyyhttu commented 11 months ago

Something weird happening here. Line 99 doesn't even have a json_decode with 5.5.2 anymore. Can you check the contents of this file; what's at line 99?

Just to bring a closure to this. I managed to get access to the files. The files seem to be from the date and time when the addon upgrade was run:

$ ls -al
total 312
drwxr-xr-x  2 pyyhttu users   24 Oct  8 10:40 .
drwxr-xr-x 12 pyyhttu users   19 Oct  8 10:40 ..
-rw-r--r--  1 pyyhttu users 1502 Oct  8 10:40 Repair.php
-rw-r--r--  1 pyyhttu users 2932 Oct  8 10:40 Version000000Date20220812163631.php
-rw-r--r--  1 pyyhttu users 3427 Oct  8 10:40 Version200000Date20220924015634.php
-rw-r--r--  1 pyyhttu users 2430 Oct  8 10:40 Version400000Date20221015121115.php
-rw-r--r--  1 pyyhttu users 2108 Oct  8 10:40 Version400307Date20221025002524.php
-rw-r--r--  1 pyyhttu users 1917 Oct  8 10:40 Version400308Date20221026151748.php
-rw-r--r--  1 pyyhttu users 2967 Oct  8 10:40 Version400503Date20221101033144.php
-rw-r--r--  1 pyyhttu users 2137 Oct  8 10:40 Version400604Date20221107205439.php
-rw-r--r--  1 pyyhttu users 2146 Oct  8 10:40 Version400700Date20221110030909.php
-rw-r--r--  1 pyyhttu users 3187 Oct  8 10:40 Version400800Date20221122105007.php
-rw-r--r--  1 pyyhttu users 2135 Oct  8 10:40 Version401000Date20230118043813.php
-rw-r--r--  1 pyyhttu users 3367 Oct  8 10:40 Version401100Date20230206002744.php
-rw-r--r--  1 pyyhttu users 4424 Oct  8 10:40 Version401100Date20230208181533.php
-rw-r--r--  1 pyyhttu users 2064 Oct  8 10:40 Version401300Date20230328012131.php
-rw-r--r--  1 pyyhttu users 2073 Oct  8 10:40 Version500000Date20230414042534.php
-rw-r--r--  1 pyyhttu users 2104 Oct  8 10:40 Version502000Date20230530052850.php
-rw-r--r--  1 pyyhttu users 4974 Oct  8 10:40 Version505000Date20230821044807.php
-rw-r--r--  1 pyyhttu users 2098 Oct  8 10:40 Version505001Date20230828155021.php
-rw-r--r--  1 pyyhttu users 2479 Oct  8 10:40 Version505002Date20230831201833.php
-rw-r--r--  1 pyyhttu users 1908 Oct  8 10:40 Version505003Date20230930155856.php
-rw-r--r--  1 pyyhttu users 2015 Oct  8 10:40 Version505004Date20231004200012.php
-rw-r--r--  1 pyyhttu users 2984 Oct  8 10:40 Version505005Date20231007154645.php

And Version505000Date20230821044807.php does seem to have line 99:

$ vim +99 Version505000Date20230821044807.php

98                     // try to get the exif string
99                     if (!\is_array($row) || !\array_key_exists('exif', $row) || !\is_string($row['exif'])) {                          
100                         continue;
pulsejet commented 11 months ago

These seem fine now.

Version505000Date20230821044807.php does seem to have line 99

Line 99 doesn't even have a json_decode with 5.5.2 anymore.