当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_Installer::isInstalled方法代码示例

本文整理汇总了PHP中OC_Installer::isInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Installer::isInstalled方法的具体用法?PHP OC_Installer::isInstalled怎么用?PHP OC_Installer::isInstalled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_Installer的用法示例。


在下文中一共展示了OC_Installer::isInstalled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testInstallApp

 public function testInstallApp()
 {
     $pathOfTestApp = __DIR__;
     $pathOfTestApp .= '/../data/';
     $pathOfTestApp .= 'testapp.zip';
     $tmp = OC_Helper::tmpFile('.zip');
     OC_Helper::copyr($pathOfTestApp, $tmp);
     $data = array('path' => $tmp, 'source' => 'path');
     OC_Installer::installApp($data);
     $isInstalled = OC_Installer::isInstalled(self::$appid);
     $this->assertTrue($isInstalled);
 }
开发者ID:evanjt,项目名称:core,代码行数:12,代码来源:installer.php

示例2: testInstallApp

 public function testInstallApp()
 {
     $pathOfTestApp = __DIR__;
     $pathOfTestApp .= '/../data/';
     $pathOfTestApp .= 'testapp.zip';
     $tmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
     OC_Helper::copyr($pathOfTestApp, $tmp);
     $data = array('path' => $tmp, 'source' => 'path', 'appdata' => ['id' => 'Bar', 'level' => 100]);
     OC_Installer::installApp($data);
     $isInstalled = OC_Installer::isInstalled(self::$appid);
     $this->assertTrue($isInstalled);
 }
开发者ID:kenwi,项目名称:core,代码行数:12,代码来源:installer.php

示例3: enable

 /**
  * enables an app
  * @param mixed $app app
  * @param array $groups (optional) when set, only these groups will have access to the app
  * @throws \Exception
  * @return void
  *
  * This function set an app as enabled in appconfig.
  */
 public static function enable($app, $groups = null)
 {
     self::$enabledAppsCache = array();
     // flush
     if (!OC_Installer::isInstalled($app)) {
         $app = self::installApp($app);
     }
     if (!is_null($groups)) {
         OC_Appconfig::setValue($app, 'enabled', json_encode($groups));
     } else {
         OC_Appconfig::setValue($app, 'enabled', 'yes');
     }
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:22,代码来源:app.php

示例4: installShippedApps

 /**
  * Installs shipped apps
  *
  * This function installs all apps found in the 'apps' directory that should be enabled by default;
  */
 public static function installShippedApps()
 {
     foreach (OC::$APPSROOTS as $app_dir) {
         if ($dir = opendir($app_dir['path'])) {
             while (false !== ($filename = readdir($dir))) {
                 if (substr($filename, 0, 1) != '.' and is_dir($app_dir['path'] . "/{$filename}")) {
                     if (file_exists($app_dir['path'] . "/{$filename}/appinfo/app.php")) {
                         if (!OC_Installer::isInstalled($filename)) {
                             $info = OC_App::getAppInfo($filename);
                             $enabled = isset($info['default_enable']);
                             if ($enabled) {
                                 OC_Installer::installShippedApp($filename);
                                 OC_Appconfig::setValue($filename, 'enabled', 'yes');
                             }
                         }
                     }
                 }
             }
             closedir($dir);
         }
     }
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:27,代码来源:installer.php

示例5: enable

 /**
  * enables an app
  *
  * @param mixed $app app
  * @param array $groups (optional) when set, only these groups will have access to the app
  * @throws \Exception
  * @return void
  *
  * This function set an app as enabled in appconfig.
  */
 public static function enable($app, $groups = null)
 {
     self::$enabledAppsCache = array();
     // flush
     if (!OC_Installer::isInstalled($app)) {
         $app = self::installApp($app);
     }
     $appManager = \OC::$server->getAppManager();
     if (!is_null($groups)) {
         $groupManager = \OC::$server->getGroupManager();
         $groupsList = [];
         foreach ($groups as $group) {
             $groupItem = $groupManager->get($group);
             if ($groupItem instanceof \OCP\IGroup) {
                 $groupsList[] = $groupManager->get($group);
             }
         }
         $appManager->enableAppForGroups($app, $groupsList);
     } else {
         $appManager->enableApp($app);
     }
 }
开发者ID:pierreozoux,项目名称:core,代码行数:32,代码来源:app.php

示例6: enable

 /**
  * @brief enables an app
  * @param mixed $app app
  * @throws \Exception
  * @return void
  *
  * This function set an app as enabled in appconfig.
  */
 public static function enable($app)
 {
     self::$enabledAppsCache = array();
     // flush
     if (!OC_Installer::isInstalled($app)) {
         // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string
         if (!is_numeric($app)) {
             $app = OC_Installer::installShippedApp($app);
         } else {
             $appdata = OC_OCSClient::getApplication($app, \OC_Util::getVersion());
             $download = OC_OCSClient::getApplicationDownload($app, 1, \OC_Util::getVersion());
             if (isset($download['downloadlink']) and $download['downloadlink'] != '') {
                 $info = array('source' => 'http', 'href' => $download['downloadlink'], 'appdata' => $appdata);
                 $app = OC_Installer::installApp($info);
             }
         }
     }
     $l = OC_L10N::get('core');
     if ($app !== false) {
         // check if the app is compatible with this version of ownCloud
         $info = OC_App::getAppInfo($app);
         $version = OC_Util::getVersion();
         if (!isset($info['require']) or !self::isAppVersionCompatible($version, $info['require'])) {
             throw new \Exception($l->t("App \"%s\" can't be installed because it is not compatible with this version of ownCloud.", array($info['name'])));
         } else {
             OC_Appconfig::setValue($app, 'enabled', 'yes');
             if (isset($appdata['id'])) {
                 OC_Appconfig::setValue($app, 'ocsid', $appdata['id']);
             }
             \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app));
         }
     } else {
         throw new \Exception($l->t("No app name specified"));
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:43,代码来源:app.php

示例7: enable

 /**
  * @brief enables an app
  * @param $app app
  * @returns true/false
  *
  * This function set an app as enabled in appconfig.
  */
 public static function enable($app)
 {
     if (!OC_Installer::isInstalled($app)) {
         OC_Installer::installShippedApp($app);
     }
     OC_Appconfig::setValue($app, 'enabled', 'yes');
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:14,代码来源:owncloud_lib_app.php

示例8: installShippedApps

 /**
  * Installs shipped apps
  *
  * This function installs all apps found in the 'apps' directory that should be enabled by default;
  */
 public static function installShippedApps()
 {
     foreach (OC::$APPSROOTS as $app_dir) {
         if ($dir = opendir($app_dir['path'])) {
             while (false !== ($filename = readdir($dir))) {
                 if (substr($filename, 0, 1) != '.' and is_dir($app_dir['path'] . "/{$filename}")) {
                     if (file_exists($app_dir['path'] . "/{$filename}/appinfo/info.xml")) {
                         if (!OC_Installer::isInstalled($filename)) {
                             $info = OC_App::getAppInfo($filename);
                             $enabled = isset($info['default_enable']);
                             if (($enabled || in_array($filename, \OC::$server->getAppManager()->getAlwaysEnabledApps())) && \OC::$server->getConfig()->getAppValue($filename, 'enabled') !== 'no') {
                                 OC_Installer::installShippedApp($filename);
                                 \OC::$server->getConfig()->setAppValue($filename, 'enabled', 'yes');
                             }
                         }
                     }
                 }
             }
             closedir($dir);
         }
     }
 }
开发者ID:ZverAleksey,项目名称:core,代码行数:27,代码来源:installer.php

示例9: enable

 /**
  * @brief enables an app
  * @param mixed $app app
  * @return bool
  *
  * This function set an app as enabled in appconfig.
  */
 public static function enable($app)
 {
     if (!OC_Installer::isInstalled($app)) {
         // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string
         if (!is_numeric($app)) {
             $app = OC_Installer::installShippedApp($app);
         } else {
             $download = OC_OCSClient::getApplicationDownload($app, 1);
             if (isset($download['downloadlink']) and $download['downloadlink'] != '') {
                 $app = OC_Installer::installApp(array('source' => 'http', 'href' => $download['downloadlink']));
             }
         }
     }
     if ($app !== false) {
         // check if the app is compatible with this version of ownCloud
         $info = OC_App::getAppInfo($app);
         $version = OC_Util::getVersion();
         if (!isset($info['require']) or $version[0] > $info['require']) {
             OC_Log::write('core', 'App "' . $info['name'] . '" can\'t be installed because it is not compatible with this version of ownCloud', OC_Log::ERROR);
             return false;
         } else {
             OC_Appconfig::setValue($app, 'enabled', 'yes');
             return true;
         }
     } else {
         return false;
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:35,代码来源:app.php

示例10: installShippedApps

 /**
  * @brief Installs shipped apps
  * @param $enabled
  *
  * This function installs all apps found in the 'apps' directory;
  * If $enabled is true, apps are installed as enabled.
  * If $enabled is false, apps are installed as disabled.
  */
 public static function installShippedApps()
 {
     $dir = opendir(OC::$SERVERROOT . "/apps");
     while (false !== ($filename = readdir($dir))) {
         if (substr($filename, 0, 1) != '.' and is_dir(OC::$SERVERROOT . "/apps/{$filename}")) {
             if (file_exists(OC::$SERVERROOT . "/apps/{$filename}/appinfo/app.php")) {
                 if (!OC_Installer::isInstalled($filename)) {
                     $info = OC_Installer::installShippedApp($filename);
                     $enabled = isset($info['default_enable']);
                     if ($enabled) {
                         OC_Appconfig::setValue($filename, 'enabled', 'yes');
                     } else {
                         OC_Appconfig::setValue($filename, 'enabled', 'no');
                     }
                 }
             }
         }
     }
     closedir($dir);
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:28,代码来源:owncloud_lib_installer.php


注:本文中的OC_Installer::isInstalled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。