changeset 149 | 42c6c83b8a00 |
parent 142 | ca9118d9c0f2 |
child 152 | 9b4279c25d33 |
child 153 | 9b86248e8fee |
144:380e55865f86 | 149:42c6c83b8a00 |
---|---|
59 |
59 |
60 // SCRIPT CONFIGURATION |
60 // SCRIPT CONFIGURATION |
61 // Everything related to versions goes here! |
61 // Everything related to versions goes here! |
62 |
62 |
63 // Valid versions to upgrade from |
63 // Valid versions to upgrade from |
64 $valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3', '1.0', '1.0.1', '1.0.1.1'); |
64 $valid_versions = Array('1.0b1', '1.0b2', '1.0b3', '1.0b4', '1.0RC1', '1.0RC2', '1.0RC3', '1.0', '1.0.1', '1.0.1.1', '1.0.2b1'); |
65 |
65 |
66 // Basically a list of dependencies, which should be resolved automatically |
66 // Basically a list of dependencies, which should be resolved automatically |
67 // If, for example, upgrading from 1.0b1 to 1.0RC1 requires one extra query that would not |
67 // If, for example, upgrading from 1.0b1 to 1.0RC1 requires one extra query that would not |
68 // normally be required (for whatever reason) then you would add a custom version number to the array under key '1.0b1'. |
68 // normally be required (for whatever reason) then you would add a custom version number to the array under key '1.0b1'. |
69 $deps_list = Array( |
69 $deps_list = Array( |
73 '1.0b4' => Array('1.0RC1'), |
73 '1.0b4' => Array('1.0RC1'), |
74 '1.0RC1' => Array('1.0RC2'), |
74 '1.0RC1' => Array('1.0RC2'), |
75 '1.0RC2' => Array('1.0RC3'), |
75 '1.0RC2' => Array('1.0RC3'), |
76 '1.0RC3' => Array('1.0'), |
76 '1.0RC3' => Array('1.0'), |
77 '1.0' => Array('1.0.1'), |
77 '1.0' => Array('1.0.1'), |
78 '1.0.1' => Array('1.0.1.1') |
78 '1.0.1' => Array('1.0.1.1'), |
79 '1.0.1.1' => Array('1.0.2b1') |
|
79 ); |
80 ); |
80 $this_version = '1.0.2'; |
81 $this_version = '1.0.2'; |
81 $func_list = Array( |
82 $func_list = Array( |
82 '1.0' => Array('u_1_0_1_update_del_votes'), |
83 '1.0' => Array('u_1_0_1_update_del_votes'), |
83 '1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // , |
84 '1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // , |
617 echo '<p>Preparing for schema execution...'; |
618 echo '<p>Preparing for schema execution...'; |
618 // Build an array of queries |
619 // Build an array of queries |
619 $schema = file_get_contents('upgrade.sql'); |
620 $schema = file_get_contents('upgrade.sql'); |
620 |
621 |
621 // Strip out and process version blocks |
622 // Strip out and process version blocks |
622 preg_match_all('#---BEGIN ([0-9A-z\.\-]*?)---'."\n".'(.*?)'."\n".'---END \\1---#is', $schema, $matches); |
623 preg_match_all('#---BEGIN ([0-9A-z\.\-]*?)---'."\n".'((.*?)'."\n)?".'---END \\1---#is', $schema, $matches); |
623 |
624 |
624 $from_list =& $matches[1]; |
625 $from_list =& $matches[1]; |
625 $query_list =& $matches[2]; |
626 $query_list =& $matches[3]; |
626 |
627 |
627 foreach($matches[0] as $m) |
628 foreach($matches[0] as $m) |
628 { |
629 { |
629 $schema = str_replace($m, '', $schema); |
630 $schema = str_replace($m, '', $schema); |
630 } |
631 } |