Skip to content

Commit 79fa1a9

Browse files
committed
Use the correct way to detect the OC version in better way
* the api said that getVersion return and array.. so use indexes * the api said that getL10N are since 6.0.0 but i dont trust in stupid oc api * property set version detection and use available API for older oc * now lest see test integration in jenkis for good results
1 parent 96e48a7 commit 79fa1a9

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Diff for: roundcube/src/main/php/adminSettings.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131

3232

3333
// workaround to detect OC version
34-
$ocVersion = @reset(OCP\Util::getVersion());
34+
$ocVersion = OCP\Util::getVersion();
3535
// below OC7
36-
if ($ocVersion < 7) {
36+
if ($ocVersion[0] < 7) {
3737
OCP\Util::addScript('roundcube', 'adminSettings.oc6');
3838
$tmpl = new OCP\Template('roundcube', 'tpl.adminSettings.oc6');
3939
} else {
4040
// OC7.x
41-
if ($ocVersion < 8) {
41+
if ($ocVersion[0] < 8) {
4242
OCP\Util::addScript('roundcube', 'adminSettings.oc7');
4343
$tmpl = new OCP\Template('roundcube', 'tpl.adminSettings.oc7');
4444
} else {

Diff for: roundcube/src/main/php/ajax/adminSettings.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
// workaround to detect OC version and compatibility for OC and nextcloud
1212
$ocVersion = OCP\Util::getVersion();
1313

14-
15-
if ($ocVersion < 9) {
14+
if ($ocVersion[0] < 9) {
1615
$l = new OC_L10N('roundcube');
1716
} else {
1817
$l = OC::$server->getL10N('roundcube');

Diff for: roundcube/src/main/php/appinfo/app.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@
2121
*/
2222

2323
// workaround to detect OC version and compatibility for OC and nextcloud
24-
$ocVersion = @reset(OCP\Util::getVersion());
2524

26-
if ($ocVersion < 9) {
25+
$ocVersion = implode('.',OCP\Util::getVersion());
26+
if (version_compare($ocVersion,'7.9.9','<')) // OC-8.0
27+
{
2728
$l = new OC_L10N('roundcube');
2829
} else {
29-
$l = OC::$server->getL10N('roundcube');
30+
$l = OC::$server->getL10N('roundcube'); // public api said since 6 but its not sure. so only for 8+
3031
}
3132

3233
OC::$CLASSPATH['OC_Mail_NetworkingException'] = OC_App::getAppPath('roundcube') . '/lib/MailNetworkingException.class.php';

Diff for: roundcube/src/main/php/lib/RoundCubeApp.class.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,10 @@ public static function getRedirectPath($pRcHost, $pRcPort, $pRcPath)
571571

572572
public static function saveUserSettings($appName, $ocUser, $rcUser, $rcPassword)
573573
{
574-
if ($ocVersion < 9) {
574+
if ($ocVersion[0] < 9) {
575575
$l = new OC_L10N('roundcube');
576576
} else {
577-
$l = OC::$server->getL10N('roundcube');
577+
$l = OC::$server->getL10N('roundcube'); // public api said since 6.0 but i'm not sure due oc developer are a liar
578578
}
579579

580580
if (isset($appName) && $appName == "roundcube") {

0 commit comments

Comments
 (0)