- isolate include calls in installer.php which prevents local variables to be overwritten

- add the app to the autoloader before calling install.php
This commit is contained in:
Thomas Müller 2016-01-14 17:26:30 +01:00
parent 3f64d37f2a
commit 7d2a6d4c1a
1 changed files with 18 additions and 8 deletions

View File

@ -128,8 +128,8 @@ class OC_Installer{
} }
//run appinfo/install.php //run appinfo/install.php
if((!isset($data['noinstall']) or $data['noinstall']==false) and file_exists($basedir.'/appinfo/install.php')) { if((!isset($data['noinstall']) or $data['noinstall']==false)) {
include $basedir.'/appinfo/install.php'; self::includeAppScript($basedir . '/appinfo/install.php');
} }
//set the installed version //set the installed version
@ -560,15 +560,16 @@ class OC_Installer{
*/ */
public static function installShippedApp($app) { public static function installShippedApp($app) {
//install the database //install the database
if(is_file(OC_App::getAppPath($app)."/appinfo/database.xml")) { $appPath = OC_App::getAppPath($app);
OC_DB::createDbFromStructure(OC_App::getAppPath($app)."/appinfo/database.xml"); if(is_file("$appPath/appinfo/database.xml")) {
OC_DB::createDbFromStructure("$appPath/appinfo/database.xml");
} }
//run appinfo/install.php //run appinfo/install.php
if(is_file(OC_App::getAppPath($app)."/appinfo/install.php")) { \OC::$loader->addValidRoot($appPath);
include OC_App::getAppPath($app)."/appinfo/install.php"; self::includeAppScript("$appPath/appinfo/install.php");
}
$info=OC_App::getAppInfo($app); $info = OC_App::getAppInfo($app);
if (is_null($info)) { if (is_null($info)) {
return false; return false;
} }
@ -609,4 +610,13 @@ class OC_Installer{
return empty($errors); return empty($errors);
} }
/**
* @param $basedir
*/
private static function includeAppScript($script) {
if ( file_exists($script) ){
include $script;
}
}
} }