/** * @ControllerManaged */ protected function getLogFileContent() { $lines = $this->tailFile(); $wrappedLines = array(); $maxWidth = $this->configService->getDisplayWidth(); foreach ($lines as $line) { // Get rid of "Could not create directory '/var/www/.ssh'." if (preg_match("/\\.ssh'\\./", $line)) { continue; } while (strlen($line) > $maxWidth) { $wrappedLines[] = substr($line, 0, $maxWidth) . "\n"; $line = substr($line, $maxWidth); } $wrappedLines[] = $line . "\n"; } $data = ''; $linesToDisplay = array_slice($wrappedLines, 0, $this->configService->getNumberOfLinesToDisplay()); $increment = count($linesToDisplay) > 0 ? intval(200 / count($linesToDisplay)) : 0; $colorCode = 0; foreach ($linesToDisplay as $line) { $colorCodeHex = dechex($colorCode); if (strlen($colorCodeHex) == 1) { $colorCodeHex = "0" . $colorCodeHex; } $data .= "<font color=\"#{$colorCodeHex}{$colorCodeHex}{$colorCodeHex}\">" . str_replace("\n", '<br>', htmlentities($line)) . '</font>'; $colorCode += $increment; } return array('html' => $data, 'backupExecutingOrWaitingForRun' => $this->backupService->isExecutingOrWaitingForRun(), 'lastBackupHtml' => $this->renderHtml('lastbackup.inc', array('lastBackupSuccessful' => $this->backupService->isLastBackupSuccessful(), 'lastBackupTime' => $this->backupService->getLastBackupTime()))); }