Rename PhabricatorApplication subclasses

Summary: Ref T5655. Some discussion in D9839. Generally speaking, `Phabricator{$name}Application` is clearer than `PhabricatorApplication{$name}`.

Test Plan:
# Pinned and uninstalled some applications.
# Applied patch and performed migrations.
# Verified that the pinned applications were still pinned and that the uninstalled applications were still uninstalled.
# Performed a sanity check on the database contents.

Reviewers: btrahan, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: hach-que, epriestley, Korvin

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D9982
This commit is contained in:
Joshua Spence
2014-07-23 10:03:09 +10:00
parent 1649cf94f4
commit 86c399b657
295 changed files with 918 additions and 978 deletions

View File

@@ -28,7 +28,22 @@ abstract class PhabricatorApplication implements PhabricatorPolicyInterface {
public function getName() {
return substr(get_class($this), strlen('PhabricatorApplication'));
// TODO: This is sort of gross.
$match = null;
$regex = '/^Phabricator([A-Z][a-zA-Z]*)Application$/';
if (preg_match($regex, get_class($this), $match)) {
return $match[1];
}
$regex = '/^PhabricatorApplication([A-Z][a-zA-Z]*)$/';
if (preg_match($regex, get_class($this), $match)) {
return $match[1];
}
throw new Exception('Unable to determine application name automagically.');
}
public function getShortDescription() {

View File

@@ -159,7 +159,7 @@ abstract class PhabricatorController extends AphrontController {
return $this->delegateToController($checker_controller);
}
$auth_class = 'PhabricatorApplicationAuth';
$auth_class = 'PhabricatorAuthApplication';
$auth_application = PhabricatorApplication::getByClass($auth_class);
// Require partial sessions to finish login before doing anything.
@@ -231,7 +231,6 @@ abstract class PhabricatorController extends AphrontController {
if ($this->shouldRequireAdmin() && !$user->getIsAdmin()) {
return new Aphront403Response();
}
}
public function buildStandardPageView() {
@@ -319,7 +318,6 @@ abstract class PhabricatorController extends AphrontController {
$seen = array();
while ($response instanceof AphrontProxyResponse) {
$hash = spl_object_hash($response);
if (isset($seen[$hash])) {
$seen[] = get_class($response);
@@ -403,7 +401,6 @@ abstract class PhabricatorController extends AphrontController {
->execute();
}
/**
* Render a list of links to handles, identified by PHIDs. The handles must
* already be loaded.
@@ -433,7 +430,6 @@ abstract class PhabricatorController extends AphrontController {
}
protected function buildApplicationCrumbs() {
$crumbs = array();
$application = $this->getCurrentApplication();
@@ -516,7 +512,6 @@ abstract class PhabricatorController extends AphrontController {
return 'phabricator';
}
/**
* Create a new @{class:AphrontDialogView} with defaults filled in.
*

View File

@@ -1,7 +1,6 @@
<?php
final class PhabricatorAccessControlTestCase
extends PhabricatorTestCase {
final class PhabricatorAccessControlTestCase extends PhabricatorTestCase {
protected function getPhabricatorTestCaseConfiguration() {
return array(
@@ -201,7 +200,7 @@ final class PhabricatorAccessControlTestCase
$env->overrideEnvConfig('policy.allow-public', false);
$app = PhabricatorApplication::getByClass('PhabricatorApplicationTest');
$app = PhabricatorApplication::getByClass('PhabricatorTestApplication');
$app->reset();
$app->setPolicy(
PhabricatorPolicyCapability::CAN_VIEW,

View File

@@ -1,6 +1,6 @@
<?php
final class PhabricatorApplicationTest extends PhabricatorApplication {
final class PhabricatorTestApplication extends PhabricatorApplication {
private $policies = array();
@@ -30,8 +30,7 @@ final class PhabricatorApplicationTest extends PhabricatorApplication {
}
public function getRoutes() {
return array(
);
return array();
}
}