*
* @see DB_DataObject
*/
-
class Sitemap_notice_count extends Memcached_DataObject
{
public $__table = 'sitemap_notice_count'; // table name
* @return Sitemap_notice_count object found, or null for no hits
*
*/
-
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Sitemap_notice_count', $k, $v);
*
* @return array array of column definitions
*/
-
function table()
{
return array('notice_date' => DB_DATAOBJECT_DATE + DB_DATAOBJECT_NOTNULL,
*
* @return array key definitions
*/
-
function keys()
{
return array('notice_date' => 'K');
*
* @return array key definitions
*/
-
function keyTypes()
{
return $this->keys();
$noticeCounts = self::cacheGet('sitemap:notice:counts');
if ($noticeCounts === false) {
-
$snc = new Sitemap_notice_count();
$snc->orderBy('notice_date DESC');
$noticeCounts[$snc->notice_date] = $snc->notice_count;
}
- self::cacheSet('sitemap:notice:counts', $noticeCounts);
+ // Cache notice counts for 4 hours.
+
+ self::cacheSet('sitemap:notice:counts', $noticeCounts, null, time() + 4 * 60 * 60);
}
return $noticeCounts;
{
$notice = new Notice();
$notice->whereAdd('created BETWEEN "'.$d.' 00:00:00" AND "'.self::incrementDay($d).' 00:00:00"');
+ $notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
$n = $notice->count();
return $n;
$snc = Sitemap_notice_count::staticGet('notice_date', DB_DataObject_Cast::date($d));
if (empty($snc)) {
- throw new Exception("No such registration date: $d");
+ // TRANS: Exception
+ throw new Exception(_m("No such registration date: $d."));
}
$orig = clone($snc);