本文整理汇总了PHP中OC_Installer::isUpdateAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Installer::isUpdateAvailable方法的具体用法?PHP OC_Installer::isUpdateAvailable怎么用?PHP OC_Installer::isUpdateAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Installer
的用法示例。
在下文中一共展示了OC_Installer::isUpdateAvailable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAllApps
/**
* Lists all apps, this is used in apps.php
* @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['internallabel'] = (string) $l->t('Recommended');
$info['internalclass'] = 'recommendedapp';
$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 = array();
} 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;
}
// bring the apps into the right order with a custom sort function
usort($combinedApps, function ($a, $b) {
// priority 1: active
if ($a['active'] != $b['active']) {
return $b['active'] - $a['active'];
}
// priority 2: shipped
$aShipped = array_key_exists('shipped', $a) && $a['shipped'] === 'true' ? 1 : 0;
$bShipped = array_key_exists('shipped', $b) && $b['shipped'] === 'true' ? 1 : 0;
if ($aShipped !== $bShipped) {
return $bShipped - $aShipped;
}
// priority 3: recommended
$internalClassA = isset($a['internalclass']) ? $a['internalclass'] : '';
$internalClassB = isset($b['internalclass']) ? $b['internalclass'] : '';
if ($internalClassA != $internalClassB) {
$aTemp = $internalClassA == 'recommendedapp' ? 1 : 0;
$bTemp = $internalClassB == 'recommendedapp' ? 1 : 0;
return $bTemp - $aTemp;
}
// priority 4: alphabetical
return strcasecmp($a['name'], $b['name']);
});
return $combinedApps;
//.........这里部分代码省略.........
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}