fix okapi_syncbase for deleted logs
This commit is contained in:
@ -166,7 +166,7 @@
|
||||
sql_free_result($rs);
|
||||
|
||||
// move to archive, even if own log (uuids are used for OKAPI replication)
|
||||
sql("INSERT IGNORE INTO `cache_logs_archived` SELECT *, NOW() AS `deletion_date`, '&2' AS `deleted_by`, 0 AS `restored_by` FROM `cache_logs` WHERE `cache_logs`.`id`='&1' LIMIT 1", $log_id, $usr['userid']);
|
||||
sql("INSERT IGNORE INTO `cache_logs_archived` SELECT *, '0' AS `deletion_date`, '&2' AS `deleted_by`, 0 AS `restored_by` FROM `cache_logs` WHERE `cache_logs`.`id`='&1' LIMIT 1", $log_id, $usr['userid']);
|
||||
|
||||
// remove log entry
|
||||
sql("DELETE FROM `cache_logs` WHERE `cache_logs`.`id`='&1' LIMIT 1", $log_id);
|
||||
@ -177,6 +177,10 @@
|
||||
0 = (SELECT COUNT(*) FROM `cache_logs` WHERE `user_id` = '&1' AND `cache_id` = '&2' AND `type` IN (1,7))",
|
||||
$log_record['log_user_id'], $log_record['cache_id']);
|
||||
|
||||
// now tell OKAPI about the deletion;
|
||||
// this will trigger an okapi_syncbase update, if OKAPI is installed:
|
||||
sql("UPDATE `cache_logs_archived` SET `deletion_date`=NOW() WHERE `id`='&1'", $log_id);
|
||||
|
||||
// do not use slave server for the next time ...
|
||||
db_slave_exclude();
|
||||
|
||||
|
@ -731,11 +731,14 @@ function restore_listings($cacheids, $rdate, $roptions, $simulate)
|
||||
if (!$simulate)
|
||||
{
|
||||
sql("INSERT INTO `cache_logs_archived`
|
||||
SELECT *, NOW(), '&2', '&3' FROM `cache_logs` WHERE `id`='&1'",
|
||||
SELECT *, '0', '&2', '&3' FROM `cache_logs` WHERE `id`='&1'",
|
||||
$revert_logid,
|
||||
$user_id, // original deletor's ID and not restoring admin's ID!
|
||||
$login->userid);
|
||||
sql("DELETE FROM `cache_logs` WHERE `id`='&1'", $revert_logid);
|
||||
// This triggers an okapi_syncbase update, if OKAPI is installed:
|
||||
sql("UPDATE `cache_logs_archived` SET `deletion_date`=NOW() WHERE `id`='&1'",
|
||||
$revert_logid);
|
||||
}
|
||||
$logs_restored = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user