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


PHP OC_DB::simulateUpdateDbFromStructure方法代码示例

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


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

示例1: doUpgrade

 /**
  * runs the update actions in maintenance mode, does not upgrade the source files
  * except the main .htaccess file
  *
  * @param string $currentVersion current version to upgrade to
  * @param string $installedVersion previous version from which to upgrade from
  *
  * @return bool true if the operation succeeded, false otherwise
  */
 private function doUpgrade($currentVersion, $installedVersion)
 {
     // Update htaccess files for apache hosts
     if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
         \OC_Setup::updateHtaccess();
     }
     // create empty file in data dir, so we can later find
     // out that this is indeed an ownCloud data directory
     // (in case it didn't exist before)
     file_put_contents(\OC_Config::getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
     /*
      * START CONFIG CHANGES FOR OLDER VERSIONS
      */
     if (!\OC::$CLI && version_compare($installedVersion, '6.90.1', '<')) {
         // Add the trusted_domains config if it is not existant
         // This is added to prevent host header poisoning
         \OC_Config::setValue('trusted_domains', \OC_Config::getValue('trusted_domains', array(\OC_Request::serverHost())));
     }
     /*
      * STOP CONFIG CHANGES FOR OLDER VERSIONS
      */
     // pre-upgrade repairs
     $repair = new \OC\Repair(\OC\Repair::getBeforeUpgradeRepairSteps());
     $repair->run();
     // simulate DB upgrade
     if ($this->simulateStepEnabled) {
         // simulate core DB upgrade
         \OC_DB::simulateUpdateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
         // simulate apps DB upgrade
         $version = \OC_Util::getVersion();
         $apps = \OC_App::getEnabledApps();
         foreach ($apps as $appId) {
             $info = \OC_App::getAppInfo($appId);
             if (\OC_App::isAppCompatible($version, $info) && \OC_App::shouldUpgrade($appId)) {
                 if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
                     \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
                 }
             }
         }
         $this->emit('\\OC\\Updater', 'dbSimulateUpgrade');
     }
     // upgrade from OC6 to OC7
     // TODO removed it again for OC8
     $sharePolicy = \OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
     if ($sharePolicy === 'groups_only') {
         \OC_Appconfig::setValue('core', 'shareapi_only_share_with_group_members', 'yes');
     }
     if ($this->updateStepEnabled) {
         // do the real upgrade
         \OC_DB::updateDbFromStructure(\OC::$SERVERROOT . '/db_structure.xml');
         $this->emit('\\OC\\Updater', 'dbUpgrade');
         // TODO: why not do this at the end ?
         \OC_Config::setValue('version', implode('.', \OC_Util::getVersion()));
         $disabledApps = \OC_App::checkAppsRequirements();
         if (!empty($disabledApps)) {
             $this->emit('\\OC\\Updater', 'disabledApps', array($disabledApps));
         }
         // load all apps to also upgrade enabled apps
         \OC_App::loadApps();
         // post-upgrade repairs
         $repair = new \OC\Repair(\OC\Repair::getRepairSteps());
         $repair->run();
         //Invalidate update feed
         \OC_Appconfig::setValue('core', 'lastupdatedat', 0);
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:75,代码来源:updater.php

示例2: checkAppUpgrade

 /**
  * @param string $version the oc version to check app compatibility with
  */
 protected function checkAppUpgrade($version)
 {
     $apps = \OC_App::getEnabledApps();
     $this->emit('\\OC\\Updater', 'appUpgradeCheckBefore');
     foreach ($apps as $appId) {
         $info = \OC_App::getAppInfo($appId);
         $compatible = \OC_App::isAppCompatible($version, $info);
         $isShipped = \OC_App::isShipped($appId);
         if ($compatible && $isShipped && \OC_App::shouldUpgrade($appId)) {
             /**
              * FIXME: The preupdate check is performed before the database migration, otherwise database changes
              * are not possible anymore within it. - Consider this when touching the code.
              * @link https://github.com/owncloud/core/issues/10980
              * @see \OC_App::updateApp
              */
             if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) {
                 $this->includePreUpdate($appId);
             }
             if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
                 $this->emit('\\OC\\Updater', 'appSimulateUpdate', array($appId));
                 \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
             }
         }
     }
     $this->emit('\\OC\\Updater', 'appUpgradeCheck');
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:29,代码来源:Updater.php

示例3: checkAppUpgrade

 /**
  * @param string $version the oc version to check app compatibilty with
  */
 protected function checkAppUpgrade($version)
 {
     $apps = \OC_App::getEnabledApps();
     foreach ($apps as $appId) {
         if ($version) {
             $info = \OC_App::getAppInfo($appId);
             $compatible = \OC_App::isAppCompatible($version, $info);
         } else {
             $compatible = true;
         }
         if ($compatible && \OC_App::shouldUpgrade($appId)) {
             if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
                 \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
             }
         }
     }
     $this->emit('\\OC\\Updater', 'appUpgradeCheck');
 }
开发者ID:Combustible,项目名称:core,代码行数:21,代码来源:updater.php


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