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.3 kB · 48 lines
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849<?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_EMPTY: case DiffusionBrowseResultSet::REASON_IS_FILE: $valid = true; break; } }
$output = array( 'valid' => (bool)$valid, );
return id(new AphrontAjaxResponse())->setContent($output); }}