nextcloud / user_external

👥 External user authentication methods like IMAP, SMB and FTP
https://apps.nextcloud.com/apps/user_external
107 stars 64 forks source link

Breaking changes in Nextcloud 21 #165

Closed ChristophWurst closed 3 years ago

ChristophWurst commented 3 years ago

Hi there,

I found that your app uses some classes of Nextcloud's third party libraries. Since an upgrade of those for php8 compatibility, your app will have to be adjusted as well. See https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/upgrade-guide.html#doctrine-dbal for details. Your app uses Doctrine\DBAL\Types\Type which lost the old constants: https://github.com/doctrine/dbal/blob/3.0.x/UPGRADE.md#deprecated-type-constants.

Cheers

ChristophWurst commented 3 years ago

Please note that we just merged a PR with our own constants for the types, so the app can be fully independent of any 3rdparty libraries: https://github.com/nextcloud/server/pull/25089.

violoncelloCH commented 3 years ago

Thanks for raising the issue! Sadly I'm currently way too busy studying for university, so I don't feel ready to do the required changes to get the app in shape for a Nextcloud 21 compatible release during the foreseeable future. So I'd really appreciate some help. (@ChristophWurst maybe you know someone who would have the time for it?)

ChristophWurst commented 3 years ago

Could you possibly open a forum post? I can try to get some attention on this but I can't promise more.

No worries if you don't have time for the maintenance anymore, it's a lot of work and you did this in your free time. :v:

ychaouche commented 3 years ago

@ChristophWurst

The only reference I found is in the migration step, which, of all types, only uses Type::String. Do you suggest changing references to \Doctrine\DBAL\Types\Type::* to \OCP\DB\Types:: as suggested here [1] ?

[1] https://genius.it/22343631/docs.nextcloud.com//server/latest/developer_manual/app_publishing_maintenance/upgrade-guide.html

ChristophWurst commented 3 years ago

yes, please follow the upgrade guide

oriolo commented 3 years ago

by trying to install user_external app on a fresh nextcloud 21 setup, I already did: a. in app info/info.xml; b. //use Doctrine\DBAL\Types\Type; use OCP\DB\Types; in lib/Migration/Version0010Date20200630193751.php

Now this is what I receive:

sudo -u apache php occ app:enable user_external

An unhandled exception has been thrown: Error: Class "OCA\User_external\Migration\Type" not found in /var/www/https/mycloud/apps/user_external/lib/Migration/Version0010Date20200630193751.php:48 Stack trace:

0 /var/www/https/mycloud/lib/private/DB/MigrationService.php(455): OCA\User_external\Migration\Version0010Date20200630193751->changeSchema()

1 /var/www/https/mycloud/lib/private/DB/MigrationService.php(418): OC\DB\MigrationService->migrateSchemaOnly()

2 /var/www/https/mycloud/lib/private/Installer.php(163): OC\DB\MigrationService->migrate()

3 /var/www/https/mycloud/core/Command/App/Enable.php(123): OC\Installer->installApp()

4 /var/www/https/mycloud/core/Command/App/Enable.php(93): OC\Core\Command\App\Enable->enableApp()

5 /var/www/https/mycloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\App\Enable->execute()

6 /var/www/https/mycloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()

7 /var/www/https/mycloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()

8 /var/www/https/mycloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()

9 /var/www/https/mycloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()

10 /var/www/https/mycloud/console.php(100): OC\Console\Application->run()

11 /var/www/https/mycloud/occ(11): require_once('...')

What else? thank you.

ChristophWurst commented 3 years ago

Class "OCA\User_external\Migration\Type" not found in /var/www/https/mycloud/apps/user_external/lib/Migration/Version0010Date20200630193751.php:48

You use a Type class that doesn't exist. You have to use \OCP\DB\Types

oriolo commented 3 years ago

that file is the one supplied by default with the app. I don't know where and how to change it.

oriolo commented 3 years ago

and this is the function in which the error is reported: public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /* @var ISchemaWrapper $schema / $schema = $schemaClosure();

            if (!$schema->hasTable('users_external')) {
                    $table = $schema->createTable('users_external');
                    $table->addColumn('backend', Type::STRING, [
                            'notnull' => true,
                            'length' => 128,
                            'default' => '',
                    ]);
                    $table->addColumn('uid', Type::STRING, [
                            'notnull' => true,
                            'length' => 64,
                            'default' => '',
                    ]);
                    $table->addColumn('displayname', Type::STRING, [
                            'notnull' => false,
                            'length' => 64,
                    ]);
                    $table->setPrimaryKey(['uid', 'backend']);
            }
            return $schema;
    }

the fault is in: $table->addColumn('displayname', Type::STRING, [ 'notnull' => false, 'length' => 64, ]);