true)) // }.to_i list($sql, $params) = Post::generate_sql($tags, array('count' => true)); // vde($sql); array_unshift($params, $sql); return Post::countBySql($params); } static public function recalculate_row_count() { self::connection()->executeSql("UPDATE table_data SET row_count = (SELECT COUNT(*) FROM posts WHERE parent_id IS NULL AND status <> 'deleted') WHERE name = 'posts'"); } static public function row_count() { $sql = "SELECT COUNT(*) FROM posts WHERE status <> 'deleted' AND NOT is_held AND status <> 'pending' AND is_shown_in_index"; return current(self::connection()->executeSql($sql)->fetch()); } public function increment_count() { self::connection()->executeSql("UPDATE table_data SET row_count = row_count + 1 WHERE name = 'posts'"); } public function decrement_count() { self::connection()->executeSql("UPDATE table_data SET row_count = row_count - 1 WHERE name = 'posts'"); } }