Dotclear

source: inc/dbschema/upgrade-cli.php @ 3162:8a0aaa8b643b

Revision 3162:8a0aaa8b643b, 1.2 KB checked in by franck <carnet.franck.paul@…>, 9 years ago (diff)

Better this way (and also allows use of settings2array() and prefs2array() available for everybody)

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-2013 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 -----------------------------------------
13if (!defined('DC_RC_PATH')) { return; }
14
15try
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
34     echo "Starting upgrade process\n";
35     $core->con->begin();
36     try {
37          $changes = dcUpgrade::dotclearUpgrade($core);
38     } catch (Exception $e) {
39          $core->con->rollback();
40          throw $e;
41     }
42     $core->con->commit();
43     echo 'Upgrade process successfully completed ('.$changes."). \n";
44     exit(0);
45}
46catch (Exception $e)
47{
48     echo $e->getMessage()."\n";
49     exit(1);
50}
51?>
Note: See TracBrowser for help on using the repository browser.

Sites map