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


PHP OC_App::getEnabledApps方法代码示例

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


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

示例1: getApps

 /**
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function getApps($parameters)
 {
     $apps = OC_App::listAllApps();
     $list = [];
     foreach ($apps as $app) {
         $list[] = $app['id'];
     }
     $filter = isset($_GET['filter']) ? $_GET['filter'] : false;
     if ($filter) {
         switch ($filter) {
             case 'enabled':
                 return new OC_OCS_Result(array('apps' => \OC_App::getEnabledApps()));
                 break;
             case 'disabled':
                 $enabled = OC_App::getEnabledApps();
                 return new OC_OCS_Result(array('apps' => array_diff($list, $enabled)));
                 break;
             default:
                 // Invalid filter variable
                 return new OC_OCS_Result(null, 101);
                 break;
         }
     } else {
         return new OC_OCS_Result(array('apps' => $list));
     }
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:30,代码来源:apps.php

示例2: testGetEnabledAppsIsSorted

 /**
  * Tests that the app order is correct
  */
 public function testGetEnabledAppsIsSorted()
 {
     $apps = \OC_App::getEnabledApps(true);
     // copy array
     $sortedApps = $apps;
     sort($sortedApps);
     // 'files' is always on top
     unset($sortedApps[array_search('files', $sortedApps)]);
     array_unshift($sortedApps, 'files');
     $this->assertEquals($sortedApps, $apps);
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:14,代码来源:app.php

示例3: testGetAppsDisabled

 public function testGetAppsDisabled()
 {
     $_GET['filter'] = 'disabled';
     $result = \OCA\provisioning_API\Apps::getApps(array('filter' => 'disabled'));
     $this->assertTrue($result->succeeded());
     $data = $result->getData();
     $apps = \OC_App::listAllApps();
     $list = array();
     foreach ($apps as $app) {
         $list[] = $app['id'];
     }
     $disabled = array_diff($list, \OC_App::getEnabledApps());
     $this->assertEquals(count($disabled), count($data['apps']));
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:14,代码来源:appstest.php

示例4: getApps

 public static function getApps($parameters)
 {
     $filter = isset($_GET['filter']) ? $_GET['filter'] : false;
     if ($filter) {
         switch ($filter) {
             case 'enabled':
                 return array('apps' => OC_App::getEnabledApps());
                 break;
             case 'disabled':
                 $apps = OC_App::getAllApps();
                 $enabled = OC_App::getEnabledApps();
                 return array('apps' => array_diff($apps, $enabled));
                 break;
             default:
                 // Invalid filter variable
                 return 101;
                 break;
         }
     } else {
         return array('apps' => OC_App::getAllApps());
     }
 }
开发者ID:netcon-source,项目名称:apps,代码行数:22,代码来源:apps.php

示例5: checkUpgrade

 /**
  * Checks if the version requires an update and shows
  * @param bool $showTemplate Whether an update screen should get shown
  * @return bool|void
  */
 public static function checkUpgrade($showTemplate = true)
 {
     if (\OCP\Util::needUpgrade()) {
         $systemConfig = \OC::$server->getSystemConfig();
         if ($showTemplate && !$systemConfig->getValue('maintenance', false)) {
             $version = OC_Util::getVersion();
             $oldTheme = $systemConfig->getValue('theme');
             $systemConfig->setValue('theme', '');
             OC_Util::addScript('config');
             // needed for web root
             OC_Util::addScript('update');
             $tmpl = new OC_Template('', 'update.admin', 'guest');
             $tmpl->assign('version', OC_Util::getVersionString());
             // get third party apps
             $apps = OC_App::getEnabledApps();
             $incompatibleApps = array();
             foreach ($apps as $appId) {
                 $info = OC_App::getAppInfo($appId);
                 if (!OC_App::isAppCompatible($version, $info)) {
                     $incompatibleApps[] = $info;
                 }
             }
             $tmpl->assign('appList', $incompatibleApps);
             $tmpl->assign('productName', 'ownCloud');
             // for now
             $tmpl->assign('oldTheme', $oldTheme);
             $tmpl->printPage();
             exit;
         } else {
             return true;
         }
     }
     return false;
 }
开发者ID:andyboeh,项目名称:core,代码行数:39,代码来源:base.php

示例6: needUpgrade

 /**
  * Check whether the instance needs to perform an upgrade,
  * either when the core version is higher or any app requires
  * an upgrade.
  *
  * @param \OCP\IConfig $config
  * @return bool whether the core or any app needs an upgrade
  */
 public static function needUpgrade(\OCP\IConfig $config)
 {
     if ($config->getSystemValue('installed', false)) {
         $installedVersion = $config->getSystemValue('version', '0.0.0');
         $currentVersion = implode('.', OC_Util::getVersion());
         $versionDiff = version_compare($currentVersion, $installedVersion);
         if ($versionDiff > 0) {
             return true;
         } else {
             if ($versionDiff < 0) {
                 // downgrade attempt, throw exception
                 throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
             }
         }
         // also check for upgrades for apps (independently from the user)
         $apps = \OC_App::getEnabledApps(false, true);
         $shouldUpgrade = false;
         foreach ($apps as $app) {
             if (\OC_App::shouldUpgrade($app)) {
                 $shouldUpgrade = true;
                 break;
             }
         }
         return $shouldUpgrade;
     } else {
         return false;
     }
 }
开发者ID:reverserob,项目名称:core,代码行数:36,代码来源:util.php

示例7: doUpgrade

 /**
  * runs the update actions in maintenance mode, does not upgrade the source files
  * except the main .htaccess file
  *
  * @param string $currentVersion current version to upgrade to
  * @param string $installedVersion previous version from which to upgrade from
  *
  * @return bool true if the operation succeeded, false otherwise
  */
 private function doUpgrade($currentVersion, $installedVersion)
 {
     // Update htaccess files for apache hosts
     if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
         \OC_Setup::updateHtaccess();
     }
     // create empty file in data dir, so we can later find
     // out that this is indeed an ownCloud data directory
     // (in case it didn't exist before)
     file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
     /*
      * START CONFIG CHANGES FOR OLDER VERSIONS
      */
     if (!\OC::$CLI && version_compare($installedVersion, '6.90.1', '<')) {
         // Add the trusted_domains config if it is not existant
         // This is added to prevent host header poisoning
         \OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
     }
     /*
      * STOP CONFIG CHANGES FOR OLDER VERSIONS
      */
     // pre-upgrade repairs
     $repair = new \OC\Repair(\OC\Repair::getBeforeUpgradeRepairSteps());
     $repair->run();
     // simulate DB upgrade
     if ($this->simulateStepEnabled) {
         // simulate core DB upgrade
         \OC_DB::simulateUpdateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
         // simulate apps DB upgrade
         $version = \OC_Util::getVersion();
         $apps = \OC_App::getEnabledApps();
         foreach ($apps as $appId) {
             $info = \OC_App::getAppInfo($appId);
             if (\OC_App::isAppCompatible($version, $info) && \OC_App::shouldUpgrade($appId)) {
                 if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
                     \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
                 }
             }
         }
         $this->emit('\\OC\\Updater', 'dbSimulateUpgrade');
     }
     // upgrade from OC6 to OC7
     // TODO removed it again for OC8
     $sharePolicy = \OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
     if ($sharePolicy === 'groups_only') {
         \OC_Appconfig::setValue('core', 'shareapi_only_share_with_group_members', 'yes');
     }
     if ($this->updateStepEnabled) {
         // do the real upgrade
         \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
         $this->emit('\\OC\\Updater', 'dbUpgrade');
         // TODO: why not do this at the end ?
         \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
         $disabledApps = \OC_App::checkAppsRequirements();
         if (!empty($disabledApps)) {
             $this->emit('\\OC\\Updater', 'disabledApps', array($disabledApps));
         }
         // load all apps to also upgrade enabled apps
         \OC_App::loadApps();
         // post-upgrade repairs
         $repair = new \OC\Repair(\OC\Repair::getRepairSteps());
         $repair->run();
         //Invalidate update feed
         \OC_Appconfig::setValue('core', 'lastupdatedat', 0);
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:75,代码来源:updater.php

示例8: doAppUpgrade

 /**
  * upgrades all apps within a major ownCloud upgrade. Also loads "priority"
  * (types authentication, filesystem, logging, in that order) afterwards.
  *
  * @throws NeedsUpdateException
  */
 protected function doAppUpgrade()
 {
     $apps = \OC_App::getEnabledApps();
     $priorityTypes = array('authentication', 'filesystem', 'logging');
     $pseudoOtherType = 'other';
     $stacks = array($pseudoOtherType => array());
     foreach ($apps as $appId) {
         $priorityType = false;
         foreach ($priorityTypes as $type) {
             if (!isset($stacks[$type])) {
                 $stacks[$type] = array();
             }
             if (\OC_App::isType($appId, $type)) {
                 $stacks[$type][] = $appId;
                 $priorityType = true;
                 break;
             }
         }
         if (!$priorityType) {
             $stacks[$pseudoOtherType][] = $appId;
         }
     }
     foreach ($stacks as $type => $stack) {
         foreach ($stack as $appId) {
             if (\OC_App::shouldUpgrade($appId)) {
                 $this->emit('\\OC\\Updater', 'appUpgradeStarted', [$appId, \OC_App::getAppVersion($appId)]);
                 \OC_App::updateApp($appId);
                 $this->emit('\\OC\\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]);
             }
             if ($type !== $pseudoOtherType) {
                 // load authentication, filesystem and logging apps after
                 // upgrading them. Other apps my need to rely on modifying
                 // user and/or filesystem aspects.
                 \OC_App::loadApp($appId, false);
             }
         }
     }
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:44,代码来源:Updater.php

示例9: restoreAppConfig

 /**
  * Restore the original app config service.
  */
 private function restoreAppConfig()
 {
     \OC::$server->registerService('AppConfig', function (\OC\Server $c) {
         return new \OC\AppConfig($c->getDatabaseConnection());
     });
     \OC::$server->registerService('AppManager', function (\OC\Server $c) {
         return new \OC\App\AppManager($c->getUserSession(), $c->getAppConfig(), $c->getGroupManager(), $c->getMemCacheFactory());
     });
     // Remove the cache of the mocked apps list with a forceRefresh
     \OC_App::getEnabledApps(true);
 }
开发者ID:kenwi,项目名称:core,代码行数:14,代码来源:app.php

示例10: doAppUpgrade

 protected function doAppUpgrade()
 {
     $apps = \OC_App::getEnabledApps();
     foreach ($apps as $appId) {
         if (\OC_App::shouldUpgrade($appId)) {
             \OC_App::updateApp($appId);
             $this->emit('\\OC\\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId)));
         }
     }
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:10,代码来源:updater.php

示例11: systemWebApps

 /**
  * get a list of installed web apps
  * @param string $format
  * @return string xml/json
  */
 private static function systemWebApps($format)
 {
     $login = OC_OCS::checkpassword();
     $apps = OC_App::getEnabledApps();
     $values = array();
     foreach ($apps as $app) {
         $info = OC_App::getAppInfo($app);
         if (isset($info['standalone'])) {
             $newvalue = array('name' => $info['name'], 'url' => OC_Helper::linkToAbsolute($app, ''), 'icon' => '');
             $values[] = $newvalue;
         }
     }
     $txt = OC_OCS::generatexml($format, 'ok', 100, '', $values, 'cloud', '', 2, 0, 0);
     echo $txt;
 }
开发者ID:ryanshoover,项目名称:core,代码行数:20,代码来源:ocs.php

示例12: checkAppsRequirements

 /**
  * check if the current enabled apps are compatible with the current
  * ownCloud version. disable them if not.
  * This is important if you upgrade ownCloud and have non ported 3rd
  * party apps installed.
  */
 public static function checkAppsRequirements($apps = array())
 {
     if (empty($apps)) {
         $apps = OC_App::getEnabledApps();
     }
     $version = OC_Util::getVersion();
     foreach ($apps as $app) {
         // check if the app is compatible with this version of ownCloud
         $info = OC_App::getAppInfo($app);
         if (!isset($info['require']) or $version[0] . '.' . $version[1] > $info['require']) {
             OC_Log::write('core', 'App "' . $info['name'] . '" (' . $app . ') can\'t be used because it is not compatible with this version of ownCloud', OC_Log::ERROR);
             OC_App::disable($app);
         }
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:21,代码来源:app.php

示例13: testGetAppsDisabled

 public function testGetAppsDisabled()
 {
     $this->ocsClient->expects($this->any())->method($this->anything())->will($this->returnValue(null));
     $_GET['filter'] = 'disabled';
     $result = $this->api->getApps(['filter' => 'disabled']);
     $this->assertTrue($result->succeeded());
     $data = $result->getData();
     $apps = \OC_App::listAllApps(false, true, $this->ocsClient);
     $list = array();
     foreach ($apps as $app) {
         $list[] = $app['id'];
     }
     $disabled = array_diff($list, \OC_App::getEnabledApps());
     $this->assertEquals(count($disabled), count($data['apps']));
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:15,代码来源:AppsTest.php

示例14: restoreAppConfig

 /**
  * Restore the original app config service.
  */
 private function restoreAppConfig()
 {
     $oldService = $this->oldAppConfigService;
     \OC::$server->registerService('AppConfig', function ($c) use($oldService) {
         return $oldService;
     });
     // Remove the cache of the mocked apps list with a forceRefresh
     \OC_App::getEnabledApps(true);
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:12,代码来源:app.php

示例15: updateApps

 /**
  * check if any apps need updating and update those
  */
 public static function updateApps()
 {
     $versions = self::getAppVersions();
     //ensure files app is installed for upgrades
     if (!isset($versions['files'])) {
         $versions['files'] = '0';
     }
     foreach ($versions as $app => $installedVersion) {
         $currentVersion = OC_App::getAppVersion($app);
         if ($currentVersion) {
             if (version_compare($currentVersion, $installedVersion, '>')) {
                 OC_Log::write($app, 'starting app upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG);
                 OC_App::updateApp($app);
                 OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
             }
         }
     }
     // check if the current enabled apps are compatible with the current ownCloud version. disable them if not.
     // this is important if you upgrade ownCloud and have non ported 3rd party apps installed
     $apps = OC_App::getEnabledApps();
     $version = OC_Util::getVersion();
     foreach ($apps as $app) {
         // check if the app is compatible with this version of ownCloud
         $info = OC_App::getAppInfo($app);
         if (!isset($info['require']) or $version[0] > $info['require']) {
             OC_Log::write('core', 'App "' . $info['name'] . '" can\'t be used because it is not compatible with this version of ownCloud', OC_Log::ERROR);
             OC_App::disable($app);
         }
     }
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:33,代码来源:app.php


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