summaryrefslogtreecommitdiffstatshomepage
path: root/src/SemanticScuttle/Service/TagCache.php
diff options
context:
space:
mode:
authorGravatar cweiske2009-10-03 21:52:30 +0000
committerGravatar cweiske2009-10-03 21:52:30 +0000
commitd5f09b7e4d802cdc2d5f3f876c48ea918c961488 (patch)
treeaa1eb37219c17bef03b1515e5074b4743f89a9a3 /src/SemanticScuttle/Service/TagCache.php
parentb7345f833dea849e94f2ce23fdbe6ab58ba98be3 (diff)
downloadscuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.tar.gz
scuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.zip
make the application work again
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@388 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service/TagCache.php')
-rw-r--r--src/SemanticScuttle/Service/TagCache.php54
1 files changed, 33 insertions, 21 deletions
diff --git a/src/SemanticScuttle/Service/TagCache.php b/src/SemanticScuttle/Service/TagCache.php
index ed2eefc..30f9ebd 100644
--- a/src/SemanticScuttle/Service/TagCache.php
+++ b/src/SemanticScuttle/Service/TagCache.php
@@ -1,31 +1,43 @@
<?php
-
-/*
- * This class infers on relation between tags by storing all the including tags or synonymous tag.
- * For example, if the user creates: tag1>tag2>tag3, the system can infer that tag is included into tag1.
- * Instead of computing this relation several times, it is saved into this current table.
+/**
+ * This class infers on relation between tags by storing all
+ * the including tags or synonymous tag.
+ * For example, if the user creates: tag1>tag2>tag3, the system
+ * can infer that tag is included into tag1.
+ * Instead of computing this relation several times, it is saved
+ * into this current table.
* For synonymy, this table stores also the group of synonymous tags.
- * The table must be updated for each modification of the relations between tags.
+ * The table must be updated for each modification of
+ * the relations between tags.
*/
-
-class TagCacheService {
- var $db;
+class SemanticScuttle_Service_TagCache extends SemanticScuttle_Service
+{
var $tablename;
- function &getInstance(&$db) {
+ /**
+ * Returns the single service instance
+ *
+ * @param DB $db Database object
+ *
+ * @return SemanticScuttle_Service
+ */
+ public static function getInstance($db)
+ {
static $instance;
- if (!isset($instance))
- $instance =& new TagCacheService($db);
+ if (!isset($instance)) {
+ $instance = new self($db);
+ }
return $instance;
}
- function TagCacheService(&$db) {
- $this->db =& $db;
+ protected function __construct($db)
+ {
+ $this->db =$db;
$this->tablename = $GLOBALS['tableprefix'] .'tagscache';
}
function getChildren($tag1, $uId) {
- $tagservice =& ServiceFactory::getServiceInstance('TagService');
+ $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$tag1 = $tagservice->normalize($tag1);
if($tag1 == '') return false;
@@ -54,7 +66,7 @@ class TagCacheService {
}
function addChild($tag1, $tag2, $uId) {
- $tagservice =& ServiceFactory::getServiceInstance('TagService');
+ $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$tag1 = $tagservice->normalize($tag1);
$tag2 = $tagservice->normalize($tag2);
@@ -98,7 +110,7 @@ class TagCacheService {
}
function existsChild($tag1, $tag2, $uId) {
- $tagservice =& ServiceFactory::getServiceInstance('TagService');
+ $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$tag1 = $tagservice->normalize($tag1);
$tag2 = $tagservice->normalize($tag2);
@@ -202,7 +214,7 @@ class TagCacheService {
}
function _isSynonymKey($tag1, $uId) {
- $tagservice =& ServiceFactory::getServiceInstance('TagService');
+ $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$tag1 = $tagservice->normalize($tag1);
$query = "SELECT tag1 FROM `". $this->getTableName() ."`";
@@ -214,7 +226,7 @@ class TagCacheService {
}
function _isSynonymValue($tag2, $uId) {
- $tagservice =& ServiceFactory::getServiceInstance('TagService');
+ $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$tag2 = $tagservice->normalize($tag2);
$query = "SELECT tag2 FROM `". $this->getTableName() ."`";
@@ -238,7 +250,7 @@ class TagCacheService {
}
function _getSynonymKey($tag2, $uId) {
- $tagservice =& ServiceFactory::getServiceInstance('TagService');
+ $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$tag2 = $tagservice->normalize($tag2);
if($this->_isSynonymKey($tag2)) return $tag2;
@@ -267,7 +279,7 @@ class TagCacheService {
* $tagExcepted allows to hide a value.
*/
function _getSynonymValues($tag1, $uId, $tagExcepted = NULL) {
- $tagservice =& ServiceFactory::getServiceInstance('TagService');
+ $tagservice =SemanticScuttle_Service_Factory::getServiceInstance('Tag');
$tag1 = $tagservice->normalize($tag1);
$tagExcepted = $tagservice->normalize($tagExcepted);