- Webmaster or administrator can login to run upgrade.
- Inserting upgrade line in mysql.inc.php still work. - Convert espagnol upgrade file to utf8. - Minor changes in upgrade processus. - Remove all comments in pclzip.lib.php. git-svn-id: http://piwigo.org/svn/trunk@2836 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
82a2d09d76
commit
e91161f331
13 changed files with 3019 additions and 5241 deletions
|
|
@ -23,17 +23,11 @@
|
|||
|
||||
function check_upgrade()
|
||||
{
|
||||
// Is Piwigo already installed ?
|
||||
if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE)
|
||||
if (defined('PHPWG_IN_UPGRADE'))
|
||||
{
|
||||
$message = 'Piwigo is not in upgrade mode. In include/mysql.inc.php,
|
||||
insert line
|
||||
<pre style="background-color:lightgray">
|
||||
define(\'PHPWG_IN_UPGRADE\', true);
|
||||
</pre>
|
||||
if you want to upgrade';
|
||||
die($message);
|
||||
return PHPWG_IN_UPGRADE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// concerning upgrade, we use the default tables
|
||||
|
|
@ -137,4 +131,47 @@ WHERE id IN ("' . implode('","', $plugins) . '")
|
|||
}
|
||||
}
|
||||
|
||||
// Check access rights
|
||||
function check_upgrade_access_rights($current_release, $username, $password)
|
||||
{
|
||||
global $conf, $page;
|
||||
|
||||
if (version_compare($current_release, '1.5.0', '<'))
|
||||
{
|
||||
$query = '
|
||||
SELECT password, status
|
||||
FROM '.PREFIX_TABLE.'users
|
||||
WHERE username = "'.$username.'"
|
||||
;';
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = '
|
||||
SELECT u.password, ui.status
|
||||
FROM '.$conf['users_table'].' AS u
|
||||
INNER JOIN '.PREFIX_TABLE.'user_infos AS ui
|
||||
ON u.id = ui.user_id
|
||||
WHERE '.$conf['user_fields']['username'].'="'.$username.'"
|
||||
;';
|
||||
}
|
||||
$row = mysql_fetch_assoc(mysql_query($query));
|
||||
|
||||
if (!isset($conf['pass_convert']))
|
||||
{
|
||||
$conf['pass_convert'] = create_function('$s', 'return md5($s);');
|
||||
}
|
||||
|
||||
if ($row['password'] != $conf['pass_convert']($_POST['password']))
|
||||
{
|
||||
array_push($page['errors'], l10n('invalid_pwd'));
|
||||
}
|
||||
elseif ($row['status'] != 'admin' and $row['status'] != 'webmaster')
|
||||
{
|
||||
array_push($page['errors'], l10n('You do not have access rights to run upgrade'));
|
||||
}
|
||||
else
|
||||
{
|
||||
define('PHPWG_IN_UPGRADE', true);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -12,17 +12,16 @@
|
|||
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/template/{$themeconf.template}/theme/{$themeconf.theme}/theme.css">
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
#theHeader { height: 105px; }
|
||||
|
||||
.content {
|
||||
width: 800px;
|
||||
min-height: 0px !important;
|
||||
margin: auto;
|
||||
padding: 25px;
|
||||
text-align: left;
|
||||
width: 800px;
|
||||
min-height: 0px !important;
|
||||
margin: auto;
|
||||
padding: 25px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h2 { width: 770px !important; }
|
||||
table { margin: 0px; }
|
||||
td { padding: 3px 10px; }
|
||||
</style>
|
||||
{/literal}
|
||||
<title>Piwigo {$RELEASE} - {'Upgrade'|@translate}</title>
|
||||
|
|
@ -36,17 +35,56 @@ h2 { width: 770px !important; }
|
|||
{if isset($introduction)}
|
||||
<h2>Piwigo {$RELEASE} - {'Upgrade'|@translate}</h2>
|
||||
|
||||
<p>{'language'|@translate}
|
||||
<select name="language" onchange="document.location = 'upgrade.php?language='+this.options[this.selectedIndex].value;">
|
||||
{html_options options=$language_options selected=$language_selection}
|
||||
</select>
|
||||
</p>
|
||||
{if isset($errors)}
|
||||
<div class="errors">
|
||||
<ul>
|
||||
{foreach from=$errors item=error}
|
||||
<li>{$error}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>{'language'|@translate}</td>
|
||||
<td>
|
||||
<select name="language" onchange="document.location = 'upgrade.php?language='+this.options[this.selectedIndex].value;">
|
||||
{html_options options=$language_options selected=$language_selection}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>{'introduction message'|@translate|@sprintf:$introduction.CURRENT_RELEASE}</p>
|
||||
{if isset($login)}
|
||||
<p>{'upgrade login message'|@translate}</p>
|
||||
{/if}
|
||||
|
||||
<form method="POST" action="{$introduction.F_ACTION}" name="upgrade_form">
|
||||
{if isset($login)}
|
||||
<table>
|
||||
<tr>
|
||||
<td>{'Username'|@translate}</td>
|
||||
<td><input type="text" name="username" id="username" size="25" maxlength="40" style="width: 150px;" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{'Password'|@translate}</td>
|
||||
<td><input type="password" name="password" id="password" size="25" maxlength="25" style="width: 150px;" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
|
||||
<p style="text-align: center;">
|
||||
<a href="{$introduction.RUN_UPGRADE_URL}">{'Upgrade from %s to %s'|@translate|@sprintf:$introduction.CURRENT_RELEASE:$RELEASE}</b>
|
||||
<input class="submit" type="submit" name="submit" value="{'Upgrade from %s to %s'|@translate|@sprintf:$introduction.CURRENT_RELEASE:$RELEASE}"/>
|
||||
</p>
|
||||
</form>
|
||||
<!--
|
||||
<p style="text-align: center;">
|
||||
<a href="{$introduction.RUN_UPGRADE_URL}">{'Upgrade from %s to %s'|@translate|@sprintf:$introduction.CURRENT_RELEASE:$RELEASE}</a>
|
||||
</p>
|
||||
-->
|
||||
|
||||
{/if}
|
||||
|
||||
{if isset($upgrade)}
|
||||
|
|
|
|||
|
|
@ -129,8 +129,8 @@ SELECT language, COUNT(user_id) AS count FROM '.USER_INFOS_TABLE.'
|
|||
$result = pwg_query($query);
|
||||
while ( $row=mysql_fetch_assoc($result) )
|
||||
{
|
||||
$lang = $row["language"];
|
||||
$lang_def = explode('.', $lang);
|
||||
$language = $row["language"];
|
||||
$lang_def = explode('.', $language);
|
||||
if ( count($lang_def)==2 )
|
||||
{
|
||||
$new_lang = $lang_def[0];
|
||||
|
|
@ -141,12 +141,12 @@ SELECT language, COUNT(user_id) AS count FROM '.USER_INFOS_TABLE.'
|
|||
$new_lang = 'en_UK';
|
||||
$charset = 'iso-8859-1';
|
||||
}
|
||||
$all_langs[$lang] = array(
|
||||
$all_langs[$language] = array(
|
||||
'count' => $row['count'],
|
||||
'new_lang' => $new_lang,
|
||||
'charset' => $charset,
|
||||
);
|
||||
$upgrade_log .= ">>user_lang\t".$lang."\t".$row['count']."\n";
|
||||
$upgrade_log .= ">>user_lang\t".$language."\t".$row['count']."\n";
|
||||
}
|
||||
$upgrade_log .= "\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ previous configuration',
|
|||
'in include/mysql.inc.php, before
|
||||
<pre style="background-color:lightgray">?></pre>
|
||||
insert
|
||||
<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);<pre>'
|
||||
<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);</pre>'
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ INSERT INTO `'.PREFIX_TABLE.'upgrade`
|
|||
}
|
||||
|
||||
echo '</pre>';
|
||||
ob_clean();
|
||||
ob_end_clean();
|
||||
|
||||
// now we upgrade from 2.0.0
|
||||
// include_once(PHPWG_ROOT_PATH.'install/upgrade_2.0.0.php');
|
||||
|
|
|
|||
|
|
@ -32,8 +32,9 @@ $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['remove line from mysql.inc.php'] = 'In include/mysql.inc.php, remove:';
|
||||
$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>General>Maintenance] if you encounter any problem.';
|
||||
$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';
|
||||
|
||||
?>
|
||||
|
|
@ -31,8 +31,9 @@ $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['remove line from mysql.inc.php'] = 'In include/mysql.inc.php, remove:';
|
||||
$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>General>Maintenance] if you encounter any problem.';
|
||||
$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';
|
||||
|
||||
?>
|
||||
|
|
@ -21,18 +21,19 @@
|
|||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$lang['Upgrade'] = 'Puesta al día';
|
||||
$lang['introduction message'] = 'Esta página le propone poner al día la base de dato correspondiente a su antigua versión de piwigo hacia la nueva versión.
|
||||
El asistente de postura al día piensa en la versión actual es un <strong> versión %s </strong> (o equivalente). ';
|
||||
$lang['Upgrade from %s to %s'] = 'Puesta al día por la versión %s a %s';
|
||||
$lang['Statistics'] = 'Estadísticas';
|
||||
$lang['total upgrade time'] = 'tiempo total de la puesta al día';
|
||||
$lang['Upgrade'] = 'Puesta al día';
|
||||
$lang['introduction message'] = 'Esta página le propone poner al día la base de dato correspondiente a su antigua versión de piwigo hacia la nueva versión.
|
||||
El asistente de postura al día piensa en la versión actual es un <strong> versión %s </strong> (o equivalente). ';
|
||||
$lang['Upgrade from %s to %s'] = 'Puesta al día por la versión %s a %s';
|
||||
$lang['Statistics'] = 'Estadísticas';
|
||||
$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['remove line from mysql.inc.php'] = 'En el fichero include/mysql.inc.php, borre la línea siguiente:';
|
||||
$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['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:';
|
||||
/*TODO*/$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
|
||||
/*TODO*/$lang['You do not have access rights to run upgrade'] = 'You do not have access rights to run upgrade';
|
||||
|
||||
?>
|
||||
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
$lang['Upgrade'] = 'Mise à jour';
|
||||
$lang['introduction message'] = 'Cette page vous propose de mettre à jour la base de donnée correspondante à votre ancienne version de piwigo vers la nouvelle version.
|
||||
L\'assistant de mise à jour pense la version actuelle est une <strong>version %s</strong> (ou équivalente).';
|
||||
L\'assistant de mise à jour pense que la version actuelle est une <strong>version %s</strong> (ou équivalente).';
|
||||
$lang['upgrade login message'] = 'Seul un adminitrateur peut lancer la mise à jour: veuillez vous identifier ci-dessous.';
|
||||
$lang['Upgrade from %s to %s'] = 'Mise à jour de la version %s à %s';
|
||||
$lang['Statistics'] = 'Statistiques';
|
||||
$lang['total upgrade time'] = 'temps total de la mise à jour';
|
||||
|
|
@ -31,8 +32,9 @@ $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['remove line from mysql.inc.php'] = 'Dans le fichier include/mysql.inc.php, effacez la ligne suivante:';
|
||||
$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['You do not have access rights to run upgrade'] = 'Vous n\'avez pas les droits necessaires pour lancer la mise à jour.';
|
||||
|
||||
?>
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
$lang['Upgrade'] = 'Upgrade';
|
||||
$lang['introduction message'] = 'This page proposes to upgrade your database corresponding to your old version of Piwigo to the current version.
|
||||
The upgrade assistant thinks you are currently running a <strong>release %s</strong> (or equivalent).';
|
||||
$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
|
||||
$lang['Upgrade from %s to %s'] = 'Upgrade from version %s to %s';
|
||||
$lang['Statistics'] = 'Statistics';
|
||||
$lang['total upgrade time'] = 'total upgrade time';
|
||||
|
|
@ -32,8 +33,9 @@ $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['remove line from mysql.inc.php'] = 'In include/mysql.inc.php, remove:';
|
||||
$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>General>Maintenance] if you encounter any problem.';
|
||||
$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';
|
||||
|
||||
?>
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
$lang['Upgrade'] = 'Upgrade';
|
||||
$lang['introduction message'] = 'This page proposes to upgrade your database corresponding to your old version of Piwigo to the current version.
|
||||
The upgrade assistant thinks you are currently running a <strong>release %s</strong> (or equivalent).';
|
||||
$lang['upgrade login message'] = 'Only administrator can run upgrade: please sign in below.';
|
||||
$lang['Upgrade from %s to %s'] = 'Upgrade from version %s to %s';
|
||||
$lang['Statistics'] = 'Statistics';
|
||||
$lang['total upgrade time'] = 'total upgrade time';
|
||||
|
|
@ -32,8 +33,9 @@ $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['remove line from mysql.inc.php'] = 'In include/mysql.inc.php, remove:';
|
||||
$lang['perform a maintenance check'] = 'Perform a maintenance check in [Administration>General>Maintenance] if you encounter any problem.';
|
||||
$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';
|
||||
|
||||
?>
|
||||
168
upgrade.php
168
upgrade.php
|
|
@ -29,6 +29,11 @@ if (version_compare(PHP_VERSION, '5', '<'))
|
|||
|
||||
define('PHPWG_ROOT_PATH', './');
|
||||
|
||||
if (!file_exists(PHPWG_ROOT_PATH.'include/mysql.inc.php'))
|
||||
{
|
||||
die('Could not find include/mysql.inc.php file.');
|
||||
}
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'include/functions.inc.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php');
|
||||
|
|
@ -37,8 +42,6 @@ include(PHPWG_ROOT_PATH.'include/mysql.inc.php');
|
|||
include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
|
||||
@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
|
||||
|
||||
check_upgrade();
|
||||
|
||||
prepare_conf_upgrade();
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'include/constants.php');
|
||||
|
|
@ -53,18 +56,6 @@ if ( version_compare(mysql_get_server_info(), '4.1.0', '>=')
|
|||
pwg_query('SET NAMES "'.DB_CHARSET.'"');
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | tricky output |
|
||||
// +-----------------------------------------------------------------------+
|
||||
echo '<!-- This is an HTML comment given in order to make IE outputs';
|
||||
echo ' the code.'."\n";
|
||||
echo ' Indeed, IE doesn\'t start to send output until a limit';
|
||||
echo ' of XXX bytes '."\n";
|
||||
echo str_repeat( ' ', 80 )."\n";
|
||||
echo str_repeat( ' ', 80 )."\n";
|
||||
echo str_repeat( ' ', 80 )."\n";
|
||||
echo '-->'."\n";
|
||||
flush();
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | functions |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
@ -168,9 +159,9 @@ else
|
|||
}
|
||||
}
|
||||
|
||||
load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
|
||||
load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
|
||||
load_language( 'upgrade.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
|
||||
load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
|
||||
load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
|
||||
load_language( 'upgrade.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | template initialization |
|
||||
|
|
@ -180,16 +171,6 @@ $template = new Template(PHPWG_ROOT_PATH.'admin/template/goto', 'roma');
|
|||
$template->set_filenames(array('upgrade'=>'upgrade.tpl'));
|
||||
$template->assign('RELEASE', PHPWG_VERSION);
|
||||
|
||||
foreach (get_languages('utf-8') as $language_code => $language_name)
|
||||
{
|
||||
if ($language == $language_code)
|
||||
{
|
||||
$template->assign('language_selection', $language_code);
|
||||
}
|
||||
$languages_options[$language_code] = $language_name;
|
||||
}
|
||||
$template->assign('language_options', $languages_options);
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | upgrade choice |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
@ -197,74 +178,63 @@ $template->assign('language_options', $languages_options);
|
|||
$tables = get_tables();
|
||||
$columns_of = get_columns_of($tables);
|
||||
|
||||
if (!isset($_GET['version']))
|
||||
// find the current release
|
||||
if (!in_array('param', $columns_of[PREFIX_TABLE.'config']))
|
||||
{
|
||||
// find the current release
|
||||
if (!in_array('param', $columns_of[PREFIX_TABLE.'config']))
|
||||
// we're in branch 1.3, important upgrade, isn't it?
|
||||
if (in_array(PREFIX_TABLE.'user_category', $tables))
|
||||
{
|
||||
// we're in branch 1.3, important upgrade, isn't it?
|
||||
if (in_array(PREFIX_TABLE.'user_category', $tables))
|
||||
{
|
||||
$current_release = '1.3.1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_release = '1.3.0';
|
||||
}
|
||||
}
|
||||
else if (!in_array(PREFIX_TABLE.'user_cache', $tables))
|
||||
{
|
||||
$current_release = '1.4.0';
|
||||
}
|
||||
else if (!in_array(PREFIX_TABLE.'tags', $tables))
|
||||
{
|
||||
$current_release = '1.5.0';
|
||||
}
|
||||
else if ( !in_array(PREFIX_TABLE.'history_summary', $tables) )
|
||||
{
|
||||
if (!in_array('auto_login_key', $columns_of[PREFIX_TABLE.'user_infos']))
|
||||
{
|
||||
$current_release = '1.6.0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_release = '1.6.2';
|
||||
}
|
||||
}
|
||||
else if (!in_array('md5sum', $columns_of[PREFIX_TABLE.'images']))
|
||||
{
|
||||
$current_release = '1.7.0';
|
||||
$current_release = '1.3.1';
|
||||
}
|
||||
else
|
||||
{
|
||||
die('No upgrade required, the database structure is up to date');
|
||||
$current_release = '1.3.0';
|
||||
}
|
||||
|
||||
$template->assign(
|
||||
'introduction',
|
||||
array(
|
||||
'CURRENT_RELEASE' => $current_release,
|
||||
'RUN_UPGRADE_URL' =>
|
||||
PHPWG_ROOT_PATH.'upgrade.php?version='.$current_release.'&language='.$language,
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (!in_array(PREFIX_TABLE.'user_cache', $tables))
|
||||
{
|
||||
$current_release = '1.4.0';
|
||||
}
|
||||
else if (!in_array(PREFIX_TABLE.'tags', $tables))
|
||||
{
|
||||
$current_release = '1.5.0';
|
||||
}
|
||||
else if ( !in_array(PREFIX_TABLE.'history_summary', $tables) )
|
||||
{
|
||||
if (!in_array('auto_login_key', $columns_of[PREFIX_TABLE.'user_infos']))
|
||||
{
|
||||
$current_release = '1.6.0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$current_release = '1.6.2';
|
||||
}
|
||||
}
|
||||
else if (!in_array('md5sum', $columns_of[PREFIX_TABLE.'images']))
|
||||
{
|
||||
$current_release = '1.7.0';
|
||||
}
|
||||
else
|
||||
{
|
||||
die('No upgrade required, the database structure is up to date');
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | upgrade launch |
|
||||
// +-----------------------------------------------------------------------+
|
||||
$page['infos'] = array();
|
||||
$page['errors'] = array();
|
||||
|
||||
else
|
||||
if (isset($_POST['username']) and isset($_POST['password']))
|
||||
{
|
||||
if (in_array('md5sum', $columns_of[PREFIX_TABLE.'images']))
|
||||
{
|
||||
die('No database upgrade required, do not refresh the page');
|
||||
}
|
||||
check_upgrade_access_rights($current_release, $_POST['username'], $_POST['password']);
|
||||
}
|
||||
|
||||
$upgrade_file = PHPWG_ROOT_PATH.'install/upgrade_'.$_GET['version'].'.php';
|
||||
if (isset($_POST['submit']) and check_upgrade())
|
||||
{
|
||||
$upgrade_file = PHPWG_ROOT_PATH.'install/upgrade_'.$current_release.'.php';
|
||||
if (is_file($upgrade_file))
|
||||
{
|
||||
$page['infos'] = array();
|
||||
$page['upgrade_start'] = get_moment();
|
||||
$conf['die_on_sql_error'] = false;
|
||||
include($upgrade_file);
|
||||
|
|
@ -283,7 +253,7 @@ else
|
|||
$template->assign(
|
||||
'upgrade',
|
||||
array(
|
||||
'VERSION' => $_GET['version'],
|
||||
'VERSION' => $current_release,
|
||||
'TOTAL_TIME' => get_elapsed_time(
|
||||
$page['upgrade_start'],
|
||||
$page['upgrade_end']
|
||||
|
|
@ -300,12 +270,9 @@ else
|
|||
|
||||
array_push($page['infos'],
|
||||
l10n('delete upgrade files'),
|
||||
l10n('remove line from mysql.inc.php') . '<pre>define(\'PHPWG_IN_UPGRADE\', true);</pre>',
|
||||
l10n('perform a maintenance check')
|
||||
);
|
||||
|
||||
$template->assign('infos', $page['infos']);
|
||||
|
||||
invalidate_user_cache();
|
||||
|
||||
// c13y_upgrade plugin means "check integrity after upgrade", so it
|
||||
|
|
@ -317,10 +284,41 @@ REPLACE INTO '.PLUGINS_TABLE.'
|
|||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | start template output |
|
||||
// +-----------------------------------------------------------------------+
|
||||
else
|
||||
{
|
||||
foreach (get_languages('utf-8') as $language_code => $language_name)
|
||||
{
|
||||
die('Hacking attempt');
|
||||
if ($language == $language_code)
|
||||
{
|
||||
$template->assign('language_selection', $language_code);
|
||||
}
|
||||
$languages_options[$language_code] = $language_name;
|
||||
}
|
||||
$template->assign('language_options', $languages_options);
|
||||
|
||||
$template->assign('introduction', array(
|
||||
'CURRENT_RELEASE' => $current_release,
|
||||
'F_ACTION' => 'upgrade.php?language=' . $language));
|
||||
|
||||
if (!check_upgrade())
|
||||
{
|
||||
$template->assign('login', true);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($page['errors']) != 0)
|
||||
{
|
||||
$template->assign('errors', $page['errors']);
|
||||
}
|
||||
|
||||
if (count($page['infos']) != 0)
|
||||
{
|
||||
$template->assign('infos', $page['infos']);
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue