phorge/src/applications/config/controller/module/PhabricatorConfigModuleController.php
Christopher Speck ce3d484b0e Addressing some PHP8 incompatibilities - Diffusion & Differential
Summary: Running through setting up and using Diffusion repositories and addressing PHP8 issues that come up.

Test Plan:
I set up a hosted mercurial repository and pushed commits to it over ssh.
I set up a hosted git repository and pushed commits to it over ssh.
I set up a mirrored mercurial repository over ssh.
I set up a mirrored git repository over ssh.

I created a diff on a git repository and landed it.
I created a diff on a mercurial repository and landed it.

I cloned and pushed a commit to a mercurial repo over http.
I cloned and pushed a commit to a git repo over http.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D21864
2023-05-28 23:09:53 -04:00

64 lines
1.6 KiB
PHP

<?php
final class PhabricatorConfigModuleController
extends PhabricatorConfigController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$key = $request->getURIData('module');
$all_modules = PhabricatorConfigModule::getAllModules();
if ($key === null || !strlen($key)) {
$key = head_key($all_modules);
}
if (empty($all_modules[$key])) {
return new Aphront404Response();
}
$module = $all_modules[$key];
$content = $module->renderModuleStatus($request);
$title = $module->getModuleName();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$modules_uri = $this->getApplicationURI('module/');
$modules = PhabricatorConfigModule::getAllModules();
foreach ($modules as $module_key => $module) {
$nav->newLink($module_key)
->setName($module->getModuleName())
->setHref(urisprintf('%s%s/', $modules_uri, $module_key))
->setIcon('fa-puzzle-piece');
}
$nav->selectFilter($key);
$header = $this->buildHeaderView($title);
if ($content instanceof AphrontTableView) {
$view = $this->buildConfigBoxView($title, $content);
} else {
$view = $content;
}
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(pht('Extensions/Modules'), $modules_uri)
->addTextCrumb($title)
->setBorder(true);
$content = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter($view);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->setNavigation($nav)
->appendChild($content);
}
}