merge -c2863 from trunk to branch 2.0

- Remove advises of file removal at the end of install/upgrade.
- Automatic change mysql.inc.php if file is writable, else purpose manual change to user.

git-svn-id: http://piwigo.org/svn/branches/2.0@2864 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice
2008-11-12 12:41:27 +00:00
parent df2f3a4f4d
commit b5b089670a
10 changed files with 43 additions and 48 deletions
+5 -29
View File
@@ -101,25 +101,6 @@ if ( !defined('PWG_CHARSET') )
{
$upgrade_log = '';
// +-----------------------------------------------------------------------+
// 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);
}
// +-----------------------------------------------------------------------+
// load all the user languages
$all_langs=array();
@@ -274,17 +255,12 @@ ALTER TABLE t1 CHANGE c1 c1 TEXT CHARACTER SET utf8;
// +-----------------------------------------------------------------------+
// write the result to file and update #user_infos.language
$config_file_contents =
substr($config_file_contents, 0, $php_end_tag).'
define(\'PWG_CHARSET\', \''.$pwg_charset.'\');
// changes to write in mysql.inc.php
array_push($mysql_changes,
'define(\'PWG_CHARSET\', \''.$pwg_charset.'\');
define(\'DB_CHARSET\', \''.$db_charset.'\');
define(\'DB_COLLATE\', \'\');
'.substr($config_file_contents, $php_end_tag);
$fp = @fopen( $config_file, 'w' );
@fputs($fp, $config_file_contents, strlen($config_file_contents));
@fclose($fp);
define(\'DB_COLLATE\', \'\');'
);
foreach ($all_langs as $old_lang=>$lang_data)
{