aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-03-14 15:18:01 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-03-14 15:18:01 +0000
commit146c63e90cd46b727fdc34acb1b224656d81efc5 (patch)
treeb93eff2f2eedf8d3f0736e8edd2a42d3f425e404 /services
parentd10c26fd1de42d9d7030f383dc20ac2c17fccbd1 (diff)
downloadsemanticscuttle-146c63e90cd46b727fdc34acb1b224656d81efc5.tar.gz
semanticscuttle-146c63e90cd46b727fdc34acb1b224656d81efc5.tar.bz2
Feature improvement: make rename tags more consistent (with regards to linked tags)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@85 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'services')
-rw-r--r--services/tag2tagservice.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/services/tag2tagservice.php b/services/tag2tagservice.php
index d3a4a77..ee26a11 100644
--- a/services/tag2tagservice.php
+++ b/services/tag2tagservice.php
@@ -231,6 +231,30 @@ class Tag2TagService {
return true;
}
+ function renameTag($uId, $oldName, $newName) {
+ $query = 'UPDATE `'. $this->getTableName() .'`';
+ $query.= ' SET tag1="'.$newName.'"';
+ $query.= ' WHERE tag1="'.$oldName.'"';
+ $query.= ' AND uId="'.$uId.'"';
+ $this->db->sql_query($query);
+
+ $query = 'UPDATE `'. $this->getTableName() .'`';
+ $query.= ' SET tag2="'.$newName.'"';
+ $query.= ' WHERE tag2="'.$oldName.'"';
+ $query.= ' AND uId="'.$uId.'"';
+ $this->db->sql_query($query);
+
+ // Update stats
+ $tsts =& ServiceFactory::getServiceInstance('TagStatService');
+ $tsts->updateStat($oldName, '=', $uId);
+ $tsts->updateStat($oldName, '>', $uId);
+ $tsts->updateStat($newName, '=', $uId);
+ $tsts->updateStat($newName, '>', $uId);
+
+ return true;
+
+ }
+
function deleteAll() {
$query = 'TRUNCATE TABLE `'. $this->getTableName() .'`';
$this->db->sql_query($query);