本文整理汇总了PHP中update_helpful_links函数的典型用法代码示例。如果您正苦于以下问题:PHP update_helpful_links函数的具体用法?PHP update_helpful_links怎么用?PHP update_helpful_links使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_helpful_links函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: update_results_page
function update_results_page()
{
drupal_set_title('Drupal database update');
$links = update_helpful_links();
update_task_list();
// Report end result
if (module_exists('dblog')) {
$log_message = ' All errors have been <a href="' . base_path() . '?q=admin/reports/dblog">logged</a>.';
} else {
$log_message = ' All errors have been logged.';
}
if ($_SESSION['update_success']) {
$output = '<p>Updates were attempted. If you see no failures below, you may proceed happily to the <a href="' . base_path() . '?q=admin">administration pages</a>. Otherwise, you may need to update your database manually.' . $log_message . '</p>';
} else {
list($module, $version) = array_pop(reset($_SESSION['updates_remaining']));
$output = '<p class="error">The update process was aborted prematurely while running <strong>update #' . $version . ' in ' . $module . '.module</strong>.' . $log_message;
if (module_exists('dblog')) {
$output .= ' You may need to check the <code>watchdog</code> database table manually.';
}
$output .= '</p>';
}
if (!empty($GLOBALS['update_free_access'])) {
$output .= "<p><strong>Reminder: don't forget to set the <code>\$update_free_access</code> value in your <code>settings.php</code> file back to <code>FALSE</code>.</strong></p>";
}
$output .= theme('item_list', array('items' => $links));
// Output a list of queries executed
if (!empty($_SESSION['update_results'])) {
$output .= '<div id="update-results">';
$output .= '<h2>The following updates returned messages</h2>';
foreach ($_SESSION['update_results'] as $module => $updates) {
$output .= '<h3>' . $module . ' module</h3>';
foreach ($updates as $number => $queries) {
if ($number != '#abort') {
$messages = array();
foreach ($queries as $query) {
// If there is no message for this update, don't show anything.
if (empty($query['query'])) {
continue;
}
if ($query['success']) {
$messages[] = '<li class="success">' . $query['query'] . '</li>';
} else {
$messages[] = '<li class="failure"><strong>Failed:</strong> ' . $query['query'] . '</li>';
}
}
if ($messages) {
$output .= '<h4>Update #' . $number . "</h4>\n";
$output .= '<ul>' . implode("\n", $messages) . "</ul>\n";
}
}
$output .= '</ul>';
}
}
$output .= '</div>';
}
unset($_SESSION['update_results']);
unset($_SESSION['update_success']);
return $output;
}
开发者ID:berkes,项目名称:sympal,代码行数:59,代码来源:update.php
示例2: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, array &$form_state)
{
$count = 0;
$incompatible_count = 0;
$form['start'] = array('#tree' => TRUE, '#type' => 'details');
// 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('#type' => 'item', '#title' => $module . ' module', '#markup' => $update['warning'], '#prefix' => '<div class="messages messages--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 $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('#theme' => 'links', '#links' => update_helpful_links());
// No updates to run, so caches won't get flushed later. Clear them now.
update_flush_all_caches();
} 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['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => 'Apply pending updates', '#button_type' => 'primary');
}
return $form;
}
开发者ID:alnutile,项目名称:drunatra,代码行数:64,代码来源:UpdateScriptSelectionForm.php
示例3: update_results_page
/**
* Displays results of the update script with any accompanying errors.
*/
function update_results_page()
{
// Report end result.
if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
$log_message = ' All errors have been <a href="' . base_path() . '?q=admin/reports/dblog">logged</a>.';
} else {
$log_message = ' All errors have been logged.';
}
if ($_SESSION['update_success']) {
$output = '<p>Updates were attempted. If you see no failures below, you may proceed happily back to your <a href="' . base_path() . '">site</a>. Otherwise, you may need to update your database manually.' . $log_message . '</p>';
} else {
$last = reset($_SESSION['updates_remaining']);
list($module, $version) = array_pop($last);
$output = '<p class="error">The update process was aborted prematurely while running <strong>update #' . $version . ' in ' . $module . '.module</strong>.' . $log_message;
if (\Drupal::moduleHandler()->moduleExists('dblog')) {
$output .= ' You may need to check the <code>watchdog</code> database table manually.';
}
$output .= '</p>';
}
if (Settings::get('update_free_access')) {
$output .= "<p><strong>Reminder: don't forget to set the <code>\$settings['update_free_access']</code> value in your <code>settings.php</code> file back to <code>FALSE</code>.</strong></p>";
}
$links = array('#theme' => 'links', '#links' => update_helpful_links());
$output .= drupal_render($links);
// Output a list of queries executed.
if (!empty($_SESSION['update_results'])) {
$all_messages = '';
foreach ($_SESSION['update_results'] as $module => $updates) {
if ($module != '#abort') {
$module_has_message = FALSE;
$query_messages = '';
foreach ($updates as $number => $queries) {
$messages = array();
foreach ($queries as $query) {
// If there is no message for this update, don't show anything.
if (empty($query['query'])) {
continue;
}
if ($query['success']) {
$messages[] = '<li class="success">' . $query['query'] . '</li>';
} else {
$messages[] = '<li class="failure"><strong>Failed:</strong> ' . $query['query'] . '</li>';
}
}
if ($messages) {
$module_has_message = TRUE;
$query_messages .= '<h4>Update #' . $number . "</h4>\n";
$query_messages .= '<ul>' . implode("\n", $messages) . "</ul>\n";
}
}
// If there were any messages in the queries then prefix them with the
// module name and add it to the global message list.
if ($module_has_message) {
$all_messages .= '<h3>' . $module . " module</h3>\n" . $query_messages;
}
}
}
if ($all_messages) {
$output .= '<div class="update-results"><h2>The following updates returned messages</h2>';
$output .= $all_messages;
$output .= '</div>';
}
}
unset($_SESSION['update_results']);
unset($_SESSION['update_success']);
$build = array('#title' => 'Drupal database update', '#markup' => $output);
return $build;
}
开发者ID:anatalsceo,项目名称:en-classe,代码行数:71,代码来源:update.php
注:本文中的update_helpful_links函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论