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
Pull Request — integration (#2604)
by Brendan
04:24
created

migration_221::postUpdateNotes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 9.4285
1
<?php
2
3
    class migration_221 extends Migration
4
    {
5
        public static function getVersion()
6
        {
7
            return '2.2.1';
8
        }
9
10
        public static function getReleaseNotes()
11
        {
12
            return 'http://getsymphony.com/download/releases/version/2.2.1/';
13
        }
14
15
        public static function upgrade()
16
        {
17
            // 2.2.1 Beta 1
18
            if (version_compare(self::$existing_version, '2.2.1 Beta 1', '<=')) {
19
                Symphony::Configuration()->set('version', '2.2.1 Beta 1', 'symphony');
20
                try {
21
                    Symphony::Database()->query('CREATE INDEX `session_expires` ON `tbl_sessions` (`session_expires`)');
22
                    Symphony::Database()->query('OPTIMIZE TABLE `tbl_sessions`');
23
                } catch (Exception $ex) {
24
                }
25
                Symphony::Configuration()->write();
26
            }
27
28
            // 2.2.1 Beta 2
29
            if (version_compare(self::$existing_version, '2.2.1 Beta 2', '<=')) {
30
                Symphony::Configuration()->set('version', '2.2.1 Beta 2', 'symphony');
31
32
                // Add Security Rules from 2.2 to .htaccess
33
                try {
34
                    $htaccess = file_get_contents(DOCROOT . '/.htaccess');
35
36
                    if ($htaccess !== false && !preg_match('/### SECURITY - Protect crucial files/', $htaccess)) {
37
                        $security = '
38
            ### SECURITY - Protect crucial files
39
            RewriteRule ^manifest/(.*)$ - [F]
40
            RewriteRule ^workspace/(pages|utilities)/(.*)\.xsl$ - [F]
41
            RewriteRule ^(.*)\.sql$ - [F]
42
            RewriteRule (^|/)\. - [F]
43
44
            ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"';
45
46
                        $htaccess = str_replace('### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"', $security,
47
                            $htaccess);
48
                        file_put_contents(DOCROOT . '/.htaccess', $htaccess);
49
                    }
50
                } catch (Exception $ex) {
51
                }
52
53
                // Add correct index to the `tbl_cache`
54
                try {
55
                    Symphony::Database()->query('ALTER TABLE `tbl_cache` DROP INDEX `creation`');
56
                    Symphony::Database()->query('CREATE INDEX `expiry` ON `tbl_cache` (`expiry`)');
57
                    Symphony::Database()->query('OPTIMIZE TABLE `tbl_cache`');
58
                } catch (Exception $ex) {
59
                }
60
61
                // Remove Hide Association field from Select Data tables
62
                $select_tables = Symphony::Database()->fetchCol("field_id",
63
                    "SELECT `field_id` FROM `tbl_fields_select`");
64
65
                if (is_array($select_tables) && !empty($select_tables)) {
66
                    foreach ($select_tables as $field) {
67
                        if (Symphony::Database()->tableContainsField('tbl_entries_data_' . $field,
68
                            'show_association')
69
                        ) {
70
                            Symphony::Database()->query(sprintf(
71
                                "ALTER TABLE `tbl_entries_data_%d` DROP `show_association`",
72
                                $field
73
                            ));
74
                        }
75
                    }
76
                }
77
78
                // Update Select table to include the sorting option
79
                if (!Symphony::Database()->tableContainsField('tbl_fields_select', 'sort_options')) {
80
                    Symphony::Database()->query('ALTER TABLE `tbl_fields_select` ADD `sort_options` ENUM( "yes", "no" ) COLLATE utf8_unicode_ci NOT NULL DEFAULT "no"');
81
                }
82
83
                // Remove the 'driver' from the Config
84
                Symphony::Configuration()->remove('driver', 'database');
85
                Symphony::Configuration()->write();
86
87
                // Remove the NOT NULL from the Author tables
88
                try {
89
                    $author = Symphony::Database()->fetchCol("field_id", "SELECT `field_id` FROM `tbl_fields_author`");
90
91
                    foreach ($author as $id) {
92
                        $table = '`tbl_entries_data_' . $id . '`';
93
94
                        Symphony::Database()->query(
95
                            'ALTER TABLE ' . $table . ' CHANGE `author_id` `author_id` INT(11) UNSIGNED NULL'
96
                        );
97
                    }
98
                } catch (Exception $ex) {
99
                }
100
101
                Symphony::Configuration()->write();
102
            }
103
104
            // Update the version information
105
            return parent::upgrade();
106
        }
107
108
        public static function postUpdateNotes()
109
        {
110
            return array(
111
                __('Version %s introduces some improvements and fixes to Static XML Datasources. If you have any Static XML Datasources in your installation, please be sure to re-save them through the Data Source Editor to prevent unexpected results.',
112
                    array('<code>2.2.1</code>'))
113
            );
114
        }
115
    }
116