summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-03-11 22:43:55 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-03-11 22:43:55 -0400
commit4a41dbcdc4ba61b8aa59f4d3cba545652e5706e1 (patch)
tree231b0ec660ca779df89263dfd6bc3833064e454d
parent254e5e502017dad767a6b57aa2c5c9422d6e02e5 (diff)
parent2fa6d429776f60925717a7c18330c3df0cd9d124 (diff)
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
-rw-r--r--actions/peopletag.php2
-rw-r--r--actions/sup.php4
-rw-r--r--classes/Notice.php6
3 files changed, 9 insertions, 3 deletions
diff --git a/actions/peopletag.php b/actions/peopletag.php
index 6b1e34f1a..5add75485 100644
--- a/actions/peopletag.php
+++ b/actions/peopletag.php
@@ -119,7 +119,7 @@ class PeopletagAction extends Action
'FROM profile JOIN profile_tag ' .
'ON profile.id = profile_tag.tagger ' .
'WHERE profile_tag.tagger = profile_tag.tagged ' .
- 'AND tag = "%s" ' .
+ "AND tag = '%s' " .
'ORDER BY profile_tag.modified DESC%s';
$profile->query(sprintf($qry, $this->tag, $lim));
diff --git a/actions/sup.php b/actions/sup.php
index f4b1cda23..8ef9207fa 100644
--- a/actions/sup.php
+++ b/actions/sup.php
@@ -65,7 +65,9 @@ class SupAction extends Action
$notice->query('SELECT profile_id, max(id) AS max_id ' .
'FROM notice ' .
- 'WHERE created > (now() - ' . $seconds . ') ' .
+ ((common_config('db','type') == 'pgsql') ?
+ 'WHERE extract(epoch from created) > (extract(epoch from now()) - ' . $seconds . ') ' :
+ 'WHERE created > (now() - ' . $seconds . ') ' ) .
'GROUP BY profile_id');
$updates = array();
diff --git a/classes/Notice.php b/classes/Notice.php
index 1e3b330f2..3087e39a7 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -232,7 +232,11 @@ class Notice extends Memcached_DataObject
$notice = new Notice();
$notice->profile_id = $profile_id;
$notice->content = $content;
- $notice->whereAdd('now() - created < ' . common_config('site', 'dupelimit'));
+ if (common_config('db','type') == 'pgsql')
+ $notice->whereAdd('extract(epoch from now() - created) < ' . common_config('site', 'dupelimit'));
+ else
+ $notice->whereAdd('now() - created < ' . common_config('site', 'dupelimit'));
+
$cnt = $notice->count();
return ($cnt == 0);
}