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:35
created

migration_222   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 58
rs 10
wmc 9
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getVersion() 0 4 1
A getReleaseNotes() 0 4 1
1
<?php
2
namespace SymphonyCms\Installer\Migrations;
3
4
use SymphonyCms\Installer\Lib\Migration;
5
use Symphony;
6
use Exception;
7
8
class migration_222 extends Migration
9
{
10
    public static function getVersion()
11
    {
12
        return '2.2.2';
13
    }
14
15
    public static function getReleaseNotes()
16
    {
17
        return 'http://getsymphony.com/download/releases/version/2.2.2/';
18
    }
19
20
    public static function upgrade()
21
    {
22
        // 2.2.2 Beta 1
23
        if (version_compare(self::$existing_version, '2.2.2 Beta 1', '<=')) {
24
            Symphony::Configuration()->set('version', '2.2.2 Beta 1', 'symphony');
25
26
            // Rename old variations of the query_caching configuration setting
27
            if (Symphony::Configuration()->get('disable_query_caching', 'database')) {
28
                $value = (Symphony::Configuration()->get(
29
                    'disable_query_caching',
30
                    'database'
31
                ) === "no") ? "on" : "off";
32
33
                Symphony::Configuration()->set('query_caching', $value, 'database');
34
                Symphony::Configuration()->remove('disable_query_caching', 'database');
35
            }
36
37
            // Add Session GC collection as a configuration parameter
38
            Symphony::Configuration()->set('session_gc_divisor', '10', 'symphony');
39
40
            // Save the manifest changes
41
            Symphony::Configuration()->write();
42
        }
43
44
        // 2.2.2 Beta 2
45
        if (version_compare(self::$existing_version, '2.2.2 Beta 2', '<=')) {
46
            Symphony::Configuration()->set('version', '2.2.2 Beta 2', 'symphony');
47
            try {
48
                // Change Textareas to be MEDIUMTEXT columns
49
                $textarea_tables = Symphony::Database()->fetchCol(
50
                    "field_id",
51
                    "SELECT `field_id` FROM `tbl_fields_textarea`"
52
                );
53
54
                foreach ($textarea_tables as $field) {
55
                    Symphony::Database()->query(sprintf(
56
                        "ALTER TABLE `tbl_entries_data_%d` CHANGE `value` `value` MEDIUMTEXT, CHANGE `value_formatted` `value_formatted` MEDIUMTEXT",
57
                        $field
58
                    ));
59
                    Symphony::Database()->query(sprintf('OPTIMIZE TABLE `tbl_entries_data_%d`', $field));
60
                }
61
            } catch (Exception $ex) {
62
            }
63
64
            // Save the manifest changes
65
            Symphony::Configuration()->write();
66
        }
67
68
        // Update the version information
69
        return parent::upgrade();
70
    }
71
}
72