GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 4ccb09...2f9dc2 )
by Nicolas
03:16
created

migration_270   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getVersion() 0 4 1
A getReleaseNotes() 0 4 1
B upgrade() 0 40 2
1
<?php
2
3
    class migration_270 extends Migration
4
    {
5
        public static function getVersion()
6
        {
7
            return '2.7.0';
8
        }
9
10
        public static function getReleaseNotes()
11
        {
12
            return 'http://getsymphony.com/download/releases/version/2.7.0/';
13
        }
14
15
        public static function upgrade()
16
        {
17
            // Update `pre_populate` replace "yes" with "now"
18
            // Update `pre_populate` replace "no" or NULL with ""
19
            try {
20
                Symphony::Database()->query('
21
                        UPDATE `tbl_fields_date` SET `pre_populate` = "now" WHERE `pre_populate`= "yes";
22
                ');
23
                Symphony::Database()->query('
24
                        UPDATE `tbl_fields_date` SET `pre_populate` = NULL WHERE `pre_populate` = "no" OR `pre_populate` = ""
25
                ');
26
            } catch (Exception $ex) {
27
                // ignore
28
            }
29
30
            // Add dates and author columns
31
            $now = DateTimeObj::get('Y-m-d H:i:s');
32
            $nowGMT = DateTimeObj::getGMT('Y-m-d H:i:s');
33
            Symphony::Database()->query("
34
                ALTER TABLE `tbl_sections`
35
                    ADD COLUMN `author_id` int(11) unsigned NOT NULL DEFAULT 1,
36
                    ADD COLUMN `modification_author_id` int(11) unsigned NOT NULL DEFAULT 1,
37
                    ADD COLUMN `creation_date` datetime NOT NULL DEFAULT '$now',
38
                    ADD COLUMN `creation_date_gmt` datetime NOT NULL DEFAULT '$nowGMT',
39
                    ADD COLUMN `modification_date` datetime NOT NULL DEFAULT '$now',
40
                    ADD COLUMN `modification_date_gmt` datetime NOT NULL DEFAULT '$nowGMT',
41
                    ADD KEY `creation_date` (`creation_date`),
42
                    ADD KEY `creation_date_gmt` (`creation_date_gmt`),
43
                    ADD KEY `modification_date` (`modification_date`),
44
                    ADD KEY `modification_date_gmt` (`modification_date_gmt`);
45
            ");
46
            Symphony::Database()->query("
47
                ALTER TABLE `tbl_entries`
48
                    ADD COLUMN `modification_author_id` int(11) unsigned NOT NULL DEFAULT 1
49
                        AFTER `author_id`
50
            ");
51
52
            // Update the version information
53
            return parent::upgrade();
54
        }
55
    }
56