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


PHP OC::checkUpgrade方法代码示例

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


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

示例1: execute

 /**
  * Execute the upgrade command
  *
  * @param InputInterface $input input interface
  * @param OutputInterface $output output interface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $simulateStepEnabled = true;
     $updateStepEnabled = true;
     if ($input->getOption('skip-migration-test')) {
         $simulateStepEnabled = false;
     }
     if ($input->getOption('dry-run')) {
         $updateStepEnabled = false;
     }
     if (!$simulateStepEnabled && !$updateStepEnabled) {
         $output->writeln('<error>Only one of "--skip-migration-test" or "--dry-run" ' . 'can be specified at a time.</error>');
         return self::ERROR_INVALID_ARGUMENTS;
     }
     if (\OC::checkUpgrade(false)) {
         $self = $this;
         $updater = new Updater(\OC::$server->getHTTPHelper(), \OC::$server->getAppConfig());
         $updater->setSimulateStepEnabled($simulateStepEnabled);
         $updater->setUpdateStepEnabled($updateStepEnabled);
         $updater->listen('\\OC\\Updater', 'maintenanceStart', function () use($output) {
             $output->writeln('<info>Turned on maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'maintenanceEnd', function () use($output, $updateStepEnabled, $self) {
             $output->writeln('<info>Turned off maintenance mode</info>');
             $mode = $updateStepEnabled ? 'Update' : 'Update simulation';
             $status = $self->upgradeFailed ? 'failed' : 'successful';
             $message = "<info>{$mode} {$status}</info>";
             $output->writeln($message);
         });
         $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($output) {
             $output->writeln('<info>Updated database</info>');
         });
         $updater->listen('\\OC\\Updater', 'dbSimulateUpgrade', function () use($output) {
             $output->writeln('<info>Checked database schema update</info>');
         });
         $updater->listen('\\OC\\Updater', 'disabledApps', function ($appList) use($output) {
             $output->writeln('<info>Disabled incompatible apps: ' . implode(', ', $appList) . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'failure', function ($message) use($output, $self) {
             $output->writeln("<error>{$message}</error>");
             $self->upgradeFailed = true;
         });
         $updater->upgrade();
         $this->postUpgradeCheck($input, $output);
         return self::ERROR_SUCCESS;
     } else {
         if ($this->config->getSystemValue('maintenance', false)) {
             //Possible scenario: ownCloud core is updated but an app failed
             $output->writeln('<warning>ownCloud is in maintenance mode</warning>');
             $output->write('<comment>Maybe an upgrade is already in process. Please check the ' . 'logfile (data/owncloud.log). If you want to re-run the ' . 'upgrade procedure, remove the "maintenance mode" from ' . 'config.php and call this script again.</comment>', true);
             return self::ERROR_MAINTENANCE_MODE;
         } else {
             $output->writeln('<info>ownCloud is already latest version</info>');
             return self::ERROR_UP_TO_DATE;
         }
     }
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:63,代码来源:upgrade.php

示例2: checkMaintenanceMode

 /**
  * This method is called before any HTTP method and returns http status code 503
  * in case the system is in maintenance mode.
  *
  * @throws \Sabre\DAV\Exception\ServiceUnavailable
  * @internal param string $method
  * @return bool
  */
 public function checkMaintenanceMode()
 {
     if (OC_Config::getValue('maintenance', false)) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable();
     }
     if (OC::checkUpgrade(false)) {
         throw new \Sabre\DAV\Exception\ServiceUnavailable('Upgrade needed');
     }
     return true;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:18,代码来源:maintenanceplugin.php

示例3: checkMaintenanceMode

 /**
  * This method is called before any HTTP method and returns http status code 503
  * in case the system is in maintenance mode.
  *
  * @throws ServiceUnavailable
  * @return bool
  */
 public function checkMaintenanceMode()
 {
     if ($this->config->getSystemValue('singleuser', false)) {
         throw new ServiceUnavailable('System in single user mode.');
     }
     if ($this->config->getSystemValue('maintenance', false)) {
         throw new ServiceUnavailable('System in maintenance mode.');
     }
     if (\OC::checkUpgrade(false)) {
         throw new ServiceUnavailable('Upgrade needed');
     }
     return true;
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:20,代码来源:MaintenancePlugin.php

示例4: execute

 /**
  * Execute the upgrade command
  *
  * @param InputInterface $input input interface
  * @param OutputInterface $output output interface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     global $RUNTIME_NOAPPS;
     $RUNTIME_NOAPPS = true;
     //no apps, yet
     require_once \OC::$SERVERROOT . '/lib/base.php';
     // Don't do anything if ownCloud has not been installed
     if (!\OC_Config::getValue('installed', false)) {
         $output->writeln('<error>ownCloud has not yet been installed</error>');
         return self::ERROR_NOT_INSTALLED;
     }
     if (\OC::checkUpgrade(false)) {
         $updater = new Updater();
         $updater->listen('\\OC\\Updater', 'maintenanceStart', function () use($output) {
             $output->writeln('<info>Turned on maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'maintenanceEnd', function () use($output) {
             $output->writeln('<info>Turned off maintenance mode</info>');
             $output->writeln('<info>Update successful</info>');
         });
         $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($output) {
             $output->writeln('<info>Updated database</info>');
         });
         $updater->listen('\\OC\\Updater', 'filecacheStart', function () use($output) {
             $output->writeln('<info>Updating filecache, this may take really long...</info>');
         });
         $updater->listen('\\OC\\Updater', 'filecacheDone', function () use($output) {
             $output->writeln('<info>Updated filecache</info>');
         });
         $updater->listen('\\OC\\Updater', 'filecacheProgress', function ($out) use($output) {
             $output->writeln('... ' . $out . '% done ...');
         });
         $updater->listen('\\OC\\Updater', 'failure', function ($message) use($output) {
             $output->writeln($message);
             \OC_Config::setValue('maintenance', false);
         });
         $updater->upgrade();
         $this->postUpgradeCheck($input, $output);
         return self::ERROR_SUCCESS;
     } else {
         if (\OC_Config::getValue('maintenance', false)) {
             //Possible scenario: ownCloud core is updated but an app failed
             $output->writeln('<warning>ownCloud is in maintenance mode</warning>');
             $output->write('<comment>Maybe an upgrade is already in process. Please check the ' . 'logfile (data/owncloud.log). If you want to re-run the ' . 'upgrade procedure, remove the "maintenance mode" from ' . 'config.php and call this script again.</comment>', true);
             return self::ERROR_MAINTENANCE_MODE;
         } else {
             $output->writeln('<info>ownCloud is already latest version</info>');
             return self::ERROR_UP_TO_DATE;
         }
     }
 }
开发者ID:hjimmy,项目名称:owncloud,代码行数:57,代码来源:upgrade.php

示例5: set_time_limit

 *
 * This program 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, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */
set_time_limit(0);
require_once '../../lib/base.php';

\OCP\JSON::callCheck();

if (OC::checkUpgrade(false)) {
	// if a user is currently logged in, their session must be ignored to
	// avoid side effects
	\OC_User::setIncognitoMode(true);

	$l = new \OC_L10N('core');
	$eventSource = \OC::$server->createEventSource();
	$logger = \OC::$server->getLogger();
	$updater = new \OC\Updater(
			\OC::$server->getHTTPHelper(),
			\OC::$server->getConfig(),
			$logger
	);
	$incompatibleApps = [];
	$disabledThirdPartyApps = [];
开发者ID:ninjasilicon,项目名称:core,代码行数:30,代码来源:update.php

示例6: execute

 /**
  * Execute the upgrade command
  *
  * @param InputInterface $input input interface
  * @param OutputInterface $output output interface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $simulateStepEnabled = true;
     $updateStepEnabled = true;
     $skip3rdPartyAppsDisable = false;
     if ($input->getOption('skip-migration-test')) {
         $simulateStepEnabled = false;
     }
     if ($input->getOption('dry-run')) {
         $updateStepEnabled = false;
     }
     if ($input->getOption('no-app-disable')) {
         $skip3rdPartyAppsDisable = true;
     }
     if (!$simulateStepEnabled && !$updateStepEnabled) {
         $output->writeln('<error>Only one of "--skip-migration-test" or "--dry-run" ' . 'can be specified at a time.</error>');
         return self::ERROR_INVALID_ARGUMENTS;
     }
     if (\OC::checkUpgrade(false)) {
         if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
             // Prepend each line with a little timestamp
             $timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter());
             $output->setFormatter($timestampFormatter);
         }
         $self = $this;
         $updater = new Updater($this->config, \OC::$server->getIntegrityCodeChecker(), $this->logger);
         $updater->setSimulateStepEnabled($simulateStepEnabled);
         $updater->setUpdateStepEnabled($updateStepEnabled);
         $updater->setSkip3rdPartyAppsDisable($skip3rdPartyAppsDisable);
         $dispatcher = \OC::$server->getEventDispatcher();
         $progress = new ProgressBar($output);
         $progress->setFormat(" %message%\n %current%/%max% [%bar%] %percent:3s%%");
         $listener = function ($event) use($progress, $output) {
             if ($event instanceof GenericEvent) {
                 $message = $event->getSubject();
                 if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
                     $output->writeln(' Checking table ' . $message);
                 } else {
                     if (strlen($message) > 60) {
                         $message = substr($message, 0, 57) . '...';
                     }
                     $progress->setMessage($message);
                     if ($event[0] === 1) {
                         $output->writeln('');
                         $progress->start($event[1]);
                     }
                     $progress->setProgress($event[0]);
                     if ($event[0] === $event[1]) {
                         $progress->setMessage('Done');
                         $progress->finish();
                         $output->writeln('');
                     }
                 }
             }
         };
         $repairListener = function ($event) use($progress, $output) {
             if (!$event instanceof GenericEvent) {
                 return;
             }
             switch ($event->getSubject()) {
                 case '\\OC\\Repair::startProgress':
                     $progress->setMessage('Starting ...');
                     $output->writeln($event->getArgument(1));
                     $output->writeln('');
                     $progress->start($event->getArgument(0));
                     break;
                 case '\\OC\\Repair::advance':
                     $desc = $event->getArgument(1);
                     if (!empty($desc)) {
                         $progress->setMessage($desc);
                     }
                     $progress->advance($event->getArgument(0));
                     break;
                 case '\\OC\\Repair::finishProgress':
                     $progress->setMessage('Done');
                     $progress->finish();
                     $output->writeln('');
                     break;
                 case '\\OC\\Repair::step':
                     if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
                         $output->writeln('<info>Repair step: ' . $event->getArgument(0) . '</info>');
                     }
                     break;
                 case '\\OC\\Repair::info':
                     if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
                         $output->writeln('<info>Repair info: ' . $event->getArgument(0) . '</info>');
                     }
                     break;
                 case '\\OC\\Repair::warning':
                     $output->writeln('<error>Repair warning: ' . $event->getArgument(0) . '</error>');
                     break;
                 case '\\OC\\Repair::error':
                     $output->writeln('<error>Repair error: ' . $event->getArgument(0) . '</error>');
                     break;
//.........这里部分代码省略.........
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:101,代码来源:Upgrade.php

示例7: execute

 /**
  * Execute the upgrade command
  *
  * @param InputInterface $input input interface
  * @param OutputInterface $output output interface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $simulateStepEnabled = true;
     $updateStepEnabled = true;
     $skip3rdPartyAppsDisable = false;
     if ($this->config->getSystemValue('update.skip-migration-test', false)) {
         $output->writeln('<info>"skip-migration-test" is activated via config.php</info>');
         $simulateStepEnabled = false;
     }
     if ($input->getOption('skip-migration-test')) {
         $simulateStepEnabled = false;
     }
     if ($input->getOption('dry-run')) {
         $updateStepEnabled = false;
     }
     if ($input->getOption('no-app-disable')) {
         $skip3rdPartyAppsDisable = true;
     }
     if (!$simulateStepEnabled && !$updateStepEnabled) {
         $output->writeln('<error>Only one of "--skip-migration-test" or "--dry-run" ' . 'can be specified at a time.</error>');
         return self::ERROR_INVALID_ARGUMENTS;
     }
     if (\OC::checkUpgrade(false)) {
         if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
             // Prepend each line with a little timestamp
             $timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter());
             $output->setFormatter($timestampFormatter);
         }
         $self = $this;
         $updater = new Updater(\OC::$server->getHTTPHelper(), $this->config, \OC::$server->getIntegrityCodeChecker(), $this->logger);
         $updater->setSimulateStepEnabled($simulateStepEnabled);
         $updater->setUpdateStepEnabled($updateStepEnabled);
         $updater->setSkip3rdPartyAppsDisable($skip3rdPartyAppsDisable);
         $updater->listen('\\OC\\Updater', 'maintenanceEnabled', function () use($output) {
             $output->writeln('<info>Turned on maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'maintenanceDisabled', function () use($output) {
             $output->writeln('<info>Turned off maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'maintenanceActive', function () use($output) {
             $output->writeln('<info>Maintenance mode is kept active</info>');
         });
         $updater->listen('\\OC\\Updater', 'updateEnd', function ($success) use($output, $updateStepEnabled, $self) {
             $mode = $updateStepEnabled ? 'Update' : 'Update simulation';
             if ($success) {
                 $message = "<info>{$mode} successful</info>";
             } else {
                 $message = "<error>{$mode} failed</error>";
             }
             $output->writeln($message);
         });
         $updater->listen('\\OC\\Updater', 'dbUpgradeBefore', function () use($output) {
             $output->writeln('<info>Updating database schema</info>');
         });
         $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($output) {
             $output->writeln('<info>Updated database</info>');
         });
         $updater->listen('\\OC\\Updater', 'dbSimulateUpgradeBefore', function () use($output) {
             $output->writeln('<info>Checking whether the database schema can be updated (this can take a long time depending on the database size)</info>');
         });
         $updater->listen('\\OC\\Updater', 'dbSimulateUpgrade', function () use($output) {
             $output->writeln('<info>Checked database schema update</info>');
         });
         $updater->listen('\\OC\\Updater', 'incompatibleAppDisabled', function ($app) use($output) {
             $output->writeln('<info>Disabled incompatible app: ' . $app . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'thirdPartyAppDisabled', function ($app) use($output) {
             $output->writeln('<info>Disabled 3rd-party app: ' . $app . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'upgradeAppStoreApp', function ($app) use($output) {
             $output->writeln('<info>Update 3rd-party app: ' . $app . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'repairWarning', function ($app) use($output) {
             $output->writeln('<error>Repair warning: ' . $app . '</error>');
         });
         $updater->listen('\\OC\\Updater', 'repairError', function ($app) use($output) {
             $output->writeln('<error>Repair error: ' . $app . '</error>');
         });
         $updater->listen('\\OC\\Updater', 'appUpgradeCheckBefore', function () use($output) {
             $output->writeln('<info>Checking updates of apps</info>');
         });
         $updater->listen('\\OC\\Updater', 'appSimulateUpdate', function ($app) use($output) {
             $output->writeln("<info>Checking whether the database schema for <{$app}> can be updated (this can take a long time depending on the database size)</info>");
         });
         $updater->listen('\\OC\\Updater', 'appUpgradeCheck', function () use($output) {
             $output->writeln('<info>Checked database schema update for apps</info>');
         });
         $updater->listen('\\OC\\Updater', 'appUpgradeStarted', function ($app, $version) use($output) {
             $output->writeln("<info>Updating <{$app}> ...</info>");
         });
         $updater->listen('\\OC\\Updater', 'appUpgrade', function ($app, $version) use($output) {
             $output->writeln("<info>Updated <{$app}> to {$version}</info>");
         });
         $updater->listen('\\OC\\Updater', 'failure', function ($message) use($output, $self) {
//.........这里部分代码省略.........
开发者ID:darioajr,项目名称:core,代码行数:101,代码来源:upgrade.php

示例8: execute

 /**
  * Execute the upgrade command
  *
  * @param InputInterface $input input interface
  * @param OutputInterface $output output interface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $simulateStepEnabled = true;
     $updateStepEnabled = true;
     $skip3rdPartyAppsDisable = false;
     if ($input->getOption('skip-migration-test')) {
         $simulateStepEnabled = false;
     }
     if ($input->getOption('dry-run')) {
         $updateStepEnabled = false;
     }
     if ($input->getOption('no-app-disable')) {
         $skip3rdPartyAppsDisable = true;
     }
     if (!$simulateStepEnabled && !$updateStepEnabled) {
         $output->writeln('<error>Only one of "--skip-migration-test" or "--dry-run" ' . 'can be specified at a time.</error>');
         return self::ERROR_INVALID_ARGUMENTS;
     }
     if (\OC::checkUpgrade(false)) {
         $self = $this;
         $updater = new Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig());
         $updater->setSimulateStepEnabled($simulateStepEnabled);
         $updater->setUpdateStepEnabled($updateStepEnabled);
         $updater->setSkip3rdPartyAppsDisable($skip3rdPartyAppsDisable);
         $updater->listen('\\OC\\Updater', 'maintenanceEnabled', function () use($output) {
             $output->writeln('<info>Turned on maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'maintenanceDisabled', function () use($output) {
             $output->writeln('<info>Turned off maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'maintenanceActive', function () use($output) {
             $output->writeln('<info>Maintenance mode is kept active</info>');
         });
         $updater->listen('\\OC\\Updater', 'updateEnd', function ($success) use($output, $updateStepEnabled, $self) {
             $mode = $updateStepEnabled ? 'Update' : 'Update simulation';
             $status = $success ? 'successful' : 'failed';
             $type = $success ? 'info' : 'error';
             $message = "<{$type}>{$mode} {$status}</{$type}>";
             $output->writeln($message);
         });
         $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($output) {
             $output->writeln('<info>Updated database</info>');
         });
         $updater->listen('\\OC\\Updater', 'dbSimulateUpgrade', function () use($output) {
             $output->writeln('<info>Checked database schema update</info>');
         });
         $updater->listen('\\OC\\Updater', 'incompatibleAppDisabled', function ($app) use($output) {
             $output->writeln('<info>Disabled incompatible app: ' . $app . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'thirdPartyAppDisabled', function ($app) use($output) {
             $output->writeln('<info>Disabled 3rd-party app: ' . $app . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'upgradeAppStoreApp', function ($app) use($output) {
             $output->writeln('<info>Update 3rd-party app: ' . $app . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'repairWarning', function ($app) use($output) {
             $output->writeln('<error>Repair warning: ' . $app . '</error>');
         });
         $updater->listen('\\OC\\Updater', 'repairError', function ($app) use($output) {
             $output->writeln('<error>Repair error: ' . $app . '</error>');
         });
         $updater->listen('\\OC\\Updater', 'appUpgradeCheck', function () use($output) {
             $output->writeln('<info>Checked database schema update for apps</info>');
         });
         $updater->listen('\\OC\\Updater', 'appUpgradeStarted', function ($app, $version) use($output) {
             $output->writeln("<info>Updating <{$app}> ...</info>");
         });
         $updater->listen('\\OC\\Updater', 'appUpgrade', function ($app, $version) use($output) {
             $output->writeln("<info>Updated <{$app}> to {$version}</info>");
         });
         $updater->listen('\\OC\\Updater', 'failure', function ($message) use($output, $self) {
             $output->writeln("<error>{$message}</error>");
         });
         $success = $updater->upgrade();
         $this->postUpgradeCheck($input, $output);
         if (!$success) {
             return self::ERROR_FAILURE;
         }
         return self::ERROR_SUCCESS;
     } else {
         if ($this->config->getSystemValue('maintenance', false)) {
             //Possible scenario: ownCloud core is updated but an app failed
             $output->writeln('<warning>ownCloud is in maintenance mode</warning>');
             $output->write('<comment>Maybe an upgrade is already in process. Please check the ' . 'logfile (data/owncloud.log). If you want to re-run the ' . 'upgrade procedure, remove the "maintenance mode" from ' . 'config.php and call this script again.</comment>', true);
             return self::ERROR_MAINTENANCE_MODE;
         } else {
             $output->writeln('<info>ownCloud is already latest version</info>');
             return self::ERROR_UP_TO_DATE;
         }
     }
 }
开发者ID:alfrescoo,项目名称:core,代码行数:97,代码来源:upgrade.php

示例9: execute

 /**
  * Execute the upgrade command
  *
  * @param InputInterface $input input interface
  * @param OutputInterface $output output interface
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     require_once \OC::$SERVERROOT . '/lib/base.php';
     // Don't do anything if ownCloud has not been installed
     if (!\OC_Config::getValue('installed', false)) {
         $output->writeln('<error>ownCloud has not yet been installed</error>');
         return self::ERROR_NOT_INSTALLED;
     }
     $simulateStepEnabled = true;
     $updateStepEnabled = true;
     if ($input->getOption('skip-migration-test')) {
         $simulateStepEnabled = false;
     }
     if ($input->getOption('dry-run')) {
         $updateStepEnabled = false;
     }
     if (!$simulateStepEnabled && !$updateStepEnabled) {
         $output->writeln('<error>Only one of "--skip-migration-test" or "--dry-run" ' . 'can be specified at a time.</error>');
         return self::ERROR_INVALID_ARGUMENTS;
     }
     if (\OC::checkUpgrade(false)) {
         $updater = new Updater();
         $updater->setSimulateStepEnabled($simulateStepEnabled);
         $updater->setUpdateStepEnabled($updateStepEnabled);
         $updater->listen('\\OC\\Updater', 'maintenanceStart', function () use($output) {
             $output->writeln('<info>Turned on maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'maintenanceEnd', function () use($output) {
             $output->writeln('<info>Turned off maintenance mode</info>');
         });
         $updater->listen('\\OC\\Updater', 'updateEnd', function ($success) use($output, $updateStepEnabled, $self) {
             $mode = $updateStepEnabled ? 'Update' : 'Update simulation';
             $status = $success ? 'successful' : 'failed';
             $type = $success ? 'info' : 'error';
             $message = "<{$type}>{$mode} {$status}</{$type}>";
             $output->writeln($message);
         });
         $updater->listen('\\OC\\Updater', 'dbUpgrade', function () use($output) {
             $output->writeln('<info>Updated database</info>');
         });
         $updater->listen('\\OC\\Updater', 'dbSimulateUpgrade', function () use($output) {
             $output->writeln('<info>Checked database schema update</info>');
         });
         $updater->listen('\\OC\\Updater', 'disabledApps', function ($appList) use($output) {
             $output->writeln('<info>Disabled incompatible apps: ' . implode(', ', $appList) . '</info>');
         });
         $updater->listen('\\OC\\Repair', 'info', function ($message) use($output) {
             $output->writeln('<info>Repair info: ' . $message . '</info>');
         });
         $updater->listen('\\OC\\Updater', 'failure', function ($message) use($output) {
             $output->writeln("<error>{$message}</error>");
             \OC_Config::setValue('maintenance', false);
         });
         $updater->listen('\\OC\\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($output) {
             $output->writeln("<info>Set log level to debug - current level: '{$logLevelName}'</info>");
         });
         $updater->listen('\\OC\\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($output) {
             $output->writeln("<info>Reset log level to '{$logLevelName}'</info>");
         });
         $success = $updater->upgrade();
         $this->postUpgradeCheck($input, $output);
         if (!$success) {
             return self::ERROR_FAILURE;
         }
         return self::ERROR_SUCCESS;
     } else {
         if (\OC_Config::getValue('maintenance', false)) {
             //Possible scenario: ownCloud core is updated but an app failed
             $output->writeln('<warning>ownCloud is in maintenance mode</warning>');
             $output->write('<comment>Maybe an upgrade is already in process. Please check the ' . 'logfile (data/owncloud.log). If you want to re-run the ' . 'upgrade procedure, remove the "maintenance mode" from ' . 'config.php and call this script again.</comment>', true);
             return self::ERROR_MAINTENANCE_MODE;
         } else {
             $output->writeln('<info>ownCloud is already latest version</info>');
             return self::ERROR_UP_TO_DATE;
         }
     }
 }
开发者ID:droiter,项目名称:openwrt-on-android,代码行数:83,代码来源:upgrade.php


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