3
class Step23 extends UpgradeStep
8
$SQL = "UPDATE `setting` SET `value` = '%d' WHERE `setting`.`setting` = 'MAINTENANCE_ENABLED' LIMIT 1";
9
$SQL = sprintf($SQL, $this->db->escape_string($this->a[0]));
10
$this->db->query($SQL);
12
$SQL = "UPDATE `setting` SET `value` = '%d' WHERE `setting`.`setting` = 'MAINTENANCE_LOG_MAXAGE' LIMIT 1";
13
$SQL = sprintf($SQL, $this->db->escape_string($this->a[1]));
14
$this->db->query($SQL);
16
$SQL = "UPDATE `setting` SET `value` = '%d' WHERE `setting`.`setting` = 'MAINTENANCE_STAT_MAXAGE' LIMIT 1";
17
$SQL = sprintf($SQL, $this->db->escape_string($this->a[2]));
18
$this->db->query($SQL);
20
$SQL = "UPDATE `setting` SET `value` = '%d' WHERE `setting`.`setting` = 'MAINTENANCE_EMAIL_ALERTS' LIMIT 1";
21
$SQL = sprintf($SQL, $this->db->escape_string($this->a[3]));
22
$this->db->query($SQL);
24
$SQL = "UPDATE `setting` SET `value` = '%s' WHERE `setting`.`setting` = 'mail_to' LIMIT 1";
25
$SQL = sprintf($SQL, $this->db->escape_string($this->a[4]));
26
$this->db->query($SQL);
28
$SQL = "UPDATE `setting` SET `value` = '%s' WHERE `setting`.`setting` = 'mail_from' LIMIT 1";
29
$SQL = sprintf($SQL, $this->db->escape_string($this->a[5]));
30
$this->db->query($SQL);
32
$SQL = "UPDATE `setting` SET `value` = '%d' WHERE `setting`.`setting` = 'MAINTENANCE_ALERT_TOUT' LIMIT 1";
33
$SQL = sprintf($SQL, $this->db->escape_string($this->a[6]));
34
$this->db->query($SQL);
39
public function Questions()
41
// TODO: Fix the "more info" URL to a page in the wiki
42
$this->q[0]['question'] = "Allow the periodic maintenance and alerts script to run if called. See <a href=\"http://wiki.xibo.org.uk/wiki/Manual:Admin:Settings_Help#Maintenance\">here</a> for more information.";
43
$this->q[0]['type'] = _CHECKBOX;
44
$this->q[0]['default'] = true;
45
$this->q[1]['question'] = "How long in days should we keep log data for? 0 keeps logs indefinitely. (Requires maintenance script to be run to work)";
46
$this->q[1]['type'] = _INPUTBOX;
47
$this->q[1]['default'] = "30";
48
$this->q[2]['question'] = "How long in days should we keep statistics for? 0 keeps statistics indefinitely. (Requires maintenance script to be run to work)";
49
$this->q[2]['type'] = _INPUTBOX;
50
$this->q[2]['default'] = "30";
51
$this->q[3]['question'] = "Should the maintenance and alerts script notify you by email of problems?";
52
$this->q[3]['type'] = _CHECKBOX;
53
$this->q[3]['default'] = true;
54
$this->q[4]['question'] = "Email address to send alerts to";
55
$this->q[4]['type'] = _INPUTBOX;
56
$this->q[4]['default'] = "admin@yourdomain.com";
57
$this->q[5]['question'] = "Email address alerts should be sent from";
58
$this->q[5]['type'] = _INPUTBOX;
59
$this->q[5]['default'] = "xibo@yourdomain.com";
60
$this->q[6]['question'] = "How long in minutes after the last time a client connects should we send an alert? (Can be overridden on each display)";
61
$this->q[6]['type'] = _INPUTBOX;
62
$this->q[6]['default'] = "12";
66
public function ValidateQuestion($questionNumber,$response)
68
switch ($questionNumber) {
70
if (\Kit::ValidateParam($response, _BOOL)) {
71
$this->a[0] = "Protected";
78
$this->a[1] = \Kit::ValidateParam($response, _INT, 30);
81
$this->a[2] = \Kit::ValidateParam($response, _INT, 30);
84
$this->a[3] = \Kit::ValidateParam($response, _BOOL);
87
// TODO: Teach \Kit how to validate email addresses?
88
$this->a[4] = \Kit::ValidateParam($response, _PASSWORD);
91
// TODO: Teach \Kit how to validate email addresses?
92
$this->a[5] = \Kit::ValidateParam($response, _PASSWORD);
95
$this->a[6] = \Kit::ValidateParam($response, _INT, 12);