mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Remove some ancient daemon log code
Summary: Ref T13253. Long ago, daemon logs were visible in the web UI. They were removed because access to logs generally does not conform to policy rules, and may leak the existence (and sometimes contents) of hidden objects, occasionally leak credentials in certain error messages, etc. These bits and pieces were missed. Test Plan: Grepped for removed symbols. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13253 Differential Revision: https://secure.phabricator.com/D20199
This commit is contained in:
parent
cf048f4402
commit
c10b283b92
4 changed files with 0 additions and 183 deletions
|
@ -2860,8 +2860,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDaemonLog' => 'applications/daemon/storage/PhabricatorDaemonLog.php',
|
'PhabricatorDaemonLog' => 'applications/daemon/storage/PhabricatorDaemonLog.php',
|
||||||
'PhabricatorDaemonLogEvent' => 'applications/daemon/storage/PhabricatorDaemonLogEvent.php',
|
'PhabricatorDaemonLogEvent' => 'applications/daemon/storage/PhabricatorDaemonLogEvent.php',
|
||||||
'PhabricatorDaemonLogEventGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonLogEventGarbageCollector.php',
|
'PhabricatorDaemonLogEventGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonLogEventGarbageCollector.php',
|
||||||
'PhabricatorDaemonLogEventViewController' => 'applications/daemon/controller/PhabricatorDaemonLogEventViewController.php',
|
|
||||||
'PhabricatorDaemonLogEventsView' => 'applications/daemon/view/PhabricatorDaemonLogEventsView.php',
|
|
||||||
'PhabricatorDaemonLogGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonLogGarbageCollector.php',
|
'PhabricatorDaemonLogGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonLogGarbageCollector.php',
|
||||||
'PhabricatorDaemonLogListController' => 'applications/daemon/controller/PhabricatorDaemonLogListController.php',
|
'PhabricatorDaemonLogListController' => 'applications/daemon/controller/PhabricatorDaemonLogListController.php',
|
||||||
'PhabricatorDaemonLogListView' => 'applications/daemon/view/PhabricatorDaemonLogListView.php',
|
'PhabricatorDaemonLogListView' => 'applications/daemon/view/PhabricatorDaemonLogListView.php',
|
||||||
|
@ -8725,8 +8723,6 @@ phutil_register_library_map(array(
|
||||||
),
|
),
|
||||||
'PhabricatorDaemonLogEvent' => 'PhabricatorDaemonDAO',
|
'PhabricatorDaemonLogEvent' => 'PhabricatorDaemonDAO',
|
||||||
'PhabricatorDaemonLogEventGarbageCollector' => 'PhabricatorGarbageCollector',
|
'PhabricatorDaemonLogEventGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||||
'PhabricatorDaemonLogEventViewController' => 'PhabricatorDaemonController',
|
|
||||||
'PhabricatorDaemonLogEventsView' => 'AphrontView',
|
|
||||||
'PhabricatorDaemonLogGarbageCollector' => 'PhabricatorGarbageCollector',
|
'PhabricatorDaemonLogGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||||
'PhabricatorDaemonLogListController' => 'PhabricatorDaemonController',
|
'PhabricatorDaemonLogListController' => 'PhabricatorDaemonController',
|
||||||
'PhabricatorDaemonLogListView' => 'AphrontView',
|
'PhabricatorDaemonLogListView' => 'AphrontView',
|
||||||
|
|
|
@ -45,7 +45,6 @@ final class PhabricatorDaemonsApplication extends PhabricatorApplication {
|
||||||
'' => 'PhabricatorDaemonLogListController',
|
'' => 'PhabricatorDaemonLogListController',
|
||||||
'(?P<id>[1-9]\d*)/' => 'PhabricatorDaemonLogViewController',
|
'(?P<id>[1-9]\d*)/' => 'PhabricatorDaemonLogViewController',
|
||||||
),
|
),
|
||||||
'event/(?P<id>[1-9]\d*)/' => 'PhabricatorDaemonLogEventViewController',
|
|
||||||
'bulk/' => array(
|
'bulk/' => array(
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?' =>
|
'(?:query/(?P<queryKey>[^/]+)/)?' =>
|
||||||
'PhabricatorDaemonBulkJobListController',
|
'PhabricatorDaemonBulkJobListController',
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorDaemonLogEventViewController
|
|
||||||
extends PhabricatorDaemonController {
|
|
||||||
|
|
||||||
public function handleRequest(AphrontRequest $request) {
|
|
||||||
$id = $request->getURIData('id');
|
|
||||||
|
|
||||||
$event = id(new PhabricatorDaemonLogEvent())->load($id);
|
|
||||||
if (!$event) {
|
|
||||||
return new Aphront404Response();
|
|
||||||
}
|
|
||||||
|
|
||||||
$event_view = id(new PhabricatorDaemonLogEventsView())
|
|
||||||
->setEvents(array($event))
|
|
||||||
->setUser($request->getUser())
|
|
||||||
->setCombinedLog(true)
|
|
||||||
->setShowFullMessage(true);
|
|
||||||
|
|
||||||
$log_panel = id(new PHUIObjectBoxView())
|
|
||||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
||||||
->appendChild($event_view);
|
|
||||||
|
|
||||||
$daemon_id = $event->getLogID();
|
|
||||||
|
|
||||||
$crumbs = $this->buildApplicationCrumbs()
|
|
||||||
->addTextCrumb(
|
|
||||||
pht('Daemon %s', $daemon_id),
|
|
||||||
$this->getApplicationURI("log/{$daemon_id}/"))
|
|
||||||
->addTextCrumb(pht('Event %s', $event->getID()))
|
|
||||||
->setBorder(true);
|
|
||||||
|
|
||||||
$header = id(new PHUIHeaderView())
|
|
||||||
->setHeader(pht('Combined Log'))
|
|
||||||
->setHeaderIcon('fa-file-text');
|
|
||||||
|
|
||||||
$view = id(new PHUITwoColumnView())
|
|
||||||
->setHeader($header)
|
|
||||||
->setFooter($log_panel);
|
|
||||||
|
|
||||||
return $this->newPage()
|
|
||||||
->setTitle(pht('Combined Daemon Log'))
|
|
||||||
->appendChild($view);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,131 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorDaemonLogEventsView extends AphrontView {
|
|
||||||
|
|
||||||
private $events;
|
|
||||||
private $combinedLog;
|
|
||||||
private $showFullMessage;
|
|
||||||
|
|
||||||
|
|
||||||
public function setShowFullMessage($show_full_message) {
|
|
||||||
$this->showFullMessage = $show_full_message;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setEvents(array $events) {
|
|
||||||
assert_instances_of($events, 'PhabricatorDaemonLogEvent');
|
|
||||||
$this->events = $events;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCombinedLog($is_combined) {
|
|
||||||
$this->combinedLog = $is_combined;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render() {
|
|
||||||
$viewer = $this->getViewer();
|
|
||||||
$rows = array();
|
|
||||||
|
|
||||||
foreach ($this->events as $event) {
|
|
||||||
|
|
||||||
// Limit display log size. If a daemon gets stuck in an output loop this
|
|
||||||
// page can be like >100MB if we don't truncate stuff. Try to do cheap
|
|
||||||
// line-based truncation first, and fall back to expensive UTF-8 character
|
|
||||||
// truncation if that doesn't get things short enough.
|
|
||||||
|
|
||||||
$message = $event->getMessage();
|
|
||||||
$more = null;
|
|
||||||
|
|
||||||
if (!$this->showFullMessage) {
|
|
||||||
$more_lines = null;
|
|
||||||
$more_chars = null;
|
|
||||||
$line_limit = 12;
|
|
||||||
if (substr_count($message, "\n") > $line_limit) {
|
|
||||||
$message = explode("\n", $message);
|
|
||||||
$more_lines = count($message) - $line_limit;
|
|
||||||
$message = array_slice($message, 0, $line_limit);
|
|
||||||
$message = implode("\n", $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
$char_limit = 8192;
|
|
||||||
if (strlen($message) > $char_limit) {
|
|
||||||
$message = phutil_utf8v($message);
|
|
||||||
$more_chars = count($message) - $char_limit;
|
|
||||||
$message = array_slice($message, 0, $char_limit);
|
|
||||||
$message = implode('', $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($more_chars) {
|
|
||||||
$more = new PhutilNumber($more_chars);
|
|
||||||
$more = pht('Show %d more character(s)...', $more);
|
|
||||||
} else if ($more_lines) {
|
|
||||||
$more = new PhutilNumber($more_lines);
|
|
||||||
$more = pht('Show %d more line(s)...', $more);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($more) {
|
|
||||||
$id = $event->getID();
|
|
||||||
$more = array(
|
|
||||||
"\n...\n",
|
|
||||||
phutil_tag(
|
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => "/daemon/event/{$id}/",
|
|
||||||
),
|
|
||||||
$more),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$row = array(
|
|
||||||
$event->getLogType(),
|
|
||||||
phabricator_date($event->getEpoch(), $viewer),
|
|
||||||
phabricator_time($event->getEpoch(), $viewer),
|
|
||||||
array(
|
|
||||||
$message,
|
|
||||||
$more,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($this->combinedLog) {
|
|
||||||
array_unshift(
|
|
||||||
$row,
|
|
||||||
phutil_tag(
|
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => '/daemon/log/'.$event->getLogID().'/',
|
|
||||||
),
|
|
||||||
pht('Daemon %s', $event->getLogID())));
|
|
||||||
}
|
|
||||||
|
|
||||||
$rows[] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
$classes = array(
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
'right',
|
|
||||||
'wide prewrap',
|
|
||||||
);
|
|
||||||
|
|
||||||
$headers = array(
|
|
||||||
'Type',
|
|
||||||
'Date',
|
|
||||||
'Time',
|
|
||||||
'Message',
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($this->combinedLog) {
|
|
||||||
array_unshift($classes, 'pri');
|
|
||||||
array_unshift($headers, 'Daemon');
|
|
||||||
}
|
|
||||||
|
|
||||||
$log_table = new AphrontTableView($rows);
|
|
||||||
$log_table->setHeaders($headers);
|
|
||||||
$log_table->setColumnClasses($classes);
|
|
||||||
|
|
||||||
return $log_table->render();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue