Move app upgrade check to loading of apps
This commit is contained in:
parent
a25ae4b4b6
commit
2f0b4983e9
12
lib/app.php
12
lib/app.php
|
@ -84,6 +84,7 @@ class OC_App{
|
||||||
*/
|
*/
|
||||||
public static function loadApp($app){
|
public static function loadApp($app){
|
||||||
if(is_file(self::getAppPath($app).'/appinfo/app.php')){
|
if(is_file(self::getAppPath($app).'/appinfo/app.php')){
|
||||||
|
self::checkUpgrade($app);
|
||||||
require_once( $app.'/appinfo/app.php' );
|
require_once( $app.'/appinfo/app.php' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,17 +527,13 @@ class OC_App{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if any apps need updating and update those
|
* check if the app need updating and update when needed
|
||||||
*/
|
*/
|
||||||
public static function updateApps(){
|
public static function checkUpgrade($app) {
|
||||||
$versions = self::getAppVersions();
|
$versions = self::getAppVersions();
|
||||||
//ensure files app is installed for upgrades
|
|
||||||
if(!isset($versions['files'])){
|
|
||||||
$versions['files']='0';
|
|
||||||
}
|
|
||||||
foreach( $versions as $app=>$installedVersion ){
|
|
||||||
$currentVersion=OC_App::getAppVersion($app);
|
$currentVersion=OC_App::getAppVersion($app);
|
||||||
if ($currentVersion) {
|
if ($currentVersion) {
|
||||||
|
$installedVersion = $versions[$app];
|
||||||
if (version_compare($currentVersion, $installedVersion, '>')) {
|
if (version_compare($currentVersion, $installedVersion, '>')) {
|
||||||
OC_Log::write($app, 'starting app upgrade from '.$installedVersion.' to '.$currentVersion,OC_Log::DEBUG);
|
OC_Log::write($app, 'starting app upgrade from '.$installedVersion.' to '.$currentVersion,OC_Log::DEBUG);
|
||||||
OC_App::updateApp($app);
|
OC_App::updateApp($app);
|
||||||
|
@ -544,7 +541,6 @@ class OC_App{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if the current enabled apps are compatible with the current
|
* check if the current enabled apps are compatible with the current
|
||||||
|
|
|
@ -208,9 +208,9 @@ class OC{
|
||||||
|
|
||||||
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
|
||||||
OC_App::checkAppsRequirements();
|
OC_App::checkAppsRequirements();
|
||||||
|
// load all apps to also upgrade enabled apps
|
||||||
|
OC_App::loadApps();
|
||||||
}
|
}
|
||||||
|
|
||||||
OC_App::updateApps();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue