1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

Fixed and re-enabled active content stat for recent theme

This commit is contained in:
Jason Puglisi 2015-03-19 21:49:57 -04:00
parent d4d5f59451
commit 1283e51ca5

View File

@ -125,15 +125,18 @@
$stats['unique_posters'] = number_format($query->fetchColumn());
// Active content
/*$query = 'SELECT SUM(`filesize`) FROM (';
$query = 'SELECT `files` FROM (';
foreach ($boards as &$_board) {
if (in_array($_board['uri'], $this->excluded))
continue;
$query .= sprintf("SELECT `filesize` FROM ``posts_%s`` UNION ALL ", $_board['uri']);
$query .= sprintf("SELECT `files` FROM ``posts_%s`` UNION ALL ", $_board['uri']);
}
$query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
$query = preg_replace('/UNION ALL $/', ' WHERE `num_files` > 0) AS `posts_all`', $query);
$query = query($query) or error(db_error());
$stats['active_content'] = $query->fetchColumn();*/
$files = $query->fetchAll();
$stats['active_content'] = 0;
foreach ($files as &$file)
$stats['active_content'] += intval(preg_replace('/.*"size":([0-9]*).*/', '$1', $file[0]));
return Element('themes/recent/recent.html', Array(
'settings' => $settings,