aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHabeas Codice <habeascodice@federated.social>2015-03-09 17:54:14 -0700
committerHabeas Codice <habeascodice@federated.social>2015-03-09 17:54:14 -0700
commita611eed172cdec63f8007e74583178d12a9335ec (patch)
treed714ba6165a546eef484dad51636805c4fd77411
parent972780c3ce1ffa0e70a72a167b9088c937a07d84 (diff)
downloadvolse-hubzilla-a611eed172cdec63f8007e74583178d12a9335ec.tar.gz
volse-hubzilla-a611eed172cdec63f8007e74583178d12a9335ec.tar.bz2
volse-hubzilla-a611eed172cdec63f8007e74583178d12a9335ec.zip
Whoops... should've actually checked the pg manual before merging #920 :-)
replace if(cond,val,val) with case when cond then val else val end, works on both DBs
-rw-r--r--mod/admin.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 714548f04..8fb9866a7 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -189,7 +189,7 @@ function admin_page_summary(&$a) {
// list total user accounts, expirations etc.
$accounts = array();
- $r = q("SELECT COUNT(*) AS total, COUNT(IF(account_expires > %s, 1, NULL)) AS expiring, COUNT(IF(account_expires < %s AND account_expires != '%s', 1, NULL)) AS expired, COUNT(IF((account_flags & %d)>0, 1, NULL)) AS blocked FROM account",
+ $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN account_expires > %s THEN 1 ELSE NULL END) AS expiring, COUNT(CASE WHEN account_expires < %s AND account_expires != '%s' THEN 1 ELSE NULL END) AS expired, COUNT(CASE WHEN (account_flags & %d)>0 THEN 1 ELSE NULL END) AS blocked FROM account",
db_utcnow(),
db_utcnow(),
dbesc(NULL_DATE),
@@ -208,7 +208,7 @@ function admin_page_summary(&$a) {
// available channels, primary and clones
$channels = array();
- $r = q("SELECT COUNT(*) AS total, COUNT(IF(channel_primary = 1, 1, NULL)) AS main, COUNT(IF(channel_primary = 0, 1, NULL)) AS clones FROM channel WHERE NOT (channel_pageflags & %d)>0",
+ $r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE NOT (channel_pageflags & %d)>0",
intval(PAGE_REMOVED)
);
if ($r) {