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
05:28
created

migration_233   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 51
Duplicated Lines 35.29 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getVersion() 0 4 1
A getReleaseNotes() 0 4 1
C upgrade() 18 34 7

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace SymphonyCms\Installer\Migrations;
3
4
use SymphonyCms\Installer\Lib\Migration;
5
use Symphony;
6
7
class migration_233 extends Migration
8
{
9
    public static function getVersion()
10
    {
11
        return '2.3.3';
12
    }
13
14
    public static function getReleaseNotes()
15
    {
16
        return 'http://getsymphony.com/download/releases/version/2.3.3/';
17
    }
18
19
    public static function upgrade()
20
    {
21 View Code Duplication
        if (version_compare(self::$existing_version, '2.3.3beta1', '<=')) {
22
            // Update DB for the new author role #1692
23
            Symphony::Database()->query(
24
                "ALTER TABLE `tbl_authors` CHANGE `user_type` `user_type` ENUM('author', 'manager', 'developer') DEFAULT 'author'"
25
            );
26
27
            // Remove directory from the upload fields, #1719
28
            $upload_tables = Symphony::Database()->fetchCol(
29
                "field_id",
30
                "SELECT `field_id` FROM `tbl_fields_upload`"
31
            );
32
33
            if (is_array($upload_tables) && !empty($upload_tables)) {
34
                foreach ($upload_tables as $field) {
35
                    Symphony::Database()->query(sprintf(
36
                        "UPDATE tbl_entries_data_%d SET FILE = substring_index(FILE, '/', -1)",
37
                        $field
38
                    ));
39
                }
40
            }
41
        }
42
43
        if (version_compare(self::$existing_version, '2.3.3beta2', '<=')) {
44
            // Update rows for associations
45
            if (!Symphony::Configuration()->get('association_maximum_rows', 'symphony')) {
46
                Symphony::Configuration()->set('association_maximum_rows', '5', 'symphony');
47
            }
48
        }
49
50
        // Update the version information
51
        return parent::upgrade();
52
    }
53
54
    public static function preUpdateNotes()
55
    {
56
        return array(
57
            __("On update, all files paths will be removed from the core Upload field entry tables. If you are using an Upload field extension, ensure that the extension is compatible with this release before continuing.")
58
        );
59
    }
60
}
61