diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-14 17:26:30 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-14 17:28:00 +0100 |
commit | 7d2a6d4c1acd60605c728d57d71a7143989a70aa (patch) | |
tree | 046e131649ae51176cb85ba3451b1b151fe30d2f | |
parent | 3f64d37f2afd2f9a706df7495d543dccdb51c1f7 (diff) | |
download | nextcloud-server-7d2a6d4c1acd60605c728d57d71a7143989a70aa.tar.gz nextcloud-server-7d2a6d4c1acd60605c728d57d71a7143989a70aa.zip |
- isolate include calls in installer.php which prevents local variables to be overwritten
- add the app to the autoloader before calling install.php
-rw-r--r-- | lib/private/installer.php | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/private/installer.php b/lib/private/installer.php index ef5efb09b46..ace3d65c002 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -128,8 +128,8 @@ class OC_Installer{ } //run appinfo/install.php - if((!isset($data['noinstall']) or $data['noinstall']==false) and file_exists($basedir.'/appinfo/install.php')) { - include $basedir.'/appinfo/install.php'; + if((!isset($data['noinstall']) or $data['noinstall']==false)) { + self::includeAppScript($basedir . '/appinfo/install.php'); } //set the installed version @@ -560,15 +560,16 @@ class OC_Installer{ */ public static function installShippedApp($app) { //install the database - if(is_file(OC_App::getAppPath($app)."/appinfo/database.xml")) { - OC_DB::createDbFromStructure(OC_App::getAppPath($app)."/appinfo/database.xml"); + $appPath = OC_App::getAppPath($app); + if(is_file("$appPath/appinfo/database.xml")) { + OC_DB::createDbFromStructure("$appPath/appinfo/database.xml"); } //run appinfo/install.php - if(is_file(OC_App::getAppPath($app)."/appinfo/install.php")) { - include OC_App::getAppPath($app)."/appinfo/install.php"; - } - $info=OC_App::getAppInfo($app); + \OC::$loader->addValidRoot($appPath); + self::includeAppScript("$appPath/appinfo/install.php"); + + $info = OC_App::getAppInfo($app); if (is_null($info)) { return false; } @@ -609,4 +610,13 @@ class OC_Installer{ return empty($errors); } + + /** + * @param $basedir + */ + private static function includeAppScript($script) { + if ( file_exists($script) ){ + include $script; + } + } } |