/** * 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::$loader->addValidRoot($appPath); self::includeAppScript("{$appPath}/appinfo/install.php"); $info = OC_App::getAppInfo($app); if (is_null($info)) { return false; } $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']; }
/** * 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 if (is_file(OC_App::getAppPath($app) . "/appinfo/database.xml")) { OC_DB::createDbFromStructure(OC_App::getAppPath($app) . "/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); if (is_null($info)) { return false; } OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app)); if (array_key_exists('ocsid', $info)) { OC_Appconfig::setValue($app, 'ocsid', $info['ocsid']); } //set remote/public handelers foreach ($info['remote'] as $name => $path) { OCP\CONFIG::setAppValue('core', 'remote_' . $name, $app . '/' . $path); } foreach ($info['public'] as $name => $path) { OCP\CONFIG::setAppValue('core', 'public_' . $name, $app . '/' . $path); } OC_App::setAppTypes($info['id']); return $info['id']; }
/** * install an app already placed in the app folder * @param string $app id of the app to install * @returns array see OC_App::getAppInfo */ public static function installShippedApp($app) { //install the database if (is_file(OC::$APPSROOT . "/apps/{$app}/appinfo/database.xml")) { OC_DB::createDbFromStructure(OC::$APPSROOT . "/apps/{$app}/appinfo/database.xml"); } //run appinfo/install.php if (is_file(OC::$APPSROOT . "/apps/{$app}/appinfo/install.php")) { include OC::$APPSROOT . "/apps/{$app}/appinfo/install.php"; } $info = OC_App::getAppInfo($app); OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app)); //set remote/public handelers foreach ($info['remote'] as $name => $path) { OCP\CONFIG::setAppValue('core', 'remote_' . $name, '/apps/' . $app . '/' . $path); } foreach ($info['public'] as $name => $path) { OCP\CONFIG::setAppValue('core', 'public_' . $name, '/apps/' . $app . '/' . $path); } OC_App::setAppTypes($info['id']); return $info; }