basic beta

This commit is contained in:
Savetheinternet 2011-06-07 17:18:08 +10:00
parent 41dcdcdade
commit dfbb77af83
2 changed files with 31 additions and 17 deletions

View File

@ -18,6 +18,14 @@
'size' => '50' 'size' => '50'
); );
$theme['config'][] = Array(
'title' => 'Images path',
'name' => 'images',
'type' => 'text',
'default' => str_replace('\\', '/', dirname(__FILE__)) . '/images',
'size' => '50'
);
$__boards = listBoards(); $__boards = listBoards();
$__default_boards = Array(); $__default_boards = Array();
foreach($__boards as $__board) foreach($__boards as $__board)

View File

@ -18,6 +18,7 @@
global $config, $_theme; global $config, $_theme;
$this->boards = explode(' ', $settings['boards']); $this->boards = explode(' ', $settings['boards']);
$this->spans = Array('hour', 'day', 'week', 'month');
$this->interval = 60; $this->interval = 60;
$this->height = 150; $this->height = 150;
$this->width = 700; $this->width = 700;
@ -25,6 +26,8 @@
if($action == 'cron') { if($action == 'cron') {
if(!file_exists($settings['path'])) if(!file_exists($settings['path']))
mkdir($settings['path']); mkdir($settings['path']);
if(!file_exists($settings['images']))
mkdir($settings['images']);
foreach($this->boards as &$board) { foreach($this->boards as &$board) {
$file = $settings['path'] . '/' . $board . '.rrd'; $file = $settings['path'] . '/' . $board . '.rrd';
@ -54,23 +57,26 @@
'N:' . $count))) 'N:' . $count)))
error('RRDtool failed: ' . htmlentities(rrd_error())); error('RRDtool failed: ' . htmlentities(rrd_error()));
// Graph graph foreach($this->spans as &$span) {
if(!rrd_graph('/var/vhosts/s.avetheinter.net/intel/test-' . $board . '.png', Array( // Graph graph
'-s -1hour', if(!rrd_graph($settings['images'] . $board . '-' . $span . '.png', Array(
'-t Posts on ' . sprintf($config['board_abbreviation'], $board), '-s -1' . $span,
'--lazy', '-t Posts on ' . sprintf($config['board_abbreviation'], $board),
'-h', $this->height, '-w', $this->width, //'--lazy',
'-l 0', '-l 0',
'-a', 'PNG', '-h', $this->height, '-w', $this->width,
'-v posts/sec', '-l 0',
'DEF:posts=' . $file . ':posts:AVERAGE', '-a', 'PNG',
'LINE2:posts#336600:Posts', '-W', 'Powered by Tinyboard',
'GPRINT:posts:MAX: Max\\: %5.1lf %S', '-v posts/minute',
'GPRINT:posts:AVERAGE: Avg\\: %5.1lf %S', 'DEF:posts=' . $file . ':posts:AVERAGE',
'GPRINT:posts:LAST: Current\\: %5.1lf %Sreq/sec', 'LINE2:posts#336600:Posts',
'HRULE:0#000000'))) 'GPRINT:posts:MAX: Max\\: %5.1lf %s',
error('RRDtool failed: ' . htmlentities(rrd_error())); 'GPRINT:posts:AVERAGE: Avg\\: %5.1lf %s',
'GPRINT:posts:LAST: Current\\: %5.1lf %sposts/min',
'HRULE:0#000000')))
error('RRDtool failed: ' . htmlentities(rrd_error()));
}
} }
} }
} }