本文整理汇总了PHP中AphrontRequest::getURIMap方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::getURIMap方法的具体用法?PHP AphrontRequest::getURIMap怎么用?PHP AphrontRequest::getURIMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontRequest
的用法示例。
在下文中一共展示了AphrontRequest::getURIMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
public final function handleRequest(AphrontRequest $request)
{
$data = $request->getURIMap();
$project = $data['gerritProject'];
if (!isset(self::$projects[$project])) {
return new Aphront404Response();
}
$CALLSIGN = self::$projects[$project];
if ($data['action'] == 'branch') {
if (!isset($data['branch'])) {
return new Aphront404Response();
}
$branch = $data['branch'];
// get rid of refs/heads prefix
$branch = str_replace('refs/heads', '', $branch);
$branch = trim($branch, '/');
$branch = str_replace('HEAD', '', $branch);
// double encode any forward slashes in ref.
$branch = str_replace('/', '%252F', $branch);
if (strlen($branch) == 0) {
return id(new AphrontRedirectResponse())->setURI("/diffusion/{$CALLSIGN}/browse/");
} else {
return id(new AphrontRedirectResponse())->setURI("/diffusion/{$CALLSIGN}/browse/{$branch}/");
}
}
if ($data['action'] == 'browse') {
if (!isset($data['branch']) || !isset($data['file'])) {
return new Aphront404Response();
}
$branch = $data['branch'];
$file = $data['file'];
return id(new AphrontRedirectResponse())->setURI("/diffusion/{$CALLSIGN}/browse/{$branch}/{$file}");
}
if ($data['action'] == 'revision') {
$sha = isset($data['sha']) ? $data['sha'] : $data['branch'];
return id(new AphrontRedirectResponse())->setURI('/r' . $CALLSIGN . $sha);
}
if ($data['action'] == 'project') {
return id(new AphrontRedirectResponse())->setURI("/diffusion/{$CALLSIGN}/");
}
phlog('did not match any repository redirect action');
return new Aphront404Response();
}
示例2: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$user = $request->getUser();
// This controller doesn't use blob/path stuff, just pass the dictionary
// in directly instead of using the AphrontRequest parsing mechanism.
$data = $request->getURIMap();
$data['user'] = $user;
$drequest = DiffusionRequest::newFromDictionary($data);
$this->diffusionRequest = $drequest;
if ($request->getStr('diff')) {
return $this->buildRawDiffResponse($drequest);
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$content = array();
$commit = id(new DiffusionCommitQuery())->setViewer($request->getUser())->withRepository($repository)->withIdentifiers(array($drequest->getCommit()))->needCommitData(true)->needAuditRequests(true)->executeOne();
$crumbs = $this->buildCrumbs(array('commit' => true));
if (!$commit) {
$exists = $this->callConduitWithDiffusionRequest('diffusion.existsquery', array('commit' => $drequest->getCommit()));
if (!$exists) {
return new Aphront404Response();
}
$error = id(new PHUIInfoView())->setTitle(pht('Commit Still Parsing'))->appendChild(pht('Failed to load the commit because the commit has not been ' . 'parsed yet.'));
return $this->buildApplicationPage(array($crumbs, $error), array('title' => pht('Commit Still Parsing')));
}
$audit_requests = $commit->getAudits();
$this->auditAuthorityPHIDs = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user);
$commit_data = $commit->getCommitData();
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
if ($is_foreign) {
$subpath = $commit_data->getCommitDetail('svn-subpath');
$error_panel = new PHUIInfoView();
$error_panel->setTitle(pht('Commit Not Tracked'));
$error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING);
$error_panel->appendChild(pht("This Diffusion repository is configured to track only one " . "subdirectory of the entire Subversion repository, and this commit " . "didn't affect the tracked subdirectory ('%s'), so no " . "information is available.", $subpath));
$content[] = $error_panel;
} else {
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
$engine->setConfig('viewer', $user);
require_celerity_resource('phabricator-remarkup-css');
$parents = $this->callConduitWithDiffusionRequest('diffusion.commitparentsquery', array('commit' => $drequest->getCommit()));
if ($parents) {
$parents = id(new DiffusionCommitQuery())->setViewer($user)->withRepository($repository)->withIdentifiers($parents)->execute();
}
$headsup_view = id(new PHUIHeaderView())->setHeader(nonempty($commit->getSummary(), pht('Commit Detail')));
$headsup_actions = $this->renderHeadsupActionList($commit, $repository);
$commit_properties = $this->loadCommitProperties($commit, $commit_data, $parents, $audit_requests);
$property_list = id(new PHUIPropertyListView())->setHasKeyboardShortcuts(true)->setUser($user)->setObject($commit);
foreach ($commit_properties as $key => $value) {
$property_list->addProperty($key, $value);
}
$message = $commit_data->getCommitMessage();
$revision = $commit->getCommitIdentifier();
$message = $this->linkBugtraq($message);
$message = $engine->markupText($message);
$property_list->invokeWillRenderEvent();
$property_list->setActionList($headsup_actions);
$detail_list = new PHUIPropertyListView();
$detail_list->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
$detail_list->addTextContent(phutil_tag('div', array('class' => 'diffusion-commit-message phabricator-remarkup'), $message));
$headsup_view->setTall(true);
$object_box = id(new PHUIObjectBoxView())->setHeader($headsup_view)->addPropertyList($property_list)->addPropertyList($detail_list);
$content[] = $object_box;
}
$content[] = $this->buildComments($commit);
$hard_limit = 1000;
if ($commit->isImported()) {
$change_query = DiffusionPathChangeQuery::newFromDiffusionRequest($drequest);
$change_query->setLimit($hard_limit + 1);
$changes = $change_query->loadChanges();
} else {
$changes = array();
}
$was_limited = count($changes) > $hard_limit;
if ($was_limited) {
$changes = array_slice($changes, 0, $hard_limit);
}
$content[] = $this->buildMergesTable($commit);
$highlighted_audits = $commit->getAuthorityAudits($user, $this->auditAuthorityPHIDs);
$count = count($changes);
$bad_commit = null;
if ($count == 0) {
$bad_commit = queryfx_one(id(new PhabricatorRepository())->establishConnection('r'), 'SELECT * FROM %T WHERE fullCommitName = %s', PhabricatorRepository::TABLE_BADCOMMIT, 'r' . $callsign . $commit->getCommitIdentifier());
}
$show_changesets = false;
if ($bad_commit) {
$content[] = $this->renderStatusMessage(pht('Bad Commit'), $bad_commit['description']);
} else {
if ($is_foreign) {
// Don't render anything else.
} else {
if (!$commit->isImported()) {
$content[] = $this->renderStatusMessage(pht('Still Importing...'), pht('This commit is still importing. Changes will be visible once ' . 'the import finishes.'));
} else {
if (!count($changes)) {
$content[] = $this->renderStatusMessage(pht('Empty Commit'), pht('This commit is empty and does not affect any paths.'));
} else {
if ($was_limited) {
$content[] = $this->renderStatusMessage(pht('Enormous Commit'), pht('This commit is enormous, and affects more than %d files. ' . 'Changes are not shown.', $hard_limit));
} else {
//.........这里部分代码省略.........
示例3: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$data = $request->getURIMap();
$data = $data + array('dblob' => $this->getRequest()->getStr('ref'));
try {
$drequest = DiffusionRequest::newFromAphrontRequestDictionary($data, $request);
} catch (Exception $ex) {
return id(new Aphront404Response())->setRequest($request);
}
$this->setDiffusionRequest($drequest);
$drequest = $this->getDiffusionRequest();
$viewer = $this->getViewer();
if (!$request->isAjax()) {
// This request came out of the dropdown menu, either "View Standalone"
// or "View Raw File".
$view = $request->getStr('view');
if ($view == 'r') {
$uri = $drequest->generateURI(array('action' => 'browse', 'params' => array('view' => 'raw')));
} else {
$uri = $drequest->generateURI(array('action' => 'change'));
}
return id(new AphrontRedirectResponse())->setURI($uri);
}
$data = $this->callConduitWithDiffusionRequest('diffusion.diffquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath()));
$drequest->updateSymbolicCommit($data['effectiveCommit']);
$raw_changes = ArcanistDiffChange::newFromConduit($data['changes']);
$diff = DifferentialDiff::newEphemeralFromRawChanges($raw_changes);
$changesets = $diff->getChangesets();
$changeset = reset($changesets);
if (!$changeset) {
return new Aphront404Response();
}
$parser = new DifferentialChangesetParser();
$parser->setUser($viewer);
$parser->setChangeset($changeset);
$parser->setRenderingReference($drequest->generateURI(array('action' => 'rendering-ref')));
$parser->readParametersFromRequest($request);
$coverage = $drequest->loadCoverage();
if ($coverage) {
$parser->setCoverage($coverage);
}
$commit = $drequest->loadCommit();
$pquery = new DiffusionPathIDQuery(array($changeset->getFilename()));
$ids = $pquery->loadPathIDs();
$path_id = $ids[$changeset->getFilename()];
$parser->setLeftSideCommentMapping($path_id, false);
$parser->setRightSideCommentMapping($path_id, true);
$parser->setCanMarkDone($commit->getAuthorPHID() && $viewer->getPHID() == $commit->getAuthorPHID());
$parser->setObjectOwnerPHID($commit->getAuthorPHID());
$parser->setWhitespaceMode(DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
$inlines = PhabricatorAuditInlineComment::loadDraftAndPublishedComments($viewer, $commit->getPHID(), $path_id);
if ($inlines) {
foreach ($inlines as $inline) {
$parser->parseInlineComment($inline);
}
$phids = mpull($inlines, 'getAuthorPHID');
$handles = $this->loadViewerHandles($phids);
$parser->setHandles($handles);
}
$engine = new PhabricatorMarkupEngine();
$engine->setViewer($viewer);
foreach ($inlines as $inline) {
$engine->addObject($inline, PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
}
$engine->process();
$parser->setMarkupEngine($engine);
$spec = $request->getStr('range');
list($range_s, $range_e, $mask) = DifferentialChangesetParser::parseRangeSpecification($spec);
$parser->setRange($range_s, $range_e);
$parser->setMask($mask);
return id(new PhabricatorChangesetResponse())->setRenderedChangeset($parser->renderChangeset())->setUndoTemplates($parser->getRenderer()->renderUndoTemplates());
}