hypery2k / owncloud

In this repo you'll find apps and enhancements for owncloud
Other
156 stars 85 forks source link

Code improvement for adminSettings.php #378

Closed mikygee closed 7 years ago

mikygee commented 7 years ago

Hello,

A call generated an error messages in the logs because OC_Appconfig::deleteKey didn't exist This patch corrects the problem The file is located in apps/roundcube/ajax

--- adminSettings.php.orig      Fri Feb 17 15:26:56 2017
+++ adminSettings.php   Fri Feb 17 15:26:51 2017
@@ -44,7 +44,7 @@
                        } else if ($param == 'rcRefreshInterval') {
                                $refresh = trim($_POST[$param]);
                                if ($refresh == '') {
-                                       OC_Appconfig::deleteKey('roundcube', $param);
+                                       \OC_Config::deleteKey('roundcube'.$param, $param);
                                } else if (!is_numeric($refresh)) {
                                        OC_JSON::error(array(
                                        "data" => array(
mckaygerhard commented 7 years ago

hey do u tri it the pull request?

mckaygerhard commented 7 years ago

i'll investigate the availibility for oc 7 and oc 6 of this patch remenber that i used oc 7 and oc 6 too! and then i'll try to integrate without break compatibility

mckaygerhard commented 7 years ago

the error message its produced due the interface deprecated the method since oc 8 api.. as documentation said: https://doc.owncloud.org/api/classes/OCP.IAppConfig.html#method_deleteKey the correct usage must be\OC_Config::deleteAppValue but this only applies since OC 8 that breaks the compatibility..

so i'll try to made a conditional to detect when are oc 6, oc 7 and oc 8+ and put a proper code.. thanks for the hint

NOTE: the api documentation of OC are horrored! what a crek! i got later due there's no search tool for that! and as non-expert-developer i could find at right time!

mikygee commented 7 years ago

Hello, Sorry I didn't see your messages. You might want to try OC_Util::getVersion or OC_Util::getVersionString() to do that Congrats

mckaygerhard commented 7 years ago

yes that's what i do, thanks for the tip, currently i'm busy with my depot proyect but in few days i'll try to make ssomething good in the app

mckaygerhard commented 7 years ago

now i find the right way to do this for newer versions>

\OCP\Util::connectHook('OC_Appconfig', 'deleteKey', 'roundcube', $param);

now need the precise steps to detect oc version with getVersion (available in all OC) or getVersionString (this seeems does not exits now)

\OCP\Util::getVersion()

or maybe must be:

\OC_Util::getVersion()