1 | <?php |
||
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() |
||
14 | |||
15 | public static function getReleaseNotes() |
||
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) { |
||
72 |