~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to install/database/23.php

  • Committer: Dan Garner
  • Date: 2015-09-29 15:16:59 UTC
  • mto: (454.2.11) (471.2.2)
  • mto: This revision was merged to the branch mainline in revision 468.
  • Revision ID: git-v1:ae24387a7b1397750b6ec86d0f286373da05eb16
Fixed Display Version Information Form (not showing media name)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
class Step23 extends UpgradeStep
 
4
{
 
5
 
 
6
        public function Boot()
 
7
        {
 
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);
 
11
 
 
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);
 
15
 
 
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);
 
19
 
 
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);
 
23
 
 
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);
 
27
 
 
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);
 
31
 
 
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);
 
35
 
 
36
                return true;
 
37
        }
 
38
 
 
39
        public function Questions()
 
40
        {
 
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";
 
63
                return $this->q;
 
64
        }
 
65
 
 
66
        public function ValidateQuestion($questionNumber,$response)
 
67
        {
 
68
                switch ($questionNumber) {
 
69
                        case 0:
 
70
                if (\Kit::ValidateParam($response, _BOOL)) {
 
71
                    $this->a[0] = "Protected";
 
72
                }
 
73
                else {
 
74
                    $this->a[0] = "Off";
 
75
                }
 
76
                                return true;
 
77
            case 1:
 
78
                $this->a[1] = \Kit::ValidateParam($response, _INT, 30);
 
79
                return true;
 
80
            case 2:
 
81
                $this->a[2] = \Kit::ValidateParam($response, _INT, 30);
 
82
                return true;
 
83
            case 3:
 
84
                $this->a[3] = \Kit::ValidateParam($response, _BOOL);
 
85
                return true;
 
86
            case 4:
 
87
                // TODO: Teach \Kit how to validate email addresses?
 
88
                $this->a[4] = \Kit::ValidateParam($response, _PASSWORD);
 
89
                return true;
 
90
            case 5:
 
91
                // TODO: Teach \Kit how to validate email addresses?
 
92
                $this->a[5] = \Kit::ValidateParam($response, _PASSWORD);
 
93
                return true;
 
94
            case 6:
 
95
                $this->a[6] = \Kit::ValidateParam($response, _INT, 12);
 
96
                return true;
 
97
                }
 
98
 
 
99
                return false;
 
100
        }
 
101
}
 
102
 
 
103
?>