3
* Xibo - Digital Signage - http://www.xibo.org.uk
4
* Copyright (C) 2009-2012 Daniel Garner
6
* This file is part of Xibo.
8
* Xibo is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Affero General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
13
* Xibo is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
18
* You should have received a copy of the GNU Affero General Public License
19
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
23
defined('XIBO') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");
25
class Bandwidth extends Data {
27
public static $REGISTER = 1;
28
public static $RF = 2;
29
public static $SCHEDULE = 3;
30
public static $GETFILE = 4;
31
public static $GETRESOURCE = 5;
32
public static $MEDIAINVENTORY = 6;
33
public static $NOTIFYSTATUS = 7;
34
public static $SUBMITSTATS = 8;
35
public static $SUBMITLOG = 9;
36
public static $BLACKLIST = 10;
37
public static $SCREENSHOT = 11;
39
public function Log($displayId, $type, $sizeInBytes) {
41
$dbh = \Xibo\Storage\PDOConnect::init();
43
$sth = $dbh->prepare('
44
INSERT INTO `bandwidth` (Month, Type, DisplayID, Size) VALUES (:month, :type, :displayid, :size)
45
ON DUPLICATE KEY UPDATE Size = Size + :size2
49
'month' => strtotime(date('m').'/02/'.date('Y').' 00:00:00'),
51
'displayid' => $displayId,
52
'size' => $sizeInBytes,
53
'size2' => $sizeInBytes
58
catch (Exception $e) {
59
Log::error($e->getMessage());