1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Rename "HeraldAction" to "HeraldActionRecord"

Summary:
Ref T8726. I want to modularize actions like fields, but the base class should be "HeraldAction".

Eventually, "HeraldCondition" should probably be "HeraldFieldRecord", and then both Action and Condition should just be rolled into Rule, probably, but that can wait and doesn't block anything.

Test Plan: Ran migration, poked around UI, used `git grep`.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T8726

Differential Revision: https://secure.phabricator.com/D13644
This commit is contained in:
epriestley 2015-07-23 13:26:40 -07:00
parent 37b6436384
commit e0861bf240
8 changed files with 16 additions and 14 deletions

View file

@ -99,7 +99,7 @@ foreach (new LiskMigrationIterator($table) as $condition) {
echo pht('Updated mailing lists in Herald condition %d.', $id)."\n"; echo pht('Updated mailing lists in Herald condition %d.', $id)."\n";
} }
$table = new HeraldAction(); $table = new HeraldActionRecord();
$conn_w = $table->establishConnection('w'); $conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $action) { foreach (new LiskMigrationIterator($table) as $action) {
$name = $action->getAction(); $name = $action->getAction();

View file

@ -0,0 +1,2 @@
RENAME TABLE {$NAMESPACE}_herald.herald_action
TO {$NAMESPACE}_herald.herald_actionrecord;

View file

@ -1007,7 +1007,7 @@ phutil_register_library_map(array(
'HarbormasterUploadArtifactBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php', 'HarbormasterUploadArtifactBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php',
'HarbormasterWaitForPreviousBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.php', 'HarbormasterWaitForPreviousBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.php',
'HarbormasterWorker' => 'applications/harbormaster/worker/HarbormasterWorker.php', 'HarbormasterWorker' => 'applications/harbormaster/worker/HarbormasterWorker.php',
'HeraldAction' => 'applications/herald/storage/HeraldAction.php', 'HeraldActionRecord' => 'applications/herald/storage/HeraldActionRecord.php',
'HeraldAdapter' => 'applications/herald/adapter/HeraldAdapter.php', 'HeraldAdapter' => 'applications/herald/adapter/HeraldAdapter.php',
'HeraldAlwaysField' => 'applications/herald/field/HeraldAlwaysField.php', 'HeraldAlwaysField' => 'applications/herald/field/HeraldAlwaysField.php',
'HeraldAnotherRuleField' => 'applications/herald/field/HeraldAnotherRuleField.php', 'HeraldAnotherRuleField' => 'applications/herald/field/HeraldAnotherRuleField.php',
@ -4661,7 +4661,7 @@ phutil_register_library_map(array(
'HarbormasterUploadArtifactBuildStepImplementation' => 'HarbormasterBuildStepImplementation', 'HarbormasterUploadArtifactBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterWaitForPreviousBuildStepImplementation' => 'HarbormasterBuildStepImplementation', 'HarbormasterWaitForPreviousBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterWorker' => 'PhabricatorWorker', 'HarbormasterWorker' => 'PhabricatorWorker',
'HeraldAction' => 'HeraldDAO', 'HeraldActionRecord' => 'HeraldDAO',
'HeraldAdapter' => 'Phobject', 'HeraldAdapter' => 'Phobject',
'HeraldAlwaysField' => 'HeraldField', 'HeraldAlwaysField' => 'HeraldField',
'HeraldAnotherRuleField' => 'HeraldField', 'HeraldAnotherRuleField' => 'HeraldField',

View file

@ -690,7 +690,7 @@ abstract class HeraldAdapter extends Phobject {
public function willSaveAction( public function willSaveAction(
HeraldRule $rule, HeraldRule $rule,
HeraldAction $action) { HeraldActionRecord $action) {
$target = $action->getTarget(); $target = $action->getTarget();
if (is_array($target)) { if (is_array($target)) {
@ -996,7 +996,7 @@ abstract class HeraldAdapter extends Phobject {
} }
private function renderActionAsText( private function renderActionAsText(
HeraldAction $action, HeraldActionRecord $action,
PhabricatorHandleList $handles) { PhabricatorHandleList $handles) {
$rule_global = HeraldRuleTypeConfig::RULE_TYPE_GLOBAL; $rule_global = HeraldRuleTypeConfig::RULE_TYPE_GLOBAL;
@ -1028,7 +1028,7 @@ abstract class HeraldAdapter extends Phobject {
} }
private function renderActionTargetAsText( private function renderActionTargetAsText(
HeraldAction $action, HeraldActionRecord $action,
PhabricatorHandleList $handles) { PhabricatorHandleList $handles) {
$target = $action->getTarget(); $target = $action->getTarget();

View file

@ -313,7 +313,7 @@ final class HeraldRuleController extends HeraldController {
$action[1] = null; $action[1] = null;
} }
$obj = new HeraldAction(); $obj = new HeraldActionRecord();
$obj->setAction($action[0]); $obj->setAction($action[0]);
$obj->setTarget($action[1]); $obj->setTarget($action[1]);

View file

@ -108,7 +108,7 @@ final class HeraldRuleQuery extends PhabricatorCursorPagedPolicyAwareQuery {
$rule_ids); $rule_ids);
$conditions = mgroup($conditions, 'getRuleID'); $conditions = mgroup($conditions, 'getRuleID');
$actions = id(new HeraldAction())->loadAllWhere( $actions = id(new HeraldActionRecord())->loadAllWhere(
'ruleID IN (%Ld)', 'ruleID IN (%Ld)',
$rule_ids); $rule_ids);
$actions = mgroup($actions, 'getRuleID'); $actions = mgroup($actions, 'getRuleID');

View file

@ -1,6 +1,6 @@
<?php <?php
final class HeraldAction extends HeraldDAO { final class HeraldActionRecord extends HeraldDAO {
protected $ruleID; protected $ruleID;

View file

@ -99,14 +99,14 @@ final class HeraldRule extends HeraldDAO
if (!$this->getID()) { if (!$this->getID()) {
return array(); return array();
} }
return id(new HeraldAction())->loadAllWhere( return id(new HeraldActionRecord())->loadAllWhere(
'ruleID = %d', 'ruleID = %d',
$this->getID()); $this->getID());
} }
public function attachActions(array $actions) { public function attachActions(array $actions) {
// TODO: validate actions have been attached. // TODO: validate actions have been attached.
assert_instances_of($actions, 'HeraldAction'); assert_instances_of($actions, 'HeraldActionRecord');
$this->actions = $actions; $this->actions = $actions;
return $this; return $this;
} }
@ -123,9 +123,9 @@ final class HeraldRule extends HeraldDAO
} }
public function saveActions(array $actions) { public function saveActions(array $actions) {
assert_instances_of($actions, 'HeraldAction'); assert_instances_of($actions, 'HeraldActionRecord');
return $this->saveChildren( return $this->saveChildren(
id(new HeraldAction())->getTableName(), id(new HeraldActionRecord())->getTableName(),
$actions); $actions);
} }
@ -162,7 +162,7 @@ final class HeraldRule extends HeraldDAO
queryfx( queryfx(
$this->establishConnection('w'), $this->establishConnection('w'),
'DELETE FROM %T WHERE ruleID = %d', 'DELETE FROM %T WHERE ruleID = %d',
id(new HeraldAction())->getTableName(), id(new HeraldActionRecord())->getTableName(),
$this->getID()); $this->getID());
$result = parent::delete(); $result = parent::delete();
$this->saveTransaction(); $this->saveTransaction();