]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/poche/Poche.class.php
Clean old unused tags when deleting a tag
[github/wallabag/wallabag.git] / inc / poche / Poche.class.php
index 61bc8e13ccc56f6c2d90c06f7132ddc471876e41..dc7b76d0b104ce12eff211ec15b677044e9fe6af 100755 (executable)
@@ -558,7 +558,7 @@ class Poche
                         }
                     }
                 }
-                $this->messages->add('s', _('the tag has been applied successfully'));
+                $this->messages->add('s', _('The tag has been applied successfully'));
                 Tools::redirect();
                 break;
             case 'remove_tag' :
@@ -570,6 +570,10 @@ class Poche
                     Tools::redirect();
                 }
                 $this->store->removeTagForEntry($id, $tag_id);
+                Tools::logm('tag entry deleted');
+                $this->store->cleanUnusedTags();
+                Tools::logm('old tags cleaned');
+                $this->messages->add('s', _('The tag has been successfully deleted'));
                 Tools::redirect();
                 break;
             default:
@@ -1131,6 +1135,13 @@ class Poche
         $this->messages->add('s', _('Cache deleted.'));
         Tools::redirect();
     }
+    
+    public function cleanTags() {
+        $this->store->cleanUnusedTags();
+        $this->messages->add('s', _('The unused tags have been cleaned.'));
+        Tools::logm('clean tags');
+        Tools::redirect();
+    }
 
     /**
      * return new purifier object with actual config