本文整理汇总了PHP中update_get_update_list函数的典型用法代码示例。如果您正苦于以下问题:PHP update_get_update_list函数的具体用法?PHP update_get_update_list怎么用?PHP update_get_update_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_get_update_list函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: listUpdates
/**
* @return array
*
* @see update_script_selection_form()
*/
private function listUpdates()
{
// [
// 'oxygen' => [
// 'pending' => [
// 7001 => 'Update description.',
// ],
// 'start' => 7001,
// ],
$list = array();
require_once DRUPAL_ROOT . '/includes/install.inc';
drupal_load_updates();
foreach (update_get_update_list() as $extension => $info) {
if (!isset($info['start'])) {
// @todo: The update is incompatible, show a warning?
continue;
}
$list[$extension] = $info['start'];
}
$updates = array();
foreach (update_resolve_dependencies($list) as $update) {
if (!$update['allowed']) {
if ($update['missing_dependencies']) {
// Some module dependency is missing, so it's not safe to update.
continue;
} else {
// There was a PHP syntax error in the module.
continue;
}
}
$updates = array($update['module'] => $update['number']) + $updates;
}
return $updates;
}
开发者ID:Briareos,项目名称:Oxygen,代码行数:39,代码来源:DatabaseMigrateAction.php
示例2: update_script_selection_form
function update_script_selection_form($form, &$form_state)
{
$count = 0;
$incompatible_count = 0;
$form['start'] = array('#tree' => TRUE, '#type' => 'fieldset', '#collapsed' => TRUE, '#collapsible' => TRUE);
// Ensure system.module's updates appear first.
$form['start']['system'] = array();
$updates = update_get_update_list();
$starting_updates = array();
$incompatible_updates_exist = FALSE;
foreach ($updates as $module => $update) {
if (!isset($update['start'])) {
$form['start'][$module] = array('#title' => $module, '#item' => $update['warning'], '#prefix' => '<div class="warning">', '#suffix' => '</div>');
$incompatible_updates_exist = TRUE;
continue;
}
if (!empty($update['pending'])) {
$starting_updates[$module] = $update['start'];
$form['start'][$module] = array('#type' => 'hidden', '#value' => $update['start']);
$form['start'][$module . '_updates'] = array('#theme' => 'item_list', '#items' => $update['pending'], '#title' => $module . ' module');
}
if (isset($update['pending'])) {
$count = $count + count($update['pending']);
}
}
// Find and label any incompatible updates.
foreach (update_resolve_dependencies($starting_updates) as $function => $data) {
if (!$data['allowed']) {
$incompatible_updates_exist = TRUE;
$incompatible_count++;
$module_update_key = $data['module'] . '_updates';
if (isset($form['start'][$module_update_key]['#items'][$data['number']])) {
$text = $data['missing_dependencies'] ? 'This update will been skipped due to the following missing dependencies: <em>' . implode(', ', $data['missing_dependencies']) . '</em>' : "This update will be skipped due to an error in the module's code.";
$form['start'][$module_update_key]['#items'][$data['number']] .= '<div class="warning">' . $text . '</div>';
}
// Move the module containing this update to the top of the list.
$form['start'] = array($module_update_key => $form['start'][$module_update_key]) + $form['start'];
}
}
// Warn the user if any updates were incompatible.
if ($incompatible_updates_exist) {
drupal_set_message('Some of the pending updates cannot be applied because their dependencies were not met.', 'warning');
}
if (empty($count)) {
drupal_set_message(t('No pending updates.'));
unset($form);
$form['links'] = array('#markup' => theme('item_list', array('items' => update_helpful_links())));
} else {
$form['help'] = array('#markup' => '<p>The version of Drupal you are updating from has been automatically detected.</p>', '#weight' => -5);
if ($incompatible_count) {
$form['start']['#title'] = format_plural($count, '1 pending update (@number_applied to be applied, @number_incompatible skipped)', '@count pending updates (@number_applied to be applied, @number_incompatible skipped)', array('@number_applied' => $count - $incompatible_count, '@number_incompatible' => $incompatible_count));
} else {
$form['start']['#title'] = format_plural($count, '1 pending update', '@count pending updates');
}
$form['has_js'] = array('#type' => 'hidden', '#default_value' => FALSE);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => 'Apply pending updates');
}
return $form;
}
开发者ID:boombatower,项目名称:drupal,代码行数:60,代码来源:update.php
示例3: update_script_selection_form
function update_script_selection_form($form, &$form_state)
{
$count = 0;
$form['start'] = array('#tree' => TRUE, '#type' => 'fieldset', '#collapsed' => TRUE, '#collapsible' => TRUE);
// Ensure system.module's updates appear first
$form['start']['system'] = array();
$updates = update_get_update_list();
foreach ($updates as $module => $update) {
if (!isset($update['start'])) {
$form['start'][$module] = array('#title' => $module, '#item' => $update['warning'], '#prefix' => '<div class="warning">', '#suffix' => '</div>');
continue;
}
if (!empty($update['pending'])) {
$form['start'][$module] = array('#type' => 'hidden', '#value' => $update['start']);
$form['start'][$module . '_updates'] = array('#markup' => theme('item_list', array('items' => $update['pending'], 'title' => $module . ' module')));
}
if (isset($update['pending'])) {
$count = $count + count($update['pending']);
}
}
if (empty($count)) {
drupal_set_message(t('No pending updates.'));
unset($form);
$form['links'] = array('#markup' => theme('item_list', array('items' => update_helpful_links())));
} else {
$form['help'] = array('#markup' => '<p>The version of Drupal you are updating from has been automatically detected.</p>', '#weight' => -5);
$form['start']['#title'] = format_plural($count, '1 pending update', '@count pending updates');
$form['has_js'] = array('#type' => 'hidden', '#default_value' => FALSE);
$form['submit'] = array('#type' => 'submit', '#value' => 'Apply pending updates');
}
return $form;
}
开发者ID:berkes,项目名称:sympal,代码行数:32,代码来源:update.php
示例4: getLastUpdate
protected function getLastUpdate($module)
{
$this->getDrupalHelper()->loadLegacyFile('/core/includes/update.inc');
$this->getDrupalHelper()->loadLegacyFile('/core/includes/schema.inc');
$updates = update_get_update_list();
if (empty($updates[$module]['pending'])) {
$lastUpdateSchema = drupal_get_schema_versions($module);
} else {
$lastUpdateSchema = reset(array_keys($updates[$module]['pending'], max($updates[$module]['pending'])));
}
return $lastUpdateSchema;
}
开发者ID:mnico,项目名称:DrupalConsole,代码行数:12,代码来源:PostUpdateCommand.php
示例5: 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']);
}
开发者ID:blasoliva,项目名称:DrupalConsole,代码行数:52,代码来源:ExecuteCommand.php
示例6: 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']);
}
开发者ID:xsw3ws,项目名称:DrupalConsole,代码行数:52,代码来源:UpdateExecuteCommand.php
示例7: 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);
}
开发者ID:killua99,项目名称:DrupalConsole,代码行数:49,代码来源:DebugCommand.php
示例8: getSchemaUpdates
/**
* Returns available database schema updates once a new version is installed.
*
* @return array
*/
public function getSchemaUpdates()
{
require_once DRUPAL_ROOT . '/core/includes/install.inc';
require_once DRUPAL_ROOT . '/core/includes/update.inc';
if (!self::canUpdate($this->name)) {
return array();
}
module_load_include('install', $this->name);
if (!($updates = drupal_get_schema_versions($this->name))) {
return array();
}
$modules_with_updates = update_get_update_list();
if ($updates = $modules_with_updates[$this->name]) {
if ($updates['start']) {
return $updates['pending'];
}
}
return array();
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:24,代码来源:Module.php
示例9: 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);
}
}
开发者ID:mnico,项目名称:DrupalConsole,代码行数:24,代码来源:DebugCommand.php
示例10: 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->module = $input->getArgument('module');
$this->update_n = $input->getArgument('update-n');
$this->get('site')->loadLegacyFile('/core/includes/install.inc');
$this->get('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'));
$state = $this->getDrupalService('state');
$state->set('system.maintenance_mode', true);
$this->runUpdates($io, $updates);
$this->runPostUpdates($io);
$state->set('system.maintenance_mode', false);
$io->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
$this->get('chain_queue')->addCommand('cache:rebuild', ['cache' => 'all']);
}
开发者ID:mnico,项目名称:DrupalConsole,代码行数:24,代码来源:ExecuteCommand.php
示例11: 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);
}
开发者ID:xsw3ws,项目名称:DrupalConsole,代码行数:37,代码来源:UpdateDebugCommand.php
示例12: getModuleUpdates
/**
* Retrieves module updates.
*
* @return array
* The module updates that can be performed.
*/
protected function getModuleUpdates()
{
$return = array();
$updates = update_get_update_list();
foreach ($updates as $module => $update) {
$return[$module] = $update['start'];
}
return $return;
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:15,代码来源:DbUpdateController.php
注:本文中的update_get_update_list函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论