cccraig / MugShot

Plugin for piwigo.
MIT License
14 stars 15 forks source link

Activation fails under Piwigo 13.8.0 #50

Open MarioOsswald opened 1 year ago

MarioOsswald commented 1 year ago

Fresh installation of piwigo 13.8.0 fails to activate MugShot. When I add a new plugin / search MugShot, piwigo offers to add version 2.0.3 from site https://de.piwigo.org/ext/extension_view.php?eid=910

Once added (message - successfully installed), it displays version 2.0.2 and appears on the list of available updates 2.0.2 -> 2.0.3. I updated (successfully), but it remains on version 2.0.2 an re-appears on the list.

I've found advice to fix the version number manually in piwigo/plugins/MugShot/main.inc.php (was still 2.0.2 there). OK so far, the updates available loop disapperared.

But I can't activate the MugShot plugin even with the correct version number. While trying, an error message appears with no further details.

Piwigo 13.8.0 Ubuntu 22.04 PHP: 8.1.21

jresse commented 10 months ago

Even i have the same error

piwigo: 13.7.0 Ubuntu: 22.04.2 LTS PHP 8.1.2-1ubuntu2.11

Adding below error from the apache error.log file: modified error log to hide local system info

`PHP Fatal error: Uncaught mysqli_sql_exception: Duplicate entry 'MugShot' for key 'PRIMARY' in /include/dblayer/functions_mysqli.inc.php:139 Stack trace:

0 /include/dblayer/functions_mysqli.inc.php(139): mysqli->query()

1 /plugins/MugShot/include/helpers.php(84): pwg_query()

2 /plugins/MugShot/maintain.inc.php(40): create_facetag_table()

3 /plugins/MugShot/maintain.inc.php(65): MugShot_maintain->install()

4 /admin/include/plugins.class.php(202): MugShot_maintain->activate()

5 /include/ws_functions/pwg.extensions.php(76): plugins->perform_action()

6 /include/ws_core.inc.php(600): ws_plugins_performAction()

7 /include/ws_protocols/rest_handler.php(41): PwgServer->invoke()

8 /include/ws_core.inc.php(281): PwgRestRequestHandler->handleRequest()

9 /ws.php(22): PwgServer->run()

10 {main}

thrown in /include/dblayer/functions_mysqli.inc.php on line 139, referer: http:///photos/admin.php?page=plugins&plugin=MugShot&pwg_token=1ecf01c9207585c1d9616d971224868f&action=activate&filter=deactivated`

jresse commented 10 months ago

Update:

  1. When the MugShot extension is tried to be activated, it does an insert operation on the CONFIG_TABLE
  2. But the installation of the piwigo already has an entry of MugShot in the CONFIG_TABLE and the sql insert operation fails resulting in the failure to activate the extension

I was able to get the extension activated by below: WA: manually delete the MugShot entry from the piwigo_config table of the piwigo_db

achuet commented 9 months ago

Thanks @jresse ..

Use this to delete the entry manually. DELETE FROM piwigo_config Where param = 'MugShot';

laerm commented 8 months ago

Check line 82 of the file plugins/MugShot/include/helpers.php

If it reads

$configQuery = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("MugShot","","MugShot configuration values");';

Change to

$configQuery = 'REPLACE INTO ' . CONFIG_TABLE . ' (param,value,comment) VALUES ("MugShot","","MugShot configuration values");';