/home/suroeste/public_html/wp-content/plugins/akeebabackupwp/app/Solo/Helper
Edit: /home/suroeste/public_html/wp-content/plugins/akeebabackupwp/app/Solo/Helper/Status.php (6702B)
setContainer($container);
$this->status = Factory::getConfigurationChecks()->getShortStatus();
$this->warnings = Factory::getConfigurationChecks()->getDetailedStatus();
$status = Factory::getConfigurationChecks()->getFolderStatus();
$this->outputWritable = $status['output'];
}
/**
* Get a Singleton instance
*
* @return self
*/
public static function &getInstance(Container $container)
{
static $instance = null;
if (empty($instance))
{
$instance = new self($container);
}
return $instance;
}
/**
* Returns the HTML for the backup status cell
*
* @return string HTML
*/
public function getStatusCell()
{
$status = Factory::getConfigurationChecks()->getShortStatus();
$quirks = Factory::getConfigurationChecks()->getDetailedStatus();
if ($status && empty($quirks))
{
$html = '
' . Text::_('COM_AKEEBA_CPANEL_LBL_STATUS_OK')
. '
';
}
elseif ($status && !empty($quirks))
{
$html = '
' . Text::_('COM_AKEEBA_CPANEL_LBL_STATUS_WARNING')
. '
';
}
else
{
$html = '
' . Text::_('COM_AKEEBA_CPANEL_LBL_STATUS_ERROR')
. '
';
}
return $html;
}
/**
* Returns HTML for the warnings (status details)
*
* @param bool $onlyErrors Should I only return errors? If false (default) errors AND warnings are returned.
*
* @return string HTML
*/
public function getQuirksCell($onlyErrors = false)
{
$html = '
' . Text::_('COM_AKEEBA_CPANEL_WARNING_QNONE') . '
';
$quirks = Factory::getConfigurationChecks()->getDetailedStatus();
if (!empty($quirks))
{
$html = "
\n";
foreach ($quirks as $quirk)
{
$html .= $this->renderWarnings($quirk, $onlyErrors);
}
$html .= "
\n";
}
return $html;
}
/**
* Returns a boolean value, indicating if warnings have been detected.
*
* @return bool True if there is at least one detected warnings
*/
public function hasQuirks()
{
$quirks = Factory::getConfigurationChecks()->getDetailedStatus();
return !empty($quirks);
}
/**
* Returns the details of the latest backup as HTML
*
* @return string HTML
* @throws \Awf\Exception\App
*/
public function getLatestBackupDetails()
{
/** @var Container $container */
$container = Platform::getInstance()->getContainer();
$db = $container->db;
$query = $db->getQuery(true)
->select('MAX(' . $db->qn('id') . ')')
->from($db->qn('#__ak_stats'));
$db->setQuery($query);
$id = $db->loadResult();
$backup_types = Factory::getEngineParamsProvider()->loadScripting();
if (empty($id))
{
return '
' . Text::_('COM_AKEEBA_BACKUP_STATUS_NONE') . '
';
}
$record = Platform::getInstance()->get_statistics($id);
switch ($record['status'])
{
case 'run':
$status = Text::_('COM_AKEEBA_BUADMIN_LABEL_STATUS_PENDING');
$statusClass = "akeeba-label--warning";
break;
case 'fail':
$status = Text::_('COM_AKEEBA_BUADMIN_LABEL_STATUS_FAIL');
$statusClass = "akeeba-label--failure";
break;
case 'complete':
$status = Text::_('COM_AKEEBA_BUADMIN_LABEL_STATUS_OK');
$statusClass = "akeeba-label--success";
break;
default:
$status = '';
$statusClass = '';
}
switch ($record['origin'])
{
case 'frontend':
$origin = Text::_('COM_AKEEBA_BUADMIN_LABEL_ORIGIN_FRONTEND');
break;
case 'backend':
$origin = Text::_('COM_AKEEBA_BUADMIN_LABEL_ORIGIN_BACKEND');
break;
case 'cli':
$origin = Text::_('COM_AKEEBA_BUADMIN_LABEL_ORIGIN_CLI');
break;
default:
$origin = '–';
break;
}
$type = '';
if (array_key_exists($record['type'], $backup_types['scripts']))
{
$type = Platform::getInstance()->translate($backup_types['scripts'][$record['type']]['text']);
}
$startTime = $this->getContainer()->dateFactory($record['backupstart'], 'UTC');
$tz = new \DateTimeZone($container->appConfig->get('timezone', 'UTC'));
$startTime->setTimezone($tz);
$html = '
';
$html .= '| ' . Text::_('COM_AKEEBA_BUADMIN_LABEL_START') . ' | ' . $startTime->format(
Text::_('DATE_FORMAT_LC2'), true
) . ' |
';
$html .= '| ' . Text::_('COM_AKEEBA_BUADMIN_LABEL_DESCRIPTION') . ' | ' . $record['description']
. ' |
';
$html .= '| ' . Text::_('COM_AKEEBA_BUADMIN_LABEL_STATUS') . ' | ' . $status . ' |
';
$html .= '| ' . Text::_('COM_AKEEBA_BUADMIN_LABEL_ORIGIN') . ' | ' . $origin . ' |
';
$html .= '| ' . Text::_('COM_AKEEBA_BUADMIN_LABEL_TYPE') . ' | ' . $type . ' |
';
$html .= '
';
return $html;
}
/**
* Gets the HTML for a single line of the warnings area.
*
* @param array $quirk A quirk definition array
* @param bool $onlyErrors Should I only return errors? If false (default) errors AND warnings are returned.
*
* @return string HTML
*/
private function renderWarnings($quirk, $onlyErrors = false)
{
if ($onlyErrors && ($quirk['severity'] != 'critical'))
{
return '';
}
$quirk['severity'] = $quirk['severity'] == 'critical' ? 'high' : $quirk['severity'];
return '
' . $quirk['description'] . '' . "\n";
}
}