MySQL DATE cannot hold timestamp

This commit is contained in:
Ulrich Block 2014-09-09 21:21:21 +02:00
parent 427f7f332b
commit 4d0eed63a8
3 changed files with 4 additions and 6 deletions

View File

@ -109,8 +109,6 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
print 'Checking Gameserver, Voiceserver MySQL DB sizes and Web Quotas' . "\r\n";
}
$dayAndHour=date('Y-m-d H:').'00:00';
$dayAndZeroHour=date('Y-m-d').' 00:00:00';
$ssprache = getlanguagefile('settings','uk',0);
$vosprache = getlanguagefile('voice','uk',0);
$sprache = getlanguagefile('gserver','uk',0);
@ -1070,8 +1068,8 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
$connection->StopServer($virtualserver_id);
}
}
$query = $sql->prepare("INSERT INTO `voice_server_stats` (`sid`,`mid`,`installed`,`used`,`traffic`,`date`,`uid`,`resellerid`) VALUES (?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE `traffic`=`traffic`+VALUES(`traffic`),`used`=(`used`*(`count`/(`count`+1))+(VALUES(`used`)*(1/(`count`+1)))),`installed`=(`installed`*(`count`/(`count`+1))+(VALUES(`installed`)*(1/(`count`+1)))),`count`=`count`+1");
$query->execute(array($ts3id, $ts3masterid, $server['virtualserver_maxclients'], $usedslots, $addedtraffic, $dayAndZeroHour, $userid, $resellerid));
$query = $sql->prepare("INSERT INTO `voice_server_stats` (`sid`,`mid`,`installed`,`used`,`traffic`,`date`,`uid`,`resellerid`) VALUES (?,?,?,?,?,CURRENT_DATE(),?,?) ON DUPLICATE KEY UPDATE `traffic`=`traffic`+VALUES(`traffic`),`used`=(`used`*(`count`/(`count`+1))+(VALUES(`used`)*(1/(`count`+1)))),`installed`=(`installed`*(`count`/(`count`+1))+(VALUES(`installed`)*(1/(`count`+1)))),`count`=`count`+1");
$query->execute(array($ts3id, $ts3masterid, $server['virtualserver_maxclients'], $usedslots, $addedtraffic, $userid, $resellerid));
} else if (isset($ts3id)) {
$uptime = 1;
$usedslots = 0;

View File

@ -1707,7 +1707,7 @@ $query = "CREATE TABLE IF NOT EXISTS `voice_server_stats` (
`installed` decimal(6,2) unsigned NOT NULL,
`used` decimal(6,2) unsigned NOT NULL,
`traffic` bigint(19) unsigned NOT NULL,
`date` date NOT NULL DEFAULT CURRENT_TIMESTAMP,
`date` date NOT NULL,
`uid` int(10) unsigned DEFAULT NULL,
`count` bigint(19) unsigned DEFAULT 0,
`resellerid` int(10) unsigned DEFAULT NULL,

View File

@ -1492,7 +1492,7 @@ $defined['voice_server_backup'] = array(
$defined['voice_server_stats'] = array(
'sid' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>""),
'date' => array("Type"=>"date","Null"=>"NO","Key"=>"PRI","Default"=>"CURRENT_TIMESTAMP","Extra"=>""),
'date' => array("Type"=>"date","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>""),
'mid' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"MUL","Default"=>"","Extra"=>""),
'installed' => array("Type"=>"decimal(6,2) unsigned","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
'used' => array("Type"=>"decimal(6,2) unsigned","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),