- 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/trunk@2863 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
patdenice 2008-11-12 12:40:20 +00:00
parent 1d9821abd1
commit cd9f45fd1d
10 changed files with 43 additions and 48 deletions

View file

@ -22,6 +22,7 @@
table { margin: 0px; }
td { padding: 3px 10px; }
textarea { margin-left: 20px; }
</style>
{/literal}
<title>Piwigo {$RELEASE} - {'Upgrade'|@translate}</title>

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)
{

View file

@ -595,15 +595,8 @@ if (!is_writable($config_file))
die('FILE NOT WRITABLE '.$config_file);
}
// 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);
$fp = @fopen( $config_file, 'w' );
@fputs($fp, $config_file_contents, strlen($config_file_contents));
@fclose($fp);
// changes to write in mysql.inc.php
array_push($mysql_changes, 'define(\'PHPWG_INSTALLED\', true);');
// Send infos
$page['infos'] = array_merge(

View file

@ -31,11 +31,11 @@ $lang['total upgrade time'] = 'total upgrade time';
$lang['total SQL time'] = 'total SQL time';
$lang['SQL queries'] = 'SQL queries';
$lang['Upgrade informations'] = 'Upgrade informations';
$lang['delete upgrade files'] = '[Security] Delete files "upgrade.php", "upgrade_feed.php", "install.php" and "install" directory';
$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>Specials>Maintenance] if you encounter any problem.';
$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'All sub-categories of private categories become private';

View file

@ -30,11 +30,11 @@ $lang['total upgrade time'] = 'total upgrade time';
$lang['total SQL time'] = 'total SQL time';
$lang['SQL queries'] = 'SQL queries';
$lang['Upgrade informations'] = 'Upgrade informations';
$lang['delete upgrade files'] = '[Security] Delete files "upgrade.php", "upgrade_feed.php", "install.php" and "install" directory';
$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>Specials>Maintenance] if you encounter any problem.';
$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'All sub-categories of private categories become private';

View file

@ -30,11 +30,11 @@ $lang['total upgrade time'] = 'tiempo total de la puesta al día';
$lang['total SQL time'] = 'tiempo total de la demanda SQL';
$lang['SQL queries'] = 'número de demanda SQL';
$lang['Upgrade informations'] = 'Informaciones sobre la puesta al día';
$lang['delete upgrade files'] = '[Seguridad] Borre los ficheros "upgrade.php", "upgrade_feed.php", "install.php" así como el expediente "install"';
$lang['perform a maintenance check'] = 'Por favor, efectúes un mantenimiento en [Administración>Especiales>Mantenimiento] si usted encuentra problemas.';
$lang['deactivated plugins'] = 'Por precaución, el plugins siguiente han sido desactivados. Verifique si existen unas posturas al día antes de reactivarlas:';
$lang['upgrade login message'] = 'Sólo un administrador puede lanzar la puesta al día: por favor, identifiqúese más abajo.';
$lang['You do not have access rights to run upgrade'] = 'Usted no tiene los derechos necessaires para lanzar la puesta al día.';
/* TODO */$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Todas las subcategorías de categorías privadas se vuelven privadas';

View file

@ -30,11 +30,11 @@ $lang['total upgrade time'] = 'temps total de la mise à jour';
$lang['total SQL time'] = 'temps total des requêtes SQL';
$lang['SQL queries'] = 'nombre de requêtes SQL';
$lang['Upgrade informations'] = 'Informations sur la mise à jour';
$lang['delete upgrade files'] = '[Sécurité] Effacez les fichiers "upgrade.php", "upgrade_feed.php", "install.php" ainsi que le dossier "install"';
$lang['perform a maintenance check'] = 'Veuillez effectuer une maintenance dans [Administration>Spéciales>Maintenance] si vous rencontrez des problèmes.';
$lang['deactivated plugins'] = 'Par précaution, les plugins suivants ont été désactivés. Vérifiez s\'il existe des mises à jour avant de les réactiver:';
$lang['upgrade login message'] = 'Seul un adminitrateur peut lancer la mise à jour: veuillez vous identifier ci-dessous.';
$lang['upgrade login message'] = 'Seul un administrateur peut lancer la mise à jour: veuillez vous identifier ci-dessous.';
$lang['You do not have access rights to run upgrade'] = 'Vous n\'avez pas les droits necessaires pour lancer la mise à jour.';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'Dans le fichier <i>include/mysql.inc.php</i>, avant <b>?></b>, insérez:';
// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Toutes les sous-catégories de catégories privées deviennent privées';

View file

@ -30,11 +30,11 @@ $lang['total upgrade time'] = 'tempo totale per aggiornamento';
$lang['total SQL time'] = 'tempo totale delle esecuzioni SQL';
$lang['SQL queries'] = 'numero delle esecuzioni SQL';
$lang['Upgrade informations'] = 'Informazioni sul\'aggiornamento';
$lang['delete upgrade files'] = '[Sicurezza] Cancellare i files "upgrade.php", "upgrade_feed.php", "install.php" e la directory "install"';
$lang['perform a maintenance check'] = 'Se riscontrate dei problemi, effettuare una manutezione in [Amministrazione>Speciale>Manutenzione].';
$lang['deactivated plugins'] = 'Per precauzione, i plugins sono stati disattivati. Verificate se non esistono degli aggiornamenti prima di riattivarli:';
$lang['upgrade login message'] = 'Solo un\'amministratore può eseguire l\'aggiornamento: identificatevi.';
$lang['You do not have access rights to run upgrade'] = 'Non avete le autorizzazioni necessarie per effettuare l\'aggiornamento';
/* TODO */$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'Tutte le sotto categorie delle categorie private diventono private';

View file

@ -31,11 +31,11 @@ $lang['total upgrade time'] = 'total upgrade time';
$lang['total SQL time'] = 'total SQL time';
$lang['SQL queries'] = 'SQL queries';
$lang['Upgrade informations'] = 'Upgrade informations';
$lang['delete upgrade files'] = '[Security] Delete files "upgrade.php", "upgrade_feed.php", "install.php" and "install" directory';
$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>Specials>Maintenance] if you encounter any problem.';
$lang['deactivated plugins'] = 'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:';
$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
$lang['in include/mysql.inc.php, before ?>, insert:'] = 'In <i>include/mysql.inc.php</i>, before <b>?></b>, insert:';
// Upgrade informations from upgrade_1.3.1.php
$lang['all sub-categories of private categories become private'] = 'All sub-categories of private categories become private';

View file

@ -29,9 +29,17 @@ if (version_compare(PHP_VERSION, '5', '<'))
define('PHPWG_ROOT_PATH', './');
if (!file_exists(PHPWG_ROOT_PATH.'include/mysql.inc.php'))
// load 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('Could not find include/mysql.inc.php file.');
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);
}
include_once(PHPWG_ROOT_PATH.'include/functions.inc.php');
@ -224,6 +232,7 @@ else
// +-----------------------------------------------------------------------+
$page['infos'] = array();
$page['errors'] = array();
$mysql_changes = array();
if (isset($_POST['username']) and isset($_POST['password']))
{
@ -239,6 +248,23 @@ if (isset($_POST['submit']) and check_upgrade())
$conf['die_on_sql_error'] = false;
include($upgrade_file);
// Something to add in mysql.inc.php?
if (!empty($mysql_changes))
{
$config_file_contents =
substr($config_file_contents, 0, $php_end_tag) . "\r\n"
. implode("\r\n\r\n" , $mysql_changes) . "\r\n"
. substr($config_file_contents, $php_end_tag);
if (!@file_put_contents($config_file, $config_file_contents))
{
array_push($page['infos'],
l10n('in include/mysql.inc.php, before ?>, insert:') . '
<p><textarea rows="5" cols="40">'.implode("\r\n\r\n" , $mysql_changes).'</textarea></p>'
);
}
}
// Plugins deactivation
if (in_array(PREFIX_TABLE.'plugins', $tables))
{
@ -269,7 +295,6 @@ if (isset($_POST['submit']) and check_upgrade())
);
array_push($page['infos'],
l10n('delete upgrade files'),
l10n('perform a maintenance check')
);