Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking changes in Nextcloud 21 #165

Closed
ChristophWurst opened this issue Jan 12, 2021 · 9 comments · Fixed by #173
Closed

Breaking changes in Nextcloud 21 #165

ChristophWurst opened this issue Jan 12, 2021 · 9 comments · Fixed by #173
Labels
0. Needs triage bug Something isn't working

Comments

@ChristophWurst
Copy link
Member

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 ChristophWurst added bug Something isn't working 0. Needs triage labels Jan 12, 2021
@ChristophWurst
Copy link
Member Author

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: nextcloud/server#25089.

@violoncelloCH
Copy link
Member

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
Copy link
Member Author

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. ✌️

@ychaouche
Copy link

@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
Copy link
Member Author

yes, please follow the upgrade guide

@oriolo
Copy link

oriolo commented Mar 8, 2021

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
Copy link
Member Author

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
Copy link

oriolo commented Mar 8, 2021

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

@oriolo
Copy link

oriolo commented Mar 8, 2021

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,
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants