aboutsummaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index 19325d1..5941ed8 100644
--- a/functions.php
+++ b/functions.php
@@ -62,6 +62,18 @@ function db_select_posts($from=NOW, $amount=10, $sort='desc', $page=1) {
return (!empty($rows)) ? $rows : false;
}
+function db_posts_count() {
+ global $config;
+ global $db;
+ if(empty($db)) return false;
+
+ $statement = $db->prepare('SELECT COUNT(*) AS posts_count FROM posts');
+ $statement->execute();
+ $row = $statement->fetch(PDO::FETCH_ASSOC);
+
+ return (int) $row['posts_count'];
+}
+
/* function that pings the official micro.blog endpoint for feed refreshes */
function ping_microblog() {
global $config;