Page MenuHomePhabricator

D8127.diff
No OneTemporary

D8127.diff

Index: resources/sql/autopatches/20140201.gc.1.mailsent.sql
===================================================================
--- /dev/null
+++ resources/sql/autopatches/20140201.gc.1.mailsent.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_metamta.metamta_mail
+ ADD KEY `key_created` (dateCreated);
Index: resources/sql/autopatches/20140201.gc.2.mailreceived.sql
===================================================================
--- /dev/null
+++ resources/sql/autopatches/20140201.gc.2.mailreceived.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_metamta.metamta_receivedmail
+ ADD KEY `key_created` (dateCreated);
Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -923,6 +923,8 @@
'ManiphestTransactionSaveController' => 'applications/maniphest/controller/ManiphestTransactionSaveController.php',
'ManiphestView' => 'applications/maniphest/view/ManiphestView.php',
'MetaMTAConstants' => 'applications/metamta/constants/MetaMTAConstants.php',
+ 'MetaMTAMailReceivedGarbageCollector' => 'applications/metamta/garbagecollector/MetaMTAMailReceivedGarbageCollector.php',
+ 'MetaMTAMailSentGarbageCollector' => 'applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php',
'MetaMTANotificationType' => 'applications/metamta/constants/MetaMTANotificationType.php',
'MetaMTAReceivedMailStatus' => 'applications/metamta/constants/MetaMTAReceivedMailStatus.php',
'NuanceCapabilitySourceDefaultEdit' => 'applications/nuance/capability/NuanceCapabilitySourceDefaultEdit.php',
@@ -3513,6 +3515,8 @@
'ManiphestTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'ManiphestTransactionSaveController' => 'ManiphestController',
'ManiphestView' => 'AphrontView',
+ 'MetaMTAMailReceivedGarbageCollector' => 'PhabricatorGarbageCollector',
+ 'MetaMTAMailSentGarbageCollector' => 'PhabricatorGarbageCollector',
'MetaMTANotificationType' => 'MetaMTAConstants',
'MetaMTAReceivedMailStatus' => 'MetaMTAConstants',
'NuanceCapabilitySourceDefaultEdit' => 'PhabricatorPolicyCapability',
Index: src/applications/metamta/garbagecollector/MetaMTAMailReceivedGarbageCollector.php
===================================================================
--- /dev/null
+++ src/applications/metamta/garbagecollector/MetaMTAMailReceivedGarbageCollector.php
@@ -0,0 +1,21 @@
+<?php
+
+final class MetaMTAMailReceivedGarbageCollector
+ extends PhabricatorGarbageCollector {
+
+ public function collectGarbage() {
+ $ttl = phutil_units('90 days in seconds');
+
+ $table = new PhabricatorMetaMTAReceivedMail();
+ $conn_w = $table->establishConnection('w');
+
+ queryfx(
+ $conn_w,
+ 'DELETE FROM %T WHERE dateCreated < %d LIMIT 100',
+ $table->getTableName(),
+ time() - $ttl);
+
+ return ($conn_w->getAffectedRows() == 100);
+ }
+
+}
Index: src/applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php
===================================================================
--- /dev/null
+++ src/applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php
@@ -0,0 +1,21 @@
+<?php
+
+final class MetaMTAMailSentGarbageCollector
+ extends PhabricatorGarbageCollector {
+
+ public function collectGarbage() {
+ $ttl = phutil_units('90 days in seconds');
+
+ $table = new PhabricatorMetaMTAMail();
+ $conn_w = $table->establishConnection('w');
+
+ queryfx(
+ $conn_w,
+ 'DELETE FROM %T WHERE dateCreated < %d LIMIT 100',
+ $table->getTableName(),
+ time() - $ttl);
+
+ return ($conn_w->getAffectedRows() == 100);
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 24, 5:32 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7656940
Default Alt Text
D8127.diff (3 KB)

Event Timeline