@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 GC for sent and received mail

Summary: Ref T4368. We don't currently GC these tables, and the sent mail table is one of the largest on `secure.phabricator.com`. There's no value in retaining this information indefinitely. Instead, retain it for 90 days, which should be plenty of time to debug/diagnose any issues.

Test Plan: Ran `phd debug garbage`, saw it clean up a reasonable amount of data from these tables.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4368

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

+50
+2
resources/sql/autopatches/20140201.gc.1.mailsent.sql
··· 1 + ALTER TABLE {$NAMESPACE}_metamta.metamta_mail 2 + ADD KEY `key_created` (dateCreated);
+2
resources/sql/autopatches/20140201.gc.2.mailreceived.sql
··· 1 + ALTER TABLE {$NAMESPACE}_metamta.metamta_receivedmail 2 + ADD KEY `key_created` (dateCreated);
+4
src/__phutil_library_map__.php
··· 923 923 'ManiphestTransactionSaveController' => 'applications/maniphest/controller/ManiphestTransactionSaveController.php', 924 924 'ManiphestView' => 'applications/maniphest/view/ManiphestView.php', 925 925 'MetaMTAConstants' => 'applications/metamta/constants/MetaMTAConstants.php', 926 + 'MetaMTAMailReceivedGarbageCollector' => 'applications/metamta/garbagecollector/MetaMTAMailReceivedGarbageCollector.php', 927 + 'MetaMTAMailSentGarbageCollector' => 'applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php', 926 928 'MetaMTANotificationType' => 'applications/metamta/constants/MetaMTANotificationType.php', 927 929 'MetaMTAReceivedMailStatus' => 'applications/metamta/constants/MetaMTAReceivedMailStatus.php', 928 930 'NuanceCapabilitySourceDefaultEdit' => 'applications/nuance/capability/NuanceCapabilitySourceDefaultEdit.php', ··· 3513 3515 'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 3514 3516 'ManiphestTransactionSaveController' => 'ManiphestController', 3515 3517 'ManiphestView' => 'AphrontView', 3518 + 'MetaMTAMailReceivedGarbageCollector' => 'PhabricatorGarbageCollector', 3519 + 'MetaMTAMailSentGarbageCollector' => 'PhabricatorGarbageCollector', 3516 3520 'MetaMTANotificationType' => 'MetaMTAConstants', 3517 3521 'MetaMTAReceivedMailStatus' => 'MetaMTAConstants', 3518 3522 'NuanceCapabilitySourceDefaultEdit' => 'PhabricatorPolicyCapability',
+21
src/applications/metamta/garbagecollector/MetaMTAMailReceivedGarbageCollector.php
··· 1 + <?php 2 + 3 + final class MetaMTAMailReceivedGarbageCollector 4 + extends PhabricatorGarbageCollector { 5 + 6 + public function collectGarbage() { 7 + $ttl = phutil_units('90 days in seconds'); 8 + 9 + $table = new PhabricatorMetaMTAReceivedMail(); 10 + $conn_w = $table->establishConnection('w'); 11 + 12 + queryfx( 13 + $conn_w, 14 + 'DELETE FROM %T WHERE dateCreated < %d LIMIT 100', 15 + $table->getTableName(), 16 + time() - $ttl); 17 + 18 + return ($conn_w->getAffectedRows() == 100); 19 + } 20 + 21 + }
+21
src/applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php
··· 1 + <?php 2 + 3 + final class MetaMTAMailSentGarbageCollector 4 + extends PhabricatorGarbageCollector { 5 + 6 + public function collectGarbage() { 7 + $ttl = phutil_units('90 days in seconds'); 8 + 9 + $table = new PhabricatorMetaMTAMail(); 10 + $conn_w = $table->establishConnection('w'); 11 + 12 + queryfx( 13 + $conn_w, 14 + 'DELETE FROM %T WHERE dateCreated < %d LIMIT 100', 15 + $table->getTableName(), 16 + time() - $ttl); 17 + 18 + return ($conn_w->getAffectedRows() == 100); 19 + } 20 + 21 + }