diff --git a/web/install/update_440-500.php b/web/install/update_440-500.php index fb954ba7..c0ae0d44 100644 --- a/web/install/update_440-500.php +++ b/web/install/update_440-500.php @@ -49,6 +49,9 @@ if (isset($include) and $include == true) { $query = $sql->prepare("DROP TABLE IF EXISTS `voice_stats_settings`"); $query->execute(); + $query = $sql->prepare("DELETE FROM `easywi_statistics`"); + $query->execute(); + $response->add('Repairing tables if needed.'); include(EASYWIDIR . '/stuff/methods/tables_repair.php'); diff --git a/web/statuscheck.php b/web/statuscheck.php index d1cc169b..f7a16530 100644 --- a/web/statuscheck.php +++ b/web/statuscheck.php @@ -1215,12 +1215,9 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip, if ($checkTypeOfServer == 'all' or $checkTypeOfServer == 'st') { $query = $sql->prepare("SELECT u.`id`,u.`cname`,u.`resellerid`,u.`accounttype`,s.`brandname` FROM `userdata` AS u LEFT JOIN `settings` AS s ON u.`resellerid`=s.`resellerid` WHERE u.`active`='Y'"); - - $query3 = $sql->prepare("INSERT INTO `easywi_statistics` (`gameMasterInstalled`,`gameMasterActive`,`gameMasterSlotsAvailable`,`gameserverInstalled`,`gameserverActive`,`gameserverSlotsInstalled`,`gameserverSlotsActive`,`gameserverSlotsUsed`,`gameserverNoPassword`,`gameserverNoTag`,`gameserverNotRunning`,`ticketsCompleted`,`ticketsInProcess`,`ticketsNew`,`userAmount`,`userAmountActive`,`virtualMasterInstalled`,`virtualMasterActive`,`virtualMasterVserverAvailable`,`virtualInstalled`,`virtualActive`,`voiceMasterInstalled`,`voiceMasterActive`,`voiceMasterSlotsAvailable`,`voiceserverInstalled`,`voiceserverActive`,`voiceserverSlotsInstalled`,`voiceserverSlotsActive`,`voiceserverSlotsUsed`,`voiceserverTrafficAllowed`,`voiceserverTrafficUsed`,`webMasterInstalled`,`webMasterActive`,`webMasterSlotsAvailable`,`webspaceInstalled`,`webspaceActive`,`webspaceSpaceGiven`,`webspaceSpaceUsed`,`userID`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); - $query4 = $sql->prepare("UPDATE `easywi_statistics_current` SET `gameMasterInstalled`=?,`gameMasterActive`=?,`gameMasterSlotsAvailable`=?,`gameserverInstalled`=?,`gameserverActive`=?,`gameserverSlotsInstalled`=?,`gameserverSlotsActive`=?,`gameserverSlotsUsed`=?,`gameserverNoPassword`=?,`gameserverNoTag`=?,`gameserverNotRunning`=?,`ticketsCompleted`=?,`ticketsInProcess`=?,`ticketsNew`=?,`userAmount`=?,`userAmountActive`=?,`virtualMasterInstalled`=?,`virtualMasterActive`=?,`virtualMasterVserverAvailable`=?,`virtualInstalled`=?,`virtualActive`=?,`voiceMasterInstalled`=?,`voiceMasterActive`=?,`voiceMasterSlotsAvailable`=?,`voiceserverInstalled`=?,`voiceserverActive`=?,`voiceserverSlotsInstalled`=?,`voiceserverSlotsActive`=?,`voiceserverSlotsUsed`=?,`voiceserverTrafficAllowed`=?,`voiceserverTrafficUsed`=?,`webMasterInstalled`=?,`webMasterActive`=?,`webMasterSlotsAvailable`=?,`webspaceInstalled`=?,`webspaceActive`=?,`webspaceSpaceGiven`=?,`webspaceSpaceUsed`=? WHERE `userID`=? LIMIT 1"); - $query->execute(); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { + if (($row['accounttype'] == 'a' and !isset($adminStatsCollected)) or $row['accounttype'] != 'a') { echo "Gathering statistics for user " . $row['cname'] . " with ID " . $row['id'] . " \r\n"; @@ -1525,7 +1522,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip, $query2 = $sql->prepare("UPDATE `easywi_statistics_current` SET " . $updateString . " WHERE `userID`= " . $insertID . " LIMIT 1"); $query2->execute(); - $query2 = $sql->prepare("INSERT INTO `easywi_statistics` (" . $insertColumns . ",`userID`,`statDate`,`countUpdates`) VALUES (" . implode(',', $statsArray) . "," . $insertID . ",'" . date('Y-m-d H:00:00') . "',1) ON DUPLICATE KEY UPDATE " . $duplicateString . ",`countUpdates`=`countUpdates`+1"); + $query2 = $sql->prepare("INSERT INTO `easywi_statistics` (" . $insertColumns . ",`userID`,`statDate`,`countUpdates`) VALUES (" . implode(',', $statsArray) . "," . $insertID . ",CURDATE(),1) ON DUPLICATE KEY UPDATE " . $duplicateString . ",`countUpdates`=`countUpdates`+1"); $query2->execute(); } } diff --git a/web/stuff/methods/tables_add.php b/web/stuff/methods/tables_add.php index eb12aece..ffbe7941 100644 --- a/web/stuff/methods/tables_add.php +++ b/web/stuff/methods/tables_add.php @@ -260,7 +260,7 @@ $query = "CREATE TABLE IF NOT EXISTS `easywi_statistics` ( `webspaceSpaceGivenActive` int(10) unsigned DEFAULT 0, `webspaceSpaceUsed` int(10) unsigned DEFAULT 0, `userID` int(10) unsigned NOT NULL DEFAULT 0, - `statDate` timestamp DEFAULT CURRENT_TIMESTAMP, + `statDate` date NOT NULL, `countUpdates` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`userID`,`statDate`) ) ENGINE=InnoDB"; diff --git a/web/stuff/methods/tables_repair.php b/web/stuff/methods/tables_repair.php index 948702ab..1927e63c 100644 --- a/web/stuff/methods/tables_repair.php +++ b/web/stuff/methods/tables_repair.php @@ -299,7 +299,7 @@ $defined['easywi_statistics'] = array( 'webspaceSpaceGivenActive' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"","Default"=>"0","Extra"=>""), 'webspaceSpaceUsed' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"","Default"=>"0","Extra"=>""), 'userID' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"0","Extra"=>""), - 'statDate' => array("Type"=>"timestamp","Null"=>"NO","Key"=>"PRI","Default"=>"CURRENT_TIMESTAMP","Extra"=>""), + 'statDate' => array("Type"=>"date","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>""), 'countUpdates' => array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"","Default"=>"0","Extra"=>"") ); @@ -1613,7 +1613,7 @@ foreach ($defined as $table => $t_p) { $properties = $t_p[$Field]; foreach ($row as $key => $value) { - if ($key != 'Field' and $key != 'Key' and !in_array($Field, $key_differ) and $properties[$key] != $value) { + if ($key != 'Field' and $key != 'Key' and !in_array($Field, $key_differ) and strtolower($properties[$key]) != strtolower($value)) { $key_differ[] = $Field; } else if ($key == 'Key' and $value == '' and $properties['Key'] == 'MUL') { $addIndex[] = $Field; @@ -1630,7 +1630,7 @@ foreach ($defined as $table => $t_p) { foreach ($key_differ as $key) { $NULL = ($t_p[$key]['Null'] == 'NO') ? 'NOT NULL' : 'NULL'; - $extra = ($t_p[$key]['Extra'] == '') ? ' ' . strtoupper($t_p[$key]['Extra']) : ''; + $extra = ($t_p[$key]['Extra'] != '') ? ' ' . strtoupper($t_p[$key]['Extra']) : ''; if ($t_p[$key]['Default'] == 'CURRENT_TIMESTAMP') { $DEFAULT = 'DEFAULT CURRENT_TIMESTAMP'; diff --git a/web/template/default/cms/page_header.tpl b/web/template/default/cms/page_header.tpl index d3b5712f..82779a19 100644 --- a/web/template/default/cms/page_header.tpl +++ b/web/template/default/cms/page_header.tpl @@ -7,7 +7,7 @@ - +