diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0ef10f04ea..1618f2078c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -715,6 +715,7 @@ phutil_register_library_map(array( 'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php', 'DifferentialUpdateRevisionConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php', 'DifferentialViewState' => 'applications/differential/storage/DifferentialViewState.php', + 'DifferentialViewStateGarbageCollector' => 'applications/differential/garbagecollector/DifferentialViewStateGarbageCollector.php', 'DifferentialViewStateQuery' => 'applications/differential/query/DifferentialViewStateQuery.php', 'DiffusionAuditorDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorDatasource.php', 'DiffusionAuditorFunctionDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorFunctionDatasource.php', @@ -6803,6 +6804,7 @@ phutil_register_library_map(array( 'DifferentialDAO', 'PhabricatorPolicyInterface', ), + 'DifferentialViewStateGarbageCollector' => 'PhabricatorGarbageCollector', 'DifferentialViewStateQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DiffusionAuditorDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 'DiffusionAuditorFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource', diff --git a/src/applications/differential/garbagecollector/DifferentialViewStateGarbageCollector.php b/src/applications/differential/garbagecollector/DifferentialViewStateGarbageCollector.php new file mode 100644 index 0000000000..e862de22f1 --- /dev/null +++ b/src/applications/differential/garbagecollector/DifferentialViewStateGarbageCollector.php @@ -0,0 +1,29 @@ +establishConnection('w'); + + queryfx( + $conn, + 'DELETE FROM %R WHERE dateModified < %d LIMIT 100', + $table, + $this->getGarbageEpoch()); + + return ($conn->getAffectedRows() == 100); + } + +} diff --git a/src/applications/differential/storage/DifferentialViewState.php b/src/applications/differential/storage/DifferentialViewState.php index 763edd8460..101061f379 100644 --- a/src/applications/differential/storage/DifferentialViewState.php +++ b/src/applications/differential/storage/DifferentialViewState.php @@ -23,6 +23,9 @@ final class DifferentialViewState 'key_object' => array( 'columns' => array('objectPHID'), ), + 'key_modified' => array( + 'columns' => array('dateModified'), + ), ), ) + parent::getConfiguration(); }