1
|
|
|
<?php |
2
|
|
|
namespace SymphonyCms\Installer\Migrations; |
3
|
|
|
|
4
|
|
|
use SymphonyCms\Installer\Lib\Migration; |
5
|
|
|
use Symphony; |
6
|
|
|
use Exception; |
7
|
|
|
|
8
|
|
|
class migration_234 extends Migration |
9
|
|
|
{ |
10
|
|
|
public static function getVersion() |
11
|
|
|
{ |
12
|
|
|
return '2.3.4'; |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
public static function getReleaseNotes() |
16
|
|
|
{ |
17
|
|
|
return 'http://getsymphony.com/download/releases/version/2.3.4/'; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
public static function upgrade() |
21
|
|
|
{ |
22
|
|
View Code Duplication |
if (version_compare(self::$existing_version, '2.3.4beta1', '<=')) { |
23
|
|
|
// Detect mod_rewrite #1808 |
24
|
|
|
try { |
25
|
|
|
$htaccess = file_get_contents(DOCROOT . '/.htaccess'); |
26
|
|
|
|
27
|
|
|
if ($htaccess !== false && !preg_match('/SetEnv HTTP_MOD_REWRITE No/', $htaccess)) { |
28
|
|
|
$rewrite = ' |
29
|
|
|
<IfModule !mod_rewrite.c> |
30
|
|
|
SetEnv HTTP_MOD_REWRITE No |
31
|
|
|
</IfModule> |
32
|
|
|
|
33
|
|
|
<IfModule mod_rewrite.c>'; |
34
|
|
|
|
35
|
|
|
$htaccess = str_replace('<IfModule mod_rewrite.c>', $rewrite, $htaccess); |
36
|
|
|
file_put_contents(DOCROOT . '/.htaccess', $htaccess); |
37
|
|
|
} |
38
|
|
|
} catch (Exception $ex) { |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
// Extend token field to enable more secure tokens |
42
|
|
|
try { |
43
|
|
|
Symphony::Database()->query('ALTER TABLE `tbl_forgotpass` CHANGE `token` `token` VARCHAR(16);'); |
44
|
|
|
} catch (Exception $ex) { |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
if (version_compare(self::$existing_version, '2.3.4beta2', '<=')) { |
49
|
|
|
// Extend session_id field for default Suhosin installs |
50
|
|
|
try { |
51
|
|
|
Symphony::Database()->query('ALTER TABLE `tbl_sessions` CHANGE `session` `session` VARCHAR(128);'); |
52
|
|
|
} catch (Exception $ex) { |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
// Update the version information |
57
|
|
|
return parent::upgrade(); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|