| Line | |
|---|
| 1 | #!/usr/bin/env php |
|---|
| 2 | <?php |
|---|
| 3 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 4 | # |
|---|
| 5 | # This file is part of Dotclear 2. |
|---|
| 6 | # |
|---|
| 7 | # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear |
|---|
| 8 | # Licensed under the GPL version 2.0 license. |
|---|
| 9 | # See LICENSE file or |
|---|
| 10 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 11 | # |
|---|
| 12 | # -- END LICENSE BLOCK ----------------------------------------- |
|---|
| 13 | if (!defined('DC_RC_PATH')) { return; } |
|---|
| 14 | |
|---|
| 15 | try |
|---|
| 16 | { |
|---|
| 17 | if (isset($_SERVER['argv'][1])) { |
|---|
| 18 | $dc_conf = $_SERVER['argv'][1]; |
|---|
| 19 | } elseif (isset($_SERVER['DC_RC_PATH'])) { |
|---|
| 20 | $dc_conf = realpath($_SERVER['DC_RC_PATH']); |
|---|
| 21 | } else { |
|---|
| 22 | $dc_conf = dirname(__FILE__).'/../config.php'; |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | if (!is_file($dc_conf)) { |
|---|
| 26 | throw new Exception(sprintf('%s is not a file',$dc_conf)); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | $_SERVER['DC_RC_PATH'] = $dc_conf; |
|---|
| 30 | unset($dc_conf); |
|---|
| 31 | |
|---|
| 32 | require dirname(__FILE__).'/../prepend.php'; |
|---|
| 33 | require dirname(__FILE__).'/upgrade.php'; |
|---|
| 34 | |
|---|
| 35 | echo "Starting upgrade process\n"; |
|---|
| 36 | $core->con->begin(); |
|---|
| 37 | try { |
|---|
| 38 | $changes = dotclearUpgrade(&$core); |
|---|
| 39 | } catch (Exception $e) { |
|---|
| 40 | $core->con->rollback(); |
|---|
| 41 | throw $e; |
|---|
| 42 | } |
|---|
| 43 | $core->con->commit(); |
|---|
| 44 | echo 'Upgrade process successfully completed ('.$changes."). \n"; |
|---|
| 45 | exit(0); |
|---|
| 46 | } |
|---|
| 47 | catch (Exception $e) |
|---|
| 48 | { |
|---|
| 49 | echo $e->getMessage()."\n"; |
|---|
| 50 | exit(1); |
|---|
| 51 | } |
|---|
| 52 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.