Passed
Push — 1.7 ( 23cbb7...8df8a8 )
by Greg
08:15
created
app/Schema/Migration11.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -22,22 +22,22 @@
 block discarded – undo
22 22
  * Upgrade the database schema from version 11 to version 12.
23 23
  */
24 24
 class Migration11 implements MigrationInterface {
25
-	/**
26
-	 * Upgrade to to the next version
27
-	 */
28
-	public function upgrade() {
29
-		// - delete the wt_name.n_list column; it has never been used
30
-		// - a bug in webtrees 1.1.2 caused the wt_name.n_full column
31
-		// to include slashes around the surname. These are unnecessary,
32
-		// and cause problems when we try to match the name from the
33
-		// gedcom with the name from the table.
34
-		// Remove slashes from INDI names
35
-		Database::exec("UPDATE `##name` SET n_full=REPLACE(n_full, '/', '') WHERE n_surn IS NOT NULL");
25
+    /**
26
+     * Upgrade to to the next version
27
+     */
28
+    public function upgrade() {
29
+        // - delete the wt_name.n_list column; it has never been used
30
+        // - a bug in webtrees 1.1.2 caused the wt_name.n_full column
31
+        // to include slashes around the surname. These are unnecessary,
32
+        // and cause problems when we try to match the name from the
33
+        // gedcom with the name from the table.
34
+        // Remove slashes from INDI names
35
+        Database::exec("UPDATE `##name` SET n_full=REPLACE(n_full, '/', '') WHERE n_surn IS NOT NULL");
36 36
 
37
-		try {
38
-			Database::exec("ALTER TABLE `##name` DROP n_list");
39
-		} catch (PDOException $x) {
40
-			// Already done?
41
-		}
42
-	}
37
+        try {
38
+            Database::exec("ALTER TABLE `##name` DROP n_list");
39
+        } catch (PDOException $x) {
40
+            // Already done?
41
+        }
42
+    }
43 43
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,13 @@
 block discarded – undo
21 21
 /**
22 22
  * Upgrade the database schema from version 11 to version 12.
23 23
  */
24
-class Migration11 implements MigrationInterface {
24
+class Migration11 implements MigrationInterface
25
+{
25 26
 	/**
26 27
 	 * Upgrade to to the next version
27 28
 	 */
28
-	public function upgrade() {
29
+	public function upgrade()
30
+	{
29 31
 		// - delete the wt_name.n_list column; it has never been used
30 32
 		// - a bug in webtrees 1.1.2 caused the wt_name.n_full column
31 33
 		// to include slashes around the surname. These are unnecessary,
Please login to merge, or discard this patch.
app/Schema/Migration34.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@
 block discarded – undo
22 22
  * Upgrade the database schema from version 34 to version 35.
23 23
  */
24 24
 class Migration34 implements MigrationInterface {
25
-	/**
26
-	 * Upgrade to to the next version
27
-	 */
28
-	public function upgrade() {
29
-		// New modules (charts) have been added.
30
-		Module::getInstalledModules('enabled');
25
+    /**
26
+     * Upgrade to to the next version
27
+     */
28
+    public function upgrade() {
29
+        // New modules (charts) have been added.
30
+        Module::getInstalledModules('enabled');
31 31
 
32
-		// Delete old/unused settings
33
-		Database::exec(
34
-			"DELETE FROM `##gedcom_setting` WHERE setting_name IN ('COMMON_NAMES_ADD', 'COMMON_NAMES_REMOVE', 'COMMON_NAMES_THRESHOLD')"
35
-		);
36
-	}
32
+        // Delete old/unused settings
33
+        Database::exec(
34
+            "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('COMMON_NAMES_ADD', 'COMMON_NAMES_REMOVE', 'COMMON_NAMES_THRESHOLD')"
35
+        );
36
+    }
37 37
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,13 @@
 block discarded – undo
21 21
 /**
22 22
  * Upgrade the database schema from version 34 to version 35.
23 23
  */
24
-class Migration34 implements MigrationInterface {
24
+class Migration34 implements MigrationInterface
25
+{
25 26
 	/**
26 27
 	 * Upgrade to to the next version
27 28
 	 */
28
-	public function upgrade() {
29
+	public function upgrade()
30
+	{
29 31
 		// New modules (charts) have been added.
30 32
 		Module::getInstalledModules('enabled');
31 33
 
Please login to merge, or discard this patch.
app/Schema/Migration2.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,31 +22,31 @@
 block discarded – undo
22 22
  * Upgrade the database schema from version 2 to version 2.
23 23
  */
24 24
 class Migration2 implements MigrationInterface {
25
-	/**
26
-	 * Upgrade to to the next version
27
-	 */
28
-	public function upgrade() {
29
-		// - create the wt_gedcom_chunk table to import gedcoms in
30
-		// blocks of data smaller than the max_allowed_packet restriction.
25
+    /**
26
+     * Upgrade to to the next version
27
+     */
28
+    public function upgrade() {
29
+        // - create the wt_gedcom_chunk table to import gedcoms in
30
+        // blocks of data smaller than the max_allowed_packet restriction.
31 31
 
32
-		Database::exec(
33
-			"CREATE TABLE IF NOT EXISTS `##gedcom_chunk` (" .
34
-			" gedcom_chunk_id INTEGER AUTO_INCREMENT NOT NULL," .
35
-			" gedcom_id       INTEGER                NOT NULL," .
36
-			" chunk_data      MEDIUMBLOB             NOT NULL," .
37
-			" imported        BOOLEAN                NOT NULL DEFAULT FALSE," .
38
-			" PRIMARY KEY     (gedcom_chunk_id)," .
39
-			"         KEY ix1 (gedcom_id, imported)," .
40
-			" FOREIGN KEY `##gedcom_chunk_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" .
41
-			") COLLATE utf8_unicode_ci ENGINE=InnoDB"
42
-		);
32
+        Database::exec(
33
+            "CREATE TABLE IF NOT EXISTS `##gedcom_chunk` (" .
34
+            " gedcom_chunk_id INTEGER AUTO_INCREMENT NOT NULL," .
35
+            " gedcom_id       INTEGER                NOT NULL," .
36
+            " chunk_data      MEDIUMBLOB             NOT NULL," .
37
+            " imported        BOOLEAN                NOT NULL DEFAULT FALSE," .
38
+            " PRIMARY KEY     (gedcom_chunk_id)," .
39
+            "         KEY ix1 (gedcom_id, imported)," .
40
+            " FOREIGN KEY `##gedcom_chunk_fk1` (gedcom_id) REFERENCES `##gedcom` (gedcom_id)" .
41
+            ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
42
+        );
43 43
 
44
-		try {
45
-			Database::exec(
46
-				"ALTER TABLE `##gedcom` DROP import_gedcom, DROP import_offset"
47
-			);
48
-		} catch (PDOException $ex) {
49
-			// Perhaps we have already deleted these columns?
50
-		}
51
-	}
44
+        try {
45
+            Database::exec(
46
+                "ALTER TABLE `##gedcom` DROP import_gedcom, DROP import_offset"
47
+            );
48
+        } catch (PDOException $ex) {
49
+            // Perhaps we have already deleted these columns?
50
+        }
51
+    }
52 52
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,13 @@
 block discarded – undo
21 21
 /**
22 22
  * Upgrade the database schema from version 2 to version 2.
23 23
  */
24
-class Migration2 implements MigrationInterface {
24
+class Migration2 implements MigrationInterface
25
+{
25 26
 	/**
26 27
 	 * Upgrade to to the next version
27 28
 	 */
28
-	public function upgrade() {
29
+	public function upgrade()
30
+	{
29 31
 		// - create the wt_gedcom_chunk table to import gedcoms in
30 32
 		// blocks of data smaller than the max_allowed_packet restriction.
31 33
 
Please login to merge, or discard this patch.
app/Schema/Migration22.php 2 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -22,74 +22,74 @@
 block discarded – undo
22 22
  * Upgrade the database schema from version 22 to version 23.
23 23
  */
24 24
 class Migration22 implements MigrationInterface {
25
-	/**
26
-	 * Upgrade to to the next version
27
-	 */
28
-	public function upgrade() {
29
-		// - data update for 1.4.0 media changes
30
-		$_cfgs = Database::prepare(
31
-			"SELECT gs1.gedcom_id AS gedcom_id, gs1.setting_value AS media_directory, gs2.setting_value AS use_media_firewall, gs3.setting_value AS media_firewall_thumbs, gs4.setting_value AS media_firewall_rootdir" .
32
-			" FROM `##gedcom_setting` gs1" .
33
-			" LEFT JOIN `##gedcom_setting` gs2 ON (gs1.gedcom_id = gs2.gedcom_id AND gs2.setting_name='USE_MEDIA_FIREWALL')" .
34
-			" LEFT JOIN `##gedcom_setting` gs3 ON (gs1.gedcom_id = gs3.gedcom_id AND gs3.setting_name='MEDIA_FIREWALL_THUMBS')" .
35
-			" LEFT JOIN `##gedcom_setting` gs4 ON (gs1.gedcom_id = gs4.gedcom_id AND gs4.setting_name='MEDIA_FIREWALL_ROOTDIR')" .
36
-			" WHERE gs1.setting_name = 'MEDIA_DIRECTORY'"
37
-		)->fetchAll();
25
+    /**
26
+     * Upgrade to to the next version
27
+     */
28
+    public function upgrade() {
29
+        // - data update for 1.4.0 media changes
30
+        $_cfgs = Database::prepare(
31
+            "SELECT gs1.gedcom_id AS gedcom_id, gs1.setting_value AS media_directory, gs2.setting_value AS use_media_firewall, gs3.setting_value AS media_firewall_thumbs, gs4.setting_value AS media_firewall_rootdir" .
32
+            " FROM `##gedcom_setting` gs1" .
33
+            " LEFT JOIN `##gedcom_setting` gs2 ON (gs1.gedcom_id = gs2.gedcom_id AND gs2.setting_name='USE_MEDIA_FIREWALL')" .
34
+            " LEFT JOIN `##gedcom_setting` gs3 ON (gs1.gedcom_id = gs3.gedcom_id AND gs3.setting_name='MEDIA_FIREWALL_THUMBS')" .
35
+            " LEFT JOIN `##gedcom_setting` gs4 ON (gs1.gedcom_id = gs4.gedcom_id AND gs4.setting_name='MEDIA_FIREWALL_ROOTDIR')" .
36
+            " WHERE gs1.setting_name = 'MEDIA_DIRECTORY'"
37
+        )->fetchAll();
38 38
 
39
-		// The constant WT_DATA_DIR is not defined yet (although it was when this script was originally written).
40
-		$WT_DATA_DIR = realpath('data');
39
+        // The constant WT_DATA_DIR is not defined yet (although it was when this script was originally written).
40
+        $WT_DATA_DIR = realpath('data');
41 41
 
42
-		// Check the config for each tree
43
-		foreach ($_cfgs as $_cfg) {
44
-			if ($_cfg->use_media_firewall) {
45
-				// We’re using the media firewall.
46
-				$_mf_dir = realpath($_cfg->media_firewall_rootdir) . DIRECTORY_SEPARATOR;
47
-				if ($_mf_dir == $WT_DATA_DIR) {
48
-					// We’re already storing our media in the data folder - nothing to do.
49
-				} else {
50
-					// We’ve chosen a custom location for our media folder - need to update our media-folder to point to it.
51
-					// We have, for example,
52
-					// $_mf_dir = /home/fisharebest/my_pictures/
53
-					// $WT_DATA_DIR = /home/fisharebest/public_html/webtrees/data/
54
-					// Therefore we need to calculate ../../../my_pictures/
55
-					$_media_dir = '';
56
-					$_tmp_dir   = $WT_DATA_DIR;
57
-					while (strpos($_mf_dir, $_tmp_dir) !== 0) {
58
-						$_media_dir .= '../';
59
-						$_tmp_dir = preg_replace('~[^/\\\\]+[/\\\\]$~', '', $_tmp_dir);
60
-						if ($_tmp_dir == '') {
61
-							// Shouldn't get here - but this script is not allowed to fail...
62
-							continue 2;
63
-						}
64
-					}
65
-					$_media_dir .= $_cfg->media_directory;
66
-					Database::prepare(
67
-						"UPDATE `##gedcom_setting`" .
68
-						" SET setting_value=?" .
69
-						" WHERE gedcom_id=? AND setting_name='MEDIA_DIRECTORY'"
70
-					)->execute(array($_media_dir, $_cfg->gedcom_id));
71
-				}
72
-			} else {
73
-				// Not using the media firewall - just move the public folder to the new location (if we can).
74
-				if (
75
-					file_exists(WT_ROOT . $_cfg->media_directory) &&
76
-					is_dir(WT_ROOT . $_cfg->media_directory) &&
77
-					!file_exists($WT_DATA_DIR . $_cfg->media_directory)
78
-				) {
79
-					try {
80
-						rename(WT_ROOT . $_cfg->media_directory, $WT_DATA_DIR . $_cfg->media_directory);
81
-					} catch (\ErrorException $ex) {
82
-						// Cannot move the folder?
83
-					}
84
-					File::delete($WT_DATA_DIR . $_cfg->media_directory . '.htaccess');
85
-					File::delete($WT_DATA_DIR . $_cfg->media_directory . 'index.php');
86
-					File::delete($WT_DATA_DIR . $_cfg->media_directory . 'Mediainfo.txt');
87
-					File::delete($WT_DATA_DIR . $_cfg->media_directory . 'thumbs/Thumbsinfo.txt');
88
-				}
89
-			}
90
-		}
42
+        // Check the config for each tree
43
+        foreach ($_cfgs as $_cfg) {
44
+            if ($_cfg->use_media_firewall) {
45
+                // We’re using the media firewall.
46
+                $_mf_dir = realpath($_cfg->media_firewall_rootdir) . DIRECTORY_SEPARATOR;
47
+                if ($_mf_dir == $WT_DATA_DIR) {
48
+                    // We’re already storing our media in the data folder - nothing to do.
49
+                } else {
50
+                    // We’ve chosen a custom location for our media folder - need to update our media-folder to point to it.
51
+                    // We have, for example,
52
+                    // $_mf_dir = /home/fisharebest/my_pictures/
53
+                    // $WT_DATA_DIR = /home/fisharebest/public_html/webtrees/data/
54
+                    // Therefore we need to calculate ../../../my_pictures/
55
+                    $_media_dir = '';
56
+                    $_tmp_dir   = $WT_DATA_DIR;
57
+                    while (strpos($_mf_dir, $_tmp_dir) !== 0) {
58
+                        $_media_dir .= '../';
59
+                        $_tmp_dir = preg_replace('~[^/\\\\]+[/\\\\]$~', '', $_tmp_dir);
60
+                        if ($_tmp_dir == '') {
61
+                            // Shouldn't get here - but this script is not allowed to fail...
62
+                            continue 2;
63
+                        }
64
+                    }
65
+                    $_media_dir .= $_cfg->media_directory;
66
+                    Database::prepare(
67
+                        "UPDATE `##gedcom_setting`" .
68
+                        " SET setting_value=?" .
69
+                        " WHERE gedcom_id=? AND setting_name='MEDIA_DIRECTORY'"
70
+                    )->execute(array($_media_dir, $_cfg->gedcom_id));
71
+                }
72
+            } else {
73
+                // Not using the media firewall - just move the public folder to the new location (if we can).
74
+                if (
75
+                    file_exists(WT_ROOT . $_cfg->media_directory) &&
76
+                    is_dir(WT_ROOT . $_cfg->media_directory) &&
77
+                    !file_exists($WT_DATA_DIR . $_cfg->media_directory)
78
+                ) {
79
+                    try {
80
+                        rename(WT_ROOT . $_cfg->media_directory, $WT_DATA_DIR . $_cfg->media_directory);
81
+                    } catch (\ErrorException $ex) {
82
+                        // Cannot move the folder?
83
+                    }
84
+                    File::delete($WT_DATA_DIR . $_cfg->media_directory . '.htaccess');
85
+                    File::delete($WT_DATA_DIR . $_cfg->media_directory . 'index.php');
86
+                    File::delete($WT_DATA_DIR . $_cfg->media_directory . 'Mediainfo.txt');
87
+                    File::delete($WT_DATA_DIR . $_cfg->media_directory . 'thumbs/Thumbsinfo.txt');
88
+                }
89
+            }
90
+        }
91 91
 
92
-		// Delete old settings
93
-		Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_MEDIA_FIREWALL', 'MEDIA_FIREWALL_THUMBS', 'MEDIA_FIREWALL_ROOTDIR')");
94
-	}
92
+        // Delete old settings
93
+        Database::exec("DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_MEDIA_FIREWALL', 'MEDIA_FIREWALL_THUMBS', 'MEDIA_FIREWALL_ROOTDIR')");
94
+    }
95 95
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,13 @@
 block discarded – undo
21 21
 /**
22 22
  * Upgrade the database schema from version 22 to version 23.
23 23
  */
24
-class Migration22 implements MigrationInterface {
24
+class Migration22 implements MigrationInterface
25
+{
25 26
 	/**
26 27
 	 * Upgrade to to the next version
27 28
 	 */
28
-	public function upgrade() {
29
+	public function upgrade()
30
+	{
29 31
 		// - data update for 1.4.0 media changes
30 32
 		$_cfgs = Database::prepare(
31 33
 			"SELECT gs1.gedcom_id AS gedcom_id, gs1.setting_value AS media_directory, gs2.setting_value AS use_media_firewall, gs3.setting_value AS media_firewall_thumbs, gs4.setting_value AS media_firewall_rootdir" .
Please login to merge, or discard this patch.
app/Schema/Migration27.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -22,39 +22,39 @@
 block discarded – undo
22 22
  * Upgrade the database schema from version 27 to version 28.
23 23
  */
24 24
 class Migration27 implements MigrationInterface {
25
-	/**
26
-	 * Upgrade to to the next version
27
-	 */
28
-	public function upgrade() {
29
-		// Delete old/unused settings
30
-		Database::exec(
31
-			"DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_GEONAMES')"
32
-		);
25
+    /**
26
+     * Upgrade to to the next version
27
+     */
28
+    public function upgrade() {
29
+        // Delete old/unused settings
30
+        Database::exec(
31
+            "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_GEONAMES')"
32
+        );
33 33
 
34
-		try {
35
-			// Indexes created by setup.php or schema update 17-18
36
-			Database::exec("ALTER TABLE `##site_access_rule` DROP INDEX ix1, DROP INDEX ix2, DROP INDEX ix3");
37
-			// Indexes created by schema update 17-18
38
-			Database::exec("ALTER TABLE `##site_access_rule` DROP INDEX ix4, DROP INDEX ix5, DROP INDEX ix6");
39
-		} catch (PDOException $ex) {
40
-			// Already done?
41
-		}
34
+        try {
35
+            // Indexes created by setup.php or schema update 17-18
36
+            Database::exec("ALTER TABLE `##site_access_rule` DROP INDEX ix1, DROP INDEX ix2, DROP INDEX ix3");
37
+            // Indexes created by schema update 17-18
38
+            Database::exec("ALTER TABLE `##site_access_rule` DROP INDEX ix4, DROP INDEX ix5, DROP INDEX ix6");
39
+        } catch (PDOException $ex) {
40
+            // Already done?
41
+        }
42 42
 
43
-		// User data may contains duplicates - these will prevent us from creating the new indexes
44
-		Database::exec(
45
-			"DELETE t1 FROM `##site_access_rule` AS t1 JOIN `##site_access_rule` AS t2 ON t1.ip_address_end = t2.ip_address_end AND t1.ip_address_start = t2.ip_address_start AND t1.user_agent_pattern = t2.user_agent_pattern AND t1.site_access_rule_id <> t2.site_access_rule_id"
46
-		);
43
+        // User data may contains duplicates - these will prevent us from creating the new indexes
44
+        Database::exec(
45
+            "DELETE t1 FROM `##site_access_rule` AS t1 JOIN `##site_access_rule` AS t2 ON t1.ip_address_end = t2.ip_address_end AND t1.ip_address_start = t2.ip_address_start AND t1.user_agent_pattern = t2.user_agent_pattern AND t1.site_access_rule_id <> t2.site_access_rule_id"
46
+        );
47 47
 
48
-		// ix1 - covering index for visitor lookup
49
-		// ix2 - for total counts in admin page
50
-		try {
51
-			Database::exec(
52
-				"ALTER TABLE `##site_access_rule`" .
53
-				" ADD UNIQUE INDEX `##site_access_rule_ix1` (ip_address_end, ip_address_start, user_agent_pattern, rule)," .
54
-				" ADD        INDEX `##site_access_rule_ix2` (rule)"
55
-			);
56
-		} catch (PDOException $ex) {
57
-			// Already done?
58
-		}
59
-	}
48
+        // ix1 - covering index for visitor lookup
49
+        // ix2 - for total counts in admin page
50
+        try {
51
+            Database::exec(
52
+                "ALTER TABLE `##site_access_rule`" .
53
+                " ADD UNIQUE INDEX `##site_access_rule_ix1` (ip_address_end, ip_address_start, user_agent_pattern, rule)," .
54
+                " ADD        INDEX `##site_access_rule_ix2` (rule)"
55
+            );
56
+        } catch (PDOException $ex) {
57
+            // Already done?
58
+        }
59
+    }
60 60
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,13 @@
 block discarded – undo
21 21
 /**
22 22
  * Upgrade the database schema from version 27 to version 28.
23 23
  */
24
-class Migration27 implements MigrationInterface {
24
+class Migration27 implements MigrationInterface
25
+{
25 26
 	/**
26 27
 	 * Upgrade to to the next version
27 28
 	 */
28
-	public function upgrade() {
29
+	public function upgrade()
30
+	{
29 31
 		// Delete old/unused settings
30 32
 		Database::exec(
31 33
 			"DELETE FROM `##gedcom_setting` WHERE setting_name IN ('USE_GEONAMES')"
Please login to merge, or discard this patch.
app/Schema/Migration1.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,23 +21,23 @@
 block discarded – undo
21 21
  * Upgrade the database schema from version 1 to version 2.
22 22
  */
23 23
 class Migration1 implements MigrationInterface {
24
-	/**
25
-	 * Upgrade to to the next version
26
-	 */
27
-	public function upgrade() {
28
-		// Create the wt_session table to store session data in the database,
29
-		// rather than in the filesystem.
30
-		Database::exec(
31
-			"CREATE TABLE IF NOT EXISTS `##session` (" .
32
-			" session_id   CHAR(32)    NOT NULL," .
33
-			" session_time TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," .
34
-			" user_id      INTEGER     NOT NULL," .
35
-			" ip_address   VARCHAR(32) NOT NULL," .
36
-			" session_data MEDIUMBLOB  NOT NULL," .
37
-			" PRIMARY KEY     (session_id)," .
38
-			"         KEY ix1 (session_time)," .
39
-			"         KEY ix2 (user_id, ip_address)" .
40
-			") COLLATE utf8_unicode_ci ENGINE=InnoDB"
41
-		);
42
-	}
24
+    /**
25
+     * Upgrade to to the next version
26
+     */
27
+    public function upgrade() {
28
+        // Create the wt_session table to store session data in the database,
29
+        // rather than in the filesystem.
30
+        Database::exec(
31
+            "CREATE TABLE IF NOT EXISTS `##session` (" .
32
+            " session_id   CHAR(32)    NOT NULL," .
33
+            " session_time TIMESTAMP   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP," .
34
+            " user_id      INTEGER     NOT NULL," .
35
+            " ip_address   VARCHAR(32) NOT NULL," .
36
+            " session_data MEDIUMBLOB  NOT NULL," .
37
+            " PRIMARY KEY     (session_id)," .
38
+            "         KEY ix1 (session_time)," .
39
+            "         KEY ix2 (user_id, ip_address)" .
40
+            ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
41
+        );
42
+    }
43 43
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,13 @@
 block discarded – undo
20 20
 /**
21 21
  * Upgrade the database schema from version 1 to version 2.
22 22
  */
23
-class Migration1 implements MigrationInterface {
23
+class Migration1 implements MigrationInterface
24
+{
24 25
 	/**
25 26
 	 * Upgrade to to the next version
26 27
 	 */
27
-	public function upgrade() {
28
+	public function upgrade()
29
+	{
28 30
 		// Create the wt_session table to store session data in the database,
29 31
 		// rather than in the filesystem.
30 32
 		Database::exec(
Please login to merge, or discard this patch.
app/Schema/Migration33.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
  * Upgrade the database schema from version 33 to version 34.
22 22
  */
23 23
 class Migration33 implements MigrationInterface {
24
-	/**
25
-	 * Upgrade to to the next version
26
-	 */
27
-	public function upgrade() {
28
-		Database::exec(
29
-			"INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" .
30
-			" ('Mozilla/5.0 (Mobile; Windows Phone 8.1; % Microsoft; %', 'allow', 'Windows Phone 8.1')"
31
-		);
32
-	}
24
+    /**
25
+     * Upgrade to to the next version
26
+     */
27
+    public function upgrade() {
28
+        Database::exec(
29
+            "INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" .
30
+            " ('Mozilla/5.0 (Mobile; Windows Phone 8.1; % Microsoft; %', 'allow', 'Windows Phone 8.1')"
31
+        );
32
+    }
33 33
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,13 @@
 block discarded – undo
20 20
 /**
21 21
  * Upgrade the database schema from version 33 to version 34.
22 22
  */
23
-class Migration33 implements MigrationInterface {
23
+class Migration33 implements MigrationInterface
24
+{
24 25
 	/**
25 26
 	 * Upgrade to to the next version
26 27
 	 */
27
-	public function upgrade() {
28
+	public function upgrade()
29
+	{
28 30
 		Database::exec(
29 31
 			"INSERT IGNORE INTO `##site_access_rule` (user_agent_pattern, rule, comment) VALUES" .
30 32
 			" ('Mozilla/5.0 (Mobile; Windows Phone 8.1; % Microsoft; %', 'allow', 'Windows Phone 8.1')"
Please login to merge, or discard this patch.
app/Schema/Migration24.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,25 +21,25 @@
 block discarded – undo
21 21
  * Upgrade the database schema from version 24 to version 25.
22 22
  */
23 23
 class Migration24 implements MigrationInterface {
24
-	/**
25
-	 * Upgrade to to the next version
26
-	 */
27
-	public function upgrade() {
28
-		// Tree settings become site settings
29
-		Database::exec(
30
-			"INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" .
31
-			" SELECT setting_name, MIN(setting_value)" . // Can't use ANY_VALUE() until MySQL5.7
32
-			" FROM `##gedcom_setting`" .
33
-			" WHERE setting_name IN ('SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'" .
34
-			" GROUP BY setting_name"
35
-		);
24
+    /**
25
+     * Upgrade to to the next version
26
+     */
27
+    public function upgrade() {
28
+        // Tree settings become site settings
29
+        Database::exec(
30
+            "INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" .
31
+            " SELECT setting_name, MIN(setting_value)" . // Can't use ANY_VALUE() until MySQL5.7
32
+            " FROM `##gedcom_setting`" .
33
+            " WHERE setting_name IN ('SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'" .
34
+            " GROUP BY setting_name"
35
+        );
36 36
 
37
-		Database::exec(
38
-			"DELETE FROM `##gedcom_setting` WHERE setting_name IN ('ALLOW_EDIT_GEDCOM', 'SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'"
39
-		);
37
+        Database::exec(
38
+            "DELETE FROM `##gedcom_setting` WHERE setting_name IN ('ALLOW_EDIT_GEDCOM', 'SHOW_REGISTER_CAUTION', 'WELCOME_TEXT_CUST_HEAD') OR setting_name LIKE 'WELCOME_TEXT_AUTH_MODE%'"
39
+        );
40 40
 
41
-		Database::exec(
42
-			"DELETE FROM `##site_setting` WHERE setting_name IN ('STORE_MESSAGES')"
43
-		);
44
-	}
41
+        Database::exec(
42
+            "DELETE FROM `##site_setting` WHERE setting_name IN ('STORE_MESSAGES')"
43
+        );
44
+    }
45 45
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,13 @@
 block discarded – undo
20 20
 /**
21 21
  * Upgrade the database schema from version 24 to version 25.
22 22
  */
23
-class Migration24 implements MigrationInterface {
23
+class Migration24 implements MigrationInterface
24
+{
24 25
 	/**
25 26
 	 * Upgrade to to the next version
26 27
 	 */
27
-	public function upgrade() {
28
+	public function upgrade()
29
+	{
28 30
 		// Tree settings become site settings
29 31
 		Database::exec(
30 32
 			"INSERT IGNORE INTO `##site_setting` (setting_name, setting_value)" .
Please login to merge, or discard this patch.
app/Schema/Migration8.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
  * Upgrade the database schema from version 8 to version 9.
23 23
  */
24 24
 class Migration8 implements MigrationInterface {
25
-	/**
26
-	 * Upgrade to to the next version
27
-	 */
28
-	public function upgrade() {
29
-		// Add support for the persian/jalali calendar
30
-		try {
31
-			Database::exec(
32
-				"ALTER TABLE `##dates` CHANGE d_type d_type ENUM('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@')"
33
-			);
34
-		} catch (PDOException $ex) {
35
-			// Already been run?
36
-		}
37
-	}
25
+    /**
26
+     * Upgrade to to the next version
27
+     */
28
+    public function upgrade() {
29
+        // Add support for the persian/jalali calendar
30
+        try {
31
+            Database::exec(
32
+                "ALTER TABLE `##dates` CHANGE d_type d_type ENUM('@#DGREGORIAN@', '@#DJULIAN@', '@#DHEBREW@', '@#DFRENCH R@', '@#DHIJRI@', '@#DROMAN@', '@#DJALALI@')"
33
+            );
34
+        } catch (PDOException $ex) {
35
+            // Already been run?
36
+        }
37
+    }
38 38
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,11 +21,13 @@
 block discarded – undo
21 21
 /**
22 22
  * Upgrade the database schema from version 8 to version 9.
23 23
  */
24
-class Migration8 implements MigrationInterface {
24
+class Migration8 implements MigrationInterface
25
+{
25 26
 	/**
26 27
 	 * Upgrade to to the next version
27 28
 	 */
28
-	public function upgrade() {
29
+	public function upgrade()
30
+	{
29 31
 		// Add support for the persian/jalali calendar
30 32
 		try {
31 33
 			Database::exec(
Please login to merge, or discard this patch.