fluxapps / LiveVoting

ILIAS LiveVoting plugin
https://fluxlabs.ch
15 stars 20 forks source link

DatabaseDetector.php raises Exception in ILIAS 7-26 & v2023.01.26 #42

Open valid0r opened 10 months ago

valid0r commented 10 months ago

When creating a new LiveVoting object an ilias error messages is thrown. The content of the exception is as follows:

Whoops\Exception\ErrorException thrown with message "Class srag\DIC\LiveVoting\Database\DatabaseDetector contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (ilDBInterface::primaryExistsByFields)"

Stacktrace:
#2 Whoops\Exception\ErrorException in /[...]/ilias/Customizing/global/plugins/Services/Repository/RepositoryObject/LiveVoting/vendor/srag/dic/src/Database/DatabaseDetector.php:19
#1 Whoops\Run:handleError in /[...]/ilias/libs/composer/vendor/filp/whoops/src/Whoops/Run.php:514
#0 Whoops\Run:handleShutdown in [internal]:0

-- GET Data --

ref_id                   : 432545
cmd                      : content
cmdClass                 : xlvovotinggui
cmdNode                  : rt:qv:1bi
baseClass                : ilobjplugindispatchgui
lang                     : de
limit                    : 9999

We're using ILIAS v7.26 and the LiveVoting Release v2023.01.26.

iFadi commented 10 months ago

We updated today to ILIAS 7.26, because of the latest security ILIAS updates and facing the same issue, where can we find the "2023.09.18" Tag for the fix.

Thanks Kind Regards.

iFadi commented 10 months ago

@valid0r

I've added a dirty-patch to fix the issue. edit DatabaseDetector.php from the {ILIAS Root}:

vim Customizing/global/plugins/Services/Repository/RepositoryObject/LiveVoting/vendor/srag/dic/src/Database/DatabaseDetector.php

and add this function after this line: protected static $instance = null;

/**
 * Implements the primaryExistsByFields method from ilDBInterface.
 *
 * This method was added to address compatibility issues with newer versions
 * of ILIAS, specifically ILIAS8 and ILIAS7
 * @see https://github.com/ILIAS-eLearning/ILIAS/commit/3d4ccc6a24d5d3e487d9e303a41a7bb12262eb48
 *
 * @param string $table_name The name of the table.
 * @param array $fields An array of fields.
 * @return bool A stub return. This should be adjusted based on the actual implementation.
 */
public function primaryExistsByFields(string $table_name, array $fields): bool
{
    // TODO: Implement the actual logic for this method.
    return false;
}

PS: I'm not this Plugin Developer, so NO WARRANTIES

valid0r commented 10 months ago

@iFadi thanks for the Fix!

This seems to be a problem with a changed Interface between versions. @mstuder cann you confirm this and maybe add the fix to the upstream?

Thanks again to all involved!