mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-03 17:07:17 +00:00
fix: path not found erorrs for multiple-automation-lock-files
Closes #244
This commit is contained in:
+61
-45
@@ -237,15 +237,17 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function loyaltyRegeneration() {
|
private function loyaltyRegeneration() {
|
||||||
if(file_exists("GameEngine/Prevention/loyalty.txt")) {
|
global $autoprefix;
|
||||||
unlink("GameEngine/Prevention/loyalty.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/loyalty.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/loyalty.txt");
|
||||||
}
|
}
|
||||||
//fix by ronix
|
//fix by ronix
|
||||||
//create new file to check filetime
|
//create new file to check filetime
|
||||||
//not every click regenerate but 1 minute or after
|
//not every click regenerate but 1 minute or after
|
||||||
|
|
||||||
|
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/loyalty.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/loyalty.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
global $database;
|
global $database;
|
||||||
$array = array();
|
$array = array();
|
||||||
@@ -344,11 +346,12 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function clearDeleting() {
|
private function clearDeleting() {
|
||||||
if(file_exists("GameEngine/Prevention/cleardeleting.txt")) {
|
global $autoprefix;
|
||||||
unlink("GameEngine/Prevention/cleardeleting.txt");
|
if(file_exists($autoprefix."GameEngine/Prevention/cleardeleting.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/cleardeleting.txt");
|
||||||
}
|
}
|
||||||
global $database;
|
global $database;
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/cleardeleting.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/cleardeleting.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$needDelete = $database->getNeedDelete();
|
$needDelete = $database->getNeedDelete();
|
||||||
if(count($needDelete) > 0) {
|
if(count($needDelete) > 0) {
|
||||||
@@ -947,11 +950,11 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function marketComplete() {
|
private function marketComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/market.txt")) {
|
global $database, $autoprefix;
|
||||||
unlink("GameEngine/Prevention/market.txt");
|
if(file_exists($autoprefix."GameEngine/Prevention/market.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/market.txt");
|
||||||
}
|
}
|
||||||
global $database;
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/market.txt", 'w');
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/market.txt", 'w');
|
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."send where ".TB_PREFIX."movement.ref = ".TB_PREFIX."send.id and ".TB_PREFIX."movement.proc = 0 and sort_type = 0 and endtime < $time";
|
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."send where ".TB_PREFIX."movement.ref = ".TB_PREFIX."send.id and ".TB_PREFIX."movement.proc = 0 and sort_type = 0 and endtime < $time";
|
||||||
@@ -1030,10 +1033,11 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function sendunitsComplete() {
|
private function sendunitsComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/sendunits.txt")) {
|
global $bid23,$bid34,$database,$battle,$village,$technology,$logging,$generator,$session,$units,$autoprefix;
|
||||||
unlink("GameEngine/Prevention/sendunits.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/sendunits.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/sendunits.txt");
|
||||||
}
|
}
|
||||||
global $bid23,$bid34,$database,$battle,$village,$technology,$logging,$generator,$session,$units;
|
|
||||||
$reload=false;
|
$reload=false;
|
||||||
//$ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w');
|
//$ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w');
|
||||||
//fclose($ourFileHandle);
|
//fclose($ourFileHandle);
|
||||||
@@ -3305,13 +3309,14 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function sendreinfunitsComplete() {
|
private function sendreinfunitsComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/sendreinfunits.txt")) {
|
global $bid23,$database,$battle,$session,$autoprefix;
|
||||||
unlink("GameEngine/Prevention/sendreinfunits.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/sendreinfunits.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/sendreinfunits.txt");
|
||||||
}
|
}
|
||||||
global $bid23,$database,$battle,$session;
|
|
||||||
$reload=false;
|
$reload=false;
|
||||||
$time = time();
|
$time = time();
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/sendreinfunits.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/sendreinfunits.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type = '2' and endtime < $time";
|
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type = '2' and endtime < $time";
|
||||||
$dataarray = $database->query_return($q);
|
$dataarray = $database->query_return($q);
|
||||||
@@ -3443,11 +3448,11 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function returnunitsComplete() {
|
private function returnunitsComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/returnunits.txt")) {
|
global $database, $autoprefix;
|
||||||
unlink("GameEngine/Prevention/returnunits.txt");
|
if(file_exists($autoprefix."GameEngine/Prevention/returnunits.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/returnunits.txt");
|
||||||
}
|
}
|
||||||
global $database;
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/returnunits.txt", 'w');
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/returnunits.txt", 'w');
|
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$reload=false;
|
$reload=false;
|
||||||
$time = time();
|
$time = time();
|
||||||
@@ -3535,11 +3540,12 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function sendSettlersComplete() {
|
private function sendSettlersComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/settlers.txt")) {
|
global $database, $building, $session, $autoprefix;
|
||||||
unlink("GameEngine/Prevention/settlers.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/settlers.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/settlers.txt");
|
||||||
}
|
}
|
||||||
global $database, $building, $session;
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/settlers.txt", 'w');
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/settlers.txt", 'w');
|
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 5 and endtime < $time";
|
$q = "SELECT * FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 5 and endtime < $time";
|
||||||
@@ -3590,11 +3596,13 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function researchComplete() {
|
private function researchComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/research.txt")) {
|
global $database, $autoprefix;
|
||||||
unlink("GameEngine/Prevention/research.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/research.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/research.txt");
|
||||||
}
|
}
|
||||||
global $database;
|
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/research.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/research.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM ".TB_PREFIX."research where timestamp < $time";
|
$q = "SELECT * FROM ".TB_PREFIX."research where timestamp < $time";
|
||||||
@@ -4034,12 +4042,14 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function trainingComplete() {
|
private function trainingComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/training.txt")) {
|
global $database, $autoprefix;
|
||||||
unlink("GameEngine/Prevention/training.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/training.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/training.txt");
|
||||||
}
|
}
|
||||||
global $database;
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/training.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/training.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$trainlist = $database->getTrainingList();
|
$trainlist = $database->getTrainingList();
|
||||||
if(count($trainlist) > 0){
|
if(count($trainlist) > 0){
|
||||||
@@ -4177,11 +4187,13 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function celebrationComplete() {
|
private function celebrationComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/celebration.txt")) {
|
global $database, $autoprefix;
|
||||||
unlink("GameEngine/Prevention/celebration.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/celebration.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/celebration.txt");
|
||||||
}
|
}
|
||||||
global $database;
|
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/celebration.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/celebration.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
|
|
||||||
$varray = $database->getCel();
|
$varray = $database->getCel();
|
||||||
@@ -4199,11 +4211,13 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function demolitionComplete() {
|
private function demolitionComplete() {
|
||||||
if(file_exists("GameEngine/Prevention/demolition.txt")) {
|
global $building,$database,$village,$autoprefix;
|
||||||
unlink("GameEngine/Prevention/demolition.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/demolition.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/demolition.txt");
|
||||||
}
|
}
|
||||||
global $building,$database,$village;
|
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/demolition.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/demolition.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
|
|
||||||
$varray = $database->getDemolition();
|
$varray = $database->getDemolition();
|
||||||
@@ -4469,11 +4483,13 @@ class Automation {
|
|||||||
************************************************/
|
************************************************/
|
||||||
|
|
||||||
private function starvation() {
|
private function starvation() {
|
||||||
if(file_exists("GameEngine/Prevention/starvation.txt")) {
|
global $database, $village, $autoprefix;
|
||||||
unlink("GameEngine/Prevention/starvation.txt");
|
|
||||||
|
if(file_exists($autoprefix."GameEngine/Prevention/starvation.txt")) {
|
||||||
|
unlink($autoprefix."GameEngine/Prevention/starvation.txt");
|
||||||
}
|
}
|
||||||
global $database, $village;
|
|
||||||
$ourFileHandle = fopen("GameEngine/Prevention/starvation.txt", 'w');
|
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/starvation.txt", 'w');
|
||||||
fclose($ourFileHandle);
|
fclose($ourFileHandle);
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user