diff options
author | vdigital <vdigital@piwigo.org> | 2008-01-23 21:10:13 +0000 |
---|---|---|
committer | vdigital <vdigital@piwigo.org> | 2008-01-23 21:10:13 +0000 |
commit | a874845d40229ff789aacae8a0ca0101ea78144a (patch) | |
tree | 38b360ed68b644efbd157356c8aa2a3977b70bcf | |
parent | fdf915a2c17b733af0cdc264323519703ec45971 (diff) |
Bug with no ref (and maybe 663): Currently if the "Search in subcategories" checkbox was unselected, all existing categories and elements were duplicated.
Cause: Wrong comparison between fileserver directory list and already known files in tables.
Resolution: keeping only the selected directory from the file server directory list in such cases,
if that one is still allocated.
git-svn-id: http://piwigo.org/svn/branches/branch-1_7@2193 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/site_update.php | 15 | ||||
-rw-r--r-- | template/yoga/admin/site_update.tpl | 5 |
2 files changed, 16 insertions, 4 deletions
diff --git a/admin/site_update.php b/admin/site_update.php index 2c3a4eebe..fc69a940b 100644 --- a/admin/site_update.php +++ b/admin/site_update.php @@ -240,7 +240,20 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id array_push($fs_fulldirs, $basedir); } - $inserts = array(); + // If $_POST['subcats-included'] != 1 ("Search in subcategories" is unchecked) + // $db_fulldirs doesn't include any subdirectories and $fs_fulldirs does + // So $fs_fulldirs will be limited to the selected basedir + // (if that one is in $fs_fulldirs) + if (!isset($_POST['subcats-included']) or $_POST['subcats-included'] != 1) + { + $fs_fulldirs = array_intersect($fs_fulldirs, array_keys($db_fulldirs)); + } + // print_r( $fs_fulldirs ); echo "<br>"; + // print_r( $db_fulldirs ); echo "<br>"; + // print_r( array_diff($fs_fulldirs, array_keys($db_fulldirs)) ); echo "<br>"; + // die('That\'s why dirs or files synchronizations were duplicating cats.'); + + $inserts = array(); // new categories are the directories not present yet in the database foreach (array_diff($fs_fulldirs, array_keys($db_fulldirs)) as $fulldir) { diff --git a/template/yoga/admin/site_update.tpl b/template/yoga/admin/site_update.tpl index c739562ba..b16f27645 100644 --- a/template/yoga/admin/site_update.tpl +++ b/template/yoga/admin/site_update.tpl @@ -97,10 +97,9 @@ </li> <li><label> - <img class="button" src="{themeconf:icon_dir}/check.png" alt="checked checkbox"> - <input type="HIDDEN" name="subcats-included" value="1" {SUBCATS_INCLUDED_CHECKED} /> + <input type="checkbox" name="subcats-included" value="1" {SUBCATS_INCLUDED_CHECKED} /> {lang:search_subcats_included}</label> - / (<strong>Warning</strong>: Locked control, contact our forum if needed).</li> + </li> </ul> </fieldset> |