Database PHP API Fehler mit Primary Key

  • Affected Version
    WoltLab Suite 5.4
    Affected App
    WoltLab Suite Core

    Hallo,

    seit dem neuesten Core Update scheint es Probleme mit der Database PHP API bei Primary Keys zu geben. Insbesondere geht es hier um folgendes Plugin:

    Hanashi
    September 11, 2023 at 9:30 AM

    Vor dem Update konnte ich es problemlos installieren. Seitdem Update erhalte ich folgende Fehlermeldung:

    Requested URL
    POST /acp/index.php?install-package/&t=9ec3b8a191facae151de3b590ab16e60537439f69aa027e14cabd7a0631d01ad-6ksJPWOR0JIrsH75S8Grog==
    Referrer
    https://******/acp/index.php?package-start-install/&action=install
    Error Message
    Das Datenbanklayout konnte aufgrund folgender Fehler nicht aktualisiert werden: Der Primärindex wcf1_discord_webhook (webhookID) heißt nicht 'PRIMARY'.
    Type
    RuntimeException
    File (Line)
    /Users/******/www/wsc54/lib/system/database/table/DatabaseTableChangeProcessor.class.php (1120)
    Stacktrace
    1. /Users/******/www/wsc54/acp/install_dev.hanashi.wsc.discord-api.php (95): wcf\system\database\table\DatabaseTableChangeProcessor->process(…)
    2. /Users/******/www/wsc54/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php (84): include(…)
    3. /Users/******/www/wsc54/lib/system/package/plugin/ScriptPackageInstallationPlugin.class.php (59): wcf\system\package\plugin\ScriptPackageInstallationPlugin->run(…)
    4. /Users/******/www/wsc54/lib/system/package/PackageInstallationDispatcher.class.php (792): wcf\system\package\plugin\ScriptPackageInstallationPlugin->install(…)
    5. /Users/******/www/wsc54/lib/system/package/PackageInstallationDispatcher.class.php (153): wcf\system\package\PackageInstallationDispatcher->executePIP(…)
    6. /Users/******/www/wsc54/lib/acp/action/InstallPackageAction.class.php (82): wcf\system\package\PackageInstallationDispatcher->install(…)
    7. /Users/******/www/wsc54/lib/action/AbstractDialogAction.class.php (73): wcf\acp\action\InstallPackageAction->stepInstall(…)
    8. /Users/******/www/wsc54/lib/action/AbstractAction.class.php (53): wcf\action\AbstractDialogAction->execute(…)
    9. /Users/******/www/wsc54/lib/system/request/Request.class.php (89): wcf\action\AbstractAction->__run(…)
    10. /Users/******/www/wsc54/lib/system/request/RequestHandler.class.php (119): wcf\system\request\Request->execute(…)
    11. /Users/******/www/wsc54/acp/index.php (11): wcf\system\request\RequestHandler->handle(…)

    So sieht der Teil aus für die Tabelle wcf1_discord_webhook:

  • Hallo,

    es liegt an folgender Änderung:

    und dem Issue dazu:

    PHP DDL: Validate that a PRIMARY KEY is called PRIMARY · Issue #4592 · WoltLab/WCF
    … this can happen if the DatabaseTablePrimaryIndex factory is not used.
    github.com

    Prinzipiell solltest du auch anstelle des DatabaseTableIndex die Klasse DatabaseTablePrimaryIndex nutzen:

    WCF/DatabaseTablePrimaryIndex.class.php at 5.4 · WoltLab/WCF
    WoltLab Suite Core (previously WoltLab Community Framework) - WCF/DatabaseTablePrimaryIndex.class.php at 5.4 · WoltLab/WCF
    github.com

    Diese stellt sicher, dass der korrekte Name für den Key vergeben wird.

    Ich schaue intern im Plugin-Store aber mal, wie viele Plugins das von dir verwendete Konstrukt nutzen und schaue, ob wir da einen Work-Around temporär für Version 5.4 einbauen (und dann erst mit 5.5 einen Fehler werfen).

  • Hallo

    Ich bin nur am Handy und kann es gerade nicht testen. Ich hatte vor einer weile ein Ähnliches Problem und hatte mit WoltLab kontakt. Ggf wurde da ja nun was angepasst. Versuch mal folgendes anstelle dem Primary Teil

    Code
    DatabaseTablePrimaryIndex::create()
                    ->columns(['webhookID']),

    Ich glaube alternativ könntest du dein create anpassen:

    Code
    DatabaseTableIndex::create('PRIMARY')

    Edit: zu spät :)

    Gruss

    Oliver

  • Joshua Rüsweg December 28, 2021 at 12:51 PM

    Added the Label Works as designed

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!