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'
);
$theme['config'][] = Array(
'title' => 'Images path',
'name' => 'images',
'type' => 'text',
'default' => str_replace('\\', '/', dirname(__FILE__)) . '/images',
'size' => '50'
);
$__boards = listBoards();
$__default_boards = Array();
foreach($__boards as $__board)

View File

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