source: sipes/cord/update.php @ 669aaf1

stableversion-3.0
Last change on this file since 669aaf1 was d7a822e, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio del cord

  • Propiedad mode establecida a 100755
File size: 25.7 KB
Línea 
1<?php
2
3/**
4 * @file
5 * Administrative page for handling updates from one Drupal version to another.
6 *
7 * Point your browser to "http://www.example.com/update.php" and follow the
8 * instructions.
9 *
10 * If you are not logged in as administrator, you will need to modify the access
11 * check statement inside your settings.php file. After finishing the upgrade,
12 * be sure to open settings.php again, and change it back to its original state!
13 */
14
15/**
16 * Global flag to identify update.php run, and so avoid various unwanted
17 * operations, such as hook_init() and hook_exit() invokes, css/js preprocessing
18 * and translation, and solve some theming issues. This flag is checked on several
19 * places in Drupal code (not just update.php).
20 */
21define('MAINTENANCE_MODE', 'update');
22
23/**
24 * Add a column to a database using syntax appropriate for PostgreSQL.
25 * Save result of SQL commands in $ret array.
26 *
27 * Note: when you add a column with NOT NULL and you are not sure if there are
28 * already rows in the table, you MUST also add DEFAULT. Otherwise PostgreSQL
29 * won't work when the table is not empty, and db_add_column() will fail.
30 * To have an empty string as the default, you must use: 'default' => "''"
31 * in the $attributes array. If NOT NULL and DEFAULT are set the PostgreSQL
32 * version will set values of the added column in old rows to the
33 * DEFAULT value.
34 *
35 * @param $ret
36 *   Array to which results will be added.
37 * @param $table
38 *   Name of the table, without {}
39 * @param $column
40 *   Name of the column
41 * @param $type
42 *   Type of column
43 * @param $attributes
44 *   Additional optional attributes. Recognized attributes:
45 *     not null => TRUE|FALSE
46 *     default  => NULL|FALSE|value (the value must be enclosed in '' marks)
47 * @return
48 *   nothing, but modifies $ret parameter.
49 */
50function db_add_column(&$ret, $table, $column, $type, $attributes = array()) {
51  if (array_key_exists('not null', $attributes) and $attributes['not null']) {
52    $not_null = 'NOT NULL';
53  }
54  if (array_key_exists('default', $attributes)) {
55    if (is_null($attributes['default'])) {
56      $default_val = 'NULL';
57      $default = 'default NULL';
58    }
59    elseif ($attributes['default'] === FALSE) {
60      $default = '';
61    }
62    else {
63      $default_val = "$attributes[default]";
64      $default = "default $attributes[default]";
65    }
66  }
67
68  $ret[] = update_sql("ALTER TABLE {". $table ."} ADD $column $type");
69  if (!empty($default)) {
70    $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column SET $default");
71  }
72  if (!empty($not_null)) {
73    if (!empty($default)) {
74      $ret[] = update_sql("UPDATE {". $table ."} SET $column = $default_val");
75    }
76    $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column SET NOT NULL");
77  }
78}
79
80/**
81 * Change a column definition using syntax appropriate for PostgreSQL.
82 * Save result of SQL commands in $ret array.
83 *
84 * Remember that changing a column definition involves adding a new column
85 * and dropping an old one. This means that any indices, primary keys and
86 * sequences from serial-type columns are dropped and might need to be
87 * recreated.
88 *
89 * @param $ret
90 *   Array to which results will be added.
91 * @param $table
92 *   Name of the table, without {}
93 * @param $column
94 *   Name of the column to change
95 * @param $column_new
96 *   New name for the column (set to the same as $column if you don't want to change the name)
97 * @param $type
98 *   Type of column
99 * @param $attributes
100 *   Additional optional attributes. Recognized attributes:
101 *     not null => TRUE|FALSE
102 *     default  => NULL|FALSE|value (with or without '', it won't be added)
103 * @return
104 *   nothing, but modifies $ret parameter.
105 */
106function db_change_column(&$ret, $table, $column, $column_new, $type, $attributes = array()) {
107  if (array_key_exists('not null', $attributes) and $attributes['not null']) {
108    $not_null = 'NOT NULL';
109  }
110  if (array_key_exists('default', $attributes)) {
111    if (is_null($attributes['default'])) {
112      $default_val = 'NULL';
113      $default = 'default NULL';
114    }
115    elseif ($attributes['default'] === FALSE) {
116      $default = '';
117    }
118    else {
119      $default_val = "$attributes[default]";
120      $default = "default $attributes[default]";
121    }
122  }
123
124  $ret[] = update_sql("ALTER TABLE {". $table ."} RENAME $column TO ". $column ."_old");
125  $ret[] = update_sql("ALTER TABLE {". $table ."} ADD $column_new $type");
126  $ret[] = update_sql("UPDATE {". $table ."} SET $column_new = ". $column ."_old");
127  if ($default) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET $default"); }
128  if ($not_null) { $ret[] = update_sql("ALTER TABLE {". $table ."} ALTER $column_new SET NOT NULL"); }
129  $ret[] = update_sql("ALTER TABLE {". $table ."} DROP ". $column ."_old");
130}
131
132/**
133 * Perform one update and store the results which will later be displayed on
134 * the finished page.
135 *
136 * An update function can force the current and all later updates for this
137 * module to abort by returning a $ret array with an element like:
138 * $ret['#abort'] = array('success' => FALSE, 'query' => 'What went wrong');
139 * The schema version will not be updated in this case, and all the
140 * aborted updates will continue to appear on update.php as updates that
141 * have not yet been run.
142 *
143 * @param $module
144 *   The module whose update will be run.
145 * @param $number
146 *   The update number to run.
147 * @param $context
148 *   The batch context array
149 */
150function update_do_one($module, $number, &$context) {
151  // If updates for this module have been aborted
152  // in a previous step, go no further.
153  if (!empty($context['results'][$module]['#abort'])) {
154    return;
155  }
156
157  $function = $module .'_update_'. $number;
158  if (function_exists($function)) {
159    $ret = $function($context['sandbox']);
160  }
161
162  if (isset($ret['#finished'])) {
163    $context['finished'] = $ret['#finished'];
164    unset($ret['#finished']);
165  }
166
167  if (!isset($context['results'][$module])) {
168    $context['results'][$module] = array();
169  }
170  if (!isset($context['results'][$module][$number])) {
171    $context['results'][$module][$number] = array();
172  }
173  $context['results'][$module][$number] = array_merge($context['results'][$module][$number], $ret);
174
175  if (!empty($ret['#abort'])) {
176    $context['results'][$module]['#abort'] = TRUE;
177  }
178  // Record the schema update if it was completed successfully.
179  if ($context['finished'] == 1 && empty($context['results'][$module]['#abort'])) {
180    drupal_set_installed_schema_version($module, $number);
181  }
182
183  $context['message'] = 'Updating '. check_plain($module) .' module';
184}
185
186/**
187 * Renders a form with a list of available database updates.
188 */
189function update_selection_page() {
190  $output = '<p>The version of Drupal you are updating from has been automatically detected. You can select a different version, but you should not need to.</p>';
191  $output .= '<p>Click Update to start the update process.</p>';
192
193  drupal_set_title('Drupal database update');
194  $output .= drupal_get_form('update_script_selection_form');
195
196  update_task_list('select');
197
198  return $output;
199}
200
201function update_script_selection_form() {
202  $form = array();
203  $form['start'] = array(
204    '#tree' => TRUE,
205    '#type' => 'fieldset',
206    '#title' => 'Select versions',
207    '#collapsible' => TRUE,
208    '#collapsed' => TRUE,
209  );
210
211  // Ensure system.module's updates appear first
212  $form['start']['system'] = array();
213
214  $modules = drupal_get_installed_schema_version(NULL, FALSE, TRUE);
215  foreach ($modules as $module => $schema_version) {
216    $updates = drupal_get_schema_versions($module);
217    // Skip incompatible module updates completely, otherwise test schema versions.
218    if (!update_check_incompatibility($module) && $updates !== FALSE && $schema_version >= 0) {
219      // module_invoke returns NULL for nonexisting hooks, so if no updates
220      // are removed, it will == 0.
221      $last_removed = module_invoke($module, 'update_last_removed');
222      if ($schema_version < $last_removed) {
223        $form['start'][$module] = array(
224          '#value'  => '<em>'. $module .'</em> module can not be updated. Its schema version is '. $schema_version .'. Updates up to and including '. $last_removed .' have been removed in this release. In order to update <em>'. $module .'</em> module, you will first <a href="http://drupal.org/upgrade">need to upgrade</a> to the last version in which these updates were available.',
225          '#prefix' => '<div class="warning">',
226          '#suffix' => '</div>',
227        );
228        $form['start']['#collapsed'] = FALSE;
229        continue;
230      }
231      $updates = drupal_map_assoc($updates);
232      $updates[] = 'No updates available';
233      $default = $schema_version;
234      foreach (array_keys($updates) as $update) {
235        if ($update > $schema_version) {
236          $default = $update;
237          break;
238        }
239      }
240      $form['start'][$module] = array(
241        '#type' => 'select',
242        '#title' => $module .' module',
243        '#default_value' => $default,
244        '#options' => $updates,
245      );
246    }
247  }
248
249  $form['has_js'] = array(
250    '#type' => 'hidden',
251    '#default_value' => FALSE,
252  );
253  $form['submit'] = array(
254    '#type' => 'submit',
255    '#value' => 'Update',
256  );
257  return $form;
258}
259
260function update_batch() {
261  global $base_url;
262
263  $operations = array();
264  // Set the installed version so updates start at the correct place.
265  foreach ($_POST['start'] as $module => $version) {
266    drupal_set_installed_schema_version($module, $version - 1);
267    $updates = drupal_get_schema_versions($module);
268    $max_version = max($updates);
269    if ($version <= $max_version) {
270      foreach ($updates as $update) {
271        if ($update >= $version) {
272          $operations[] = array('update_do_one', array($module, $update));
273        }
274      }
275    }
276  }
277  $batch = array(
278    'operations' => $operations,
279    'title' => 'Updating',
280    'init_message' => 'Starting updates',
281    'error_message' => 'An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.',
282    'finished' => 'update_finished',
283  );
284  batch_set($batch);
285  batch_process($base_url .'/update.php?op=results', $base_url .'/update.php');
286}
287
288function update_finished($success, $results, $operations) {
289  // clear the caches in case the data has been updated.
290  drupal_flush_all_caches();
291
292  $_SESSION['update_results'] = $results;
293  $_SESSION['update_success'] = $success;
294  $_SESSION['updates_remaining'] = $operations;
295}
296
297function update_results_page() {
298  drupal_set_title('Drupal database update');
299  // NOTE: we can't use l() here because the URL would point to 'update.php?q=admin'.
300  $links[] = '<a href="'. base_path() .'">Main page</a>';
301  $links[] = '<a href="'. base_path() .'?q=admin">Administration pages</a>';
302
303  update_task_list();
304  // Report end result
305  if (module_exists('dblog')) {
306    $log_message = ' All errors have been <a href="'. base_path() .'?q=admin/reports/dblog">logged</a>.';
307  }
308  else {
309    $log_message = ' All errors have been logged.';
310  }
311
312  if ($_SESSION['update_success']) {
313    $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>';
314  }
315  else {
316    list($module, $version) = array_pop(reset($_SESSION['updates_remaining']));
317    $output = '<p class="error">The update process was aborted prematurely while running <strong>update #'. $version .' in '. $module .'.module</strong>.'. $log_message;
318    if (module_exists('dblog')) {
319      $output .= ' You may need to check the <code>watchdog</code> database table manually.';
320    }
321    $output .= '</p>';
322  }
323
324  if (!empty($GLOBALS['update_free_access'])) {
325    $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>";
326  }
327
328  $output .= theme('item_list', $links);
329
330  // Output a list of queries executed
331  if (!empty($_SESSION['update_results'])) {
332    $output .= '<div id="update-results">';
333    $output .= '<h2>The following queries were executed</h2>';
334    foreach ($_SESSION['update_results'] as $module => $updates) {
335      $output .= '<h3>'. $module .' module</h3>';
336      foreach ($updates as $number => $queries) {
337        if ($number != '#abort') {
338          $output .= '<h4>Update #'. $number .'</h4>';
339          $output .= '<ul>';
340          foreach ($queries as $query) {
341            if ($query['success']) {
342              $output .= '<li class="success">'. $query['query'] .'</li>';
343            }
344            else {
345              $output .= '<li class="failure"><strong>Failed:</strong> '. $query['query'] .'</li>';
346            }
347          }
348          if (!count($queries)) {
349            $output .= '<li class="none">No queries</li>';
350          }
351          $output .= '</ul>';
352        }
353      }
354    }
355    $output .= '</div>';
356  }
357  unset($_SESSION['update_results']);
358  unset($_SESSION['update_success']);
359
360  return $output;
361}
362
363function update_info_page() {
364  // Change query-strings on css/js files to enforce reload for all users.
365  _drupal_flush_css_js();
366  // Flush the cache of all data for the update status module.
367  if (db_table_exists('cache_update')) {
368    cache_clear_all('*', 'cache_update', TRUE);
369  }
370
371  update_task_list('info');
372  drupal_set_title('Drupal database update');
373  $token = drupal_get_token('update');
374  $output = '<p>Use this utility to update your database whenever a new release of Drupal or a module is installed.</p><p>For more detailed information, see the <a href="http://drupal.org/upgrade">upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>';
375  $output .= "<ol>\n";
376  $output .= "<li><strong>Back up your database</strong>. This process will change your database values and in case of emergency you may need to revert to a backup.</li>\n";
377  $output .= "<li><strong>Back up your code</strong>. Hint: when backing up module code, do not leave that backup in the 'modules' or 'sites/*/modules' directories as this may confuse Drupal's auto-discovery mechanism.</li>\n";
378  $output .= '<li>Put your site into <a href="'. base_path() .'?q=admin/settings/site-maintenance">maintenance mode</a>.</li>'."\n";
379  $output .= "<li>Install your new files in the appropriate location, as described in the handbook.</li>\n";
380  $output .= "</ol>\n";
381  $output .= "<p>When you have performed the steps above, you may proceed.</p>\n";
382  $output .= '<form method="post" action="update.php?op=selection&amp;token='. $token .'"><p><input type="submit" value="Continue" /></p></form>';
383  $output .= "\n";
384  return $output;
385}
386
387function update_access_denied_page() {
388  drupal_set_title('Access denied');
389  return '<p>Access denied. You are not authorized to access this page. Please log in as the admin user (the first user you created). If you cannot log in, you will have to edit <code>settings.php</code> to bypass this access check. To do this:</p>
390<ol>
391 <li>With a text editor find the settings.php file on your system. From the main Drupal directory that you installed all the files into, go to <code>sites/your_site_name</code> if such directory exists, or else to <code>sites/default</code> which applies otherwise.</li>
392 <li>There is a line inside your settings.php file that says <code>$update_free_access = FALSE;</code>. Change it to <code>$update_free_access = TRUE;</code>.</li>
393 <li>As soon as the update.php script is done, you must change the settings.php file back to its original form with <code>$update_free_access = FALSE;</code>.</li>
394 <li>To avoid having this problem in future, remember to log in to your website as the admin user (the user you first created) before you backup your database at the beginning of the update process.</li>
395</ol>';
396}
397
398/**
399 * Create the batch table.
400 *
401 * This is part of the Drupal 5.x to 6.x migration.
402 */
403function update_create_batch_table() {
404
405  // If batch table exists, update is not necessary
406  if (db_table_exists('batch')) {
407    return;
408  }
409
410  $schema['batch'] = array(
411    'fields' => array(
412      'bid'       => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
413      'token'     => array('type' => 'varchar', 'length' => 64, 'not null' => TRUE),
414      'timestamp' => array('type' => 'int', 'not null' => TRUE),
415      'batch'     => array('type' => 'text', 'not null' => FALSE, 'size' => 'big')
416    ),
417    'primary key' => array('bid'),
418    'indexes' => array('token' => array('token')),
419  );
420
421  $ret = array();
422  db_create_table($ret, 'batch', $schema['batch']);
423  return $ret;
424}
425
426/**
427 * Disable anything in the {system} table that is not compatible with the
428 * current version of Drupal core.
429 */
430function update_fix_compatibility() {
431  $ret = array();
432  $incompatible = array();
433  $query = db_query("SELECT name, type, status FROM {system} WHERE status = 1 AND type IN ('module','theme')");
434  while ($result = db_fetch_object($query)) {
435    if (update_check_incompatibility($result->name, $result->type)) {
436      $incompatible[] = $result->name;
437    }
438  }
439  if (!empty($incompatible)) {
440    $ret[] = update_sql("UPDATE {system} SET status = 0 WHERE name IN ('". implode("','", $incompatible) ."')");
441  }
442  return $ret;
443}
444
445/**
446 * Helper function to test compatibility of a module or theme.
447 */
448function update_check_incompatibility($name, $type = 'module') {
449  static $themes, $modules;
450
451  // Store values of expensive functions for future use.
452  if (empty($themes) || empty($modules)) {
453    $themes = _system_theme_data();
454    $modules = module_rebuild_cache();
455  }
456
457  if ($type == 'module' && isset($modules[$name])) {
458    $file = $modules[$name];
459  }
460  else if ($type == 'theme' && isset($themes[$name])) {
461    $file = $themes[$name];
462  }
463  if (!isset($file)
464      || !isset($file->info['core'])
465      || $file->info['core'] != DRUPAL_CORE_COMPATIBILITY
466      || version_compare(phpversion(), $file->info['php']) < 0) {
467    return TRUE;
468  }
469  return FALSE;
470}
471
472/**
473 * Perform Drupal 5.x to 6.x updates that are required for update.php
474 * to function properly.
475 *
476 * This function runs when update.php is run the first time for 6.x,
477 * even before updates are selected or performed.  It is important
478 * that if updates are not ultimately performed that no changes are
479 * made which make it impossible to continue using the prior version.
480 * Just adding columns is safe.  However, renaming the
481 * system.description column to owner is not.  Therefore, we add the
482 * system.owner column and leave it to system_update_6008() to copy
483 * the data from description and remove description. The same for
484 * renaming locales_target.locale to locales_target.language, which
485 * will be finished by locale_update_6002().
486 */
487function update_fix_d6_requirements() {
488  $ret = array();
489
490  if (drupal_get_installed_schema_version('system') < 6000 && !variable_get('update_d6_requirements', FALSE)) {
491    $spec = array('type' => 'int', 'size' => 'small', 'default' => 0, 'not null' => TRUE);
492    db_add_field($ret, 'cache', 'serialized', $spec);
493    db_add_field($ret, 'cache_filter', 'serialized', $spec);
494    db_add_field($ret, 'cache_page', 'serialized', $spec);
495    db_add_field($ret, 'cache_menu', 'serialized', $spec);
496
497    db_add_field($ret, 'system', 'info', array('type' => 'text'));
498    db_add_field($ret, 'system', 'owner', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
499    if (db_table_exists('locales_target')) {
500      db_add_field($ret, 'locales_target', 'language', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''));
501    }
502    if (db_table_exists('locales_source')) {
503      db_add_field($ret, 'locales_source', 'textgroup', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'default'));
504      db_add_field($ret, 'locales_source', 'version', array('type' => 'varchar', 'length' => 20, 'not null' => TRUE, 'default' => 'none'));
505    }
506    variable_set('update_d6_requirements', TRUE);
507
508    // Create the cache_block table. See system_update_6027() for more details.
509    $schema['cache_block'] = array(
510      'fields' => array(
511        'cid'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
512        'data'       => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'),
513        'expire'     => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
514        'created'    => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
515        'headers'    => array('type' => 'text', 'not null' => FALSE),
516        'serialized' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)
517      ),
518      'indexes' => array('expire' => array('expire')),
519      'primary key' => array('cid'),
520    );
521    db_create_table($ret, 'cache_block', $schema['cache_block']);
522
523    // Create the semaphore table now -- the menu system after 6.15 depends on
524    // this table, and menu code runs in updates prior to the table being
525    // created in its original update function, system_update_6054().
526    $schema['semaphore'] = array(
527      'fields' => array(
528        'name' => array(
529          'type' => 'varchar',
530          'length' => 255,
531          'not null' => TRUE,
532          'default' => ''),
533        'value' => array(
534          'type' => 'varchar',
535          'length' => 255,
536          'not null' => TRUE,
537          'default' => ''),
538        'expire' => array(
539          'type' => 'float',
540          'size' => 'big',
541          'not null' => TRUE),
542        ),
543      'indexes' => array('expire' => array('expire')),
544      'primary key' => array('name'),
545    );
546    db_create_table($ret, 'semaphore', $schema['semaphore']);
547  }
548
549  return $ret;
550}
551
552/**
553 * Add the update task list to the current page.
554 */
555function update_task_list($active = NULL) {
556  // Default list of tasks.
557  $tasks = array(
558    'info' => 'Overview',
559    'select' => 'Select updates',
560    'run' => 'Run updates',
561    'finished' => 'Review log',
562  );
563
564  drupal_set_content('left', theme('task_list', $tasks, $active));
565}
566
567/**
568 * Check update requirements and report any errors.
569 */
570function update_check_requirements() {
571  // Check the system module requirements only.
572  $requirements = module_invoke('system', 'requirements', 'update');
573  $severity = drupal_requirements_severity($requirements);
574
575  // If there are issues, report them.
576  if ($severity != REQUIREMENT_OK) {
577    foreach ($requirements as $requirement) {
578      if (isset($requirement['severity']) && $requirement['severity'] != REQUIREMENT_OK) {
579        $message = isset($requirement['description']) ? $requirement['description'] : '';
580        if (isset($requirement['value']) && $requirement['value']) {
581          $message .= ' (Currently using '. $requirement['title'] .' '. $requirement['value'] .')';
582        }
583        drupal_set_message($message, 'warning');
584      }
585    }
586  }
587}
588
589// Some unavoidable errors happen because the database is not yet up-to-date.
590// Our custom error handler is not yet installed, so we just suppress them.
591ini_set('display_errors', FALSE);
592
593require_once './includes/bootstrap.inc';
594
595// We only load DRUPAL_BOOTSTRAP_CONFIGURATION for the update requirements
596// check to avoid reaching the PHP memory limit.
597$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
598if (empty($op)) {
599  // Minimum load of components.
600  drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
601
602  require_once './includes/install.inc';
603  require_once './includes/file.inc';
604  require_once './modules/system/system.install';
605
606  // Load module basics.
607  include_once './includes/module.inc';
608  $module_list['system']['filename'] = 'modules/system/system.module';
609  $module_list['filter']['filename'] = 'modules/filter/filter.module';
610  module_list(TRUE, FALSE, FALSE, $module_list);
611  drupal_load('module', 'system');
612  drupal_load('module', 'filter');
613
614  // Set up $language, since the installer components require it.
615  drupal_init_language();
616
617  // Set up theme system for the maintenance page.
618  drupal_maintenance_theme();
619
620  // Check the update requirements for Drupal.
621  update_check_requirements();
622
623  // Display the warning messages (if any) in a dedicated maintenance page,
624  // or redirect to the update information page if no message.
625  $messages = drupal_set_message();
626  if (!empty($messages['warning'])) {
627    drupal_maintenance_theme();
628    print theme('update_page', '<form method="post" action="update.php?op=info"><input type="submit" value="Continue" /></form>', FALSE);
629    exit;
630  }
631  install_goto('update.php?op=info');
632}
633
634drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
635drupal_maintenance_theme();
636
637// This must happen *after* drupal_bootstrap(), since it calls
638// variable_(get|set), which only works after a full bootstrap.
639update_create_batch_table();
640
641// Turn error reporting back on. From now on, only fatal errors (which are
642// not passed through the error handler) will cause a message to be printed.
643ini_set('display_errors', TRUE);
644
645// Access check:
646if (!empty($update_free_access) || $user->uid == 1) {
647
648  include_once './includes/install.inc';
649  include_once './includes/batch.inc';
650  drupal_load_updates();
651
652  update_fix_d6_requirements();
653  update_fix_compatibility();
654
655  $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
656  switch ($op) {
657    case 'selection':
658      if (isset($_GET['token']) && drupal_valid_token($_GET['token'], 'update')) {
659        $output = update_selection_page();
660        break;
661      }
662
663    case 'Update':
664      if (isset($_GET['token']) && drupal_valid_token($_GET['token'], 'update')) {
665        update_batch();
666        break;
667      }
668
669    // update.php ops
670    case 'info':
671      $output = update_info_page();
672      break;
673
674    case 'results':
675      $output = update_results_page();
676      break;
677
678    // Regular batch ops : defer to batch processing API
679    default:
680      update_task_list('run');
681      $output = _batch_page();
682      break;
683  }
684}
685else {
686  $output = update_access_denied_page();
687}
688if (isset($output) && $output) {
689  // We defer the display of messages until all updates are done.
690  $progress_page = ($batch = batch_get()) && isset($batch['running']);
691  print theme('update_page', $output, !$progress_page);
692}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.