first commit

This commit is contained in:
2026-02-08 21:16:11 +01:00
commit e17b7026fd
8881 changed files with 1160453 additions and 0 deletions

View File

@@ -0,0 +1,93 @@
<?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
defined('_JEXEC') || die();
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri as JUri;
/** @var \Akeeba\Component\AkeebaBackup\Administrator\View\Log\HtmlView $this */
HTMLHelper::_('formbehavior.chosen');
?>
<?php if(isset($this->logs) && count($this->logs)): ?>
<form name="adminForm" id="adminForm" action="index.php" method="post"
class="d-flex flex-column gap-2 p-2 my-2 border bg-light">
<div class="row row-cols-lg-auto gap-1 align-items-center">
<?php if(empty($this->tag)): ?>
<div class="col">
<label for="tag"><?= Text::_('COM_AKEEBABACKUP_LOG_CHOOSE_FILE_TITLE')?></label>
</div>
<?php endif ?>
<div class="col flex-grow-1">
<?php if(!empty($this->tag)): ?>
<label for="tag" class="visually-hidden"><?= Text::_('COM_AKEEBABACKUP_LOG_CHOOSE_FILE_TITLE')?></label>
<?php endif ?>
<?= HTMLHelper::_('select.genericlist', $this->logs, 'tag', [
'list.select' => $this->tag,
'list.attr' => [
'class' => 'advancedSelect form-select w-100',
'onchange' => 'document.forms.adminForm.submit();',
], 'id' => 'comAkeebaLogTagSelector',
]) ?>
</div>
<?php if(!empty($this->tag)): ?>
<div class="col flex-shrink-1">
<a class="btn btn-primary" href="<?= $this->escape(JUri::base()) ?>index.php?option=com_akeebabackup&view=Log&task=download&tag=<?= $this->escape($this->tag) ?>">
<span class="fa fa-download"></span>
<?= Text::_('COM_AKEEBABACKUP_LOG_LABEL_DOWNLOAD') ?>
</a>
</div>
<?php if ($this->hasAlice): ?>
<div class="col flex-shrink-1">
<a class="btn btn-outline-success" href="<?= $this->escape(JUri::base()) ?>index.php?option=com_akeebabackup&view=Alice&log=<?= $this->escape($this->tag) ?>&task=start&<?= \Joomla\CMS\Factory::getApplication()->getFormToken() ?>=1">
<span class="fa fa-diagnoses"></span>
<?= Text::_('COM_AKEEBABACKUP_ALICE_ANALYZE') ?>
</a>
</div>
<?php endif ?>
<?php endif ?>
</div>
<input name="option" value="com_akeebabackup" type="hidden" />
<input name="view" value="Log" type="hidden" />
<?= HTMLHelper::_('form.token') ?>
</form>
<?php endif ?>
<?php if(!empty($this->tag)): ?>
<?php if ($this->logTooBig): ?>
<div class="alert alert-warning">
<p>
<?= Text::sprintf('COM_AKEEBABACKUP_LOG_SIZE_WARNING', number_format($this->logSize / (1024 * 1024), 2)) ?>
</p>
<a class="btn btn-dark" id="showlog" href="#">
<?= Text::_('COM_AKEEBABACKUP_LOG_SHOW_LOG') ?>
</a>
</div>
<?php endif ?>
<div id="iframe-holder" class="border p-0"
style="display: <?= $this->logTooBig ? 'none' : 'block' ?>;">
<?php if(!$this->logTooBig): ?>
<iframe
src="index.php?option=com_akeebabackup&view=Log&task=iframe&format=raw&tag=<?= urlencode($this->tag) ?>"
width="99%" height="400px">
</iframe>
<?php endif ?>
</div>
<?php endif ?>
<?php if( ! (isset($this->logs) && count($this->logs))): ?>
<div class="alert alert-danger">
<?= Text::_('COM_AKEEBABACKUP_LOG_NONE_FOUND') ?>
</div>
<?php endif ?>

View File

@@ -0,0 +1,81 @@
<?php
/**
* @package akeebabackup
* @copyright Copyright (c)2006-2022 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
defined('_JEXEC') || die();
use Akeeba\Engine\Factory;
use Joomla\CMS\Language\Text;
/** @var \Akeeba\Component\AkeebaBackup\Administrator\View\Log\RawView $this */
// -- Get the log's file name
$tag = $this->tag;
$logFile = Factory::getLog()->getLogFilename($tag);
if (!@is_file($logFile) && @file_exists(substr($logFile, 0, -4)))
{
/**
* Transitional period: the log file akeeba.tag.log.php may not exist but the akeeba.tag.log does. This
* addresses this transition.
*/
$logFile = substr($logFile, 0, -4);
}
@ob_end_clean();
if (!@file_exists($logFile))
{
// Oops! The log doesn't exist!
echo '<p>' . Text::_('COM_AKEEBABACKUP_LOG_ERROR_LOGFILENOTEXISTS') . '</p>';
return;
}
else
{
// Allright, let's load and render it
$fp = fopen($logFile, "r");
if ($fp === FALSE)
{
// Oops! The log isn't readable?!
echo '<p>' . Text::_('COM_AKEEBABACKUP_LOG_ERROR_UNREADABLE') . '</p>';
return;
}
while (!feof($fp))
{
$line = fgets($fp);
if (!$line) return;
$exploded = explode("|", $line, 3);
unset($line);
if (count($exploded) < 3) continue;
switch (trim($exploded[0]))
{
case "ERROR":
$fmtString = "<span style=\"color: red; font-weight: bold;\">[";
break;
case "WARNING":
$fmtString = "<span style=\"color: #D8AD00; font-weight: bold;\">[";
break;
case "INFO":
$fmtString = "<span style=\"color: black;\">[";
break;
case "DEBUG":
$fmtString = "<span style=\"color: #666666; font-size: small;\">[";
break;
default:
$fmtString = "<span style=\"font-size: small;\">[";
break;
}
$fmtString .= $exploded[1] . "] " . htmlspecialchars($exploded[2]) . "</span><br/>\n";
unset($exploded);
echo $fmtString;
unset($fmtString);
}
}
@ob_start();