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

Fix wrong object passed to the mount provider in VersionsBackend::getAllVersionedFiles #1725

Merged
merged 1 commit into from
Nov 4, 2021

Conversation

CarlSchwan
Copy link
Member

@CarlSchwan CarlSchwan commented Nov 3, 2021

$folder['groups'] is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725

CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan CarlSchwan force-pushed the work/more-type-hintin branch from ace283b to bfdbd0b Compare November 4, 2021 09:38
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan CarlSchwan force-pushed the work/more-type-hintin branch from bfdbd0b to 2f8bb48 Compare November 4, 2021 09:50
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan CarlSchwan force-pushed the work/more-type-hintin branch from 2f8bb48 to 35f0f31 Compare November 4, 2021 09:55
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan CarlSchwan force-pushed the work/more-type-hintin branch from 35f0f31 to 407c539 Compare November 4, 2021 09:57
@CarlSchwan CarlSchwan requested a review from come-nc November 4, 2021 10:03
@CarlSchwan CarlSchwan changed the title Use more type hinting Fix wrong object passed to the mount provider in VersionsBackend::getAllVersionedFiles Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan CarlSchwan force-pushed the work/more-type-hintin branch from 407c539 to bb12117 Compare November 4, 2021 10:52
@CarlSchwan CarlSchwan merged commit e44159a into master Nov 4, 2021
@CarlSchwan CarlSchwan deleted the work/more-type-hintin branch November 4, 2021 11:39
@CarlSchwan
Copy link
Member Author

/backport to stable 22

@CarlSchwan
Copy link
Member Author

/backport to stable22

@CarlSchwan
Copy link
Member Author

/backport to stable21

@CarlSchwan
Copy link
Member Author

/backport to stable20

backportbot-nextcloud bot pushed a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
backportbot-nextcloud bot pushed a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
backportbot-nextcloud bot pushed a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
CarlSchwan added a commit that referenced this pull request Nov 4, 2021
…AllVersionedFiles

`$folder['groups']` is an array from groupId to permission. The mount
provider only wants the permission, so since we want to get all the
versionned files, just use 31 instead.

Before php8, this code was working since using & for an int and an array
gave an int. In php8, this now thrown an error.

This also include more type hinting that helped me figure out that was
wrong.

Fix #1725:

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@PhMetzger
Copy link

PhMetzger commented Nov 14, 2021

Hi Carl,

Seems there is a typo in this commit (1725), in lib/Versions/VersionsBackend.php line 36 use OCP\Constant should be use OCP\Constants.

on line 160, Constant::PERMISSION_ALL should be Constants::PERMISSION_ALL

Thank you for the fix.

@CarlSchwan
Copy link
Member Author

Hi Carl,

Seems there is a typo in this commit (1725), in lib/Versions/VersionsBackend.php line 36 use OCP\Constant should be use OCP\Constants.

on line 159, Constant::PERMISSION_ALL should be Constants::PERMISSION_ALL

Thank you for the fix.

Thanks just pushed a fix to master and stable23.

@PhMetzger
Copy link

PhMetzger commented Nov 14, 2021

Sorry seems it's not that simple.

I get this error now :
`TypeError: OCA\GroupFolders\Mount\MountProvider::getMount(): Argument #4 ($quota) must be of type int, string given, called in /opt/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php on line 160

/opt/nextcloud/apps/groupfolders/lib/Versions/VersionsBackend.php - line 160:
OCA\GroupFolders\Mount\MountProvider->getMount()

/opt/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 66:
OCA\GroupFolders\Versions\VersionsBackend->getAllVersionedFiles()

/opt/nextcloud/apps/groupfolders/lib/Versions/GroupVersionsExpireManager.php - line 57:
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireFolder()

/opt/nextcloud/apps/groupfolders/lib/BackgroundJob/ExpireGroupVersions.php - line 39:
OCA\GroupFolders\Versions\GroupVersionsExpireManager->expireAll()

/opt/nextcloud/lib/private/BackgroundJob/Job.php - line 51:
OCA\GroupFolders\BackgroundJob\ExpireGroupVersions->run()

/opt/nextcloud/lib/private/BackgroundJob/TimedJob.php - line 58:
OC\BackgroundJob\Job->execute()

/opt/nextcloud/cron.php - line 127:
OC\BackgroundJob\TimedJob->execute()`

I Will try to look at what happen, but I don't know the code base that much

@CarlSchwan
Copy link
Member Author

Hi @PhMetzger I created a pull request hopefully solving the problem once and for all :) #1753 Could you test it?

Bonne soirée :)

@PhMetzger
Copy link

Just tested it, and it seems everything is fine.

Thank you Carl

Guten abend :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants