2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Clear log in a general way using the system sort process as will only run periodically

This commit is contained in:
azammitdcarf
2012-10-04 00:06:30 +00:00
parent 2a394951f6
commit a76c8f604f
3 changed files with 4 additions and 12 deletions

View File

@@ -206,7 +206,7 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin
sleep($sleepinterval); sleep($sleepinterval);
} }
process_clear_log($process_id); process_clear_log();
} }
disable_systemsort(); disable_systemsort();

View File

@@ -248,25 +248,21 @@ function process_get_last_data($type = 1)
/** /**
* Don't let the log get too big for this process * Don't let the log get too big
* *
* @param int $process_id The process id
*
* @author Adam Zammit <adam.zammit@acspri.org.au> * @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2012-09-27 * @since 2012-09-27
*/ */
function process_clear_log($process_id) function process_clear_log()
{ {
global $db; global $db;
$sql = $sql =
"DELETE FROM process_log WHERE process_id = '$process_id' AND "DELETE FROM process_log WHERE process_log_id NOT IN (
process_log_id NOT IN (
SELECT process_log_id SELECT process_log_id
FROM ( FROM (
SELECT process_log_id SELECT process_log_id
FROM process_log FROM process_log
WHERE process_id = '$process_id'
ORDER BY process_log_id DESC ORDER BY process_log_id DESC
LIMIT " . (PROCESS_LOG_LIMIT * 3) . " LIMIT " . (PROCESS_LOG_LIMIT * 3) . "
) x ) x

View File

@@ -621,10 +621,6 @@ class voipWatch extends voip {
$time = time(); $time = time();
} }
if ($process_id) {
process_clear_log($process_id);
}
} while ($this->keepWatching); } while ($this->keepWatching);
} }