mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Remove patch preview from Phragment version controller
Summary: Patches can exceed the 30 second time out in most PHP installations. This removes the patch preview from the version controller so that users can still see the information (although they may not be able to download the actual patch). Test Plan: Viewed a version and saw that the patch didn't appear. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7767
This commit is contained in:
parent
86ec4d6021
commit
8aee78b24d
1 changed files with 0 additions and 48 deletions
|
@ -84,60 +84,12 @@ final class PhragmentVersionController extends PhragmentController {
|
||||||
$crumbs,
|
$crumbs,
|
||||||
$this->renderConfigurationWarningIfRequired(),
|
$this->renderConfigurationWarningIfRequired(),
|
||||||
$box,
|
$box,
|
||||||
$this->renderPatchFromPreviousVersion($version, $file),
|
|
||||||
$this->renderPreviousVersionList($version)),
|
$this->renderPreviousVersionList($version)),
|
||||||
array(
|
array(
|
||||||
'title' => pht('View Version'),
|
'title' => pht('View Version'),
|
||||||
'device' => true));
|
'device' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderPatchFromPreviousVersion(
|
|
||||||
PhragmentFragmentVersion $version,
|
|
||||||
PhabricatorFile $file) {
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$previous_file = null;
|
|
||||||
$previous = id(new PhragmentFragmentVersionQuery())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->withFragmentPHIDs(array($version->getFragmentPHID()))
|
|
||||||
->withSequences(array($version->getSequence() - 1))
|
|
||||||
->executeOne();
|
|
||||||
if ($previous !== null) {
|
|
||||||
$previous_file = id(new PhabricatorFileQuery())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->withPHIDs(array($previous->getFilePHID()))
|
|
||||||
->executeOne();
|
|
||||||
}
|
|
||||||
|
|
||||||
$patch = PhragmentPatchUtil::calculatePatch($previous_file, $file);
|
|
||||||
|
|
||||||
if ($patch === null) {
|
|
||||||
return id(new AphrontErrorView())
|
|
||||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
|
||||||
->setTitle(pht("Identical Version"))
|
|
||||||
->appendChild(phutil_tag(
|
|
||||||
'p',
|
|
||||||
array(),
|
|
||||||
pht("This version is identical to the previous version.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($patch) > 20480) {
|
|
||||||
// Patch is longer than 20480 characters. Trim it and let the user know.
|
|
||||||
$patch = substr($patch, 0, 20480)."\n...\n";
|
|
||||||
$patch .= pht(
|
|
||||||
"This patch is longer than 20480 characters. Use the link ".
|
|
||||||
"in the action list to download the full patch.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return id(new PHUIObjectBoxView())
|
|
||||||
->setHeader(id(new PHUIHeaderView())
|
|
||||||
->setHeader(pht('Differences since previous version')))
|
|
||||||
->appendChild(id(new PhabricatorSourceCodeView())
|
|
||||||
->setLines(phutil_split_lines($patch)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private function renderPreviousVersionList(
|
private function renderPreviousVersionList(
|
||||||
PhragmentFragmentVersion $version) {
|
PhragmentFragmentVersion $version) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue