Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
1.6 kB · 63 lines
PHP
at commit dc7d0b4a
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364<?php
final class DiffusionPathValidateController extends DiffusionController {
protected function getRepositoryIdentifierFromRequest( AphrontRequest $request) { return $request->getStr('repositoryPHID'); }
public function handleRequest(AphrontRequest $request) { $response = $this->loadDiffusionContext(); if ($response) { return $response; }
$viewer = $this->getViewer(); $drequest = $this->getDiffusionRequest(); $repository = $drequest->getRepository();
$path = $request->getStr('path'); $path = ltrim($path, '/');
$browse_results = DiffusionBrowseResultSet::newFromConduit( $this->callConduitWithDiffusionRequest( 'diffusion.browsequery', array( 'path' => $path, 'commit' => $drequest->getCommit(), 'needValidityOnly' => true, ))); $valid = $browse_results->isValidResults();
if (!$valid) { switch ($browse_results->getReasonForEmptyResultSet()) { case DiffusionBrowseResultSet::REASON_IS_FILE: $valid = true; break; case DiffusionBrowseResultSet::REASON_IS_EMPTY: $valid = true; break; } }
$output = array( 'valid' => (bool)$valid, );
if (!$valid) { $branch = $drequest->getBranch(); if ($branch) { $message = pht('Not found in %s', $branch); } else { $message = pht('Not found at %s', 'HEAD'); } } else { $message = pht('OK'); }
$output['message'] = $message;
return id(new AphrontAjaxResponse())->setContent($output); }}