本文整理汇总了PHP中update_fix_compatibility函数的典型用法代码示例。如果您正苦于以下问题:PHP update_fix_compatibility函数的具体用法?PHP update_fix_compatibility怎么用?PHP update_fix_compatibility使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_fix_compatibility函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
/* drupal_set_installed_schema_version('sample', '8000');
exit();*/
include_once DRUPAL_ROOT . '/core/includes/install.inc';
include_once DRUPAL_ROOT . '/core/includes/update.inc';
$module = $input->getArgument('module');
$update_n = $input->getArgument('update-n');
$module_handler = $this->getModuleHandler();
drupal_load_updates();
update_fix_compatibility();
$updates = update_get_update_list();
if ($module != 'all') {
if (!isset($updates[$module])) {
$output->writeln('[-] <error>' . sprintf($this->trans('commands.update.execute.messages.no-module-updates'), $module) . '</error>');
return;
} else {
// filter to execute only a specific module updates
$updates = [$module => $updates[$module]];
if ($update_n && !isset($updates[$module]['pending'][$update_n])) {
$output->writeln('[-] <info>' . sprintf($this->trans('commands.update.execute.messages.module-update-function-not-found'), $module, $update_n) . '</info>');
}
}
}
$output->writeln('[-] <info>' . $this->trans('commands.site.maintenance.description') . '</info>');
\Drupal::state()->set('system.maintenance_mode', true);
foreach ($updates as $module_name => $module_updates) {
foreach ($module_updates['pending'] as $update_number => $update) {
if ($module != 'all' && $update_n != null and $update_n != $update_number) {
continue;
}
//Executing all pending updates
if ($update_n > $module_updates['start']) {
$output->writeln('[-] <info>' . $this->trans('commands.update.execute.messages.executing-required-previous-updates') . '</info>');
}
for ($update_index = $module_updates['start']; $update_index <= $update_number; $update_index++) {
$output->writeln('[-] <info>' . sprintf($this->trans('commands.update.execute.messages.executing-update'), $update_index, $module_name) . '</info>');
try {
$module_handler->invoke($module_name, 'update_' . $update_index);
} catch (\Exception $e) {
watchdog_exception('update', $e);
$output->writeln('<error>' . $e->getMessage() . '</error>');
}
//Update module schema version
drupal_set_installed_schema_version($module_name, $update_index);
}
}
}
\Drupal::state()->set('system.maintenance_mode', false);
$output->writeln('[-] <info>' . $this->trans('commands.site.maintenance.messages.maintenance-off') . '</info>');
$this->getHelper('chain')->addCommand('cache:rebuild', ['cache' => 'all']);
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$this->getDrupalHelper()->loadLegacyFile('/core/includes/install.inc');
$this->getDrupalHelper()->loadLegacyFile('/core/includes/update.inc');
$module = $input->getArgument('module');
$update_n = $input->getArgument('update-n');
$module_handler = $this->getModuleHandler();
drupal_load_updates();
update_fix_compatibility();
$updates = update_get_update_list();
if ($module != 'all') {
if (!isset($updates[$module])) {
$io->error(sprintf($this->trans('commands.update.execute.messages.no-module-updates'), $module));
return;
} else {
// filter to execute only a specific module updates
$updates = [$module => $updates[$module]];
if ($update_n && !isset($updates[$module]['pending'][$update_n])) {
$io->info(sprintf($this->trans('commands.update.execute.messages.module-update-function-not-found'), $module, $update_n));
}
}
}
$io->info($this->trans('commands.site.maintenance.description'));
$state = $this->getService('state');
$state->set('system.maintenance_mode', true);
foreach ($updates as $module_name => $module_updates) {
foreach ($module_updates['pending'] as $update_number => $update) {
if ($module != 'all' && $update_n !== null && $update_n != $update_number) {
continue;
}
//Executing all pending updates
if ($update_n > $module_updates['start']) {
$io->info($this->trans('commands.update.execute.messages.executing-required-previous-updates'));
}
for ($update_index = $module_updates['start']; $update_index <= $update_number; $update_index++) {
$io->info(sprintf($this->trans('commands.update.execute.messages.executing-update'), $update_index, $module_name));
try {
$module_handler->invoke($module_name, 'update_' . $update_index);
} catch (\Exception $e) {
watchdog_exception('update', $e);
$io->error($e->getMessage());
}
//Update module schema version
drupal_set_installed_schema_version($module_name, $update_index);
}
}
}
$state->set('system.maintenance_mode', false);
$io->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
$this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$this->get('site')->loadLegacyFile('/core/includes/update.inc');
$this->get('site')->loadLegacyFile('/core/includes/install.inc');
$updateRegistry = $this->getDrupalService('update.post_update_registry');
drupal_load_updates();
update_fix_compatibility();
$updates = update_get_update_list();
$postUpdates = $updateRegistry->getPendingUpdateInformation();
$requirements = update_check_requirements();
$severity = drupal_requirements_severity($requirements);
$io->newLine();
if ($severity == REQUIREMENT_ERROR || $severity == REQUIREMENT_WARNING) {
$io->info($this->trans('commands.update.debug.messages.requirements-error'));
$tableHeader = [$this->trans('commands.update.debug.messages.severity'), $this->trans('commands.update.debug.messages.title'), $this->trans('commands.update.debug.messages.value'), $this->trans('commands.update.debug.messages.description')];
$tableRows = [];
foreach ($requirements as $requirement) {
if (isset($requirement['minimum schema']) & in_array($requirement['minimum schema'], array(REQUIREMENT_ERROR, REQUIREMENT_WARNING))) {
$tableRows[] = [$requirement['severity'], $requirement['title'], $requirement['value'], $requirement['description']];
}
}
$io->table($tableHeader, $tableRows);
return;
}
if (empty($updates)) {
$io->info($this->trans('commands.update.debug.messages.no-updates'));
return;
}
$tableHeader = [$this->trans('commands.update.debug.messages.module'), $this->trans('commands.update.debug.messages.update-n'), $this->trans('commands.update.debug.messages.description')];
$io->info($this->trans('commands.update.debug.messages.module-list'));
$tableRows = [];
foreach ($updates as $module => $module_updates) {
foreach ($module_updates['pending'] as $update_n => $update) {
list(, $description) = explode($update_n . " - ", $update);
$tableRows[] = [$module, $update_n, trim($description)];
}
}
$io->table($tableHeader, $tableRows);
$tableHeader = [$this->trans('commands.update.debug.messages.module'), $this->trans('commands.update.debug.messages.post-update'), $this->trans('commands.update.debug.messages.description')];
$io->info($this->trans('commands.update.debug.messages.module-list-post-update'));
$tableRows = [];
foreach ($postUpdates as $module => $module_updates) {
foreach ($module_updates['pending'] as $postUpdateFunction => $message) {
$tableRows[] = [$module, $postUpdateFunction, $message];
}
}
$io->table($tableHeader, $tableRows);
}
示例4: execute
/**
* @inheritdoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$this->module = $input->getArgument('module');
$this->update_n = $input->getArgument('update-n');
$this->site->loadLegacyFile('/core/includes/install.inc');
$this->site->loadLegacyFile('/core/includes/update.inc');
drupal_load_updates();
update_fix_compatibility();
$updates = update_get_update_list();
$this->checkUpdates($io);
$io->info($this->trans('commands.site.maintenance.description'));
$this->state->set('system.maintenance_mode', true);
$this->runUpdates($io, $updates);
$this->runPostUpdates($io);
$this->state->set('system.maintenance_mode', false);
$io->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
}
示例5: execute
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$this->get('site')->loadLegacyFile('/core/includes/update.inc');
$this->get('site')->loadLegacyFile('/core/includes/install.inc');
drupal_load_updates();
update_fix_compatibility();
$requirements = update_check_requirements();
$severity = drupal_requirements_severity($requirements);
$updates = update_get_update_list();
$io->newLine();
if ($severity == REQUIREMENT_ERROR || $severity == REQUIREMENT_WARNING) {
$this->populateRequirements($io, $requirements);
} elseif (empty($updates)) {
$io->info($this->trans('commands.update.debug.messages.no-updates'));
} else {
$this->populateUpdate($io, $updates);
$this->populatePostUpdate($io);
}
}
示例6: testFixCompatibility
function testFixCompatibility()
{
$extension_config = \Drupal::configFactory()->getEditable('core.extension');
// Add an incompatible/non-existent module to the config.
$modules = $extension_config->get('module');
$modules['incompatible_module'] = 0;
$extension_config->set('module', $modules);
$modules = $extension_config->get('module');
$this->assertTrue(in_array('incompatible_module', array_keys($modules)), 'Added incompatible/non-existent module to the config.');
// Add an incompatible/non-existent theme to the config.
$themes = $extension_config->get('theme');
$themes['incompatible_theme'] = 0;
$extension_config->set('theme', $themes);
$themes = $extension_config->get('theme');
$this->assertTrue(in_array('incompatible_theme', array_keys($themes)), 'Added incompatible/non-existent theme to the config.');
// Fix compatibility.
update_fix_compatibility();
$modules = $extension_config->get('module');
$this->assertFalse(in_array('incompatible_module', array_keys($modules)), 'Fixed modules compatibility.');
$themes = $extension_config->get('theme');
$this->assertFalse(in_array('incompatible_theme', array_keys($themes)), 'Fixed themes compatibility.');
}
示例7: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$table = $this->getHelperSet()->get('table');
$table->setlayout($table::LAYOUT_COMPACT);
include_once DRUPAL_ROOT . '/core/includes/update.inc';
include_once DRUPAL_ROOT . '/core/includes/install.inc';
$module_handler = $this->getModuleHandler();
drupal_load_updates();
update_fix_compatibility();
$updates = update_get_update_list();
$requirements = update_check_requirements();
$severity = drupal_requirements_severity($requirements);
if ($severity == REQUIREMENT_ERROR || $severity == REQUIREMENT_WARNING) {
$output->writeln('[-] <info>' . $this->trans('commands.update.debug.messages.requirements-error') . '</info>');
$table->setHeaders([$this->trans('commands.update.debug.messages.severity'), $this->trans('commands.update.debug.messages.title'), $this->trans('commands.update.debug.messages.value'), $this->trans('commands.update.debug.messages.description')]);
foreach ($requirements as $requirement) {
if (isset($requirement['minimum schema']) & in_array($requirement['minimum schema'], array(REQUIREMENT_ERROR, REQUIREMENT_WARNING))) {
$table->addRow([$requirement['severity'], $requirement['title'], $requirement['value'], $requirement['description']]);
}
}
$table->render($output);
return;
}
if (empty($updates)) {
$output->writeln('[-] <info>' . $this->trans('commands.update.debug.messages.no-updates') . '</info>');
return;
}
$table->setHeaders([$this->trans('commands.update.debug.messages.module'), $this->trans('commands.update.debug.messages.update-n'), $this->trans('commands.update.debug.messages.description')]);
$output->writeln('<info>' . $this->trans('commands.update.debug.messages.module-list') . '</info>');
foreach ($updates as $module => $module_updates) {
foreach ($module_updates['pending'] as $update_n => $update) {
list(, $description) = split($update_n . " - ", $update);
$table->addRow([$module, $update_n, trim($description)]);
}
}
$table->render($output);
}
示例8: handle
/**
* Returns a database update page.
*
* @param string $op
* The update operation to perform. Can be any of the below:
* - info
* - selection
* - run
* - results
* @param \Symfony\Component\HttpFoundation\Request $request
* The current request object.
*
* @return \Symfony\Component\HttpFoundation\Response
* A response object object.
*/
public function handle($op, Request $request)
{
require_once $this->root . '/core/includes/install.inc';
require_once $this->root . '/core/includes/update.inc';
drupal_load_updates();
update_fix_compatibility();
if ($request->query->get('continue')) {
$_SESSION['update_ignore_warnings'] = TRUE;
}
$regions = array();
$requirements = update_check_requirements();
$severity = drupal_requirements_severity($requirements);
if ($severity == REQUIREMENT_ERROR || $severity == REQUIREMENT_WARNING && empty($_SESSION['update_ignore_warnings'])) {
$regions['sidebar_first'] = $this->updateTasksList('requirements');
$output = $this->requirements($severity, $requirements, $request);
} else {
switch ($op) {
case 'selection':
$regions['sidebar_first'] = $this->updateTasksList('selection');
$output = $this->selection($request);
break;
case 'run':
$regions['sidebar_first'] = $this->updateTasksList('run');
$output = $this->triggerBatch($request);
break;
case 'info':
$regions['sidebar_first'] = $this->updateTasksList('info');
$output = $this->info($request);
break;
case 'results':
$regions['sidebar_first'] = $this->updateTasksList('results');
$output = $this->results($request);
break;
// Regular batch ops : defer to batch processing API.
// Regular batch ops : defer to batch processing API.
default:
require_once $this->root . '/core/includes/batch.inc';
$regions['sidebar_first'] = $this->updateTasksList('run');
$output = _batch_page($request);
break;
}
}
if ($output instanceof Response) {
return $output;
}
$title = isset($output['#title']) ? $output['#title'] : $this->t('Drupal database update');
return $this->bareHtmlPageRenderer->renderBarePage($output, $title, 'maintenance_page', $regions);
}
示例9: update_check_requirements
update_check_requirements();
// Redirect to the update information page if all requirements were met.
install_goto('update.php?op=info');
}
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_maintenance_theme();
// Turn error reporting back on. From now on, only fatal errors (which are
// not passed through the error handler) will cause a message to be printed.
ini_set('display_errors', TRUE);
// Only proceed with updates if the user is allowed to run them.
if ($update_access_allowed) {
include_once DRUPAL_ROOT . '/includes/install.inc';
include_once DRUPAL_ROOT . '/includes/batch.inc';
drupal_load_updates();
update_fix_d7_requirements();
update_fix_compatibility();
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
switch ($op) {
// update.php ops
case 'selection':
if (isset($_GET['token']) && $_GET['token'] == drupal_get_token('update')) {
$output = update_selection_page();
break;
}
case 'Apply pending updates':
if (isset($_GET['token']) && $_GET['token'] == drupal_get_token('update')) {
update_batch();
break;
}
case 'info':
$output = update_info_page();