summaryrefslogtreecommitdiff
path: root/src/SemanticScuttle
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-09-26 22:28:54 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-09-26 22:28:54 +0000
commit84224c32948fb80f64c26d0d84834a1c13ef7710 (patch)
treeb7b9ffa5dccd920a589b2cbd1ad528eae8437167 /src/SemanticScuttle
parent93e520165890a14ce8269b04303216458b98ad7e (diff)
downloadsemanticscuttle-84224c32948fb80f64c26d0d84834a1c13ef7710.tar.gz
semanticscuttle-84224c32948fb80f64c26d0d84834a1c13ef7710.tar.bz2
explain $sizeSearchHistory
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@755 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle')
-rw-r--r--src/SemanticScuttle/Service/SearchHistory.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/SemanticScuttle/Service/SearchHistory.php b/src/SemanticScuttle/Service/SearchHistory.php
index 6ec240a..f13f8f9 100644
--- a/src/SemanticScuttle/Service/SearchHistory.php
+++ b/src/SemanticScuttle/Service/SearchHistory.php
@@ -26,6 +26,15 @@
*/
class SemanticScuttle_Service_SearchHistory extends SemanticScuttle_DbService
{
+ /**
+ * Size of the search history.
+ * If the number of logged searches is larger than this,
+ * adding a new search will delete the oldest one automatically.
+ *
+ * Use -1 to deactivate automatic deletion.
+ *
+ * @var integer
+ */
public $sizeSearchHistory;
@@ -49,14 +58,17 @@ class SemanticScuttle_Service_SearchHistory extends SemanticScuttle_DbService
/**
- * Creates a new instance
+ * Creates a new instance.
+ *
+ * Sets $this->sizeSearchHistory to $GLOBALS['sizeSearchHistory'] or 10
+ * if the global variable is not defined.
*
* @param DB $db Database object
*/
public function __construct($db)
{
$this->db = $db;
- $this->tablename = $GLOBALS['tableprefix'] .'searchhistory';
+ $this->tablename = $GLOBALS['tableprefix'] . 'searchhistory';
if (isset($GLOBALS['sizeSearchHistory'])) {
$this->sizeSearchHistory = $GLOBALS['sizeSearchHistory'];
} else {
@@ -67,7 +79,9 @@ class SemanticScuttle_Service_SearchHistory extends SemanticScuttle_DbService
/**
- * Adds a new search to the search history
+ * Adds a new search to the search history.
+ * Automatically deletes the oldest search when the number of
+ * searches is larger than $sizeSearchHistory.
*
* @param string $terms Search terms separated by spaces
* @param string $range - 'all' - search was in all bookmarks