release 1.2.5

This commit is contained in:
Newcomer1989
2018-02-23 19:45:50 +01:00
parent 28aeb8ec6f
commit db7e1e6650
10 changed files with 159 additions and 389 deletions

View File

@@ -1,8 +1,8 @@
<?PHP
function update_rs($mysqlcon,$lang,$dbname,$logpath,$timezone,$newversion,$phpcommand,$norotate=NULL) {
$norotate = true;
enter_logfile($logpath,$timezone,4," Start updating the Ranksystem...\n",$norotate);
enter_logfile($logpath,$timezone,4," Backup the database due cloning tables...\n",$norotate);
enter_logfile($logpath,$timezone,4," Start updating the Ranksystem...",$norotate);
enter_logfile($logpath,$timezone,4," Backup the database due cloning tables...",$norotate);
$countbackuperr = 0;
$tables = array('addons_config','addon_assign_groups','config','groups','job_check','server_usage','stats_nations','stats_platforms','stats_server','stats_user','stats_versions','user','user_snapshot');
@@ -33,34 +33,34 @@ function update_rs($mysqlcon,$lang,$dbname,$logpath,$timezone,$newversion,$phpco
}
if($countbackuperr != 0) {
enter_logfile($logpath,$timezone,4," Backup failed. Please check your database permissions.\n",$norotate);
enter_logfile($logpath,$timezone,4," Update failed. Go on with normal work on old version.\n",$norotate);
enter_logfile($logpath,$timezone,4," Backup failed. Please check your database permissions.",$norotate);
enter_logfile($logpath,$timezone,4," Update failed. Go on with normal work on old version.",$norotate);
return;
} else {
enter_logfile($logpath,$timezone,4," Database-tables successfully backuped.\n",$norotate);
enter_logfile($logpath,$timezone,4," Database-tables successfully backuped.",$norotate);
}
if(!is_file(substr(__DIR__,0,-4).'update/'.$newversion.'.zip')) {
enter_logfile($logpath,$timezone,4," Downloading new update...\n",$norotate);
enter_logfile($logpath,$timezone,4," Downloading new update...",$norotate);
$newUpdate = file_get_contents('https://ts-n.net/downloads/ranksystem_'.$newversion.'.zip');
if(!is_dir(substr(__DIR__,0,-4).'update/')) {
mkdir (substr(__DIR__,0,-4).'update/');
}
$dlHandler = fopen(substr(__DIR__,0,-4).'update/ranksystem_'.$newversion.'.zip', 'w');
if(!fwrite($dlHandler,$newUpdate)) {
enter_logfile($logpath,$timezone,1," Could not save new update. Please check the permissions for folder 'update'.\n",$norotate);
enter_logfile($logpath,$timezone,4," Update failed. Go on with normal work on old version.\n",$norotate);
enter_logfile($logpath,$timezone,1," Could not save new update. Please check the permissions for folder 'update'.",$norotate);
enter_logfile($logpath,$timezone,4," Update failed. Go on with normal work on old version.",$norotate);
return;
}
if(!is_file(substr(__DIR__,0,-4).'update/ranksystem_'.$newversion.'.zip')) {
enter_logfile($logpath,$timezone,4," Something gone wrong with downloading/saving the new update file.\n",$norotate);
enter_logfile($logpath,$timezone,4," Update failed. Go on with normal work on old version.\n",$norotate);
enter_logfile($logpath,$timezone,4," Something gone wrong with downloading/saving the new update file.",$norotate);
enter_logfile($logpath,$timezone,4," Update failed. Go on with normal work on old version.",$norotate);
return;
}
fclose($dlHandler);
enter_logfile($logpath,$timezone,4," New update successfully saved.\n",$norotate);
enter_logfile($logpath,$timezone,4," New update successfully saved.",$norotate);
} else {
enter_logfile($logpath,$timezone,5," New update file already here...\n",$norotate);
enter_logfile($logpath,$timezone,5," New update file already here...",$norotate);
}
$zipHandle = zip_open(substr(__DIR__,0,-4).'update/ranksystem_'.$newversion.'.zip');
@@ -78,9 +78,9 @@ function update_rs($mysqlcon,$lang,$dbname,$logpath,$timezone,$newversion,$phpco
if(!is_dir(substr(__DIR__,0,-4).'/'.$thisFileDir)) {
if(mkdir(substr(__DIR__,0,-4).$thisFileDir, 0777, true)) {
enter_logfile($logpath,$timezone,4," Create new folder ".$thisFileDir."\n",$norotate);
enter_logfile($logpath,$timezone,4," Create new folder ".$thisFileDir,$norotate);
} else {
enter_logfile($logpath,$timezone,1," Error by creating folder ".$thisFileDir.". Please check the permissions on your folder ".substr(__DIR__,0,-4).".\n",$norotate);
enter_logfile($logpath,$timezone,1," Error by creating folder ".$thisFileDir.". Please check the permissions on your folder ".substr(__DIR__,0,-4),$norotate);
}
}
@@ -88,16 +88,16 @@ function update_rs($mysqlcon,$lang,$dbname,$logpath,$timezone,$newversion,$phpco
$contents = zip_entry_read($aF, zip_entry_filesize($aF));
$updateThis = '';
if($thisFileName == 'other/dbconfig.php' || $thisFileName == 'install.php' || $thisFileName == 'other/phpcommand.php') {
enter_logfile($logpath,$timezone,5," Did not touch ".$thisFileName."\n",$norotate);
enter_logfile($logpath,$timezone,5," Did not touch ".$thisFileName,$norotate);
} else {
if(($updateThis = fopen(substr(__DIR__,0,-4).'/'.$thisFileName, 'w')) === false) {
enter_logfile($logpath,$timezone,1," Failed to open file ".$thisFileName."\n",$norotate);
enter_logfile($logpath,$timezone,1," Failed to open file ".$thisFileName,$norotate);
$countwrongfiles++;
} elseif(!fwrite($updateThis, $contents)) {
enter_logfile($logpath,$timezone,1," Failed to write file ".$thisFileName."\n",$norotate);
enter_logfile($logpath,$timezone,1," Failed to write file ".$thisFileName,$norotate);
$countwrongfiles++;
} else {
enter_logfile($logpath,$timezone,4," Replaced file ".$thisFileName."\n",$norotate);
enter_logfile($logpath,$timezone,4," Replaced file ".$thisFileName,$norotate);
$countchangedfiles++;
}
fclose($updateThis);
@@ -123,7 +123,7 @@ function update_rs($mysqlcon,$lang,$dbname,$logpath,$timezone,$newversion,$phpco
exit;
}
} else {
enter_logfile($logpath,$timezone,1," Files updated with at least one error. Please check the log!\n",$norotate);
enter_logfile($logpath,$timezone,1," Files updated with at least one error. Please check the log!",$norotate);
// how to handle this.. Perhaps try again automatically in 30 minutes
}
}