Page MenuHomeIn-Portal Phabricator

INP-1841 - Improve performance of System Log record removal code
ClosedPublic

Authored by alex on Apr 19 2023, 7:35 AM.

Details

Test Plan

Preparations

  1. go to the IDE
  2. open the core/units/users/users_event_handler.php file for editing
  3. add the trigger_error('sample error', E_USER_ERROR); code after parent::SetCustomQuery($event); in the \UsersEventHandler::SetCustomQuery function
  4. save changes
  5. open the core/units/logs/system_logs/system_log_eh.php file for editing
  6. add this code and save changes:
protected function OnBeforeItemDelete(kEvent $event)
{
    parent::OnBeforeItemDelete($event);
    die('never executed');
}

Testing

  1. login to the Admin Console
  2. go to the User ManagementAdministrators section several times to generate several (> 3 records in the System Log)
  3. in the database adjust SystemLog.LogTimestamp column for one of the records to be 6 months old
  4. go to the Logs & ReportsSystem Log section
  5. remember records in there and their LogTimestamp column values
  6. go to the ConfigurationWebsiteScheduled Tasks section
  7. run the rotate_system_logs scheduled task
  8. confirm, that above added die(...) code wasn't executed
  9. go to the Logs & ReportsSystem Log section
  10. confirm, that records older than 1 month were deleted
  11. select a few (not all) records > press Delete button > confirm record removal
  12. confirm, that above added die(...) code wasn't executed
  13. confirm, that selected records were removed
  14. press Delete All button > confirm record removal
  15. confirm, that above added die(...) code wasn't executed
  16. confirm, that all records were removed

Diff Detail

Repository
rINP In-Portal
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

alex created this revision.Apr 19 2023, 7:35 AM
alex requested review of this revision.Apr 19 2023, 7:35 AM
alex edited the test plan for this revision. (Show Details)Apr 19 2023, 9:41 AM
erik accepted this revision.Apr 19 2023, 9:57 AM
This revision is now accepted and ready to land.Apr 19 2023, 9:57 AM
This revision was automatically updated to reflect the committed changes.