/
update_ecom.php
77 lines (68 loc) · 2.23 KB
/
update_ecom.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
75
76
77
<?php
##################################################
#
# Copyright (c) 2004-2014 OIC Group, Inc.
#
# 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.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################
/**
* @subpackage Upgrade
* @package Installation
*/
/**
* This is the class update_ecom
*/
class update_ecom extends upgradescript {
protected $from_version = '0.0.0'; // version number lower than first released version, 2.0.0
protected $to_version = '2.0.9'; // code was changed in 2.0.9
/**
* name/title of upgrade script
* @return string
*/
static function name() { return "Updates e-Commerce header/footer to new format"; }
/**
* generic description of upgrade script
* @return string
*/
function description() { return "In v2.0.9, the e-Commerce header/footer configuration was revised. This Script updates those entries."; }
/**
* additional test(s) to see if upgrade script should be run
* @return bool
*/
function needed() {
$config = new expConfig(expCore::makeLocation("ecomconfig","@globalstoresettings",""));
if (ecom_active() && (!empty($config->config['header']) || !empty($config->config['footer']))) {
return true;
} else return false;
}
/**
* updates new ecom header/footer properties/fields
* @return bool
*/
function upgrade() {
$fixed = 0;
$config = new expConfig(expCore::makeLocation("ecomconfig","@globalstoresettings",""));
if (!empty($config->config['header'])) {
$config->config['ecomheader'] = $config->config['header'];
unset ($config->config['header']);
$fixed++;
}
if (!empty($config->config['footer'])) {
$config->config['ecomfooter'] = $config->config['footer'];
unset ($config->config['footer']);
$fixed++;
}
$config->update(array('config'=>$config->config));
return ($fixed?$fixed:gt('No')).' '.gt('e-Commerce settings were corrected');
}
}
?>