1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +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";
}
$table = new HeraldAction();
$table = new HeraldActionRecord();
$conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $action) {
$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',
'HarbormasterWaitForPreviousBuildStepImplementation' => 'applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.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',
'HeraldAlwaysField' => 'applications/herald/field/HeraldAlwaysField.php',
'HeraldAnotherRuleField' => 'applications/herald/field/HeraldAnotherRuleField.php',
@ -4661,7 +4661,7 @@ phutil_register_library_map(array(
'HarbormasterUploadArtifactBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterWaitForPreviousBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterWorker' => 'PhabricatorWorker',
'HeraldAction' => 'HeraldDAO',
'HeraldActionRecord' => 'HeraldDAO',
'HeraldAdapter' => 'Phobject',
'HeraldAlwaysField' => 'HeraldField',
'HeraldAnotherRuleField' => 'HeraldField',

View file

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

View file

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

View file

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

View file

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

View file

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