-
Notifications
You must be signed in to change notification settings - Fork 24
/
version_tracking.php
70 lines (63 loc) · 2.15 KB
/
version_tracking.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
<?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 version_tracking 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 version_tracking
*
* @subpackage Upgrade
* @package Installation
*/
class version_tracking extends upgradescript {
protected $from_version = '1.99.0';
// protected $to_version = '99';
/**
* name/title of upgrade script
* @return string
*/
function name() { return "Install Version Tracking"; }
/**
* generic description of upgrade script
* @return string
*/
function description() { return "Beginning with Exponent 2.0.0 Beta3, the system begins keeping track of its versions and upgrades."; }
/**
* additional test(s) to see if upgrade script should be run
* @return bool
*/
function needed($version) {
global $db;
// we'll run when versions are equal since we may be doing an iteration update
$ver = $db->selectObject('version','created_at=(select max(created_at) from '.DB_TABLE_PREFIX.'_version)');
return ($ver->version <= $version) ? true : false;
}
/**
* adds or updates version tracking information in database
* @return bool
*/
function upgrade() {
global $db;
// $version = EXPONENT_VERSION_MAJOR.'.'.EXPONENT_VERSION_MINOR.'.'.EXPONENT_VERSION_REVISION.'-'.EXPONENT_VERSION_TYPE.''.EXPONENT_VERSION_ITERATION;
$vo = null;
$vo->version = EXPONENT_VERSION_MAJOR.'.'.EXPONENT_VERSION_MINOR.'.'.EXPONENT_VERSION_REVISION;
$vo->type = EXPONENT_VERSION_TYPE.EXPONENT_VERSION_ITERATION;
$vo->builddate = EXPONENT_VERSION_BUILDDATE;
$vo->created_at = time();
$ins = $db->insertObject($vo,'version') or die(mysql_error());
return $ins ? gt('Success') : gt('Failed');
}
}
?>