-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Uses IShare::TYPE_... in Server.php rather than the obsolete Constants #32647
Conversation
Signed-off-by: Cyrille Bollu <[email protected]>
Any app can register a provider: |
Yeah so would be good to double check if external apps like talk and circle still work |
Indeed. IIUC, plugins registered via an app are processed via server/lib/private/legacy/OC_App.php and this won't work anymore with my change. Should I just add a test in public function registerPlugin(array $pluginInfo) {
--- $shareType = constant(Share::class . '::' . $pluginInfo['shareType']);
+++ if (str_starts_with($pluginInfo['shareType'], 'SHARE_TYPE') {
+++ $shareType = constant(Share::class . '::' . $pluginInfo['shareType']);
+++ else {
+++ $shareType = $pluginInfo['shareType'];
+++ }
if ($shareType === null) {
throw new \InvalidArgumentException('Provided ShareType is invalid');
} and create issues in identified apps? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking merge until apps have been fixed
@@ -106,7 +106,7 @@ public function search($search, array $shareTypes, $lookup, $limit, $offset) { | |||
} | |||
|
|||
public function registerPlugin(array $pluginInfo) { | |||
$shareType = constant(Share::class . '::' . $pluginInfo['shareType']); | |||
$shareType = $pluginInfo['shareType']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So your proposal is:
$shareType = $pluginInfo['shareType']; | |
if (str_starts_with($pluginInfo['shareType'], 'SHARE_TYPE') { | |
$shareType = constant(Share::class . '::' . $pluginInfo['shareType']); | |
} else { | |
$shareType = $pluginInfo['shareType']; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
$shareType = $pluginInfo['shareType']; | |
if (str_starts_with($pluginInfo['shareType'], 'SHARE_TYPE') { | |
$shareType = constant(IShare::class . '::' . substr($pluginInfo['shareType'], 6)); | |
} else { | |
$shareType = $pluginInfo['shareType']; | |
} |
This way we still get rid of the old constats?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also note that $shareType is a int after constant()
but not with your code.
So should use the following on the else branch
$shareType = (int) $pluginInfo['shareType'];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@StCyr Any update on this? Any chance you could open issues for the apps that need fixing? For backward compatiblity we could also go the str_starts_with approach that was commented already.
As there is no feedback since a while I will close this ticket. Thanks for the interest in Nextcloud and the effort put into this! 🙇 |
It doesn't look like those search plugins are used somewhere else....
hmmm.... Here might be another attention point though:
server/lib/private/legacy/OC_App.php
Line 257 in 5a12e8f
Signed-off-by: Cyrille Bollu [email protected]