Prepare DestructionEngine to be modularized

Summary:
Ref T9979. The general shape of "engine" code feels pretty good, and I plan to move indexing to be more in line with other modern engines, with the ultimate goal of supporting subprojects (T10010) and several intermediate goals.

Before moving indexing, clean up Destruction, since some of the new indexes will need destruction hooks and destruction currently has a lot of `instanceof` stuff that should be easy to fix by applying more modern approaches.

Test Plan:
  - Used `bin/remove destroy` to destory an Almanac device.
  - Verified that properties for the device were destroyed.
  - Viewed module panel in UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9979

Differential Revision: https://secure.phabricator.com/D14831
This commit is contained in:
epriestley
2015-12-20 07:44:03 -08:00
parent 5fecd55d6e
commit 674388ce6a
7 changed files with 138 additions and 22 deletions

View File

@@ -0,0 +1,44 @@
<?php
final class PhabricatorDestructionEngineExtensionModule
extends PhabricatorConfigModule {
public function getModuleKey() {
return 'destructionengine';
}
public function getModuleName() {
return pht('Engine: Destruction');
}
public function renderModuleStatus(AphrontRequest $request) {
$viewer = $request->getViewer();
$extensions = PhabricatorDestructionEngineExtension::getAllExtensions();
$rows = array();
foreach ($extensions as $extension) {
$rows[] = array(
get_class($extension),
$extension->getExtensionName(),
);
}
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
pht('Class'),
pht('Name'),
))
->setColumnClasses(
array(
null,
'wide pri',
));
return id(new PHUIObjectBoxView())
->setHeaderText(pht('DestructionEngine Extensions'))
->setTable($table);
}
}