summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2012-05-26 20:40:12 +0200
committerFrank Karlitschek <frank@owncloud.org>2012-05-26 20:40:12 +0200
commit54c421f384cc53ea9f10ee2eea255b6bfdfcc835 (patch)
tree5063abf82c282e284dab7f0e09b5b8766b97e19a
parent1645f77aadc0c2f3271175516b2615aab89bea56 (diff)
downloadnextcloud-server-54c421f384cc53ea9f10ee2eea255b6bfdfcc835.tar.gz
nextcloud-server-54c421f384cc53ea9f10ee2eea255b6bfdfcc835.zip
check during ownCloud upgrade if all the installed apps are compatible with the new ownCloud version. Disable them if not
-rw-r--r--lib/app.php37
-rw-r--r--settings/js/apps.js4
2 files changed, 36 insertions, 5 deletions
diff --git a/lib/app.php b/lib/app.php
index 8ec042ddd60..78de0fa21b6 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -4,7 +4,7 @@
*
* @author Frank Karlitschek
* @author Jakob Sack
- * @copyright 2010 Frank Karlitschek karlitschek@kde.org
+ * @copyright 2012 Frank Karlitschek frank@owncloud.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -63,11 +63,14 @@ class OC_App{
// The rest comes here
$apps = self::getEnabledApps();
+ // prevent app.php from printing output
+ ob_start();
foreach( $apps as $app ){
if((is_null($types) or self::isType($app,$types))){
self::loadApp($app);
}
}
+ ob_end_clean();
self::$init = true;
@@ -186,8 +189,16 @@ class OC_App{
}
}
if($app!==false){
- OC_Appconfig::setValue( $app, 'enabled', 'yes' );
- return true;
+ // check if the app is compatible with this version of ownCloud
+ $info=OC_App::getAppInfo($app);
+ $version=OC_Util::getVersion();
+ if(!isset($info['require']) or ($version[0]>$info['require'])){
+ OC_Log::write('core','App "'.$info['name'].'" can\'t be installed because it is not compatible with this version of ownCloud',OC_Log::ERROR);
+ return false;
+ }else{
+ OC_Appconfig::setValue( $app, 'enabled', 'yes' );
+ return true;
+ }
}else{
return false;
}
@@ -514,6 +525,26 @@ class OC_App{
}
}
}
+
+ // check if the current enabled apps are compatible with the current ownCloud version. disable them if not.
+ // this is important if you upgrade ownCloud and have non ported 3rd party apps installed
+ $apps =OC_App::getEnabledApps();
+ $version=OC_Util::getVersion();
+ foreach($apps as $app) {
+
+ // check if the app is compatible with this version of ownCloud
+ $info=OC_App::getAppInfo($app);
+ if(!isset($info['require']) or ($version[0]>$info['require'])){
+ OC_Log::write('core','App "'.$info['name'].'" can\'t be used because it is not compatible with this version of ownCloud',OC_Log::ERROR);
+ OC_App::disable( $app );
+ }
+
+
+
+ }
+
+
+
}
/**
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 8aa54463b3b..f6e08b608bd 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -41,7 +41,7 @@ $(document).ready(function(){
if(active){
$.post(OC.filePath('settings','ajax','disableapp.php'),{appid:app},function(result){
if(!result || result.status!='success'){
- OC.dialogs.alert('Error','Error while disabling app');
+ OC.dialogs.alert('Error while disabling app','Error');
}
else {
element.data('active',false);
@@ -54,7 +54,7 @@ $(document).ready(function(){
}else{
$.post(OC.filePath('settings','ajax','enableapp.php'),{appid:app},function(result){
if(!result || result.status!='success'){
- OC.dialogs.alert('Error','Error while enabling app');
+ OC.dialogs.alert('Error while enabling app','Error');
}
else {
element.data('active',true);