From 4793c2e10ef0f45fe556d248b8d96aaa844dc6ef Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 12 May 2009 11:42:42 +0000 Subject: Closes #1003: Using more efficient query git-svn-id: https://code.elgg.org/elgg/trunk@3283 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/system_log.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/lib/system_log.php') diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php index 71996c8b3..8f546598f 100644 --- a/engine/lib/system_log.php +++ b/engine/lib/system_log.php @@ -245,15 +245,15 @@ $ts = $now - $offset; // create table - if (!update_data("CREATE TABLE {$CONFIG->dbprefix}system_log_$now as SELECT * from {$CONFIG->dbprefix}system_log WHERE time_created<=$ts")) + if (!update_data("CREATE TABLE {$CONFIG->dbprefix}system_log_$now as SELECT * from {$CONFIG->dbprefix}system_log WHERE time_created<$ts")) return false; - // alter table to engine - if (!update_data("ALTER TABLE {$CONFIG->dbprefix}system_log_$now engine=archive")) - return false; - // delete - if (delete_data("DELETE from {$CONFIG->dbprefix}system_log WHERE id in (select id from {$CONFIG->dbprefix}system_log_$now)")===false) // Don't delete on time since we are running in a concurrent environment + if (delete_data("DELETE from {$CONFIG->dbprefix}system_log WHERE time_created<$ts)")===false) // Don't delete on time since we are running in a concurrent environment + return false; + + // alter table to engine + if (!update_data("ALTER TABLE {$CONFIG->dbprefix}system_log_$now engine=archive")) return false; return true; -- cgit v1.2.3