1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 18:32:41 +01:00
phorge-phorge/src/applications/diffusion/controller/DiffusionHistoryController.php
vrana ef85f49adc Delete license headers from files
Summary:
This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory).

We are removing the headers for these reasons:

- It wastes space in editors, less code is visible in editor upon opening a file.
- It brings noise to diff of the first change of any file every year.
- It confuses Git file copy detection when creating small files.
- We don't have an explicit license header in other files (JS, CSS, images, documentation).
- Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new.

This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook).

Test Plan: Verified that the license survived only in LICENSE file and that it didn't modify externals.

Reviewers: epriestley, davidrecordon

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2035

Differential Revision: https://secure.phabricator.com/D3886
2012-11-05 11:16:51 -08:00

100 lines
2.7 KiB
PHP

<?php
final class DiffusionHistoryController extends DiffusionController {
public function processRequest() {
$drequest = $this->diffusionRequest;
$request = $this->getRequest();
$page_size = $request->getInt('pagesize', 100);
$offset = $request->getInt('page', 0);
$history_query = DiffusionHistoryQuery::newFromDiffusionRequest(
$drequest);
$history_query->setOffset($offset);
$history_query->setLimit($page_size + 1);
if (!$request->getBool('copies')) {
$history_query->needDirectChanges(true);
$history_query->needChildChanges(true);
}
$show_graph = !strlen($drequest->getPath());
if ($show_graph) {
$history_query->needParents(true);
}
$history = $history_query->loadHistory();
$pager = new AphrontPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
if (count($history) == $page_size + 1) {
array_pop($history);
$pager->setHasMorePages(true);
} else {
$pager->setHasMorePages(false);
}
$pager->setURI($request->getRequestURI(), 'page');
$content = array();
$content[] = $this->buildCrumbs(
array(
'branch' => true,
'path' => true,
'view' => 'history',
));
if ($request->getBool('copies')) {
$button_title = 'Hide Copies/Branches';
$copies_new = null;
} else {
$button_title = 'Show Copies/Branches';
$copies_new = true;
}
$button = phutil_render_tag(
'a',
array(
'class' => 'button small grey',
'href' => $request->getRequestURI()->alter('copies', $copies_new),
),
phutil_escape_html($button_title));
$history_table = new DiffusionHistoryTableView();
$history_table->setDiffusionRequest($drequest);
$history_table->setHistory($history);
$history_table->loadRevisions();
$phids = $history_table->getRequiredHandlePHIDs();
$handles = $this->loadViewerHandles($phids);
$history_table->setHandles($handles);
if ($show_graph) {
$history_table->setParents($history_query->getParents());
$history_table->setIsHead($offset == 0);
}
$history_panel = new AphrontPanelView();
$history_panel->setHeader('History');
$history_panel->addButton($button);
$history_panel->appendChild($history_table);
$history_panel->appendChild($pager);
$content[] = $history_panel;
// TODO: Sometimes we do have a change view, we need to look at the most
// recent history entry to figure it out.
$nav = $this->buildSideNav('history', false);
$nav->appendChild($content);
return $this->buildStandardPageResponse(
$nav,
array(
'title' => 'history',
));
}
}