[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 echo "Cleaning up old Herald rule applied rows...\n"; 4 $table = new HeraldRule(); 5 $table->openTransaction(); 6 $table->beginReadLocking(); 7 8 $rules = $table->loadAll(); 9 foreach ($rules as $key => $rule) { 10 $first_policy = HeraldRepetitionPolicyConfig::toInt( 11 HeraldRepetitionPolicyConfig::FIRST); 12 if ($rule->getRepetitionPolicy() != $first_policy) { 13 unset($rules[$key]); 14 } 15 } 16 17 $conn_w = $table->establishConnection('w'); 18 19 $clause = ''; 20 if ($rules) { 21 $clause = qsprintf( 22 $conn_w, 23 'WHERE ruleID NOT IN (%Ld)', 24 mpull($rules, 'getID')); 25 } 26 27 echo 'This may take a moment'; 28 do { 29 queryfx( 30 $conn_w, 31 'DELETE FROM %T %Q LIMIT 1000', 32 HeraldRule::TABLE_RULE_APPLIED, 33 $clause); 34 echo '.'; 35 } while ($conn_w->getAffectedRows()); 36 37 $table->endReadLocking(); 38 $table->saveTransaction(); 39 echo "\nDone.\n";
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |