X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fpersonaltagcloudsection.php;h=5ea3f188dbf61b2385ad85fde65d15831a381154;hb=dc4fafbbd16adecc94fb1e3ee889689cfb786c3a;hp=57c5b84a13faf8d79fe4732b86403bafa4de875b;hpb=d35b2d3f3c2128b147a6fa897032262c1f632262;p=quix0rs-gnu-social.git diff --git a/lib/personaltagcloudsection.php b/lib/personaltagcloudsection.php index 57c5b84a13..5ea3f188db 100644 --- a/lib/personaltagcloudsection.php +++ b/lib/personaltagcloudsection.php @@ -21,13 +21,13 @@ * * @category Widget * @package StatusNet - * @author Evan Prodromou + * @author Evan Prodromou * @copyright 2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -36,7 +36,7 @@ if (!defined('LACONICA')) { * * @category Widget * @package StatusNet - * @author Evan Prodromou + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -58,13 +58,10 @@ class PersonalTagCloudSection extends TagCloudSection function getTags() { - if (common_config('db', 'type') == 'pgsql') { - $weightexpr='sum(exp(-extract(epoch from (now() - notice_tag.created)) / %s))'; - } else { - $weightexpr='sum(exp(-(now() - notice_tag.created) / %s))'; - } - - $qry = 'SELECT notice_tag.tag, '. + $weightexpr = common_sql_weight('notice_tag.created', common_config('tag', 'dropoff')); + // @fixme should we use the cutoff too? Doesn't help with indexing per-user. + + $qry = 'SELECT notice_tag.tag, '. $weightexpr . ' as weight ' . 'FROM notice_tag JOIN notice ' . 'ON notice_tag.notice_id = notice.id ' . @@ -83,7 +80,6 @@ class PersonalTagCloudSection extends TagCloudSection $tag = Memcached_DataObject::cachedQuery('Notice_tag', sprintf($qry, - common_config('tag', 'dropoff'), $this->user->id), 3600); return $tag;