release 1.3.22
This commit is contained in:
@@ -2,28 +2,28 @@
|
||||
function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
|
||||
$starttime = microtime(true);
|
||||
|
||||
if (in_array($db_cache['job_check']['reset_user_time']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_user_delete']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_group_withdraw']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_webspace_cache']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_usage_graph']['timestamp'], ["1","2"], true)) {
|
||||
if (in_array(intval($db_cache['job_check']['reset_user_time']['timestamp']), [1,2], true) || in_array(intval($db_cache['job_check']['reset_user_delete']['timestamp']), [1,2], true) || in_array(intval($db_cache['job_check']['reset_group_withdraw']['timestamp']), [1,2], true) || in_array(intval($db_cache['job_check']['reset_webspace_cache']['timestamp']), [1,2], true) || in_array(intval($db_cache['job_check']['reset_usage_graph']['timestamp']), [1,2], true)) {
|
||||
|
||||
enter_logfile($cfg,4,"Reset job(s) started");
|
||||
enter_logfile(4,"Reset job(s) started");
|
||||
$err_cnt = 0;
|
||||
|
||||
if (in_array($db_cache['job_check']['reset_group_withdraw']['timestamp'], ["1","2"], true)) {
|
||||
if (in_array(intval($db_cache['job_check']['reset_group_withdraw']['timestamp']), [1,2], true)) {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='2' WHERE `job_name`='reset_group_withdraw';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err_cnt++;
|
||||
} else {
|
||||
$db_cache['job_check']['reset_group_withdraw']['timestamp'] = 2;
|
||||
enter_logfile($cfg,4," Started job '".$lang['wihladm32']."'");
|
||||
enter_logfile(4," Started job '".$lang['wihladm32']."'");
|
||||
}
|
||||
|
||||
krsort($cfg['rankup_definition']);
|
||||
|
||||
if (($all_clients = $mysqlcon->query("SELECT `cldbid`,`uuid`,`name` FROM `$dbname`.`user`")->fetchAll(PDO::FETCH_ASSOC|PDO::FETCH_UNIQUE)) === false) {
|
||||
shutdown($mysqlcon,$cfg,1,"Select on DB failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
shutdown($mysqlcon,1,"Select on DB failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
}
|
||||
|
||||
foreach ($cfg['rankup_definition'] as $rank) {
|
||||
enter_logfile($cfg,5," Getting TS3 servergrouplist for ".$db_cache['groups'][$rank['group']]['sgidname']." (ID: ".$rank['group'].")");
|
||||
enter_logfile(5," Getting TS3 servergrouplist for ".$db_cache['groups'][$rank['group']]['sgidname']." (ID: ".$rank['group'].")");
|
||||
try {
|
||||
usleep($cfg['teamspeak_query_command_delay']);
|
||||
$tsclientlist = $ts3->servergroupclientlist($rank['group']);
|
||||
@@ -33,28 +33,28 @@ function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
|
||||
try {
|
||||
usleep($cfg['teamspeak_query_command_delay']);
|
||||
$ts3->serverGroupClientDel($rank['group'], $tsclient['cldbid']);
|
||||
enter_logfile($cfg,5," ".sprintf($lang['sgrprm'], $db_cache['groups'][$rank['group']]['sgidname'], $rank['group'], $all_clients[$tsclient['cldbid']]['name'], $all_clients[$tsclient['cldbid']]['uuid'], $tsclient['cldbid']));
|
||||
enter_logfile(5," ".sprintf($lang['sgrprm'], $db_cache['groups'][$rank['group']]['sgidname'], $rank['group'], $all_clients[$tsclient['cldbid']]['name'], $all_clients[$tsclient['cldbid']]['uuid'], $tsclient['cldbid']));
|
||||
} catch (Exception $e) {
|
||||
enter_logfile($cfg,2," TS3 error: ".$e->getCode().': '.$e->getMessage()." ; ".sprintf($lang['sgrprerr'], $all_clients[$tsclient['cldbid']]['name'], $all_clients[$tsclient['cldbid']]['uuid'], $tsclient['cldbid'], $db_cache['groups'][$rank['group']]['sgidname'], $rank['group']));
|
||||
enter_logfile(2," TS3 error: ".$e->getCode().': '.$e->getMessage()." ; ".sprintf($lang['sgrprerr'], $all_clients[$tsclient['cldbid']]['name'], $all_clients[$tsclient['cldbid']]['uuid'], $tsclient['cldbid'], $db_cache['groups'][$rank['group']]['sgidname'], $rank['group']));
|
||||
$err_cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
enter_logfile($cfg,2," TS3 error: ".$e->getCode().': '.$e->getMessage()." due getting servergroupclientlist for group ".$groupid);
|
||||
enter_logfile(2," TS3 error: ".$e->getCode().': '.$e->getMessage()." due getting servergroupclientlist for group ".$groupid);
|
||||
$err_cnt++;
|
||||
}
|
||||
}
|
||||
if ($err_cnt == 0) {
|
||||
if ($mysqlcon->exec("UPDATE `$dbname`.`user` SET `grpid`=0; UPDATE `$dbname`.`job_check` SET `timestamp`='4' WHERE `job_name`='reset_group_withdraw';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_group_withdraw']['timestamp'] = 4;
|
||||
enter_logfile($cfg,4," Finished job '".$lang['wihladm32']."'");
|
||||
enter_logfile(4," Finished job '".$lang['wihladm32']."'");
|
||||
}
|
||||
} else {
|
||||
if ($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='3' WHERE `job_name`='reset_group_withdraw';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_group_withdraw']['timestamp'] = 3;
|
||||
}
|
||||
@@ -62,54 +62,54 @@ function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
|
||||
}
|
||||
|
||||
|
||||
if ($err_cnt == 0 && in_array($db_cache['job_check']['reset_user_time']['timestamp'], ["1","2"], true)) {
|
||||
if ($err_cnt == 0 && in_array(intval($db_cache['job_check']['reset_user_time']['timestamp']), [1,2], true)) {
|
||||
$err = 0;
|
||||
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='2' WHERE `job_name`='reset_user_time';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
$db_cache['job_check']['reset_user_time']['timestamp'] = 2;
|
||||
enter_logfile($cfg,4," Started job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm311'].")");
|
||||
enter_logfile(4," Started job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm311'].")");
|
||||
}
|
||||
|
||||
// zero times
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`stats_server` SET `total_online_time`='0', `total_online_month`='0', `total_online_week`='0', `total_active_time`='0', `total_inactive_time`='0';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Reset Server statistics summary (table: stats_server)");
|
||||
enter_logfile(4," Reset Server statistics summary (table: stats_server)");
|
||||
}
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`stats_user` SET `count_week`='0', `count_month`='0', `idle_week`='0', `idle_month`='0', `total_connections`='0', `active_week`='0', `active_month`='0';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Reset My statistics (table: stats_user)");
|
||||
enter_logfile(4," Reset My statistics (table: stats_user)");
|
||||
}
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`user` SET `count`='0', `grpid`='0', `nextup`='0', `idle`='0', `boosttime`='0', `rank`='0', `grpsince`='0';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Reset List Rankup / user statistics (table: user)");
|
||||
enter_logfile(4," Reset List Rankup / user statistics (table: user)");
|
||||
}
|
||||
if($mysqlcon->exec("DELETE FROM `$dbname`.`user_snapshot`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned Top users / user statistic snapshots (table: user_snapshot)");
|
||||
enter_logfile(4," Cleaned Top users / user statistic snapshots (table: user_snapshot)");
|
||||
}
|
||||
|
||||
|
||||
if ($err == 0) {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='4' WHERE `job_name`='reset_user_time';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_user_time']['timestamp'] = 4;
|
||||
enter_logfile($cfg,4," Finished job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm311'].")");
|
||||
enter_logfile(4," Finished job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm311'].")");
|
||||
}
|
||||
} else {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='3' WHERE `job_name`='reset_user_time';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_user_time']['timestamp'] = 3;
|
||||
}
|
||||
@@ -117,100 +117,100 @@ function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
|
||||
}
|
||||
|
||||
|
||||
if ($err_cnt == 0 && in_array($db_cache['job_check']['reset_user_delete']['timestamp'], ["1","2"], true)) {
|
||||
if ($err_cnt == 0 && in_array(intval($db_cache['job_check']['reset_user_delete']['timestamp']), [1,2], true)) {
|
||||
$err = 0;
|
||||
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='2' WHERE `job_name`='reset_user_delete';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
$db_cache['job_check']['reset_user_delete']['timestamp'] = 2;
|
||||
enter_logfile($cfg,4," Started job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm312'].")");
|
||||
enter_logfile(4," Started job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm312'].")");
|
||||
}
|
||||
|
||||
// remove clients
|
||||
if($mysqlcon->exec("DELETE FROM `$dbname`.`stats_nations`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned donut chart nations (table: stats_nations)");
|
||||
enter_logfile(4," Cleaned donut chart nations (table: stats_nations)");
|
||||
}
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`stats_platforms` SET `count`=0;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned donut chart platforms (table: stats_platforms)");
|
||||
enter_logfile(4," Cleaned donut chart platforms (table: stats_platforms)");
|
||||
}
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`stats_server` SET `total_user`='0', `total_online_time`='0', `total_online_month`='0', `total_online_week`='0', `total_active_time`='0', `total_inactive_time`='0', `country_nation_name_1`='', `country_nation_name_2`='', `country_nation_name_3`='', `country_nation_name_4`='', `country_nation_name_5`='', `country_nation_1`='0', `country_nation_2`='0', `country_nation_3`='0', `country_nation_4`='0', `country_nation_5`='0', `country_nation_other`='0', `platform_1`='0', `platform_2`='0', `platform_3`='0', `platform_4`='0', `platform_5`='0', `platform_other`='0', `version_name_1`='', `version_name_2`='', `version_name_3`='', `version_name_4`='', `version_name_5`='', `version_1`='0', `version_2`='0', `version_3`='0', `version_4`='0', `version_5`='0', `version_other`='0';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Reset Server statistics summary (table: stats_server)");
|
||||
enter_logfile(4," Reset Server statistics summary (table: stats_server)");
|
||||
}
|
||||
if($mysqlcon->exec("DELETE FROM `$dbname`.`stats_user`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned My statistics (table: stats_user)");
|
||||
enter_logfile(4," Cleaned My statistics (table: stats_user)");
|
||||
}
|
||||
if($mysqlcon->exec("DELETE FROM `$dbname`.`stats_versions`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned donut chart versions (table: stats_versions)");
|
||||
enter_logfile(4," Cleaned donut chart versions (table: stats_versions)");
|
||||
}
|
||||
if($mysqlcon->exec("DELETE FROM `$dbname`.`user`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned List Rankup / user statistics (table: user)");
|
||||
enter_logfile(4," Cleaned List Rankup / user statistics (table: user)");
|
||||
}
|
||||
if($mysqlcon->exec("DELETE FROM `$dbname`.`user_iphash`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned user ip-hash values (table: user_iphash)");
|
||||
enter_logfile(4," Cleaned user ip-hash values (table: user_iphash)");
|
||||
}
|
||||
if($mysqlcon->exec("DELETE FROM `$dbname`.`user_snapshot`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
$err++;
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned Top users / user statistic snapshots (table: user_snapshot)");
|
||||
enter_logfile(4," Cleaned Top users / user statistic snapshots (table: user_snapshot)");
|
||||
}
|
||||
|
||||
|
||||
if ($err == 0) {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='4' WHERE `job_name`='reset_user_delete';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_user_delete']['timestamp'] = 4;
|
||||
enter_logfile($cfg,4," Finished job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm312'].")");
|
||||
enter_logfile(4," Finished job '".$lang['wihladm31']."' (".$lang['wisupidle'].": ".$lang['wihladm312'].")");
|
||||
}
|
||||
} else {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='3' WHERE `job_name`='reset_user_delete';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_user_delete']['timestamp'] = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($db_cache['job_check']['reset_webspace_cache']['timestamp'], ["1","2"], true)) {
|
||||
if (in_array(intval($db_cache['job_check']['reset_webspace_cache']['timestamp']), [1,2], true)) {
|
||||
if ($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='2' WHERE `job_name`='reset_webspace_cache';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_webspace_cache']['timestamp'] = 2;
|
||||
enter_logfile($cfg,4," Started job '".$lang['wihladm33']."'");
|
||||
enter_logfile(4," Started job '".$lang['wihladm33']."'");
|
||||
if ($mysqlcon->exec("DELETE FROM `$dbname`.`groups`;") === false) {
|
||||
enter_logfile($cfg,4," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(4," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`=1 WHERE `job_name`='reload_trigger';") === false) {
|
||||
enter_logfile($cfg,4," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(4," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$del_folder = array('avatars/','tsicons/');
|
||||
$del_folder = array('avatars'.DIRECTORY_SEPARATOR,'tsicons'.DIRECTORY_SEPARATOR);
|
||||
$err_cnt = 0;
|
||||
|
||||
if (!function_exists('rm_file_reset')) {
|
||||
@@ -218,9 +218,9 @@ function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
|
||||
foreach(scandir($folder) as $file) {
|
||||
if (in_array($file, array('.','..','check.png','placeholder.png','rs.png','servericon.png','100.png','200.png','300.png','500.png','600.png')) || is_dir($folder.$file)) continue;
|
||||
if(unlink($folder.$file)) {
|
||||
enter_logfile($cfg,4," File ".$folder.$file." successfully deleted.");
|
||||
enter_logfile(4," File ".$folder.$file." successfully deleted.");
|
||||
} else {
|
||||
enter_logfile($cfg,2," File ".$folder.$file." couldn't be deleted. Please check the file permissions.");
|
||||
enter_logfile(2," File ".$folder.$file." couldn't be deleted. Please check the file permissions.");
|
||||
$err_cnt++;
|
||||
}
|
||||
}
|
||||
@@ -228,21 +228,21 @@ function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
|
||||
}
|
||||
|
||||
foreach ($del_folder as $folder) {
|
||||
if(is_dir(substr(__DIR__,0,-4).$folder)) {
|
||||
rm_file_reset(substr(__DIR__,0,-4).$folder,$cfg);
|
||||
if(is_dir(dirname(__DIR__).DIRECTORY_SEPARATOR.$folder)) {
|
||||
rm_file_reset(dirname(__DIR__).DIRECTORY_SEPARATOR.$folder,$cfg);
|
||||
}
|
||||
}
|
||||
|
||||
if ($err_cnt == 0) {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='4' WHERE `job_name`='reset_webspace_cache';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_webspace_cache']['timestamp'] = 4;
|
||||
enter_logfile($cfg,4," Finished job '".$lang['wihladm33']."'");
|
||||
enter_logfile(4," Finished job '".$lang['wihladm33']."'");
|
||||
}
|
||||
} else {
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='3' WHERE `job_name`='reset_webspace_cache';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_webspace_cache']['timestamp'] = 3;
|
||||
}
|
||||
@@ -250,45 +250,44 @@ function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
|
||||
}
|
||||
|
||||
|
||||
if (in_array($db_cache['job_check']['reset_usage_graph']['timestamp'], ["1","2"], true)) {
|
||||
if (in_array(intval($db_cache['job_check']['reset_usage_graph']['timestamp']), [1,2], true)) {
|
||||
if ($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='2' WHERE `job_name`='reset_usage_graph';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_usage_graph']['timestamp'] = 2;
|
||||
enter_logfile($cfg,4," Started job '".$lang['wihladm34']."'");
|
||||
enter_logfile(4," Started job '".$lang['wihladm34']."'");
|
||||
}
|
||||
if ($mysqlcon->exec("DELETE FROM `$dbname`.`server_usage`;") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='3' WHERE `job_name`='reset_usage_graph';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_usage_graph']['timestamp'] = 3;
|
||||
}
|
||||
} else {
|
||||
enter_logfile($cfg,4," Cleaned server usage graph (table: server_usage)");
|
||||
enter_logfile(4," Cleaned server usage graph (table: server_usage)");
|
||||
if($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`='4' WHERE `job_name`='reset_usage_graph';") === false) {
|
||||
enter_logfile($cfg,2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
enter_logfile(2," Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
|
||||
} else {
|
||||
$db_cache['job_check']['reset_usage_graph']['timestamp'] = 4;
|
||||
enter_logfile($cfg,4," Finished job '".$lang['wihladm34']."'");
|
||||
enter_logfile(4," Finished job '".$lang['wihladm34']."'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enter_logfile($cfg,4,"Reset job(s) finished");
|
||||
enter_logfile(4,"Reset job(s) finished");
|
||||
|
||||
if($db_cache['job_check']['reset_stop_after']['timestamp'] == "1") {
|
||||
$path = substr(__DIR__, 0, -4);
|
||||
if(intval($db_cache['job_check']['reset_stop_after']['timestamp']) == 1) {
|
||||
if (substr(php_uname(), 0, 7) == "Windows") {
|
||||
pclose(popen("start /B cmd /C ".$phpcommand." ".$path."worker.php stop >NUL 2>NUL", "r"));
|
||||
file_put_contents($path.'logs\autostart_deactivated',"");
|
||||
pclose(popen("start /B cmd /C ".$phpcommand." ".dirname(__DIR__).DIRECTORY_SEPARATOR."worker.php stop >NUL 2>NUL", "r"));
|
||||
file_put_contents($GLOBALS['autostart'],"");
|
||||
} else {
|
||||
exec($phpcommand." ".$path."worker.php stop > /dev/null &");
|
||||
file_put_contents($path.'logs/autostart_deactivated',"");
|
||||
exec($phpcommand." ".dirname(__DIR__).DIRECTORY_SEPARATOR."worker.php stop > /dev/null &");
|
||||
file_put_contents($GLOBALS['autostart'],"");
|
||||
}
|
||||
shutdown($mysqlcon,$cfg,4,"Stop requested after Reset job. Wait for manually start.");
|
||||
shutdown($mysqlcon,4,"Stop requested after Reset job. Wait for manually start.");
|
||||
}
|
||||
}
|
||||
enter_logfile($cfg,6,"reset_rs needs: ".(number_format(round((microtime(true) - $starttime), 5),5)));
|
||||
enter_logfile(6,"reset_rs needs: ".(number_format(round((microtime(true) - $starttime), 5),5)));
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user