Skip to content
Newer
Older
100644 368 lines (318 sloc) 13.6 KB
0a4f99e - added update.php to replace the updates/* files to make future upgr…
Kjartan Mannes authored Nov 15, 2001
1 <?php
645d026 @dbuytaert - Added $Id$ tags. Patch by Chris.
dbuytaert authored Sep 25, 2003
2 // $Id$
94e30bf @dbuytaert - Patch by JonBob: for consistency and readability, add brief descrip…
dbuytaert authored Aug 21, 2004
3
4 /**
a3bb66e @webchick #259623 by dopry and Damien Tournoud: Convert includes/requires to us…
webchick authored Sep 20, 2008
5 * Root directory of Drupal installation.
6 */
d802c69 @webchick #363013 by mannkind: Use getwd() rather than realpath(__FILE__) to de…
webchick authored Feb 8, 2009
7 define('DRUPAL_ROOT', getcwd());
a3bb66e @webchick #259623 by dopry and Damien Tournoud: Convert includes/requires to us…
webchick authored Sep 20, 2008
8
9 /**
94e30bf @dbuytaert - Patch by JonBob: for consistency and readability, add brief descrip…
dbuytaert authored Aug 21, 2004
10 * @file
11 * Administrative page for handling updates from one Drupal version to another.
12 *
a5bbf6c @dbuytaert - Patch #53468 by jvandyk: documentation improvements.
dbuytaert authored Mar 11, 2006
13 * Point your browser to "http://www.example.com/update.php" and follow the
94e30bf @dbuytaert - Patch by JonBob: for consistency and readability, add brief descrip…
dbuytaert authored Aug 21, 2004
14 * instructions.
15 *
0b7962c @dbuytaert - Patch #570572 by winston, David_Rothstein | Shai, Xano, alexanderpa…
dbuytaert authored Sep 14, 2009
16 * If you are not logged in using the site maintenance account, you will need
17 * to modify the access check statement inside your settings.php file. After
18 * finishing the upgrade, be sure to open settings.php again, and change it back
19 * to its original state!
94e30bf @dbuytaert - Patch by JonBob: for consistency and readability, add brief descrip…
dbuytaert authored Aug 21, 2004
20 */
780a345 @dbuytaert - Added some explanation to the top of the file and fixed a braino.
dbuytaert authored Dec 16, 2001
21
66b7a5c @goba #199946 by JirkaRybka: append a short query string to CSS and JS file…
goba authored Jan 7, 2008
22 /**
23 * Global flag to identify update.php run, and so avoid various unwanted
24 * operations, such as hook_init() and hook_exit() invokes, css/js preprocessing
25 * and translation, and solve some theming issues. This flag is checked on several
26 * places in Drupal code (not just update.php).
27 */
e9f52b4 @goba #141727 by merlinofchaos, dvessel, sun: restore themeability support …
goba authored Nov 30, 2007
28 define('MAINTENANCE_MODE', 'update');
29
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
30 function update_selection_page() {
7de4153 @dbuytaert - Patch #77919 by chx, eaton, moshe, et al: enable programmaticaly su…
dbuytaert authored Aug 18, 2006
31 drupal_set_title('Drupal database update');
847304a @dbuytaert - Patch #353069 by Moshe Weitzman, dmitrig01: make drupal_get_form() …
dbuytaert authored May 12, 2009
32 $output = drupal_render(drupal_get_form('update_script_selection_form'));
7de4153 @dbuytaert - Patch #77919 by chx, eaton, moshe, et al: enable programmaticaly su…
dbuytaert authored Aug 18, 2006
33
ba0ff1a #117018: Use Garland theme for installer/maintenance pages, and add t…
Steven Wittens authored Mar 2, 2007
34 update_task_list('select');
35
7de4153 @dbuytaert - Patch #77919 by chx, eaton, moshe, et al: enable programmaticaly su…
dbuytaert authored Aug 18, 2006
36 return $output;
37 }
38
39 function update_script_selection_form() {
74a7bad @dbuytaert - Patch #325426 by moshe: correct count in update.php.
dbuytaert authored Oct 24, 2008
40 $form = array();
41 $count = 0;
7e1527e @dbuytaert - Patch #29465: new form API by Adrian et al.
dbuytaert authored Oct 7, 2005
42 $form['start'] = array(
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
43 '#tree' => TRUE,
44 '#type' => 'fieldset',
45 '#collapsed' => TRUE,
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
46 '#collapsible' => TRUE,
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
47 );
6a13ffe Running multiple updates for a module was broken since the installer.
Steven Wittens authored Jul 31, 2006
48
49 // Ensure system.module's updates appear first
50 $form['start']['system'] = array();
51
d151ea9 @webchick #554754 by gordon and dww: Added a new function update_get_update_lis…
webchick authored Aug 21, 2009
52 $updates = update_get_update_list();
53 foreach ($updates as $module => $update) {
54 if (!isset($update['start'])) {
55 $form['start'][$module] = array(
56 '#title' => $module,
57 '#item' => $update['warning'],
58 '#prefix' => '<div class="warning">',
59 '#suffix' => '</div>',
60 );
61 continue;
62 }
63 if (!empty($update['pending'])) {
64 $form['start'][$module] = array(
65 '#type' => 'hidden',
66 '#value' => $update['start'],
67 );
68 $form['start'][$module . '_updates'] = array(
c05f218 @dbuytaert - Patch #572618 by effulgentsia, pwolanin, sun: all theme functions s…
dbuytaert authored Oct 9, 2009
69 '#markup' => theme('item_list', array('items' => $update['pending'], 'title' => $module . ' module')),
d151ea9 @webchick #554754 by gordon and dww: Added a new function update_get_update_lis…
webchick authored Aug 21, 2009
70 );
71 }
72 if (isset($update['pending'])) {
73 $count = $count + count($update['pending']);
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
74 }
75 }
76
74a7bad @dbuytaert - Patch #325426 by moshe: correct count in update.php.
dbuytaert authored Oct 24, 2008
77 if (empty($count)) {
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
78 drupal_set_message(t('No pending updates.'));
79 unset($form);
80 $form['links'] = array(
c05f218 @dbuytaert - Patch #572618 by effulgentsia, pwolanin, sun: all theme functions s…
dbuytaert authored Oct 9, 2009
81 '#markup' => theme('item_list', array('items' => update_helpful_links())),
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
82 );
83 }
84 else {
85 $form['help'] = array(
86 '#markup' => '<p>The version of Drupal you are updating from has been automatically detected.</p>',
87 '#weight' => -5,
88 );
009724f @dbuytaert - Patch #584278 by cam8001, Dave Reid | moshe weitzman: Fixed pending…
dbuytaert authored Sep 28, 2009
89 $form['start']['#title'] = format_plural($count, '1 pending update', '@count pending updates');
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
90 $form['has_js'] = array(
91 '#type' => 'hidden',
92 '#default_value' => FALSE,
93 );
94 $form['submit'] = array(
95 '#type' => 'submit',
0de74c1 @webchick #371886 by karschsp: update.php button should use sentence capitaliza…
webchick authored Mar 1, 2009
96 '#value' => 'Apply pending updates',
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
97 );
98 }
7de4153 @dbuytaert - Patch #77919 by chx, eaton, moshe, et al: enable programmaticaly su…
dbuytaert authored Aug 18, 2006
99 return $form;
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
100 }
101
102
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
103 function update_helpful_links() {
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
104 // NOTE: we can't use l() here because the URL would point to 'update.php?q=admin'.
a81858f @webchick #349327 by stewsnooze: Change link from 'Main page' to 'Front page' i…
webchick authored Jan 17, 2009
105 $links[] = '<a href="' . base_path() . '">Front page</a>';
56d2664 @dbuytaert - Patch #245115 by kkaefer, John Morahan, JohnAlbin et al: after a lo…
dbuytaert authored Apr 14, 2008
106 $links[] = '<a href="' . base_path() . '?q=admin">Administration pages</a>';
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
107 return $links;
108 }
109
110 function update_results_page() {
111 drupal_set_title('Drupal database update');
112 $links = update_helpful_links();
3f2b287 - #49501: Improve error reporting in the update system
Steven Wittens authored Mar 1, 2006
113
ba0ff1a #117018: Use Garland theme for installer/maintenance pages, and add t…
Steven Wittens authored Mar 2, 2007
114 update_task_list();
cb49e19 #54003, Watchdog not logging update errors, patch by Steven
Gerhard Killesreiter authored Mar 28, 2006
115 // Report end result
6cc4cc2 @goba #176805 by dww: conditional linking to dblog pages in update.php, so …
goba authored Oct 2, 2007
116 if (module_exists('dblog')) {
56d2664 @dbuytaert - Patch #245115 by kkaefer, John Morahan, JohnAlbin et al: after a lo…
dbuytaert authored Apr 14, 2008
117 $log_message = ' All errors have been <a href="' . base_path() . '?q=admin/reports/dblog">logged</a>.';
6cc4cc2 @goba #176805 by dww: conditional linking to dblog pages in update.php, so …
goba authored Oct 2, 2007
118 }
119 else {
120 $log_message = ' All errors have been logged.';
121 }
122
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
123 if ($_SESSION['update_success']) {
56d2664 @dbuytaert - Patch #245115 by kkaefer, John Morahan, JohnAlbin et al: after a lo…
dbuytaert authored Apr 14, 2008
124 $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>';
3f2b287 - #49501: Improve error reporting in the update system
Steven Wittens authored Mar 1, 2006
125 }
126 else {
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
127 list($module, $version) = array_pop(reset($_SESSION['updates_remaining']));
56d2664 @dbuytaert - Patch #245115 by kkaefer, John Morahan, JohnAlbin et al: after a lo…
dbuytaert authored Apr 14, 2008
128 $output = '<p class="error">The update process was aborted prematurely while running <strong>update #' . $version . ' in ' . $module . '.module</strong>.' . $log_message;
6cc4cc2 @goba #176805 by dww: conditional linking to dblog pages in update.php, so …
goba authored Oct 2, 2007
129 if (module_exists('dblog')) {
130 $output .= ' You may need to check the <code>watchdog</code> database table manually.';
131 }
132 $output .= '</p>';
3f2b287 - #49501: Improve error reporting in the update system
Steven Wittens authored Mar 1, 2006
133 }
134
1372700 @goba #170638 by JirkaRybka and chx: move update access variable to setting…
goba authored Aug 28, 2007
135 if (!empty($GLOBALS['update_free_access'])) {
136 $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>";
0a4f99e - added update.php to replace the updates/* files to make future upgr…
Kjartan Mannes authored Nov 15, 2001
137 }
e66371c @dbuytaert - Patch #137211 by merlinofchaos: move theme information to .info fil…
dbuytaert authored May 6, 2007
138
c05f218 @dbuytaert - Patch #572618 by effulgentsia, pwolanin, sun: all theme functions s…
dbuytaert authored Oct 9, 2009
139 $output .= theme('item_list', array('items' => $links));
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
140
141 // Output a list of queries executed
cb34d83 @dbuytaert - Patch #131483 by kkaefer: E_NOTICE cleanup.
dbuytaert authored Mar 28, 2007
142 if (!empty($_SESSION['update_results'])) {
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
143 $output .= '<div id="update-results">';
95e95bf @dbuytaert - Patch #394268 by Crell, sun, yched: changed DIE update_sql() DIE!.
dbuytaert authored Sep 7, 2009
144 $output .= '<h2>The following updates returned messages</h2>';
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
145 foreach ($_SESSION['update_results'] as $module => $updates) {
56d2664 @dbuytaert - Patch #245115 by kkaefer, John Morahan, JohnAlbin et al: after a lo…
dbuytaert authored Apr 14, 2008
146 $output .= '<h3>' . $module . ' module</h3>';
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
147 foreach ($updates as $number => $queries) {
b05a49e @goba #208602 by KarenS: add support for aborting all updates of one module…
goba authored Jan 17, 2008
148 if ($number != '#abort') {
95e95bf @dbuytaert - Patch #394268 by Crell, sun, yched: changed DIE update_sql() DIE!.
dbuytaert authored Sep 7, 2009
149 $messages = array();
b05a49e @goba #208602 by KarenS: add support for aborting all updates of one module…
goba authored Jan 17, 2008
150 foreach ($queries as $query) {
95e95bf @dbuytaert - Patch #394268 by Crell, sun, yched: changed DIE update_sql() DIE!.
dbuytaert authored Sep 7, 2009
151 // If there is no message for this update, don't show anything.
152 if (empty($query['query'])) {
153 continue;
154 }
b05a49e @goba #208602 by KarenS: add support for aborting all updates of one module…
goba authored Jan 17, 2008
155 if ($query['success']) {
95e95bf @dbuytaert - Patch #394268 by Crell, sun, yched: changed DIE update_sql() DIE!.
dbuytaert authored Sep 7, 2009
156 $messages[] = '<li class="success">' . $query['query'] . '</li>';
b05a49e @goba #208602 by KarenS: add support for aborting all updates of one module…
goba authored Jan 17, 2008
157 }
158 else {
95e95bf @dbuytaert - Patch #394268 by Crell, sun, yched: changed DIE update_sql() DIE!.
dbuytaert authored Sep 7, 2009
159 $messages[] = '<li class="failure"><strong>Failed:</strong> ' . $query['query'] . '</li>';
b05a49e @goba #208602 by KarenS: add support for aborting all updates of one module…
goba authored Jan 17, 2008
160 }
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
161 }
95e95bf @dbuytaert - Patch #394268 by Crell, sun, yched: changed DIE update_sql() DIE!.
dbuytaert authored Sep 7, 2009
162
163 if ($messages) {
164 $output .= '<h4>Update #' . $number . "</h4>\n";
165 $output .= '<ul>' . implode("\n", $messages) . "</ul>\n";
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
166 }
167 }
168 $output .= '</ul>';
169 }
170 }
171 $output .= '</div>';
172 }
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
173 unset($_SESSION['update_results']);
174 unset($_SESSION['update_success']);
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
175
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
176 return $output;
0a4f99e - added update.php to replace the updates/* files to make future upgr…
Kjartan Mannes authored Nov 15, 2001
177 }
178
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
179 function update_info_page() {
66b7a5c @goba #199946 by JirkaRybka: append a short query string to CSS and JS file…
goba authored Jan 7, 2008
180 // Change query-strings on css/js files to enforce reload for all users.
181 _drupal_flush_css_js();
46c1d92 @goba #200028 follow up by dww: clear update module cache on update.php run…
goba authored Jan 30, 2008
182 // Flush the cache of all data for the update status module.
183 if (db_table_exists('cache_update')) {
17e3d1f @goba #200028 by dww: trivial syntax fix in cache clearing
goba authored Feb 3, 2008
184 cache_clear_all('*', 'cache_update', TRUE);
46c1d92 @goba #200028 follow up by dww: clear update module cache on update.php run…
goba authored Jan 30, 2008
185 }
66b7a5c @goba #199946 by JirkaRybka: append a short query string to CSS and JS file…
goba authored Jan 7, 2008
186
ba0ff1a #117018: Use Garland theme for installer/maintenance pages, and add t…
Steven Wittens authored Mar 2, 2007
187 update_task_list('info');
e5ad13e - #27635: Style update.php
Steven Wittens authored Jul 29, 2005
188 drupal_set_title('Drupal database update');
c11454d @dbuytaert - Patch #361699 by David Rothstein: prevent CSRF on update.php. Alrea…
dbuytaert authored Jan 21, 2009
189 $token = drupal_get_token('update');
eaaba7c #159443: Update.php text out of date and difficult to follow.
Steven Wittens authored Jul 15, 2007
190 $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/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>';
191 $output .= "<ol>\n";
192 $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";
193 $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";
9a34f7a @webchick #546048 by Gábor Hojtsy: Move maintenance mode setting to config/deve…
webchick authored Aug 11, 2009
194 $output .= '<li>Put your site into <a href="' . base_path() . '?q=admin/config/development/maintenance">maintenance mode</a>.</li>' . "\n";
eaaba7c #159443: Update.php text out of date and difficult to follow.
Steven Wittens authored Jul 15, 2007
195 $output .= "<li>Install your new files in the appropriate location, as described in the handbook.</li>\n";
196 $output .= "</ol>\n";
197 $output .= "<p>When you have performed the steps above, you may proceed.</p>\n";
898a7db @dbuytaert - Patch #314314 by mr.baileys, Dave Reid, bastos: fixed invalid HTML …
dbuytaert authored Mar 9, 2009
198 $output .= '<form method="post" action="update.php?op=selection&amp;token=' . $token . '"><p><input type="submit" value="Continue" /></p></form>';
eaaba7c #159443: Update.php text out of date and difficult to follow.
Steven Wittens authored Jul 15, 2007
199 $output .= "\n";
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
200 return $output;
201 }
202
203 function update_access_denied_page() {
204 drupal_set_title('Access denied');
0b7962c @dbuytaert - Patch #570572 by winston, David_Rothstein | Shai, Xano, alexanderpa…
dbuytaert authored Sep 14, 2009
205 return '<p>Access denied. You are not authorized to access this page. Please log in using the site maintenance account (the account you created during installation). If you cannot log in, you will have to edit <code>settings.php</code> to bypass this access check. To do this:</p>
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
206 <ol>
1372700 @goba #170638 by JirkaRybka and chx: move update access variable to setting…
goba authored Aug 28, 2007
207 <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>
208 <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>
209 <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>
0b7962c @dbuytaert - Patch #570572 by winston, David_Rothstein | Shai, Xano, alexanderpa…
dbuytaert authored Sep 14, 2009
210 <li>To avoid having this problem in the future, remember to log in to your website using the site maintenance account (the account you created during installation) before you backup your database at the beginning of the update process.</li>
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
211 </ol>';
0a4f99e - added update.php to replace the updates/* files to make future upgr…
Kjartan Mannes authored Nov 15, 2001
212 }
497ab79 - added notes to update.php which you will see before you can perform…
Kjartan Mannes authored May 11, 2002
213
ba0ff1a #117018: Use Garland theme for installer/maintenance pages, and add t…
Steven Wittens authored Mar 2, 2007
214 /**
215 * Add the update task list to the current page.
216 */
217 function update_task_list($active = NULL) {
218 // Default list of tasks.
219 $tasks = array(
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
220 'requirements' => 'Verify requirements',
ba0ff1a #117018: Use Garland theme for installer/maintenance pages, and add t…
Steven Wittens authored Mar 2, 2007
221 'info' => 'Overview',
78e1919 @dbuytaert - Patch #286035 by moshe: remove update.php number dropdowns.
dbuytaert authored Aug 31, 2008
222 'select' => 'Review updates',
ba0ff1a #117018: Use Garland theme for installer/maintenance pages, and add t…
Steven Wittens authored Mar 2, 2007
223 'run' => 'Run updates',
224 'finished' => 'Review log',
225 );
226
c05f218 @dbuytaert - Patch #572618 by effulgentsia, pwolanin, sun: all theme functions s…
dbuytaert authored Oct 9, 2009
227 drupal_add_region_content('sidebar_first', theme('task_list', array('items' => $tasks, 'active' => $active)));
ba0ff1a #117018: Use Garland theme for installer/maintenance pages, and add t…
Steven Wittens authored Mar 2, 2007
228 }
229
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
230 /**
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
231 * Returns (and optionally stores) extra requirements that only apply during
232 * particular parts of the update.php process.
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
233 */
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
234 function update_extra_requirements($requirements = NULL) {
235 static $extra_requirements = array();
236 if (isset($requirements)) {
237 $extra_requirements += $requirements;
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
238 }
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
239 return $extra_requirements;
27369e8 @webchick #304163 by chx: Allow update.php to re-generate settings.php. Now pos…
webchick authored Mar 1, 2009
240 }
241
242 /**
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
243 * Check update requirements and report any errors.
27369e8 @webchick #304163 by chx: Allow update.php to re-generate settings.php. Now pos…
webchick authored Mar 1, 2009
244 */
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
245 function update_check_requirements() {
246 // Check the system module and update.php requirements only.
247 $requirements = module_invoke('system', 'requirements', 'update');
248 $requirements += update_extra_requirements();
249 $severity = drupal_requirements_severity($requirements);
250
251 // If there are issues, report them.
252 if ($severity == REQUIREMENT_ERROR) {
253 update_task_list('requirements');
254 drupal_set_title('Requirements problem');
c05f218 @dbuytaert - Patch #572618 by effulgentsia, pwolanin, sun: all theme functions s…
dbuytaert authored Oct 9, 2009
255 $status_report = theme('status_report', array('requirements' => $requirements));
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
256 $status_report .= 'Please check the error messages and <a href="' . request_uri() . '">try again</a>.';
c05f218 @dbuytaert - Patch #572618 by effulgentsia, pwolanin, sun: all theme functions s…
dbuytaert authored Oct 9, 2009
257 print theme('update_page', array('content' => $status_report));
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
258 exit();
27369e8 @webchick #304163 by chx: Allow update.php to re-generate settings.php. Now pos…
webchick authored Mar 1, 2009
259 }
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
260 }
261
a5bbf6c @dbuytaert - Patch #53468 by jvandyk: documentation improvements.
dbuytaert authored Mar 11, 2006
262 // Some unavoidable errors happen because the database is not yet up-to-date.
70aae83 #58166, fixes for typos, patch by Uwe Herrmann
Gerhard Killesreiter authored Apr 11, 2006
263 // Our custom error handler is not yet installed, so we just suppress them.
3f2b287 - #49501: Improve error reporting in the update system
Steven Wittens authored Mar 1, 2006
264 ini_set('display_errors', FALSE);
265
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
266 // We prepare a minimal bootstrap for the update requirements check to avoid
267 // reaching the PHP memory limit.
a3bb66e @webchick #259623 by dopry and Damien Tournoud: Convert includes/requires to us…
webchick authored Sep 20, 2008
268 require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
40c8986 @dbuytaert - Patch #233091 by dww, anarcat, gordon: restructured update.php to s…
dbuytaert authored Jul 29, 2009
269 require_once DRUPAL_ROOT . '/includes/update.inc';
3f36af0 @dbuytaert - Patch #460320 by catch, fago, Frando: standardized, pluggable entit…
dbuytaert authored Aug 25, 2009
270 require_once DRUPAL_ROOT . '/includes/common.inc';
271 require_once DRUPAL_ROOT . '/includes/entity.inc';
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
272 update_prepare_d7_bootstrap();
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
273
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
274 // Determine if the current user has access to run update.php.
275 drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
276 $update_access_allowed = !empty($update_free_access) || $user->uid == 1;
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
277
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
278 // Only allow the requirements check to proceed if the current user has access
279 // to run updates (since it may expose sensitive information about the site's
280 // configuration).
281 $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
282 if (empty($op) && $update_access_allowed) {
a3bb66e @webchick #259623 by dopry and Damien Tournoud: Convert includes/requires to us…
webchick authored Sep 20, 2008
283 require_once DRUPAL_ROOT . '/includes/install.inc';
284 require_once DRUPAL_ROOT . '/includes/file.inc';
285 require_once DRUPAL_ROOT . '/modules/system/system.install';
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
286
287 // Load module basics.
a3bb66e @webchick #259623 by dopry and Damien Tournoud: Convert includes/requires to us…
webchick authored Sep 20, 2008
288 include_once DRUPAL_ROOT . '/includes/module.inc';
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
289 $module_list['system']['filename'] = 'modules/system/system.module';
290 $module_list['filter']['filename'] = 'modules/filter/filter.module';
2c55219 @webchick #497118 by chx, catch, pwolanin, JoshuaRogers, and Jacob Singh: Remov…
webchick authored Aug 24, 2009
291 module_list(TRUE, FALSE, FALSE, $module_list);
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
292 drupal_load('module', 'system');
293 drupal_load('module', 'filter');
294
a8b3369 @dbuytaert - Patch #557542 by CorniI, catch, fago, Crell, sun | pwolanin, chx, w…
dbuytaert authored Sep 27, 2009
295 // Reset the module_implements() cache so that any new hook implementations
296 // in updated code are picked up.
297 module_implements('', FALSE, TRUE);
298
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
299 // Set up $language, since the installer components require it.
ef09cf9 @dbuytaert - Patch #517542 by David Strauss: renamed functions for clarity. We s…
dbuytaert authored Jul 14, 2009
300 drupal_language_initialize();
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
301
302 // Set up theme system for the maintenance page.
303 drupal_maintenance_theme();
304
305 // Check the update requirements for Drupal.
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
306 update_check_requirements();
27369e8 @webchick #304163 by chx: Allow update.php to re-generate settings.php. Now pos…
webchick authored Mar 1, 2009
307
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
308 // Redirect to the update information page if all requirements were met.
44d71e1 @goba #200674 by scor, catch: update.php should inform users if their memor…
goba authored Jan 16, 2008
309 install_goto('update.php?op=info');
310 }
cb49e19 #54003, Watchdog not logging update errors, patch by Steven
Gerhard Killesreiter authored Mar 28, 2006
311
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
312 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
e5ad13e - #27635: Style update.php
Steven Wittens authored Jul 29, 2005
313 drupal_maintenance_theme();
3029da0 @dbuytaert - Patch #29051 by mathias: made the update.php script work when Drupa…
dbuytaert authored Aug 31, 2005
314
cb49e19 #54003, Watchdog not logging update errors, patch by Steven
Gerhard Killesreiter authored Mar 28, 2006
315 // Turn error reporting back on. From now on, only fatal errors (which are
316 // not passed through the error handler) will cause a message to be printed.
317 ini_set('display_errors', TRUE);
318
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
319 // Only proceed with updates if the user is allowed to run them.
320 if ($update_access_allowed) {
cb49e19 #54003, Watchdog not logging update errors, patch by Steven
Gerhard Killesreiter authored Mar 28, 2006
321
a3bb66e @webchick #259623 by dopry and Damien Tournoud: Convert includes/requires to us…
webchick authored Sep 20, 2008
322 include_once DRUPAL_ROOT . '/includes/install.inc';
323 include_once DRUPAL_ROOT . '/includes/batch.inc';
90acf99 #75264: Redirect uninstalled default Drupal site to install.php
Steven Wittens authored Jul 31, 2006
324 drupal_load_updates();
d026d15 @dbuytaert - Fixed links to admin page. Added help text.
dbuytaert authored Jan 7, 2003
325
bbe7b77 @dbuytaert - Patch #304163 by chx, David_Rothstein: allow update.php to regenera…
dbuytaert authored May 9, 2009
326 update_fix_d7_requirements();
29eb5a6 @dbuytaert - Patch #146910 by dww: only allow enabling modules with the same Dru…
dbuytaert authored Jun 8, 2007
327 update_fix_compatibility();
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
328
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
329 $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
330 switch ($op) {
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
331 // update.php ops
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
332
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
333 case 'selection':
c11454d @dbuytaert - Patch #361699 by David Rothstein: prevent CSRF on update.php. Alrea…
dbuytaert authored Jan 21, 2009
334 if (isset($_GET['token']) && $_GET['token'] == drupal_get_token('update')) {
335 $output = update_selection_page();
336 break;
337 }
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
338
7cc7e08 @webchick #371886 follow-up: Made an a an A so that update.php works again.
webchick authored Mar 1, 2009
339 case 'Apply pending updates':
c11454d @dbuytaert - Patch #361699 by David Rothstein: prevent CSRF on update.php. Alrea…
dbuytaert authored Jan 21, 2009
340 if (isset($_GET['token']) && $_GET['token'] == drupal_get_token('update')) {
3b5d056 @webchick #536150 follow-up by gordonh and dww: Move more update.php functions …
webchick authored Aug 3, 2009
341 update_batch($_POST['start'], $base_url . '/update.php?op=results', $base_url . '/update.php');
c11454d @dbuytaert - Patch #361699 by David Rothstein: prevent CSRF on update.php. Alrea…
dbuytaert authored Jan 21, 2009
342 break;
343 }
344
345 case 'info':
346 $output = update_info_page();
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
347 break;
348
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
349 case 'results':
350 $output = update_results_page();
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
351 break;
352
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
353 // Regular batch ops : defer to batch processing API
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
354 default:
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
355 update_task_list('run');
356 $output = _batch_page();
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
357 break;
c1f6ab3 - convert meta tags to taxonomy.
Kjartan Mannes authored May 15, 2002
358 }
359 }
360 else {
a19acb2 @dbuytaert - Patch #35924 by Neil: improved the update system.
dbuytaert authored Dec 6, 2005
361 $output = update_access_denied_page();
05014a3 - #29006: Reorganize code in update.php to be cleaner.
Steven Wittens authored Aug 17, 2005
362 }
c740ac7 @goba #127539: progressive operation support, refactoring update.php code t…
goba authored May 4, 2007
363 if (isset($output) && $output) {
fc8b22c @goba #196630 by yched: postpone warning message display until batch finish…
goba authored Dec 20, 2007
364 // We defer the display of messages until all updates are done.
365 $progress_page = ($batch = batch_get()) && isset($batch['running']);
c05f218 @dbuytaert - Patch #572618 by effulgentsia, pwolanin, sun: all theme functions s…
dbuytaert authored Oct 9, 2009
366 print theme('update_page', array('content' => $output, 'show_messages' => !$progress_page));
599fae4 #54002, Cached JS files break new drupal js error reporting behavior,…
Gerhard Killesreiter authored Mar 14, 2006
367 }
Something went wrong with that request. Please try again.