aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-10-23 21:43:26 +0000
committerplegall <plg@piwigo.org>2005-10-23 21:43:26 +0000
commit953dada953c3617e3ddd3071de8a0679bfea7cb9 (patch)
tree45bd74b1cc44aeee0365650264f452afa8b4ce46 /admin
parentda31f1fd2fd55b6a68a72d26cb2acc3b8a7817ab (diff)
- bug fixed: during file tree synchronization, warning on finding the next
rank of category which has no sub-categories yet. git-svn-id: http://piwigo.org/svn/trunk@913 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin')
-rw-r--r--admin/update.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/admin/update.php b/admin/update.php
index e4283a824..93e4f300f 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -116,10 +116,22 @@ SELECT galleries_url
// we need to have fulldirs as keys to make efficient comparison
$db_fulldirs = array_flip($db_fulldirs);
- // finding next rank for each id_uppercat
+ // finding next rank for each id_uppercat. By default, each category id
+ // has 1 for next rank on its sub-categories to create
$next_rank['NULL'] = 1;
$query = '
+SELECT id
+ FROM '.CATEGORIES_TABLE.'
+;';
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_array($result))
+ {
+ $next_rank[$row['id']] = 1;
+ }
+
+ // let's see if some categories already have some sub-categories...
+ $query = '
SELECT id_uppercat, MAX(rank)+1 AS next_rank
FROM '.CATEGORIES_TABLE.'
GROUP BY id_uppercat