-
Notifications
You must be signed in to change notification settings - Fork 24
/
upgradescript.php
74 lines (67 loc) · 1.91 KB
/
upgradescript.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* This file is part of Exponent
* Exponent is free software; you can redistribute
* it and/or modify it under the terms of the GNU
* General Public License as published by the Free
* Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The file that holds the upgradescript class
*
* @link http://www.gnu.org/licenses/gpl.txt GPL http://www.gnu.org/licenses/gpl.txt
* @package Exponent-CMS
* @copyright 2004-2011 OIC Group, Inc.
* @author Adam Kessler <adam@oicgroup.net>
* @version 2.0.0
*/
/**
* This is the class upgradescript
*
* @subpackage Upgrade
* @package Installation
*/
class upgradescript {
protected $from_version = '9999.99.99'; //set this default ridiculously high so that it NEVER runs
protected $to_version = '9999.99.99'; //set this default to something ridiculously high so it always runs
/**
* name/title of upgrade script
* @return string
*/
function name() { return "Base Model for the Upgrade Scripts"; }
/**
* generic description of upgrade script
* @return string
*/
function description() { return "This Script attempts to ".$this->name(); }
/**
* test version number (code vs database) to see if upgrade script should be run
* @param $version
* @return bool
*/
function checkVersion($version) {
// if this upgrade applies to only one version then check to see if we have a match
if ($this->from_version == $this->to_version && $version == $this->from_version) {
return true;
} elseif ($version >= $this->from_version && $version <= $this->to_version) {
return true;
} else {
return false;
}
}
/**
* additional test(s) to see if upgrade script should be run
* @return bool
*/
function needed() {
return false; // subclasses MUST return true to be run
}
/**
* main routine of upgrade script to upgrade Exponent
* @return bool
*/
function upgrade() {
return false;
}
}
?>