mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
Small DB correction
This commit is contained in:
parent
6db068fab4
commit
218019a635
@ -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');
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
|
@ -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';
|
||||
|
@ -7,7 +7,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="robots" content="index,follow,noodp,noydir" />
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="2012 - <?php echo date('Y'); ?> <?php echo $page_data->title; ?>">
|
||||
<meta name="author" content="2012 - <?php echo date('Y'); ?> Ulrich Block">
|
||||
|
||||
<link rel="canonical" href="<?php echo $page_data->canurl;?>" />
|
||||
<link href="<?php echo $page_data->getDefaultUrl();?>" hreflang="x-default" rel="alternate">
|
||||
|
Loading…
x
Reference in New Issue
Block a user