improvement: upgrades id retrieving in include/common.inc.php and

upgrade_feed.php are now made by dedicated function
get_available_upgrade_ids.

bug fixed: after an installation, you had to play all available upgrades,
which was wrong. install.php inserts informations related to all available
upgrades at installation time. Thus avoiding automatic upgrades.


git-svn-id: http://piwigo.org/svn/trunk@1027 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall
2006-02-06 21:52:16 +00:00
parent 701350ff05
commit 3d0c5236e1
4 changed files with 45 additions and 33 deletions
+2 -18
View File
@@ -134,31 +134,15 @@ or die ( "Could not connect to database" );
if ($conf['check_upgrade_feed'])
{
define('PREFIX_TABLE', $prefixeTable);
define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db');
// retrieve already applied upgrades
$query = '
SELECT id
FROM '.PREFIX_TABLE.'upgrade
FROM '.UPGRADE_TABLE.'
;';
$applied = array_from_query($query, 'id');
// retrieve existing upgrades
$existing = array();
if ($contents = opendir(UPGRADES_PATH))
{
while (($node = readdir($contents)) !== false)
{
if (is_file(UPGRADES_PATH.'/'.$node)
and preg_match('/^(.*?)-database\.php$/', $node, $match))
{
array_push($existing, $match[1]);
}
}
}
natcasesort($existing);
$existing = get_available_upgrade_ids();
// which upgrades need to be applied?
if (count(array_diff($existing, $applied)) > 0)