|
@@ -123,21 +123,54 @@ function munin_core_munin_api_fetch($graph_name) {
|
|
break;
|
|
break;
|
|
|
|
|
|
case 'munin_core_content':
|
|
case 'munin_core_content':
|
|
- $sq = 'SELECT COUNT(*) cnt FROM {node} n WHERE n.status = 1';
|
|
|
|
|
|
+ $ret = array(
|
|
|
|
+ 'node_count_unpub' => 0,
|
|
|
|
+ 'node_count' => 0,
|
|
|
|
+ 'comment_count_unpub' => 0,
|
|
|
|
+ 'comment_count' => 0,
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $sq = 'SELECT COUNT(*) cnt, n.status FROM {node} n GROUP BY n.status';
|
|
// No db_rewrite_sql(): this is an administrative mechanism
|
|
// No db_rewrite_sql(): this is an administrative mechanism
|
|
- $ret['node_count'] = db_result(db_query($sq));
|
|
|
|
-
|
|
|
|
- $sq = 'SELECT COUNT(*) cnt FROM {node} n WHERE n.status = 0';
|
|
|
|
- // No db_rewrite_sql(): this is an administrative mechanism
|
|
|
|
- $ret['node_count_unpub'] = db_result(db_query($sq));
|
|
|
|
-
|
|
|
|
- $sq = 'SELECT COUNT(*) cnt FROM {comments} c WHERE c.status = 0';
|
|
|
|
- // No db_rewrite_sql(): this is an administrative mechanism
|
|
|
|
- $ret['comment_count'] = db_result(db_query($sq));
|
|
|
|
|
|
+ $q = db_query($sq);
|
|
|
|
+ while ($o = db_fetch_object($q)) {
|
|
|
|
+ switch ($o->status) {
|
|
|
|
+ case 0:
|
|
|
|
+ $ret['node_count_unpub'] = $o->cnt;
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 1:
|
|
|
|
+ $ret['node_count'] = $o->cnt;
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ watchdog('munin_core', 'Nodes with status @status reported: @count', array(
|
|
|
|
+ '@status' => $o->status,
|
|
|
|
+ '@count' => $o->cnt,
|
|
|
|
+ ), WATCHDOG_NOTICE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- $sq = 'SELECT COUNT(*) cnt FROM {comments} c WHERE c.status = 1';
|
|
|
|
|
|
+ $sq = 'SELECT COUNT(*) cnt, c.status FROM {comments} c GROUP BY c.status';
|
|
|
|
+ $q = db_query($sq);
|
|
// No db_rewrite_sql(): this is an administrative mechanism
|
|
// No db_rewrite_sql(): this is an administrative mechanism
|
|
- $ret['comment_count_unpub'] = db_result(db_query($sq));
|
|
|
|
|
|
+ while ($o = db_fetch_object($q)) {
|
|
|
|
+ switch ($o->status) {
|
|
|
|
+ case 1:
|
|
|
|
+ $ret['comment_count_unpub'] = $o->cnt;
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 0:
|
|
|
|
+ $ret['comment_count'] = $o->cnt;
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ default:
|
|
|
|
+ watchdog('munin_core', 'Comments with status @status reported: @count', array(
|
|
|
|
+ '@status' => $o->status,
|
|
|
|
+ '@count' => $o->cnt,
|
|
|
|
+ ), WATCHDOG_NOTICE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
$sq = 'SELECT COUNT(*) FROM {term_data}';
|
|
$sq = 'SELECT COUNT(*) FROM {term_data}';
|
|
$ret['term_count'] = db_result(db_query($sq));
|
|
$ret['term_count'] = db_result(db_query($sq));
|