refactor: much speedier installation process

This commit is contained in:
Martin Ambrus
2017-10-23 13:38:32 +02:00
parent 50eb34db57
commit 12687766b6
7 changed files with 60 additions and 83 deletions
+2 -2
View File
@@ -1571,9 +1571,9 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%users` (
--
INSERT INTO `%PREFIX%users` (`id`, `username`, `password`, `email`, `tribe`, `access`, `gold`, `gender`, `birthday`, `location`, `desc1`, `desc2`, `plus`, `b1`, `b2`, `b3`, `b4`, `sit1`, `sit2`, `alliance`, `sessid`, `act`, `timestamp`, `ap`, `apall`, `dp`, `dpall`, `protect`, `quest`, `gpack`, `cp`, `lastupdate`, `RR`, `Rc`, `ok`) VALUES
(5, 'Multihunter', '', 'multihunter@travianx.mail', 0, 9, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0),
(5, 'Multihunter', '', 'multihunter@travianz.game', 0, 9, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0),
(1, 'Support', '', 'support@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0),
(2, 'Nature', '4262cc190152adfc1a3fcf32af6aa430', 'nature@travianz.game', 4, 9, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0),
(2, 'Nature', '', 'nature@travianz.game', 4, 2, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0),
(4, 'Taskmaster', '', 'taskmaster@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0);
-- --------------------------------------------------------
+1 -1
View File
@@ -23,6 +23,6 @@
header("Location: ../index.php?s=6");
header("Location: ../index.php?s=7");
?>
+17 -2
View File
@@ -20,6 +20,8 @@ if (count($data_exist)) {
}
$xyas=(1+(2*WORLD_MAX));
$values_batch = [];
$max_batch_size = 10000;
for($i=0; $i<$xyas; $i++){
$y=(WORLD_MAX-$i);
@@ -115,11 +117,24 @@ $y=(WORLD_MAX-$i);
}
//into database
$q = "INSERT into ".TB_PREFIX."wdata values (0,'".$typ."','".$otype."','".$x."','".$y."',0,'".$image."')";
$database->query($q);
$values_batch[] = "(0,'".$typ."','".$otype."','".$x."','".$y."',0,'".$image."')";
// insert the full batch when threshold is reached
if (count($values_batch) === $max_batch_size) {
$q = "INSERT into ".TB_PREFIX."wdata VALUES ".implode(',', $values_batch);
$database->query($q);
$values_batch = [];
}
}
}
// last batch may not be as big as $max_batch_size
if (count($values_batch)) {
$q = "INSERT into ".TB_PREFIX."wdata VALUES ".implode(',', $values_batch);
$database->query($q);
$values_batch = [];
}
header("Location: ../index.php?s=4");
?>
+2 -1
View File
@@ -14,6 +14,7 @@
## Source code: https://github.com/Shadowss/TravianZ ##
## ##
#################################################################################
rename("include/constant.php","../GameEngine/config.php");
?>
@@ -24,7 +25,7 @@
<span class="f10 c">Create Multihunter account</span>
<table>
<tr><td>Name:</td><td><input type="text" name="mhpw" id="mhpw" value="Multihunter" disabled="disabled"></td></tr>
<tr><td>Password:</td><td><input type="text" name="mhpw" id="mhpw" value=""></td></tr>
<tr><td>Password:</td><td><input type="password" name="mhpw" id="mhpw" value=""></td></tr>
<tr><td>Note: Rember this password! You need it for the ACP</td><td></td></tr>
</table>
</p>
+1 -2
View File
@@ -14,7 +14,6 @@
## Source code: https://github.com/Shadowss/TravianZ ##
## ##
#################################################################################
rename("include/constant.php","../GameEngine/config.php");
?>
@@ -25,7 +24,7 @@
<span class="f10 c">Create Support account</span>
<table>
<tr><td>Name:</td><td><input type="text" name="sname" value="Support" disabled="disabled"></td></tr>
<tr><td>Password:</td><td><input type="text" name="spw" id="spw" value=""></td></tr>
<tr><td>Password:</td><td><input type="password" name="spw" id="spw" value=""></td></tr>
<tr><td>Note: Rember this password! You need it for the ACP</td><td></td></tr>
</table>
</p>