/[drupal]/contributions/modules/versioncontrol_cvs/cvs_to_versioncontrol_cvs_update.php
ViewVC logotype

Contents of /contributions/modules/versioncontrol_cvs/cvs_to_versioncontrol_cvs_update.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.9 - (show annotations) (download) (as text)
Sat Jan 10 14:44:27 2009 UTC (10 months, 2 weeks ago) by jpetso
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-RC1, DRUPAL-6--1-0-ALPHA1, DRUPAL-6--1-0-BETA2, DRUPAL-6--1-0-BETA1, HEAD
Changes since 1.8: +3 -2 lines
File MIME type: text/x-php
Make Coder shut up a bit more.
1 <?php
2 // $Id: cvs_to_versioncontrol_cvs_update.php,v 1.8 2009/01/04 14:10:29 jpetso Exp $
3
4 /**
5 * @file
6 * Administrative page for handling updates from cvs module to
7 * versioncontrol_cvs module.
8 *
9 * Place this file in the root of your Drupal installation (ie, the same
10 * directory as index.php), point your browser to
11 * "http://yoursite/cvs_to_versioncontrol_cvs_update.php" and follow the
12 * instructions.
13 *
14 * If you are not logged in as administrator, you will need to modify the access
15 * check statement below. Change the TRUE to a FALSE to disable the access
16 * check. After finishing the upgrade, be sure to open this file and change the
17 * FALSE back to a TRUE!
18 */
19
20 // Enforce access checking?
21 $access_check = TRUE;
22
23 /**
24 * Convert CVS repositories.
25 */
26 function cvs_to_versioncontrol_cvs_update_1() {
27 $count = 0;
28 $repos = db_query("SELECT * FROM {cvs_repositories} ORDER BY rid");
29
30 while ($repo = db_fetch_object($repos)) {
31 db_query("INSERT INTO {versioncontrol_repositories} (repo_id, name, vcs, root, authorization_method, url_backend) VALUES (%d, '%s', '%s', '%s', '%s', '%s')", $repo->rid, $repo->name, 'cvs', $repo->root, 'versioncontrol_admin', 'versioncontrol_default_urls');
32 db_query("INSERT INTO {versioncontrol_repository_metadata} (repo_id, weight, registration_message) VALUES (%d, %d, '%s')", $repo->rid, $count, '');
33 // TODO: Best effort to convert the file/branch/tag placeholders to the new format.
34 $file_view = str_replace(array('%file', '%revision'), array('%path', '%revision'), $repo->newurl);
35 $diff = str_replace(array('%file', '%old', '%revision'), array('%path', '%old-revision', '%new-revision'), $repo->diffurl);
36 db_query("INSERT INTO {versioncontrol_repository_urls} (repo_id, commit_view, file_log_view, file_view, directory_view, diff, tracker) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s')", $repo->rid, '', '', $file_view, '', $diff, $repo->trackerurl);
37 db_query("INSERT INTO {versioncontrol_account_status_strings} (repo_id, default_condition_description, default_condition_error, motivation_description, user_notification_email, admin_notification_email, approved_email, pending_email, declined_email, disabled_email) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", $repo->rid, '', '', '', '', '', '', '', '', '');
38 db_query("INSERT INTO {versioncontrol_cvs_repositories} (repo_id, modules, update_method, updated, run_as_user) VALUES (%d, '%s', %d, %d, '%s')", $repo->rid, serialize(explode(' ', $repo->modules)), $repo->method, $repo->updated, serialize('drupal-cvs'));
39 $count++;
40 }
41
42 return array(array('success' => TRUE, 'query' => t('Converted @count repositories.', array('@count' => $count))));
43 }
44
45 /**
46 * Convert CVS users.
47 */
48 function cvs_to_versioncontrol_cvs_update_2() {
49
50 // This determines how many users will be processed in each batch run. A reasonable
51 // default has been chosen, but you may want to tweak depending on your setup.
52 $limit = 200;
53
54 // Multi-part update
55 if (!isset($_SESSION['cvs_to_versioncontrol_cvs_update_2'])) {
56 $_SESSION['cvs_to_versioncontrol_cvs_update_2'] = 0;
57 $_SESSION['cvs_to_versioncontrol_cvs_update_2_max'] = db_result(db_query("SELECT COUNT(*) FROM {cvs_accounts} WHERE cvs_user <> '' AND uid <> 0"));
58 }
59
60 $default_repo = $_SESSION['cvs_to_versioncontrol_cvs_update_default_repo'];
61
62 // Map CVS module statuses to Version Control API statuses.
63 $status_map = array(
64 CVS_PENDING => VERSIONCONTROL_ACCOUNT_STATUS_PENDING,
65 CVS_APPROVED => VERSIONCONTROL_ACCOUNT_STATUS_APPROVED,
66 CVS_DECLINED => VERSIONCONTROL_ACCOUNT_STATUS_DECLINED,
67 CVS_QUEUED => VERSIONCONTROL_ACCOUNT_STATUS_QUEUED,
68 CVS_DISABLED => VERSIONCONTROL_ACCOUNT_STATUS_DISABLED,
69 );
70
71 // Pull the next batch of users.
72 $cvs_accounts = db_query_range("SELECT * FROM {cvs_accounts} WHERE cvs_user <> '' AND uid <> 0 ORDER BY cvs_user", $_SESSION['cvs_to_versioncontrol_cvs_update_2'], $limit);
73
74 // Loop through each co-maintainer.
75 while ($cvs_account = db_fetch_object($cvs_accounts)) {
76 $repos = array();
77
78 // Pull the repos that the cvs user is associated with.
79 $user_repos = db_query("SELECT DISTINCT rid FROM {cvs_messages} WHERE cvs_user = '%s'", $cvs_account->cvs_user);
80 while ($user_repo = db_fetch_object($user_repos)) {
81 $repos[] = $user_repo->rid;
82 }
83 // Add default repo if one exists, and the user isn't associated with any other repos.
84 if (empty($repos) && $default_repo) {
85 $repos[] = $default_repo;
86 }
87 // Add a CVS user for each repo.
88 foreach ($repos as $repo) {
89 // This check is necessary because Version Control only allows one user account
90 // per Drupal user per repository, but CVS module did not have this restriction.
91 if (!db_result(db_query("SELECT uid FROM {versioncontrol_accounts} WHERE uid = %d AND repo_id = %d", $cvs_account->uid, $repo))) {
92 db_query("INSERT INTO {versioncontrol_accounts} (uid, repo_id, username) VALUES (%d, %d, '%s')", $cvs_account->uid, $repo, $cvs_account->cvs_user);
93 db_query("INSERT INTO {versioncontrol_cvs_accounts} (uid, repo_id, password) VALUES (%d, %d, '%s')", $cvs_account->uid, $repo, $cvs_account->pass);
94 db_query("INSERT INTO {versioncontrol_account_status_users} (uid, repo_id, motivation, status) VALUES (%d, %d, '%s', %d)", $cvs_account->uid, $repo, $cvs_account->motivation, $status_map[$cvs_account->status]);
95 }
96 }
97
98 $_SESSION['cvs_to_versioncontrol_cvs_update_2']++;
99
100 }
101
102 if ($_SESSION['cvs_to_versioncontrol_cvs_update_2'] >= $_SESSION['cvs_to_versioncontrol_cvs_update_2_max']) {
103 $count = $_SESSION['cvs_to_versioncontrol_cvs_update_2_max'];
104 unset($_SESSION['cvs_to_versioncontrol_cvs_update_2']);
105 unset($_SESSION['cvs_to_versioncontrol_cvs_update_2_max']);
106 unset($_SESSION['cvs_to_versioncontrol_cvs_update_default_repo']);
107 return array(array('success' => TRUE, 'query' => t('Converted @count CVS user entries.', array('@count' => $count))));
108 }
109 return array('#finished' => $_SESSION['cvs_to_versioncontrol_cvs_update_2'] / $_SESSION['cvs_to_versioncontrol_cvs_update_2_max']);
110 }
111
112 /**
113 * Convert project repository data.
114 */
115 function cvs_to_versioncontrol_cvs_update_3() {
116
117 // This determines how many projects will be processed in each batch run. A reasonable
118 // default has been chosen, but you may want to tweak depending on your setup.
119 $limit = 100;
120
121 // Multi-part update
122 if (!isset($_SESSION['cvs_to_versioncontrol_cvs_update_3'])) {
123 $_SESSION['cvs_to_versioncontrol_cvs_update_3'] = 0;
124 $_SESSION['cvs_to_versioncontrol_cvs_update_3_max'] = db_result(db_query("SELECT COUNT(*) FROM {cvs_projects}"));
125 }
126
127 // Pull the next batch of users.
128 $projects = db_query_range("SELECT p.nid, p.rid, p.directory, r.modules FROM {cvs_projects} p INNER JOIN {cvs_repositories} r ON p.rid = r.rid ORDER BY p.nid", $_SESSION['cvs_to_versioncontrol_cvs_update_3'], $limit);
129
130 // Loop through each project.
131 while ($project = db_fetch_object($projects)) {
132 // Add the repo module, and chop off the trailing slash.
133 $directory = '/'. trim($project->modules) .
134 drupal_substr($project->directory, 0, drupal_strlen($project->directory) - 1);
135 db_query("INSERT INTO {versioncontrol_project_projects} (nid, repo_id, directory) VALUES (%d, %d, '%s')", $project->nid, $project->rid, $directory);
136 $_SESSION['cvs_to_versioncontrol_cvs_update_3']++;
137 }
138
139 if ($_SESSION['cvs_to_versioncontrol_cvs_update_3'] >= $_SESSION['cvs_to_versioncontrol_cvs_update_3_max']) {
140 $count = $_SESSION['cvs_to_versioncontrol_cvs_update_3_max'];
141 unset($_SESSION['cvs_to_versioncontrol_cvs_update_3']);
142 unset($_SESSION['cvs_to_versioncontrol_cvs_update_3_max']);
143 return array(array('success' => TRUE, 'query' => t('Converted @count project repository entries.', array('@count' => $count))));
144 }
145 return array('#finished' => $_SESSION['cvs_to_versioncontrol_cvs_update_3'] / $_SESSION['cvs_to_versioncontrol_cvs_update_3_max']);
146 }
147
148 /**
149 * Perform one update and store the results which will later be displayed on
150 * the finished page.
151 *
152 * @param $module
153 * The module whose update will be run.
154 * @param $number
155 * The update number to run.
156 *
157 * @return
158 * TRUE if the update was finished. Otherwise, FALSE.
159 */
160 function update_data($module, $number) {
161
162 $function = "cvs_to_versioncontrol_cvs_update_$number";
163 $ret = $function();
164
165 // Assume the update finished unless the update results indicate otherwise.
166 $finished = 1;
167 if (isset($ret['#finished'])) {
168 $finished = $ret['#finished'];
169 unset($ret['#finished']);
170 }
171
172 // Save the query and results for display by update_finished_page().
173 if (!isset($_SESSION['update_results'])) {
174 $_SESSION['update_results'] = array();
175 }
176 if (!isset($_SESSION['update_results'][$module])) {
177 $_SESSION['update_results'][$module] = array();
178 }
179 if (!isset($_SESSION['update_results'][$module][$number])) {
180 $_SESSION['update_results'][$module][$number] = array();
181 }
182 $_SESSION['update_results'][$module][$number] = array_merge($_SESSION['update_results'][$module][$number], $ret);
183
184 return $finished;
185 }
186
187 function update_selection_page() {
188 $output = '';
189 $output .= '<p>Click Update to start the update process.</p>';
190
191 drupal_set_title('CVS module to Version Control/CVS module update');
192 // Use custom update.js.
193 drupal_add_js(update_js(), 'inline');
194 $output .= drupal_get_form('update_script_selection_form');
195
196 return $output;
197 }
198
199 function update_script_selection_form() {
200 $form = array();
201
202 $options = array(0 => '<none>');
203 $repos = db_query("SELECT rid, name FROM {cvs_repositories}");
204 while ($repo = db_fetch_object($repos)) {
205 $options[$repo->rid] = check_plain($repo->name);
206 }
207 if (count($options) > 1) {
208 $form['default_repo'] = array(
209 '#type' => 'select',
210 '#title' => 'Default repository',
211 '#options' => $options,
212 '#description' => 'The script can only migrate CVS user accounts if the CVS user has previously made at least one commit to a repository for which they have access. If a CVS user has never made a commit to any repository, you can add them to a default repository by selecting one above. If you leave this set to &lt;none&gt;, then CVS user accounts in this category will not be migrated',
213 );
214 }
215 else {
216 $form['default_repo'] = array(
217 '#type' => 'value',
218 '#value' => 0,
219 );
220 }
221
222 $form['has_js'] = array(
223 '#type' => 'hidden',
224 '#default_value' => FALSE,
225 '#attributes' => array('id' => 'edit-has_js'),
226 );
227 $form['submit'] = array(
228 '#type' => 'submit',
229 '#value' => 'Update',
230 );
231 return $form;
232 }
233
234 function update_update_page() {
235 // Set the installed version so updates start at the correct place.
236 $_SESSION['update_remaining'][] = array('module' => 'versioncontrol_cvs', 'version' => 1);
237 $_SESSION['update_remaining'][] = array('module' => 'versioncontrol_cvs', 'version' => 2);
238
239 // Set the default repo.
240 $_SESSION['cvs_to_versioncontrol_cvs_update_default_repo'] = $_POST['default_repo'];
241
242 // Keep track of total number of updates
243 if (isset($_SESSION['update_remaining'])) {
244 $_SESSION['update_total'] = count($_SESSION['update_remaining']);
245 }
246
247 if ($_POST['has_js']) {
248 return update_progress_page();
249 }
250 else {
251 return update_progress_page_nojs();
252 }
253 }
254
255 function update_progress_page() {
256 // Prevent browser from using cached drupal.js or update.js
257 drupal_add_js('misc/progress.js', 'core', 'header', FALSE, TRUE);
258 drupal_add_js(update_js(), 'inline');
259
260 drupal_set_title('Updating');
261 $output = '<div id="progress"></div>';
262 $output .= '<p id="wait">Please wait while your site is being updated.</p>';
263 return $output;
264 }
265
266 /**
267 * Can't include misc/update.js, because it makes a direct call to update.php.
268 *
269 * @return unknown
270 */
271 function update_js() {
272 return "
273 if (Drupal.jsEnabled) {
274 $(document).ready(function() {
275 $('#edit-has-js').each(function() { this.value = 1; });
276 $('#progress').each(function () {
277 var holder = this;
278
279 // Success: redirect to the summary.
280 var updateCallback = function (progress, status, pb) {
281 if (progress == 100) {
282 pb.stopMonitoring();
283 window.location = window.location.href.split('op=')[0] +'op=finished';
284 }
285 }
286
287 // Failure: point out error message and provide link to the summary.
288 var errorCallback = function (pb) {
289 var div = document.createElement('p');
290 div.className = 'error';
291 $(div).html('An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href=\"cvs_to_versioncontrol_cvs_update.php?op=error\">update summary</a>');
292 $(holder).prepend(div);
293 $('#wait').hide();
294 }
295
296 var progress = new Drupal.progressBar('updateprogress', updateCallback, \"POST\", errorCallback);
297 progress.setProgress(-1, 'Starting updates');
298 $(holder).append(progress.element);
299 progress.startMonitoring('cvs_to_versioncontrol_cvs_update.php?op=do_update', 0);
300 });
301 });
302 }
303 ";
304 }
305
306 /**
307 * Perform updates for one second or until finished.
308 *
309 * @return
310 * An array indicating the status after doing updates. The first element is
311 * the overall percentage finished. The second element is a status message.
312 */
313 function update_do_updates() {
314 while (isset($_SESSION['update_remaining']) && ($update = reset($_SESSION['update_remaining']))) {
315 $update_finished = update_data($update['module'], $update['version']);
316 if ($update_finished == 1) {
317 // Dequeue the completed update.
318 unset($_SESSION['update_remaining'][key($_SESSION['update_remaining'])]);
319 $update_finished = 0; // Make sure this step isn't counted double
320 }
321 if (timer_read('page') > 1000) {
322 break;
323 }
324 }
325
326 if ($_SESSION['update_total']) {
327 $percentage = floor(($_SESSION['update_total'] - count($_SESSION['update_remaining']) + $update_finished) / $_SESSION['update_total'] * 100);
328 }
329 else {
330 $percentage = 100;
331 }
332
333 // When no updates remain, clear the caches in case the data has been updated.
334 if (!isset($update['module'])) {
335 cache_clear_all('*', 'cache', TRUE);
336 cache_clear_all('*', 'cache_page', TRUE);
337 cache_clear_all('*', 'cache_menu', TRUE);
338 cache_clear_all('*', 'cache_filter', TRUE);
339 drupal_clear_css_cache();
340 }
341
342 return array($percentage, isset($update['module']) ? 'Updating '. $update['module'] .' module' : 'Updating complete');
343 }
344
345 /**
346 * Perform updates for the JS version and return progress.
347 */
348 function update_do_update_page() {
349 global $conf;
350
351 // HTTP Post required
352 if ($_SERVER['REQUEST_METHOD'] != 'POST') {
353 drupal_set_message('HTTP Post is required.', 'error');
354 drupal_set_title('Error');
355 return '';
356 }
357
358 // Error handling: if PHP dies, the output will fail to parse as JSON, and
359 // the Javascript will tell the user to continue to the op=error page.
360 list($percentage, $message) = update_do_updates();
361 print drupal_to_js(array('status' => TRUE, 'percentage' => $percentage, 'message' => $message));
362 }
363
364 /**
365 * Perform updates for the non-JS version and return the status page.
366 */
367 function update_progress_page_nojs() {
368 drupal_set_title('Updating');
369
370 $new_op = 'do_update';
371 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
372 // Error handling: if PHP dies, it will output whatever is in the output
373 // buffer, followed by the error message.
374 ob_start();
375 $fallback = '<p class="error">An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="cvs_to_versioncontrol_cvs_update.php?op=error">update summary</a>.</p>';
376 print theme('maintenance_page', $fallback, FALSE, TRUE);
377
378 list($percentage, $message) = update_do_updates();
379 if ($percentage == 100) {
380 $new_op = 'finished';
381 }
382
383 // Updates successful; remove fallback
384 ob_end_clean();
385 }
386 else {
387 // Abort the update if the necessary modules aren't installed.
388 if (!module_exists('versioncontrol') || !module_exists('versioncontrol_cvs') || !module_exists('cvs')) {
389 print update_finished_page(FALSE);
390 return NULL;
391 }
392
393 // This is the first page so return some output immediately.
394 $percentage = 0;
395 $message = 'Starting updates';
396 }
397
398 drupal_set_html_head('<meta http-equiv="Refresh" content="0; URL=cvs_to_versioncontrol_cvs_update.php?op='. $new_op .'">');
399 $output = theme('progress_bar', $percentage, $message);
400 $output .= '<p>Updating your site will take a few seconds.</p>';
401
402 // Note: do not output drupal_set_message()s until the summary page.
403 print theme('maintenance_page', $output, FALSE);
404 return NULL;
405 }
406
407 function update_finished_page($success) {
408 drupal_set_title('CVS module to Version Control/CVS module update.');
409 // NOTE: we can't use l() here because the URL would point to 'update.php?q=admin'.
410 $links[] = '<a href="'. base_path() .'">Main page</a>';
411 $links[] = '<a href="'. base_path() .'?q=admin">Administration pages</a>';
412
413 // Report end result
414 if ($success) {
415 $output = '<p>Updates were attempted. If you see no failures below, you should remove cvs_to_versioncontrol_cvs_update.php from your Drupal root directory. Otherwise, you may need to update your database manually. All errors have been <a href="index.php?q=admin/reports/dblog">logged</a>.</p>';
416 }
417 else {
418 $output = '<p class="error">The update process was aborted prematurely. All other errors have been <a href="index.php?q=admin/reports/dblog">logged</a>. You may need to check the <code>watchdog</code> database table manually.</p>';
419 $output .= '<p class="error">This has most likely occurred because the Version Control/CVS module or the old CVS module is not <a href="index.php?q=admin/build/modules">properly installed</a>.</p>';
420 }
421
422 $output .= theme('item_list', $links);
423
424 if ($success) {
425 $output .= "<h4>Some things to take care of now:</h4>\n";
426 $output .= "<ul>\n";
427 $output .= "<li>Visit the <a href=\"index.php?q=admin/project/versioncontrol-repositories\">Version Control repository administration page</a>, click 'Edit' for each of your repositories, and check the settings -- the script may not have migrated them all correctly, and there are also new settings that weren't supported in the CVS module.</li>\n";
428 $output .= "<li>Visit the <a href=\"index.php?q=admin/project/versioncontrol-settings\">Version control settings page</a>, and make any necessary adjustments.</li>\n";
429 $output .= "<li>If you're all done with the old CVS module, <a href=\"index.php?q=admin/build/modules\">disable/uninstall it</a>.</li>\n";
430 $output .= "</ul>\n";
431 }
432
433 // Output a list of queries executed
434 if (!empty($_SESSION['update_results'])) {
435 $output .= '<div id="update-results">';
436 $output .= '<h2>The following queries were executed</h2>';
437 foreach ($_SESSION['update_results'] as $module => $updates) {
438 $output .= '<h3>'. $module .' module</h3>';
439 foreach ($updates as $number => $queries) {
440 $output .= '<h4>Update #'. $number .'</h4>';
441 $output .= '<ul>';
442 foreach ($queries as $query) {
443 if ($query['success']) {
444 $output .= '<li class="success">'. $query['query'] .'</li>';
445 }
446 else {
447 $output .= '<li class="failure"><strong>Failed:</strong> '. $query['query'] .'</li>';
448 }
449 }
450 if (!count($queries)) {
451 $output .= '<li class="none">No queries</li>';
452 }
453 $output .= '</ul>';
454 }
455 }
456 $output .= '</div>';
457 unset($_SESSION['update_results']);
458 }
459
460 return $output;
461 }
462
463 function update_info_page() {
464 drupal_set_title('CVS module to Version Control/CVS module update.');
465 $output = "<ol>\n";
466 $output .= "<li>Use this script to <strong>upgrade an existing CVS module installation to the Version Control/CVS module</strong>. You don't need this script when installing Version Control/CVS from scratch.</li>";
467 $output .= "<li>Before doing anything, backup your database. This process will change your database and its values.</li>\n";
468 $output .= "<li>Make sure the Version Control/CVS module and the old CVS module are <a href=\"index.php?q=admin/build/modules\">properly installed</a>.</li>\n";
469 $output .= "<li>Make sure this file is placed in the root of your Drupal installation (the same directory that index.php is in) and <a href=\"cvs_to_versioncontrol_cvs_update.php?op=selection\">run the database upgrade script</a>. <strong>Don't upgrade your database twice as it will cause problems!</strong></li>\n";
470 $output .= "</ol>";
471 $output .= "<h2>Caveats</h2>\n";
472 $output .= "<ul>\n";
473 $output .= "<li>Version Control API only allows one CVS user per Drupal user account for each repository, so only the first CVS user account will be migrated if there are duplicates</li>\n";
474 $output .= "<li>The anonymous user (uid 0) will not be migrated.</li>\n";
475 $output .= "<li>The script may not accurately translate the URL information for CVS web links.</li>\n";
476 $output .= "<li>For purposes of generating CVSROOT/passwd, the 'run as user' will be 'drupal-cvs' -- to change the user, manually edit the value in <code>function cvs_to_versioncontrol_cvs_update_1()</code></li>\n";
477 $output .= "<li>While Version Control API has support for recording deletion of files, the CVS module does not -- only file addition and modification data will be migrated.</li>\n";
478 $output .= "<li>While Version Control API has support for recording metadata about branching and tagging operations, CVS module does not -- no data will be migrated in this sense.</li>\n";
479 $output .= "</ul>\n";
480 return $output;
481 }
482
483 function update_access_denied_page() {
484 drupal_set_title('Access denied');
485 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>cvs_to_versioncontrol_cvs_update.php</code> to bypass this access check. To do this:</p>
486 <ol>
487 <li>With a text editor find the cvs_to_versioncontrol_cvs_update.php file on your system. It should be in the main Drupal directory that you installed all the files into.</li>
488 <li>There is a line near top of cvs_to_versioncontrol_cvs_update.php that says <code>$access_check = TRUE;</code>. Change it to <code>$access_check = FALSE;</code>.</li>
489 <li>As soon as the update is done, you should remove cvs_to_versioncontrol_cvs_update.php from your main installation directory.</li>
490 </ol>';
491 }
492
493 include_once './includes/bootstrap.inc';
494
495 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
496 drupal_maintenance_theme();
497
498 // Access check:
499 if (($access_check == FALSE) || ($user->uid == 1)) {
500
501 $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
502 switch ($op) {
503 case 'Update':
504 $output = update_update_page();
505 break;
506
507 case 'finished':
508 $output = update_finished_page(TRUE);
509 break;
510
511 case 'error':
512 $output = update_finished_page(FALSE);
513 break;
514
515 case 'do_update':
516 $output = update_do_update_page();
517 break;
518
519 case 'do_update_nojs':
520 $output = update_progress_page_nojs();
521 break;
522
523 case 'selection':
524 $output = update_selection_page();
525 break;
526
527 default:
528 $output = update_info_page();
529 break;
530 }
531 }
532 else {
533 $output = update_access_denied_page();
534 }
535
536 if (isset($output)) {
537 print theme('maintenance_page', $output);
538 }

  ViewVC Help
Powered by ViewVC 1.1.2