本文整理汇总了PHP中OC_App::getAllApps方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::getAllApps方法的具体用法?PHP OC_App::getAllApps怎么用?PHP OC_App::getAllApps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_App
的用法示例。
在下文中一共展示了OC_App::getAllApps方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: collect
public function collect($dryRun = false)
{
foreach (\OC_App::getAllApps() as $appId) {
if (\OC_App::isShipped($appId)) {
if ($dryRun || @file_exists($this->newBase . '/' . $appId)) {
$this->appsToUpdate[$appId] = $appId;
} else {
$this->appsToDisable[$appId] = $appId;
}
}
}
}
示例3: 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());
}
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$apps = \OC_App::getAllApps();
$enabledApps = array();
$disabledApps = array();
//sort enabled apps above disabled apps
foreach ($apps as $app) {
if (\OC_App::isEnabled($app)) {
$enabledApps[] = $app;
} else {
$disabledApps[] = $app;
}
}
sort($enabledApps);
sort($disabledApps);
$output->writeln('Enabled:');
foreach ($enabledApps as $app) {
$output->writeln(' - ' . $app);
}
$output->writeln('Disabled:');
foreach ($disabledApps as $app) {
$output->writeln(' - ' . $app);
}
}
示例5: 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);
}
示例6: listAllApps
/**
* List all apps, this is used in apps.php
*
* @param bool $onlyLocal
* @param bool $includeUpdateInfo Should we check whether there is an update
* in the app store?
* @param OCSClient $ocsClient
* @return array
*/
public static function listAllApps($onlyLocal = false, $includeUpdateInfo = true, OCSClient $ocsClient)
{
$installedApps = OC_App::getAllApps();
//TODO which apps do we want to blacklist and how do we integrate
// blacklisting with the multi apps folder feature?
//we don't want to show configuration for these
$blacklist = \OC::$server->getAppManager()->getAlwaysEnabledApps();
$appList = array();
foreach ($installedApps as $app) {
if (array_search($app, $blacklist) === false) {
$info = OC_App::getAppInfo($app);
if (!isset($info['name'])) {
\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', \OCP\Util::ERROR);
continue;
}
$enabled = \OC::$server->getAppConfig()->getValue($app, 'enabled', 'no');
$info['groups'] = null;
if ($enabled === 'yes') {
$active = true;
} else {
if ($enabled === 'no') {
$active = false;
} else {
$active = true;
$info['groups'] = $enabled;
}
}
$info['active'] = $active;
if (self::isShipped($app)) {
$info['internal'] = true;
$info['level'] = self::officialApp;
$info['removable'] = false;
} else {
$info['internal'] = false;
$info['removable'] = true;
}
$info['update'] = $includeUpdateInfo ? OC_Installer::isUpdateAvailable($app) : null;
$appPath = self::getAppPath($app);
if ($appPath !== false) {
$appIcon = $appPath . '/img/' . $app . '.svg';
if (file_exists($appIcon)) {
$info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, $app . '.svg');
$info['previewAsIcon'] = true;
} else {
$appIcon = $appPath . '/img/app.svg';
if (file_exists($appIcon)) {
$info['preview'] = \OC::$server->getURLGenerator()->imagePath($app, 'app.svg');
$info['previewAsIcon'] = true;
}
}
}
$info['version'] = OC_App::getAppVersion($app);
$appList[] = $info;
}
}
if ($onlyLocal) {
$remoteApps = [];
} else {
$remoteApps = OC_App::getAppstoreApps('approved', null, $ocsClient);
}
if ($remoteApps) {
// Remove duplicates
foreach ($appList as $app) {
foreach ($remoteApps as $key => $remote) {
if ($app['name'] === $remote['name'] || isset($app['ocsid']) && $app['ocsid'] === $remote['id']) {
unset($remoteApps[$key]);
}
}
}
$combinedApps = array_merge($appList, $remoteApps);
} else {
$combinedApps = $appList;
}
return $combinedApps;
}
示例7: array
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_Util::checkAdminUser();
OC_App::loadApps();
// Load the files we need
OC_Util::addStyle("settings", "settings");
OC_Util::addScript("settings", "apps");
OC_App::setActiveNavigationEntry("core_apps");
$installedApps = OC_App::getAllApps();
//TODO which apps do we want to blacklist and how do we integrate blacklisting with the multi apps folder feature?
$blacklist = array('files');
//we dont want to show configuration for these
$appList = array();
foreach ($installedApps as $app) {
if (array_search($app, $blacklist) === false) {
$info = OC_App::getAppInfo($app);
if (!isset($info['name'])) {
OC_Log::write('core', 'App id "' . $app . '" has no name in appinfo', OC_Log::ERROR);
continue;
}
if (OC_Appconfig::getValue($app, 'enabled', 'no') == 'yes') {
$active = true;
} else {
$active = false;
示例8: listAllApps
/**
* @brief: Lists all apps, this is used in apps.php
* @return array
*/
public static function listAllApps()
{
$installedApps = OC_App::getAllApps();
//TODO which apps do we want to blacklist and how do we integrate
// blacklisting with the multi apps folder feature?
$blacklist = array('files');
//we dont want to show configuration for these
$appList = array();
foreach ($installedApps as $app) {
if (array_search($app, $blacklist) === false) {
$info = OC_App::getAppInfo($app);
if (!isset($info['name'])) {
OC_Log::write('core', 'App id "' . $app . '" has no name in appinfo', OC_Log::ERROR);
continue;
}
if (OC_Appconfig::getValue($app, 'enabled', 'no') == 'yes') {
$active = true;
} else {
$active = false;
}
$info['active'] = $active;
if (isset($info['shipped']) and $info['shipped'] == 'true') {
$info['internal'] = true;
$info['internallabel'] = 'Internal App';
$info['internalclass'] = '';
$info['update'] = false;
} else {
$info['internal'] = false;
$info['internallabel'] = '3rd Party';
$info['internalclass'] = 'externalapp';
$info['update'] = OC_Installer::isUpdateAvailable($app);
}
$info['preview'] = OC_Helper::imagePath('settings', 'trans.png');
$info['version'] = OC_App::getAppVersion($app);
$appList[] = $info;
}
}
$remoteApps = OC_App::getAppstoreApps();
if ($remoteApps) {
// Remove duplicates
foreach ($appList as $app) {
foreach ($remoteApps as $key => $remote) {
if ($app['name'] == $remote['name']) {
unset($remoteApps[$key]);
}
}
}
$combinedApps = array_merge($appList, $remoteApps);
} else {
$combinedApps = $appList;
}
// bring the apps into the right order with a custom sort funtion
usort($combinedApps, '\\OC_App::customSort');
return $combinedApps;
}
示例9: createSchema
protected function createSchema(Connection $toDB, InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Creating schema in new database</info>');
$schemaManager = new \OC\DB\MDB2SchemaManager($toDB);
$schemaManager->createDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
$apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps();
foreach ($apps as $app) {
if (file_exists(\OC_App::getAppPath($app) . '/appinfo/database.xml')) {
$schemaManager->createDbFromStructure(\OC_App::getAppPath($app) . '/appinfo/database.xml');
}
}
}
示例10: array
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once '../lib/base.php';
OC_Util::checkAdminUser();
// Load the files we need
OC_Util::addStyle("settings", "settings");
OC_Util::addScript("settings", "apps");
OC_App::setActiveNavigationEntry("core_apps");
$registeredApps = OC_App::getAllApps();
$apps = array();
$blacklist = array('files', 'files_imageviewer', 'files_textviewer');
//we dont want to show configuration for these
foreach ($registeredApps as $app) {
if (array_search($app, $blacklist) === false) {
$info = OC_App::getAppInfo($app);
$active = OC_Appconfig::getValue($app, 'enabled', 'no') == 'yes' ? true : false;
$info['active'] = $active;
if (isset($info['shipped']) and $info['shipped'] == 'true') {
$info['internal'] = true;
$info['internallabel'] = 'Internal App';
} else {
$info['internal'] = false;
$info['internallabel'] = '3rd Party App';
}
示例11: set_time_limit
/**
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
use Symfony\Component\Console\Application;
$RUNTIME_NOAPPS = true;
require_once 'lib/base.php';
// set to run indefinitely if needed
set_time_limit(0);
// Don't do anything if ownCloud has not been installed yet
if (!OC_Config::getValue('installed', false)) {
echo "Console can only be used once ownCloud has been installed" . PHP_EOL;
exit(0);
}
if (!OC::$CLI) {
echo "This script can be run from the command line only" . PHP_EOL;
exit(0);
}
$defaults = new OC_Defaults();
$application = new Application($defaults->getName(), \OC_Util::getVersionString());
require_once 'core/register_command.php';
foreach (OC_App::getAllApps() as $app) {
$file = OC_App::getAppPath($app) . '/appinfo/register_command.php';
if (file_exists($file)) {
require $file;
}
}
$application->run();
示例12: replaceDB
/**
* @brief replaces the ownCloud tables with a new set
* @param $file string path to the MDB2 xml db export file
*/
public function replaceDB($file)
{
$apps = \OC_App::getAllApps();
$this->conn->beginTransaction();
// Delete the old tables
$this->removeDBStructure(\OC::$SERVERROOT . '/db_structure.xml');
foreach ($apps as $app) {
$path = \OC_App::getAppPath($app) . '/appinfo/database.xml';
if (file_exists($path)) {
$this->removeDBStructure($path);
}
}
// Create new tables
$this->conn->commit();
}
示例13: getApps
/**
* @brief returns an array of apps that support migration
* @return array
*/
public static function getApps()
{
$allapps = OC_App::getAllApps();
foreach ($allapps as $app) {
$path = OC::$SERVERROOT . '/apps/' . $app . '/lib/migrate.php';
if (file_exists($path)) {
$supportsmigration[] = $app;
}
}
return $supportsmigration;
}
示例14: getAllApps
/**
* Providers \OC_App::getAllApps()
*
* @return array
*/
public function getAllApps()
{
return \OC_App::getAllApps();
}
示例15: getApps
/**
* returns an array of apps that support migration
* @return array
*/
public static function getApps()
{
$allapps = OC_App::getAllApps();
foreach ($allapps as $app) {
$path = self::getAppPath($app) . '/lib/migrate.php';
if (file_exists($path)) {
$supportsmigration[] = $app;
}
}
return $supportsmigration;
}