本文整理汇总了PHP中OC_App::getAppInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_App::getAppInfo方法的具体用法?PHP OC_App::getAppInfo怎么用?PHP OC_App::getAppInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_App
的用法示例。
在下文中一共展示了OC_App::getAppInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
public static function prepare($version)
{
$tempDir = self::getTempDir();
$sources = Helper::getSources($version);
$destinations = Helper::getDirectories();
if (preg_match('/^\\d+\\.\\d+/', $version, $ver)) {
$ver = $ver[0];
} else {
$ver = $version;
}
// read the list of shipped apps
$appLocation = $sources[Helper::APP_DIRNAME];
$shippedApps = array_keys(Helper::getFilteredContent($appLocation));
self::$appsToRemove = array();
try {
$locations = Helper::getPreparedLocations();
foreach ($locations as $type => $dirs) {
if (isset($sources[$type])) {
$sourceBaseDir = $sources[$type];
} else {
// Extra app directories
$sourceBaseDir = false;
}
$tempBaseDir = $tempDir . '/' . $type;
Helper::mkdir($tempBaseDir, true);
// Collect old sources
foreach ($dirs as $name => $path) {
//skip compatible, not shipped apps
if (strpos($type, Helper::APP_DIRNAME) === 0 && !in_array($name, $shippedApps)) {
//Read compatibility info
$info = \OC_App::getAppInfo($name);
if (isset($info['require']) && version_compare($ver, $info['require']) >= 0) {
continue;
}
self::$appsToRemove[] = $name;
}
self::$locations[] = array('src' => $path, 'dst' => $tempBaseDir . '/' . $name);
}
//Collect new sources
if (!$sourceBaseDir) {
continue;
}
foreach (Helper::getFilteredContent($sourceBaseDir) as $basename => $path) {
self::$locations[] = array('src' => $path, 'dst' => $destinations[$type] . '/' . $basename);
}
}
} catch (\Exception $e) {
App::log('Apps check was interrupted. Upgrade cancelled.');
throw $e;
}
return self::$locations;
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$includeExpensive = $input->getOption('include-expensive');
if ($includeExpensive) {
foreach ($this->repair->getExpensiveRepairSteps() as $step) {
$this->repair->addStep($step);
}
}
$apps = \OC::$server->getAppManager()->getInstalledApps();
foreach ($apps as $app) {
if (!\OC_App::isEnabled($app)) {
continue;
}
$info = \OC_App::getAppInfo($app);
if (!is_array($info)) {
continue;
}
$steps = $info['repair-steps']['post-migration'];
foreach ($steps as $step) {
try {
$this->repair->addStep($step);
} catch (Exception $ex) {
$output->writeln("<error>Failed to load repair step for {$app}: {$ex->getMessage()}</error>");
}
}
}
$maintenanceMode = $this->config->getSystemValue('maintenance', false);
$this->config->setSystemValue('maintenance', true);
$this->progress = new ProgressBar($output);
$this->output = $output;
$this->dispatcher->addListener('\\OC\\Repair::startProgress', [$this, 'handleRepairFeedBack']);
$this->dispatcher->addListener('\\OC\\Repair::advance', [$this, 'handleRepairFeedBack']);
$this->dispatcher->addListener('\\OC\\Repair::finishProgress', [$this, 'handleRepairFeedBack']);
$this->dispatcher->addListener('\\OC\\Repair::step', [$this, 'handleRepairFeedBack']);
$this->dispatcher->addListener('\\OC\\Repair::info', [$this, 'handleRepairFeedBack']);
$this->dispatcher->addListener('\\OC\\Repair::warning', [$this, 'handleRepairFeedBack']);
$this->dispatcher->addListener('\\OC\\Repair::error', [$this, 'handleRepairFeedBack']);
$this->repair->run();
$this->config->setSystemValue('maintenance', $maintenanceMode);
}
示例3: getAppInfo
/**
* Returns the app information from "appinfo/info.xml".
*
* If no version was present in "appinfo/info.xml", reads it
* from the external "appinfo/version" file instead.
*
* @param string $appId app id
*
* @return array app iinfo
*
* @internal
*/
public function getAppInfo($appId)
{
$appInfo = \OC_App::getAppInfo($appId);
if (!isset($appInfo['version'])) {
// read version from separate file
$appInfo['version'] = \OC_App::getAppVersion($appId);
}
return $appInfo;
}
示例4: getAppInfo
/**
* Read app metadata from the info.xml file
* @param string $app id of the app or the path of the info.xml file
* @param boolean $path (optional)
* @return array
* @since 4.0.0
*/
public static function getAppInfo($app, $path = false)
{
return \OC_App::getAppInfo($app, $path);
}
示例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;
}
示例6: listAllApps
/**
* List all apps, this is used in apps.php
*
* @param bool $onlyLocal
* @return array
*/
public static function listAllApps($onlyLocal = false)
{
$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 don't want to show configuration for these
$appList = array();
$l = \OC::$server->getL10N('core');
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;
}
$enabled = OC_Appconfig::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 (isset($info['shipped']) and $info['shipped'] == 'true') {
$info['internal'] = true;
$info['level'] = self::officialApp;
$info['removable'] = false;
} else {
$info['internal'] = false;
$info['removable'] = true;
}
$info['update'] = OC_Installer::isUpdateAvailable($app);
$appIcon = self::getAppPath($app) . '/img/' . $app . '.svg';
if (file_exists($appIcon)) {
$info['preview'] = OC_Helper::imagePath($app, $app . '.svg');
$info['previewAsIcon'] = true;
} else {
$appIcon = self::getAppPath($app) . '/img/app.svg';
if (file_exists($appIcon)) {
$info['preview'] = OC_Helper::imagePath($app, 'app.svg');
$info['previewAsIcon'] = true;
}
}
$info['version'] = OC_App::getAppVersion($app);
$appList[] = $info;
}
}
if ($onlyLocal) {
$remoteApps = [];
} else {
$remoteApps = OC_App::getAppstoreApps();
}
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: 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 !self::isAppVersionCompatible($version, $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);
OC_Hook::emit('update', 'success', 'Disabled ' . $info['name'] . ' app because it is not compatible');
}
}
}
示例8: rememberLoginAllowed
/**
* Check if it is allowed to remember login.
*
* @note Every app can set 'rememberlogin' to 'false' to disable the remember login feature
*
* @return bool
*/
public static function rememberLoginAllowed()
{
$apps = OC_App::getEnabledApps();
foreach ($apps as $app) {
$appInfo = OC_App::getAppInfo($app);
if (isset($appInfo['rememberlogin']) && $appInfo['rememberlogin'] === 'false') {
return false;
}
}
return true;
}
示例9: 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);
}
}
}
示例10: 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;
}
示例11: exportAppData
/**
* creates a migration.db in the users data dir with their app data in
* @return bool whether operation was successfull
*/
private static function exportAppData()
{
$success = true;
$return = array();
// Foreach provider
foreach (self::$providers as $provider) {
// Check if the app is enabled
if (OC_App::isEnabled($provider->getID())) {
$success = true;
// Does this app use the database?
if (file_exists(OC_App::getAppPath($provider->getID()) . '/appinfo/database.xml')) {
// Create some app tables
$tables = self::createAppTables($provider->getID());
if (is_array($tables)) {
// Save the table names
foreach ($tables as $table) {
$return['apps'][$provider->getID()]['tables'][] = $table;
}
} else {
// It failed to create the tables
$success = false;
}
}
// Run the export function?
if ($success) {
// Set the provider properties
$provider->setData(self::$uid, self::$content);
$return['apps'][$provider->getID()]['success'] = $provider->export();
} else {
$return['apps'][$provider->getID()]['success'] = false;
$return['apps'][$provider->getID()]['message'] = 'failed to create the app tables';
}
// Now add some app info the the return array
$appinfo = OC_App::getAppInfo($provider->getID());
$return['apps'][$provider->getID()]['version'] = OC_App::getAppVersion($provider->getID());
}
}
return $return;
}
示例12: installShippedApp
/**
* 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;
}
示例13: installShippedApp
/**
* 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'];
}
示例14: 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);
}
}
}
示例15: installShippedApp
/**
* 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::$SERVERROOT . "/apps/{$app}/appinfo/database.xml")) {
OC_DB::createDbFromStructure(OC::$SERVERROOT . "/apps/{$app}/appinfo/database.xml");
}
//run appinfo/install.php
if (is_file(OC::$SERVERROOT . "/apps/{$app}/appinfo/install.php")) {
include OC::$SERVERROOT . "/apps/{$app}/appinfo/install.php";
}
$info = OC_App::getAppInfo(OC::$SERVERROOT . "/apps/{$app}/appinfo/info.xml");
OC_Appconfig::setValue($app, 'installed_version', $info['version']);
return $info;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:19,代码来源:owncloud_lib_installer.php