merge r16312 from branch 2.4 to trunk

bug 2677 fixed: smarter check of the database version and manage partial upgrade.



git-svn-id: http://piwigo.org/svn/trunk@16313 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2012-07-02 22:28:50 +00:00
parent 39d54098e7
commit 52fa0fed5e
2 changed files with 30 additions and 8 deletions
+20 -5
View File
@@ -322,13 +322,28 @@ else if (!in_array('rating_score', $columns_of[PREFIX_TABLE.'images']))
{
$current_release = '2.2.0';
}
else if (!in_array('coi', $columns_of[PREFIX_TABLE.'images']))
{
$current_release = '2.3.0';
}
else
{
die('No upgrade required, the database structure is up to date');
// retrieve already applied upgrades
$query = '
SELECT id
FROM '.PREFIX_TABLE.'upgrade
;';
$applied_upgrades = array_from_query($query, 'id');
if (!in_array(127, $applied_upgrades))
{
$current_release = '2.3.0';
}
else
{
// confirm that the database is in the same version as source code files
conf_update_param('piwigo_db_version', get_branch_from_version(PHPWG_VERSION));
echo 'No upgrade required, the database structure is up to date';
echo '<br><a href="index.php">← back to gallery</a>';
exit();
}
}
// +-----------------------------------------------------------------------+