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


PHP OC_App::getAppVersion方法代码示例

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


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

示例1: testUpdateApp

 public function testUpdateApp()
 {
     $pathOfOldTestApp = __DIR__;
     $pathOfOldTestApp .= '/../data/';
     $pathOfOldTestApp .= 'testapp.zip';
     $oldTmp = OC_Helper::tmpFile('.zip');
     OC_Helper::copyr($pathOfOldTestApp, $oldTmp);
     $oldData = array('path' => $oldTmp, 'source' => 'path');
     $pathOfNewTestApp = __DIR__;
     $pathOfNewTestApp .= '/../data/';
     $pathOfNewTestApp .= 'testapp2.zip';
     $newTmp = OC_Helper::tmpFile('.zip');
     OC_Helper::copyr($pathOfNewTestApp, $newTmp);
     $newData = array('path' => $newTmp, 'source' => 'path');
     OC_Installer::installApp($oldData);
     $oldVersionNumber = OC_App::getAppVersion(self::$appid);
     OC_Installer::updateApp($newData);
     $newVersionNumber = OC_App::getAppVersion(self::$appid);
     $this->assertNotEquals($oldVersionNumber, $newVersionNumber);
 }
开发者ID:evanjt,项目名称:core,代码行数:20,代码来源:installer.php

示例2: testUpdateApp

 public function testUpdateApp()
 {
     $pathOfOldTestApp = __DIR__;
     $pathOfOldTestApp .= '/../data/';
     $pathOfOldTestApp .= 'testapp.zip';
     $oldTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
     OC_Helper::copyr($pathOfOldTestApp, $oldTmp);
     $oldData = array('path' => $oldTmp, 'source' => 'path', 'appdata' => ['id' => 'Bar', 'level' => 100]);
     $pathOfNewTestApp = __DIR__;
     $pathOfNewTestApp .= '/../data/';
     $pathOfNewTestApp .= 'testapp2.zip';
     $newTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
     OC_Helper::copyr($pathOfNewTestApp, $newTmp);
     $newData = array('path' => $newTmp, 'source' => 'path', 'appdata' => ['id' => 'Bar', 'level' => 100]);
     OC_Installer::installApp($oldData);
     $oldVersionNumber = OC_App::getAppVersion(self::$appid);
     OC_Installer::updateApp($newData);
     $newVersionNumber = OC_App::getAppVersion(self::$appid);
     $this->assertNotEquals($oldVersionNumber, $newVersionNumber);
 }
开发者ID:kenwi,项目名称:core,代码行数:20,代码来源:installer.php

示例3: 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
     if (is_file(OC_App::getAppPath($app) . "/appinfo/database.xml")) {
         OC_DB::createDbFromStructure(OC_App::getAppPath($app) . "/appinfo/database.xml");
     }
     //run appinfo/install.php
     if (is_file(OC_App::getAppPath($app) . "/appinfo/install.php")) {
         include OC_App::getAppPath($app) . "/appinfo/install.php";
     }
     $info = OC_App::getAppInfo($app);
     if (is_null($info)) {
         return false;
     }
     OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
     if (array_key_exists('ocsid', $info)) {
         OC_Appconfig::setValue($app, 'ocsid', $info['ocsid']);
     }
     //set remote/public handelers
     foreach ($info['remote'] as $name => $path) {
         OCP\CONFIG::setAppValue('core', 'remote_' . $name, $app . '/' . $path);
     }
     foreach ($info['public'] as $name => $path) {
         OCP\CONFIG::setAppValue('core', 'public_' . $name, $app . '/' . $path);
     }
     OC_App::setAppTypes($info['id']);
     return $info['id'];
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:33,代码来源:installer.php

示例4: 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

示例5: 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

示例6: updateApp

 /**
  * update the database for the app and call the update script
  *
  * @param string $appId
  * @return bool
  */
 public static function updateApp($appId)
 {
     $appPath = self::getAppPath($appId);
     if ($appPath === false) {
         return false;
     }
     if (file_exists($appPath . '/appinfo/database.xml')) {
         OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml');
     }
     unset(self::$appVersion[$appId]);
     // run upgrade code
     if (file_exists($appPath . '/appinfo/update.php')) {
         self::loadApp($appId, false);
         include $appPath . '/appinfo/update.php';
     }
     //set remote/public handlers
     $appData = self::getAppInfo($appId);
     if (array_key_exists('ocsid', $appData)) {
         \OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']);
     } elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) {
         \OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
     }
     foreach ($appData['remote'] as $name => $path) {
         \OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
     }
     foreach ($appData['public'] as $name => $path) {
         \OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
     }
     self::setAppTypes($appId);
     $version = \OC_App::getAppVersion($appId);
     \OC::$server->getAppConfig()->setValue($appId, 'installed_version', $version);
     return true;
 }
开发者ID:pierreozoux,项目名称:core,代码行数:39,代码来源:app.php

示例7: 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;
 }
开发者ID:jlschillinger,项目名称:core,代码行数:21,代码来源:appmanager.php

示例8: 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

示例9: foreach

        }
        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';
        } else {
            $info['internal'] = false;
            $info['internallabel'] = '3rd Party 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 {
开发者ID:ryanshoover,项目名称:core,代码行数:31,代码来源:apps.php

示例10: checkUpgrade

 /**
  * check if the app needs updating and update when needed
  */
 public static function checkUpgrade($app)
 {
     if (in_array($app, self::$checkedApps)) {
         return;
     }
     self::$checkedApps[] = $app;
     $versions = self::getAppVersions();
     $currentVersion = OC_App::getAppVersion($app);
     if ($currentVersion) {
         $installedVersion = $versions[$app];
         if (version_compare($currentVersion, $installedVersion, '>')) {
             $info = self::getAppInfo($app);
             OC_Log::write($app, 'starting app upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG);
             try {
                 OC_App::updateApp($app);
                 OC_Hook::emit('update', 'success', 'Updated ' . $info['name'] . ' app');
             } catch (Exception $e) {
                 OC_Hook::emit('update', 'failure', 'Failed to update ' . $info['name'] . ' app: ' . $e->getMessage());
                 $l = OC_L10N::get('lib');
                 throw new RuntimeException($l->t('Failed to upgrade "%s".', array($app)), 0, $e);
             }
             OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
         }
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:28,代码来源:app.php

示例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;
 }
开发者ID:Romua1d,项目名称:core,代码行数:43,代码来源:migrate.php

示例12: 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'];
 }
开发者ID:ZverAleksey,项目名称:core,代码行数:34,代码来源:installer.php

示例13: 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;
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:27,代码来源:installer.php

示例14: checkUpgrade

 /**
  * check if the app need updating and update when needed
  */
 public static function checkUpgrade($app)
 {
     if (in_array($app, self::$checkedApps)) {
         return;
     }
     self::$checkedApps[] = $app;
     $versions = self::getAppVersions();
     $currentVersion = OC_App::getAppVersion($app);
     if ($currentVersion) {
         $installedVersion = $versions[$app];
         if (version_compare($currentVersion, $installedVersion, '>')) {
             OC_Log::write($app, 'starting app upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG);
             try {
                 OC_App::updateApp($app);
             } catch (Exception $e) {
                 echo 'Failed to upgrade "' . $app . '". Exception="' . $e->getMessage() . '"';
                 die;
             }
             OC_Appconfig::setValue($app, 'installed_version', OC_App::getAppVersion($app));
         }
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:25,代码来源:app.php

示例15: getAppVersion

 /**
  * Get the last version of the app, either from appinfo/version or from appinfo/info.xml
  * @param string $app
  * @return string
  * @since 4.0.0
  */
 public static function getAppVersion($app)
 {
     return \OC_App::getAppVersion($app);
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:10,代码来源:app.php


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