aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Updater.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-01-20 23:34:33 +0100
committerArthurHoaro <arthur@hoa.ro>2016-02-15 20:40:39 +0100
commit21979ff11ceee0042642ac17147858a4155d54c5 (patch)
tree9527f3dbb2a23e0b42a2f9ce4cc7d4c7580da455 /application/Updater.php
parent6e607ca613b47e17f7516e94adfee930d4f3e1e8 (diff)
downloadShaarli-21979ff11ceee0042642ac17147858a4155d54c5.tar.gz
Shaarli-21979ff11ceee0042642ac17147858a4155d54c5.tar.zst
Shaarli-21979ff11ceee0042642ac17147858a4155d54c5.zip
Add exclusion in tag search
* Searching '-mytag' will now exlude all shaares with 'mytag' tag. * All tags starting with a '-' are renamed without it (through the Updater). * Unit tests. Minor code changes: * LinkDB->filter() can now take no parameters (get all link depending on logged status). * tagsStrToArray() is now static and filters blank tags.
Diffstat (limited to 'application/Updater.php')
-rw-r--r--application/Updater.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/application/Updater.php b/application/Updater.php
index 20ae0c4d..773a1ffa 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -131,6 +131,21 @@ class Updater
131 131
132 return true; 132 return true;
133 } 133 }
134
135 /**
136 * Rename tags starting with a '-' to work with tag exclusion search.
137 */
138 public function updateMethodRenameDashTags()
139 {
140 $linklist = $this->linkDB->filter();
141 foreach ($linklist as $link) {
142 $link['tags'] = preg_replace('/(^| )\-/', '$1', $link['tags']);
143 $link['tags'] = implode(' ', array_unique(LinkFilter::tagsStrToArray($link['tags'], true)));
144 $this->linkDB[$link['linkdate']] = $link;
145 }
146 $this->linkDB->savedb($this->config['config']['PAGECACHE']);
147 return true;
148 }
134} 149}
135 150
136/** 151/**