diff options
author | patdenice <patdenice@piwigo.org> | 2008-11-07 13:54:35 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2008-11-07 13:54:35 +0000 |
commit | 04395a4c359dddc5c9c7fff5eb447b5ee26204db (patch) | |
tree | b8d788f543590c3128629c794d4614a1ba9b98db /install/upgrade_1.3.1.php | |
parent | e91161f33103f7f415b0cb06045dc5ef1549e27a (diff) |
- improve 1.3.1 upgrade (automatic write in mysql.inc.php).
- translate 1.3.1 upgrade informations messages.
- security fix in upgrade login.
git-svn-id: http://piwigo.org/svn/trunk@2838 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | install/upgrade_1.3.1.php | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/install/upgrade_1.3.1.php b/install/upgrade_1.3.1.php index 8bc0d1c93..436f25953 100644 --- a/install/upgrade_1.3.1.php +++ b/install/upgrade_1.3.1.php @@ -578,24 +578,43 @@ UPDATE '.CATEGORIES_TABLE.' pwg_query($query); } -$page['infos'] = array_merge( - $page['infos'], - array( - 'all sub-categories of private categories become private', +// load the config file +$config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php'; +$config_file_contents = @file_get_contents($config_file); +if ($config_file_contents === false) +{ + die('CANNOT LOAD '.$config_file); +} +$php_end_tag = strrpos($config_file_contents, '?'.'>'); +if ($php_end_tag === false) +{ + die('CANNOT FIND PHP END TAG IN '.$config_file); +} +if (!is_writable($config_file)) +{ + die('FILE NOT WRITABLE '.$config_file); +} - 'user permissions and group permissions have been erased', +// Insert define('PHPWG_INSTALLED', true); in mysql.inc.php +$config_file_contents = + substr($config_file_contents, 0, $php_end_tag).' +define(\'PHPWG_INSTALLED\', true); +'.substr($config_file_contents, $php_end_tag); - 'only thumbnails prefix and webmaster mail address have been saved from -previous configuration', +$fp = @fopen( $config_file, 'w' ); +@fputs($fp, $config_file_contents, strlen($config_file_contents)); +@fclose($fp); - 'in include/mysql.inc.php, before -<pre style="background-color:lightgray">?></pre> -insert -<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);</pre>' +// Send infos +$page['infos'] = array_merge( + $page['infos'], + array( + l10n('all sub-categories of private categories become private'), + l10n('user permissions and group permissions have been erased'), + l10n('only thumbnails prefix and webmaster mail saved') ) ); - // now we upgrade from 1.4.0 include_once(PHPWG_ROOT_PATH.'install/upgrade_1.4.0.php'); ?>
\ No newline at end of file |