root/tags/MvBlog-2.1/upgrade.php

Revision 521, 1.6 KB (checked in by michiel, 18 months ago)

Updating files for release 2.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 2.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["dbversion"]) && $updater->settings["dbversion"])
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$patches = $updater->get_patchfiles($mode);
38if (!count($patches))
39    die("nothing to do. Your mvblog is already up-to-date.");
40
41foreach ($patches as $patch) {
42    if (!$updater->apply_dbpatch($patch, $mode))
43        die("something went wrong with patchfile $patch. Rollback to backup.");
44    echo "applied patchfile $patch. <br>";
45    /* put last version in var so we can update settings table later */
46    if ($updater->lastpatch > $latest_version)
47        $latest_version = $updater->lastpatch;
48}
49$updater->set_latest_version($latest_version);
50echo "Your MvBlog installation is updated. Have fun.";
51?>
Note: See TracBrowser for help on using the browser.