本文整理汇总了PHP中OC_App::getAppVersions方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::getAppVersions方法的具体用法?PHP OC_App::getAppVersions怎么用?PHP OC_App::getAppVersions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_App
的用法示例。
在下文中一共展示了OC_App::getAppVersions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
$shouldFilterShipped = true;
$shippedFilter = $input->getOption('shipped') === 'true';
} else {
$shouldFilterShipped = false;
}
$apps = \OC_App::getAllApps();
$enabledApps = $disabledApps = [];
$versions = \OC_App::getAppVersions();
//sort enabled apps above disabled apps
foreach ($apps as $app) {
if ($shouldFilterShipped && \OC_App::isShipped($app) !== $shippedFilter) {
continue;
}
if (\OC_App::isEnabled($app)) {
$enabledApps[] = $app;
} else {
$disabledApps[] = $app;
}
}
$apps = ['enabled' => [], 'disabled' => []];
sort($enabledApps);
foreach ($enabledApps as $app) {
$apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
}
sort($disabledApps);
foreach ($disabledApps as $app) {
$apps['disabled'][$app] = null;
}
$this->writeAppList($input, $output, $apps);
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$apps = \OC_App::getAllApps();
$enabledApps = $disabledApps = [];
$versions = \OC_App::getAppVersions();
//sort enabled apps above disabled apps
foreach ($apps as $app) {
if (\OC_App::isEnabled($app)) {
$enabledApps[] = $app;
} else {
$disabledApps[] = $app;
}
}
$apps = ['enabled' => [], 'disabled' => []];
sort($enabledApps);
foreach ($enabledApps as $app) {
$apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true;
}
sort($disabledApps);
foreach ($disabledApps as $app) {
$apps['disabled'][$app] = null;
}
$this->writeAppList($input, $output, $apps);
}
示例3: __construct
/**
* @param string $renderAs
* @param string $appId application id
*/
public function __construct($renderAs, $appId = '')
{
// yes - should be injected ....
$this->config = \OC::$server->getConfig();
// Decide which page we show
if ($renderAs == 'user') {
parent::__construct('core', 'layout.user');
if (in_array(OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
$this->assign('bodyid', 'body-settings');
} else {
$this->assign('bodyid', 'body-user');
}
// Update notification
if ($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) {
$updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig());
$data = $updater->check();
if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array()) {
$this->assign('updateAvailable', true);
$this->assign('updateVersion', $data['versionstring']);
$this->assign('updateLink', $data['web']);
\OCP\Util::addScript('core', 'update-notification');
} else {
$this->assign('updateAvailable', false);
// No update available or not an admin user
}
} else {
$this->assign('updateAvailable', false);
// Update check is disabled
}
// Add navigation entry
$this->assign('application', '');
$this->assign('appid', $appId);
$navigation = OC_App::getNavigation();
$this->assign('navigation', $navigation);
$settingsNavigation = OC_App::getSettingsNavigation();
$this->assign('settingsnavigation', $settingsNavigation);
foreach ($navigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
foreach ($settingsNavigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
$userDisplayName = OC_User::getDisplayName();
$this->assign('user_displayname', $userDisplayName);
$this->assign('user_uid', OC_User::getUser());
$this->assign('appsmanagement_active', strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0);
$this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true));
$this->assign('userAvatarSet', \OC_Helper::userAvatarSet(OC_User::getUser()));
} else {
if ($renderAs == 'error') {
parent::__construct('core', 'layout.guest', '', false);
$this->assign('bodyid', 'body-login');
} else {
if ($renderAs == 'guest') {
parent::__construct('core', 'layout.guest');
$this->assign('bodyid', 'body-login');
} else {
parent::__construct('core', 'layout.base');
}
}
}
// Send the language to our layouts
$this->assign('language', OC_L10N::findLanguage());
if (empty(self::$versionHash)) {
$v = OC_App::getAppVersions();
$v['core'] = implode('.', \OC_Util::getVersion());
self::$versionHash = md5(implode(',', $v));
}
$useAssetPipeline = self::isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
$this->generateAssets();
} else {
// Add the js files
$jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
}
foreach ($jsFiles as $info) {
$web = $info[1];
$file = $info[2];
$this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
}
// Add the css files
$cssFiles = self::findStylesheetFiles(OC_Util::$styles);
$this->assign('cssfiles', array());
foreach ($cssFiles as $info) {
$web = $info[1];
$file = $info[2];
//.........这里部分代码省略.........
示例4: __construct
/**
* @param string $renderAs
* @param string $appId application id
*/
public function __construct($renderAs, $appId = '')
{
// yes - should be injected ....
$this->config = \OC::$server->getConfig();
// Decide which page we show
if ($renderAs == 'user') {
parent::__construct('core', 'layout.user');
if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
$this->assign('bodyid', 'body-settings');
} else {
$this->assign('bodyid', 'body-user');
}
// Code integrity notification
$integrityChecker = \OC::$server->getIntegrityCodeChecker();
if (!$integrityChecker->hasPassedCheck()) {
\OCP\Util::addScript('core', 'integritycheck-failed-notification');
}
// Add navigation entry
$this->assign('application', '');
$this->assign('appid', $appId);
$navigation = \OC_App::getNavigation();
$this->assign('navigation', $navigation);
$settingsNavigation = \OC_App::getSettingsNavigation();
$this->assign('settingsnavigation', $settingsNavigation);
foreach ($navigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
foreach ($settingsNavigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
$userDisplayName = \OC_User::getDisplayName();
$appsMgmtActive = strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0;
if ($appsMgmtActive) {
$l = \OC::$server->getL10N('lib');
$this->assign('application', $l->t('Apps'));
}
$this->assign('user_displayname', $userDisplayName);
$this->assign('user_uid', \OC_User::getUser());
$this->assign('appsmanagement_active', $appsMgmtActive);
$this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true);
if (\OC_User::getUser() === false) {
$this->assign('userAvatarSet', false);
} else {
$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
}
} else {
if ($renderAs == 'error') {
parent::__construct('core', 'layout.guest', '', false);
$this->assign('bodyid', 'body-login');
} else {
if ($renderAs == 'guest') {
parent::__construct('core', 'layout.guest');
$this->assign('bodyid', 'body-login');
} else {
parent::__construct('core', 'layout.base');
}
}
}
// Send the language to our layouts
$this->assign('language', \OC_L10N::findLanguage());
if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
if (empty(self::$versionHash)) {
$v = \OC_App::getAppVersions();
$v['core'] = implode('.', \OCP\Util::getVersion());
self::$versionHash = md5(implode(',', $v));
}
} else {
self::$versionHash = md5('not installed');
}
$useAssetPipeline = self::isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
$this->generateAssets();
} else {
// Add the js files
$jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
$this->assign('jsfiles', array());
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
}
foreach ($jsFiles as $info) {
$web = $info[1];
$file = $info[2];
$this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
}
// Add the css files
$cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
$this->assign('cssfiles', array());
foreach ($cssFiles as $info) {
$web = $info[1];
//.........这里部分代码省略.........
示例5: __construct
//.........这里部分代码省略.........
\OC_Hook::emit('OC_User', 'logout', array());
});
return $userSession;
});
$this->registerService('NavigationManager', function ($c) {
return new \OC\NavigationManager();
});
$this->registerService('AllConfig', function (Server $c) {
return new \OC\AllConfig($c->getSystemConfig());
});
$this->registerService('SystemConfig', function ($c) {
return new \OC\SystemConfig();
});
$this->registerService('AppConfig', function ($c) {
return new \OC\AppConfig(\OC_DB::getConnection());
});
$this->registerService('L10NFactory', function ($c) {
return new \OC\L10N\Factory();
});
$this->registerService('URLGenerator', function (Server $c) {
$config = $c->getConfig();
$cacheFactory = $c->getMemCacheFactory();
return new \OC\URLGenerator($config, $cacheFactory);
});
$this->registerService('AppHelper', function ($c) {
return new \OC\AppHelper();
});
$this->registerService('UserCache', function ($c) {
return new Cache\File();
});
$this->registerService('MemCacheFactory', function (Server $c) {
$config = $c->getConfig();
if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
$v = \OC_App::getAppVersions();
$v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php'));
$version = implode(',', $v);
$instanceId = \OC_Util::getInstanceId();
$path = \OC::$SERVERROOT;
$prefix = md5($instanceId . '-' . $version . '-' . $path);
return new \OC\Memcache\Factory($prefix, $c->getLogger(), $config->getSystemValue('memcache.local', null), $config->getSystemValue('memcache.distributed', null), $config->getSystemValue('memcache.locking', null));
}
return new \OC\Memcache\Factory('', $c->getLogger(), '\\OC\\Memcache\\ArrayCache', '\\OC\\Memcache\\ArrayCache', '\\OC\\Memcache\\ArrayCache');
});
$this->registerService('ActivityManager', function (Server $c) {
return new ActivityManager($c->getRequest(), $c->getUserSession(), $c->getConfig());
});
$this->registerService('AvatarManager', function (Server $c) {
return new AvatarManager($c->getUserManager(), $c->getRootFolder(), $c->getL10N('lib'));
});
$this->registerService('Logger', function (Server $c) {
$logClass = $c->query('AllConfig')->getSystemValue('log_type', 'owncloud');
$logger = 'OC_Log_' . ucfirst($logClass);
call_user_func(array($logger, 'init'));
return new Log($logger);
});
$this->registerService('JobList', function (Server $c) {
$config = $c->getConfig();
return new \OC\BackgroundJob\JobList($c->getDatabaseConnection(), $config);
});
$this->registerService('Router', function (Server $c) {
$cacheFactory = $c->getMemCacheFactory();
$logger = $c->getLogger();
if ($cacheFactory->isAvailable()) {
$router = new \OC\Route\CachingRouter($cacheFactory->create('route'), $logger);
} else {
$router = new \OC\Route\Router($logger);
示例6: __construct
//.........这里部分代码省略.........
\OC_Hook::emit('OC_User', 'logout', array());
});
return $userSession;
});
$this->registerService('NavigationManager', function ($c) {
return new \OC\NavigationManager();
});
$this->registerService('AllConfig', function (Server $c) {
return new \OC\AllConfig($c->getSystemConfig());
});
$this->registerService('SystemConfig', function ($c) {
return new \OC\SystemConfig();
});
$this->registerService('AppConfig', function ($c) {
return new \OC\AppConfig(\OC_DB::getConnection());
});
$this->registerService('L10NFactory', function ($c) {
return new \OC\L10N\Factory();
});
$this->registerService('URLGenerator', function (Server $c) {
$config = $c->getConfig();
$cacheFactory = $c->getMemCacheFactory();
return new \OC\URLGenerator($config, $cacheFactory);
});
$this->registerService('AppHelper', function ($c) {
return new \OC\AppHelper();
});
$this->registerService('UserCache', function ($c) {
return new Cache\File();
});
$this->registerService('MemCacheFactory', function (Server $c) {
$config = $c->getConfig();
if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
$v = \OC_App::getAppVersions();
$v['core'] = implode('.', \OC_Util::getVersion());
$version = implode(',', $v);
$instanceId = \OC_Util::getInstanceId();
$path = \OC::$SERVERROOT;
$prefix = md5($instanceId . '-' . $version . '-' . $path);
return new \OC\Memcache\Factory($prefix, $config->getSystemValue('memcache.local', null), $config->getSystemValue('memcache.distributed', null), $config->getSystemValue('memcache.locking', null));
}
return new \OC\Memcache\Factory('', new ArrayCache(), new ArrayCache(), new ArrayCache());
});
$this->registerService('ActivityManager', function (Server $c) {
return new ActivityManager($c->getRequest(), $c->getUserSession(), $c->getConfig());
});
$this->registerService('AvatarManager', function ($c) {
return new AvatarManager();
});
$this->registerService('Logger', function (Server $c) {
$logClass = $c->query('AllConfig')->getSystemValue('log_type', 'owncloud');
$logger = 'OC_Log_' . ucfirst($logClass);
call_user_func(array($logger, 'init'));
return new Log($logger);
});
$this->registerService('JobList', function (Server $c) {
$config = $c->getConfig();
return new \OC\BackgroundJob\JobList($c->getDatabaseConnection(), $config);
});
$this->registerService('Router', function (Server $c) {
$cacheFactory = $c->getMemCacheFactory();
if ($cacheFactory->isAvailable()) {
$router = new \OC\Route\CachingRouter($cacheFactory->create('route'));
} else {
$router = new \OC\Route\Router();
}
示例7: __construct
/**
* @param string $renderas
* @param string $appid application id
*/
public function __construct($renderas, $appid = '')
{
// Decide which page we show
if ($renderas == 'user') {
parent::__construct('core', 'layout.user');
if (in_array(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
$this->assign('bodyid', 'body-settings');
} else {
$this->assign('bodyid', 'body-user');
}
// Update notification
if (OC_Config::getValue('updatechecker', true) === true) {
$data = OC_Updater::check();
if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array() && OC_User::isAdminUser(OC_User::getUser())) {
$this->assign('updateAvailable', true);
$this->assign('updateVersion', $data['versionstring']);
$this->assign('updateLink', $data['web']);
} else {
$this->assign('updateAvailable', false);
// No update available or not an admin user
}
} else {
$this->assign('updateAvailable', false);
// Update check is disabled
}
// Add navigation entry
$this->assign('application', '', false);
$this->assign('appid', $appid);
$navigation = OC_App::getNavigation();
$this->assign('navigation', $navigation);
$this->assign('settingsnavigation', OC_App::getSettingsNavigation());
foreach ($navigation as $entry) {
if ($entry['active']) {
$this->assign('application', $entry['name']);
break;
}
}
$user_displayname = OC_User::getDisplayName();
$this->assign('user_displayname', $user_displayname);
$this->assign('user_uid', OC_User::getUser());
$this->assign('appsmanagement_active', strpos(OC_Request::requestUri(), OC_Helper::linkToRoute('settings_apps')) === 0);
$this->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
} else {
if ($renderas == 'guest' || $renderas == 'error') {
parent::__construct('core', 'layout.guest');
} else {
parent::__construct('core', 'layout.base');
}
}
if (empty(self::$versionHash)) {
self::$versionHash = md5(implode(',', OC_App::getAppVersions()));
}
$useAssetPipeline = $this->isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
$this->generateAssets();
} else {
// Add the js files
$jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
$this->assign('jsfiles', array(), false);
if (OC_Config::getValue('installed', false) && $renderas != 'error') {
$this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
}
foreach ($jsfiles as $info) {
$web = $info[1];
$file = $info[2];
$this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
}
// Add the css files
$cssfiles = self::findStylesheetFiles(OC_Util::$styles);
$this->assign('cssfiles', array());
foreach ($cssfiles as $info) {
$web = $info[1];
$file = $info[2];
$this->append('cssfiles', $web . '/' . $file . '?v=' . self::$versionHash);
}
}
}
示例8: getAppVersions
protected function getAppVersions()
{
return \OC_App::getAppVersions();
}