parent
208e8de7f0
commit
5f3ff8db86
1 changed files with 7 additions and 5 deletions
|
@ -243,8 +243,8 @@ class TagEdit extends Extension {
|
||||||
global $database;
|
global $database;
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$search_set = Tag::explode(strtolower($search));
|
$search_set = Tag::explode(strtolower($search), false);
|
||||||
$replace_set = Tag::explode(strtolower($replace));
|
$replace_set = Tag::explode(strtolower($replace), false);
|
||||||
|
|
||||||
log_info("tag_edit", "Mass editing tags: '$search' -> '$replace'");
|
log_info("tag_edit", "Mass editing tags: '$search' -> '$replace'");
|
||||||
|
|
||||||
|
@ -266,17 +266,19 @@ class TagEdit extends Extension {
|
||||||
// search returns high-ids first, so we want to look
|
// search returns high-ids first, so we want to look
|
||||||
// at images with lower IDs than the previous.
|
// at images with lower IDs than the previous.
|
||||||
$search_forward = $search_set;
|
$search_forward = $search_set;
|
||||||
if($last_id >= 0) $search_forward[] = "id<$last_id";
|
if($last_id >= 0){
|
||||||
|
$search_forward[] = "id<$last_id";
|
||||||
|
$search_forward[] = "order=id_desc"; //Force high > low ID search
|
||||||
|
}
|
||||||
|
|
||||||
$images = Image::find_images(0, 100, $search_forward);
|
$images = Image::find_images(0, 100, $search_forward);
|
||||||
if(count($images) == 0) break;
|
if(count($images) == 0) break;
|
||||||
|
|
||||||
foreach($images as $image) {
|
foreach($images as $image) {
|
||||||
// remove the search'ed tags
|
// remove the search'ed tags
|
||||||
$before = $image->get_tag_array();
|
$before = array_map('strtolower', $image->get_tag_array());
|
||||||
$after = array();
|
$after = array();
|
||||||
foreach($before as $tag) {
|
foreach($before as $tag) {
|
||||||
$tag = strtolower($tag);
|
|
||||||
if(!in_array($tag, $search_set)) {
|
if(!in_array($tag, $search_set)) {
|
||||||
$after[] = $tag;
|
$after[] = $tag;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue