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); }
/** * @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); } }
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); }
/** * 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); }
require_once DRUPAL_ROOT . '/includes/install.inc'; require_once DRUPAL_ROOT . '/includes/file.inc'; require_once DRUPAL_ROOT . '/modules/system/system.install'; // Load module basics. include_once DRUPAL_ROOT . '/includes/module.inc'; $module_list['system']['filename'] = 'modules/system/system.module'; $module_list['filter']['filename'] = 'modules/filter/filter.module'; module_list(TRUE, FALSE, $module_list); drupal_load('module', 'system'); drupal_load('module', 'filter'); // Set up $language, since the installer components require it. drupal_init_language(); // Set up theme system for the maintenance page. drupal_maintenance_theme(); // Check the update requirements for Drupal. 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();
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_compatibility(); // Check the update requirements for all modules. If there are warnings, but // no errors, skip reporting them if the user has provided a URL parameter // acknowledging the warnings and indicating a desire to continue anyway. See // drupal_requirements_url(). $skip_warnings = !empty($_GET['continue']); update_check_requirements($skip_warnings); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; switch ($op) { // update.php ops. case 'selection': if (isset($_GET['token']) && drupal_valid_token($_GET['token'], 'update')) { $output = update_selection_page(); break; } case 'Apply pending updates': if (isset($_GET['token']) && drupal_valid_token($_GET['token'], 'update')) { // Generate absolute URLs for the batch processing (using $base_root), // since the batch API will pass them to url() which does not handle // update.php correctly by default. $batch_url = $base_root . drupal_current_script_url(); $redirect_url = $base_root . drupal_current_script_url(array('op' => 'results'));
require_once DRUPAL_ROOT . '/includes/install.inc'; require_once DRUPAL_ROOT . '/includes/file.inc'; require_once DRUPAL_ROOT . '/modules/system/system.install'; // Load module basics. include_once DRUPAL_ROOT . '/includes/module.inc'; $module_list['system']['filename'] = 'modules/system/system.module'; $module_list['filter']['filename'] = 'modules/filter/filter.module'; module_list(TRUE, FALSE, $module_list); drupal_load('module', 'system'); drupal_load('module', 'filter'); // Set up $language, since the installer components require it. drupal_init_language(); // Set up theme system for the maintenance page. drupal_maintenance_theme(); // Check the update requirements for Drupal. $warnings = update_check_requirements(); // Display the warning messages (if any) in a dedicated maintenance page, // or redirect to the update information page if no message. if ($warnings) { drupal_maintenance_theme(); print theme('update_page', '<form method="post" action="update.php?op=info"><input type="submit" value="Continue" /></form>', FALSE); exit; } // Write D7 settings file. update_check_d7_settings(); install_goto('update.php?op=info'); } update_prepare_d7_bootstrap(); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_maintenance_theme(); // Turn error reporting back on. From now on, only fatal errors (which are