@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a very forgiving GC for Differential viewstate information

Summary:
Ref T13455. Viewstates are fairly small and will probably grow less quickly than the changeset table, but the data is also not important to retain in the long term: if you revisit a change several months after hiding some files, it's fine if we've forgotten that you adjusted the view parameters.

Add a GC with a long default collection policy (180 days) so installs can manage the size of this table if it becomes necessary.

Test Plan: Ran via `bin/garbage` to adjust the GC policy and collect viewstates.

Maniphest Tasks: T13455

Differential Revision: https://secure.phabricator.com/D21164

+34
+2
src/__phutil_library_map__.php
··· 715 715 'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php', 716 716 'DifferentialUpdateRevisionConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php', 717 717 'DifferentialViewState' => 'applications/differential/storage/DifferentialViewState.php', 718 + 'DifferentialViewStateGarbageCollector' => 'applications/differential/garbagecollector/DifferentialViewStateGarbageCollector.php', 718 719 'DifferentialViewStateQuery' => 'applications/differential/query/DifferentialViewStateQuery.php', 719 720 'DiffusionAuditorDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorDatasource.php', 720 721 'DiffusionAuditorFunctionDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorFunctionDatasource.php', ··· 6803 6804 'DifferentialDAO', 6804 6805 'PhabricatorPolicyInterface', 6805 6806 ), 6807 + 'DifferentialViewStateGarbageCollector' => 'PhabricatorGarbageCollector', 6806 6808 'DifferentialViewStateQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 6807 6809 'DiffusionAuditorDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 6808 6810 'DiffusionAuditorFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
+29
src/applications/differential/garbagecollector/DifferentialViewStateGarbageCollector.php
··· 1 + <?php 2 + 3 + final class DifferentialViewStateGarbageCollector 4 + extends PhabricatorGarbageCollector { 5 + 6 + const COLLECTORCONST = 'differential.viewstate'; 7 + 8 + public function getCollectorName() { 9 + return pht('Differential View States'); 10 + } 11 + 12 + public function getDefaultRetentionPolicy() { 13 + return phutil_units('180 days in seconds'); 14 + } 15 + 16 + protected function collectGarbage() { 17 + $table = new DifferentialViewState(); 18 + $conn = $table->establishConnection('w'); 19 + 20 + queryfx( 21 + $conn, 22 + 'DELETE FROM %R WHERE dateModified < %d LIMIT 100', 23 + $table, 24 + $this->getGarbageEpoch()); 25 + 26 + return ($conn->getAffectedRows() == 100); 27 + } 28 + 29 + }
+3
src/applications/differential/storage/DifferentialViewState.php
··· 23 23 'key_object' => array( 24 24 'columns' => array('objectPHID'), 25 25 ), 26 + 'key_modified' => array( 27 + 'columns' => array('dateModified'), 28 + ), 26 29 ), 27 30 ) + parent::getConfiguration(); 28 31 }