root/tags/MvBlog-3.0.1/upgrade.php

Revision 746, 1.7 KB (checked in by michiel, 13 months ago)

Updating files for release 3.0.1

Line 
1<?php
2/**
3 * MvBlog -- An open source no-nosense blogtool
4 *
5 * Copyright (C) 2005-2007, Michiel van Baak
6 * Michiel van Baak <mvanbaak@users.sourceforge.net>
7 *
8 * See http://dev.mvblog.org for more information on MvBlog.
9 * That page also provides Bugtrackers, Filereleases etc.
10 *
11 * This program is free software, distributed under the terms of
12 * the GNU General Public License Version 2. See the LICENSE file
13 * at the top of the source tree.
14 *
15 * @package MvBlog
16 * @author Michiel van Baak
17 * @version 3.0.1
18 * @copyright 2005-2007 Michiel van Baak
19 */
20/**
21 * Uprade mvblog to the latest version
22 */
23if (array_key_exists("mode", $_REQUEST))
24    $mode = $_REQUEST["mode"];
25else
26    $mode = "";
27
28require_once("common/mvblog_upgrade.php");
29$updater = new Mvblog_upgrade();
30
31if (array_key_exists("dbversion", $updater->settings))
32    $latest_version = $updater->settings["dbversion"];
33else
34    $latest_version = 0;
35
36echo "looking up files for db type <b>".$updater->db->phptype."</b> starting at version <b>".$latest_version."</b>...<br />";
37
38
39$patches = $updater->get_patchfiles($mode);
40if (!count($patches))
41    die("nothing to do. Your mvblog is already up-to-date.");
42
43echo "Creating backup of your current database<br />";
44$backup = $updater->create_backups();
45
46foreach ($patches as $patch) {
47    if (!$updater->apply_dbpatch($patch, $mode))
48        die("something went wrong with patchfile $patch. Rollback to backup.");
49    echo "applied patchfile $patch. <br>";
50    /* put last version in var so we can update settings table later */
51    if ($updater->lastpatch > $latest_version)
52        $latest_version = $updater->lastpatch;
53}
54$updater->set_latest_version($latest_version);
55echo "Your MvBlog installation is updated. Have fun.";
56?>
Note: See TracBrowser for help on using the browser.