/** * install an app already placed in the app folder * @param string $app id of the app to install * @return integer */ public static function installShippedApp($app) { //install the database $appPath = OC_App::getAppPath($app); if (is_file("{$appPath}/appinfo/database.xml")) { OC_DB::createDbFromStructure("{$appPath}/appinfo/database.xml"); } //run appinfo/install.php \OC_App::registerAutoloading($app, $appPath); self::includeAppScript("{$appPath}/appinfo/install.php"); $info = OC_App::getAppInfo($app); if (is_null($info)) { return false; } \OC_App::setupBackgroundJobs($info['background-jobs']); OC_App::executeRepairSteps($app, $info['repair-steps']['install']); $config = \OC::$server->getConfig(); $config->setAppValue($app, 'installed_version', OC_App::getAppVersion($app)); if (array_key_exists('ocsid', $info)) { $config->setAppValue($app, 'ocsid', $info['ocsid']); } //set remote/public handlers foreach ($info['remote'] as $name => $path) { $config->setAppValue('core', 'remote_' . $name, $app . '/' . $path); } foreach ($info['public'] as $name => $path) { $config->setAppValue('core', 'public_' . $name, $app . '/' . $path); } OC_App::setAppTypes($info['id']); return $info['id']; }