本文整理汇总了PHP中Akeeba\Engine\Factory::getKettenrad方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getKettenrad方法的具体用法?PHP Factory::getKettenrad怎么用?PHP Factory::getKettenrad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akeeba\Engine\Factory
的用法示例。
在下文中一共展示了Factory::getKettenrad方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function __construct()
{
$this->object = 'file';
$this->subtype = 'all';
$this->method = 'api';
if (Factory::getKettenrad()->getTag() == 'restorepoint') {
$this->enabled = false;
}
}
示例2: onStep
public function onStep($tpl = null)
{
$this->setLayout('step');
$kettenrad = Factory::getKettenrad();
$array = $kettenrad->getStatusArray();
$model = $this->getModel();
$key = $model->getState('key', '');
$this->array = $array;
$this->key = $key;
return true;
}
示例3:
function __construct()
{
$this->object = 'dbobject';
$this->subtype = 'all';
$this->method = 'api';
$this->filter_name = 'SRPData';
if (Factory::getKettenrad()->getTag() != 'restorepoint') {
$this->enabled = false;
} else {
$this->init();
}
}
示例4: strtolower
function __construct()
{
$this->object = 'dir';
$this->subtype = 'content';
$this->method = 'direct';
if (empty($this->filter_name)) {
$this->filter_name = strtolower(basename(__FILE__, '.php'));
}
if (Factory::getKettenrad()->getTag() == 'restorepoint') {
$this->enabled = false;
}
parent::__construct();
}
示例5: array
function __construct()
{
$this->object = 'dir';
$this->subtype = 'content';
$this->method = 'api';
$this->filter_name = 'SRPSkipFiles';
if (Factory::getKettenrad()->getTag() != 'restorepoint') {
$this->enabled = false;
} else {
$this->filter_data = array();
$this->init();
}
}
示例6:
function __construct()
{
if (!defined('_JEXEC')) {
$this->enabled = false;
return;
}
$this->object = 'dir';
$this->subtype = 'all';
$this->method = 'api';
$this->filter_name = 'SRPDirectories';
if (Factory::getKettenrad()->getTag() != 'restorepoint') {
$this->enabled = false;
} else {
$this->init();
}
}
示例7: __construct
public function __construct()
{
$this->object = 'dir';
$this->subtype = 'inclusion';
$this->method = 'direct';
$this->filter_name = 'Libraries';
if (Factory::getKettenrad()->getTag() == 'restorepoint') {
$this->enabled = false;
}
// FIXME This filter doesn't work very well on many live hosts. Disabled for now.
parent::__construct();
return;
if (empty($this->filter_name)) {
$this->filter_name = strtolower(basename(__FILE__, '.php'));
}
// Get the saved library path and compare it to the default
$jlibdir = Platform::getInstance()->get_platform_configuration_option('jlibrariesdir', '');
if (empty($jlibdir)) {
if (defined('JPATH_LIBRARIES')) {
$jlibdir = JPATH_LIBRARIES;
} elseif (defined('JPATH_PLATFORM')) {
$jlibdir = JPATH_PLATFORM;
} else {
$jlibdir = false;
}
}
if ($jlibdir !== false) {
$jlibdir = Factory::getFilesystemTools()->TranslateWinPath($jlibdir);
$defaultLibraries = Factory::getFilesystemTools()->TranslateWinPath(JPATH_SITE . '/libraries');
if ($defaultLibraries != $jlibdir) {
// The path differs, add it here
$this->filter_data['JPATH_LIBRARIES'] = $jlibdir;
}
} else {
$this->filter_data = array();
}
parent::__construct();
}
示例8: _run
//.........这里部分代码省略.........
if (isset($_SERVER['HTTP_USER_AGENT'])) {
Factory::getLog()->log(LogLevel::INFO, "User agent :" . phpversion() <= "4.2.1" ? getenv("HTTP_USER_AGENT") : $_SERVER['HTTP_USER_AGENT']);
}
Factory::getLog()->log(LogLevel::INFO, "Safe mode :" . ini_get("safe_mode"));
Factory::getLog()->log(LogLevel::INFO, "Display errors :" . ini_get("display_errors"));
Factory::getLog()->log(LogLevel::INFO, "Error reporting :" . self::error2string());
Factory::getLog()->log(LogLevel::INFO, "Error display :" . self::errordisplay());
Factory::getLog()->log(LogLevel::INFO, "Disabled functions :" . ini_get("disable_functions"));
Factory::getLog()->log(LogLevel::INFO, "open_basedir restr.:" . ini_get('open_basedir'));
Factory::getLog()->log(LogLevel::INFO, "Max. exec. time :" . ini_get("max_execution_time"));
Factory::getLog()->log(LogLevel::INFO, "Memory limit :" . ini_get("memory_limit"));
if (function_exists("memory_get_usage")) {
Factory::getLog()->log(LogLevel::INFO, "Current mem. usage :" . memory_get_usage());
}
if (function_exists("gzcompress")) {
Factory::getLog()->log(LogLevel::INFO, "GZIP Compression : available (good)");
} else {
Factory::getLog()->log(LogLevel::INFO, "GZIP Compression : n/a (no compression)");
}
$extraNotes = Platform::getInstance()->log_platform_special_directories();
if (!empty($extraNotes) && is_array($extraNotes)) {
if (isset($extraNotes['warnings']) && is_array($extraNotes['warnings'])) {
foreach ($extraNotes['warnings'] as $warning) {
$this->setWarning($warning);
}
}
if (isset($extraNotes['errors']) && is_array($extraNotes['errors'])) {
foreach ($extraNotes['errors'] as $error) {
$this->setError($error);
}
}
}
Factory::getLog()->log(LogLevel::INFO, "Output directory :" . $registry->get('akeeba.basic.output_directory'));
Factory::getLog()->log(LogLevel::INFO, "Part size (bytes) :" . $registry->get('engine.archiver.common.part_size', 0));
Factory::getLog()->log(LogLevel::INFO, "--------------------------------------------------------------------------------");
}
// Quirks reporting
$quirks = Factory::getConfigurationChecks()->getDetailedStatus(true);
if (!empty($quirks)) {
Factory::getLog()->log(LogLevel::INFO, "Akeeba Backup has detected the following potential problems:");
foreach ($quirks as $q) {
Factory::getLog()->log(LogLevel::INFO, '- ' . $q['code'] . ' ' . $q['description'] . ' (' . $q['severity'] . ')');
}
Factory::getLog()->log(LogLevel::INFO, "You probably do not have to worry about them, but you should be aware of them.");
Factory::getLog()->log(LogLevel::INFO, "--------------------------------------------------------------------------------");
}
if (!version_compare(PHP_VERSION, '5.4.0', 'ge')) {
Factory::getLog()->log(LogLevel::WARNING, "You are using an outdated version of PHP. Akeeba Engine may not work properly. Please upgrade to PHP 5.4.0 or later.");
}
// Report profile ID
$profile_id = Platform::getInstance()->get_active_profile();
Factory::getLog()->log(LogLevel::INFO, "Loaded profile #{$profile_id}");
// Get archive name
list($relativeArchiveName, $absoluteArchiveName) = $this->getArchiveName();
// ==== Stats initialisation ===
$origin = Platform::getInstance()->get_backup_origin();
// Get backup origin
$profile_id = Platform::getInstance()->get_active_profile();
// Get active profile
$registry = Factory::getConfiguration();
$backupType = $registry->get('akeeba.basic.backup_type');
Factory::getLog()->log(LogLevel::DEBUG, "Backup type is now set to '" . $backupType . "'");
// Substitute "variables" in the archive name
$fsUtils = Factory::getFilesystemTools();
$description = $fsUtils->replace_archive_name_variables($this->description);
$comment = $fsUtils->replace_archive_name_variables($this->comment);
if ($registry->get('volatile.writer.store_on_server', true)) {
// Archive files are stored on our server
$stat_relativeArchiveName = $relativeArchiveName;
$stat_absoluteArchiveName = $absoluteArchiveName;
} else {
// Archive files are not stored on our server (FTP backup, cloud backup, sent by email, etc)
$stat_relativeArchiveName = '';
$stat_absoluteArchiveName = '';
}
$kettenrad = Factory::getKettenrad();
$temp = array('description' => $description, 'comment' => $comment, 'backupstart' => Platform::getInstance()->get_timestamp_database(), 'status' => 'run', 'origin' => $origin, 'type' => $backupType, 'profile_id' => $profile_id, 'archivename' => $stat_relativeArchiveName, 'absolute_path' => $stat_absoluteArchiveName, 'multipart' => 0, 'filesexist' => 1, 'tag' => $kettenrad->getTag(), 'backupid' => $kettenrad->getBackupId());
// Save the entry
$statistics = Factory::getStatistics();
$statistics->setStatistics($temp);
if ($statistics->getError()) {
$this->setError($statistics->getError());
return;
}
$statistics->release_multipart_lock();
// Initialize the archive.
if (Factory::getEngineParamsProvider()->getScriptingParameter('core.createarchive', true)) {
Factory::getLog()->log(LogLevel::DEBUG, "Expanded archive file name: " . $absoluteArchiveName);
Factory::getLog()->log(LogLevel::DEBUG, "Initializing archiver engine");
$archiver = Factory::getArchiverEngine();
$archiver->initialize($absoluteArchiveName);
$archiver->setComment($comment);
// Add the comment to the archive itself.
$archiver->propagateToObject($this);
if ($this->getError()) {
return;
}
}
$this->setState('postrun');
}
示例9: _apiStepBackup
private function _apiStepBackup($config)
{
$defConfig = array('profile' => null, 'tag' => AKEEBA_BACKUP_ORIGIN, 'backupid' => null);
$config = array_merge($defConfig, $config);
$profile = $config['profile'];
$tag = $config['tag'];
$backupid = $config['backupid'];
// Try to set the profile from the setup parameters
if (!empty($profile)) {
$registry = Factory::getConfiguration();
$session = JFactory::getSession();
$session->set('profile', $profile, 'akeeba');
}
Factory::loadState($tag, $backupid);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupid);
$registry = Factory::getConfiguration();
$session = JFactory::getSession();
$session->set('profile', $registry->activeProfile, 'akeeba');
$array = $kettenrad->tick();
$ret_array = $kettenrad->getStatusArray();
$array['Progress'] = $ret_array['Progress'];
try {
Factory::saveState(AKEEBA_BACKUP_ORIGIN, $backupid);
} catch (\RuntimeException $e) {
$array['Error'] = $e->getMessage();
}
if ($array['Error'] != '') {
// A backup error had occurred. Why are we here?!
$this->status = self::STATUS_ERROR;
$this->encapsulation = self::ENCAPSULATION_RAW;
return 'A backup error had occurred: ' . $array['Error'];
} elseif ($array['HasRun'] == false) {
Factory::nuke();
Factory::getFactoryStorage()->reset();
} else {
$statistics = Factory::getStatistics();
$array['BackupID'] = $statistics->getId();
}
return $array;
}
示例10: runBackup
/**
* Starts or step a backup process
*
* @return array An Akeeba Engine return array
*/
public function runBackup()
{
$ret_array = array();
$ajaxTask = $this->getState('ajax');
$tag = $this->getState('tag');
$backupId = $this->getState('backupid');
switch ($ajaxTask) {
// Start a new backup
case 'start':
// Description is passed through a strict filter which removes HTML
$description = $this->getState('description');
// The comment is passed through the Safe HTML filter (note: use 2 to force no filtering)
$comment = $this->getState('comment');
$jpskey = $this->getState('jpskey');
$angiekey = $this->getState('angiekey');
if (is_null($backupId)) {
$db = $this->getDbo();
$query = $db->getQuery(true)->select('MAX(' . $db->qn('id') . ')')->from($db->qn('#__ak_stats'));
try {
$maxId = $db->setQuery($query)->loadResult();
} catch (Exception $e) {
$maxId = 0;
}
$backupId = 'id' . ($maxId + 1);
}
// Try resetting the engine
Factory::resetState(array('maxrun' => 0));
// Remove any stale memory files left over from the previous step
if (empty($tag)) {
$tag = Platform::getInstance()->get_backup_origin();
}
$tempVarsTag = $tag;
$tempVarsTag .= empty($backupId) ? '' : '.' . $backupId;
Factory::getFactoryStorage()->reset($tempVarsTag);
Factory::loadState($tag, $backupId);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
$options = array('description' => $description, 'comment' => $comment, 'jpskey' => $jpskey, 'angiekey' => $angiekey);
$kettenrad->setup($options);
$kettenrad->tick();
$ret_array = $kettenrad->getStatusArray();
$kettenrad->resetWarnings();
// So as not to have duplicate warnings reports
try {
Factory::saveState($tag, $backupId);
} catch (\RuntimeException $e) {
$ret_array['Error'] = $e->getMessage();
}
break;
// Step through a backup
// Step through a backup
case 'step':
Factory::loadState($tag, $backupId);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
$kettenrad->tick();
$ret_array = $kettenrad->getStatusArray();
$kettenrad->resetWarnings();
// So as not to have duplicate warnings reports
try {
Factory::saveState($tag, $backupId);
} catch (\RuntimeException $e) {
$ret_array['Error'] = $e->getMessage();
}
if ($ret_array['HasRun'] == 1) {
// Clean up
Factory::nuke();
$tempVarsTag = $tag;
$tempVarsTag .= empty($backupId) ? '' : '.' . $backupId;
Factory::getFactoryStorage()->reset($tempVarsTag);
}
break;
// Send a push notification for backup failure
// Send a push notification for backup failure
case 'pushFail':
Factory::loadState($tag, $backupId);
$errorMessage = $this->getState('errorMessage');
$platform = Platform::getInstance();
$pushSubject = sprintf($platform->translate('COM_AKEEBA_PUSH_ENDBACKUP_FAIL_SUBJECT'), $platform->get_site_name(), $platform->get_host());
$key = empty($errorMessage) ? 'COM_AKEEBA_PUSH_ENDBACKUP_FAIL_BODY' : 'COM_AKEEBA_PUSH_ENDBACKUP_FAIL_BODY_WITH_MESSAGE';
$pushDetails = sprintf($platform->translate($key), $platform->get_site_name(), $platform->get_host(), $errorMessage);
Factory::getPush()->message($pushSubject, $pushDetails);
break;
default:
break;
}
return $ret_array;
}
示例11: step
public function step()
{
// Check permissions
$this->_checkPermissions();
// Set the profile
$this->_setProfile();
// Get the backup ID
$backupId = $this->input->get('backupid', null, 'raw', 2);
if (empty($backupId)) {
$backupId = null;
}
Factory::loadState(AKEEBA_BACKUP_ORIGIN, $backupId);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
$kettenrad->tick();
$array = $kettenrad->getStatusArray();
$kettenrad->resetWarnings();
// So as not to have duplicate warnings reports
try {
Factory::saveState(AKEEBA_BACKUP_ORIGIN, $backupId);
} catch (\RuntimeException $e) {
$array['Error'] = $e->getMessage();
}
if ($array['Error'] != '') {
@ob_end_clean();
echo '500 ERROR -- ' . $array['Error'];
flush();
JFactory::getApplication()->close();
} elseif ($array['HasRun'] == 1) {
// All done
Factory::nuke();
Factory::getFactoryStorage()->reset();
@ob_end_clean();
header('Content-type: text/plain');
header('Connection: close');
echo '200 OK';
flush();
JFactory::getApplication()->close();
} else {
$noredirect = $this->input->get('noredirect', 0, 'int');
if ($noredirect != 0) {
@ob_end_clean();
header('Content-type: text/plain');
header('Connection: close');
echo "301 More work required";
flush();
JFactory::getApplication()->close();
} else {
$curUri = JUri::getInstance();
$ssl = $curUri->isSSL() ? 1 : 0;
$tempURL = JRoute::_('index.php?option=com_akeeba', false, $ssl);
$uri = new JUri($tempURL);
$uri->setVar('view', 'backup');
$uri->setVar('task', 'step');
$uri->setVar('key', $this->input->get('key', '', 'none', 2));
$uri->setVar('profile', $this->input->get('profile', 1, 'int'));
if (!empty($backupId)) {
$uri->setVar('backupid', $backupId);
}
// Maybe we have a multilingual site?
$lg = F0FPlatform::getInstance()->getLanguage();
$languageTag = $lg->getTag();
$uri->setVar('lang', $languageTag);
$redirectionUrl = $uri->toString();
$this->_customRedirect($redirectionUrl);
}
}
}
示例12: runBackup
/**
* Starts or step a backup process
*
* @return array An Akeeba Engine return array
*/
public function runBackup()
{
$ret_array = array();
$ajaxTask = $this->getState('ajax');
$tag = $this->getState('tag');
$backupId = $this->getState('backupid');
switch ($ajaxTask) {
case 'start':
// Description is passed through a strict filter which removes HTML
$description = $this->getState('description');
// The comment is passed through the Safe HTML filter (note: use 2 to force no filtering)
$comment = $this->getState('comment');
$jpskey = $this->getState('jpskey');
$angiekey = $this->getState('angiekey');
if (is_null($backupId)) {
$db = $this->getDbo();
$query = $db->getQuery(true)->select('MAX(' . $db->qn('id') . ')')->from($db->qn('#__ak_stats'));
try {
$maxId = $db->setQuery($query)->loadResult();
} catch (Exception $e) {
$maxId = 0;
}
$backupId = 'id' . ($maxId + 1);
}
// Try resetting the engine
Factory::resetState(array('maxrun' => 0));
// Remove any stale memory files left over from the previous step
if (empty($tag)) {
$tag = Platform::getInstance()->get_backup_origin();
}
$tempVarsTag = $tag;
$tempVarsTag .= empty($backupId) ? '' : '.' . $backupId;
Factory::getFactoryStorage()->reset($tempVarsTag);
Factory::loadState($tag, $backupId);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
// Take care of System Restore Point setup
if ($tag == 'restorepoint') {
// Fetch the extension's version information
require_once JPATH_COMPONENT_ADMINISTRATOR . '/assets/xmlslurp/xmlslurp.php';
$slurp = new LiveUpdateXMLSlurp();
$exttype = $this->getState('type');
switch ($exttype) {
case 'component':
$extname = 'com_';
break;
case 'file':
$extname = 'file';
break;
case 'library':
$extname = 'lib_';
break;
case 'module':
$extname = 'mod_';
break;
case 'package':
$extname = 'pkg_';
break;
case 'plugin':
$extname = 'plg_';
break;
case 'template':
$extname = 'tpl_';
break;
default:
$extname = '';
break;
}
$extname .= $this->getState('name');
$info = $slurp->getInfo($extname, '');
// Get the configOverrides for this extension
$configOverrides = $this->getConfigOverridesForSRP($extname, $info);
// Create an SRP descriptor
$srpdescriptor = array('type' => $this->getState('type'), 'name' => $this->getState('name'), 'group' => $this->getState('group'), 'version' => $info['version'], 'date' => $info['date']);
// Set the description and comment
$description = "System Restore Point - " . JText::_($exttype) . ": {$extname}";
$comment = "---BEGIN SRP---\n" . json_encode($srpdescriptor) . "\n---END SRP---";
$jpskey = '';
$angiekey = '';
// Set a custom finalization action queue
$configOverrides['volatile.core.finalization.action_handlers'] = array(new Akeeba\Engine\Finalization\Srpquotas());
$configOverrides['volatile.core.finalization.action_queue'] = array('remove_temp_files', 'update_statistics', 'update_filesizes', 'apply_srp_quotas');
// Apply the configuration overrides, please
$platform = Platform::getInstance();
$platform->configOverrides = $configOverrides;
}
$options = array('description' => $description, 'comment' => $comment, 'jpskey' => $jpskey, 'angiekey' => $angiekey);
$kettenrad->setup($options);
$kettenrad->tick();
if ($kettenrad->getState() != 'running' && $tag == 'restorepoint') {
Factory::saveState($tag, $backupId);
Factory::loadState($tag, $backupId);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
$kettenrad->tick();
//.........这里部分代码省略.........
示例13: runBackup
/**
* Starts or step a backup process
*
* @return array An Akeeba Engine return array
*/
public function runBackup()
{
$ret_array = array();
$ajaxTask = $this->getState('ajax');
$tag = $this->getState('tag');
$backupId = $this->getState('backupid');
switch ($ajaxTask) {
case 'start':
// Description is passed through a strict filter which removes HTML
$description = $this->getState('description');
// The comment is passed through the Safe HTML filter (note: use 2 to force no filtering)
$comment = $this->getState('comment');
$jpskey = $this->getState('jpskey');
$angiekey = $this->getState('angiekey');
if (is_null($backupId)) {
$db = $this->getDbo();
$query = $db->getQuery(true)->select('MAX(' . $db->qn('id') . ')')->from($db->qn('#__ak_stats'));
try {
$maxId = $db->setQuery($query)->loadResult();
} catch (Exception $e) {
$maxId = 0;
}
$backupId = 'id' . ($maxId + 1);
}
// Try resetting the engine
Factory::resetState(array('maxrun' => 0));
// Remove any stale memory files left over from the previous step
if (empty($tag)) {
$tag = Platform::getInstance()->get_backup_origin();
}
$tempVarsTag = $tag;
$tempVarsTag .= empty($backupId) ? '' : '.' . $backupId;
Factory::getFactoryStorage()->reset($tempVarsTag);
Factory::loadState($tag, $backupId);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
$options = array('description' => $description, 'comment' => $comment, 'jpskey' => $jpskey, 'angiekey' => $angiekey);
$kettenrad->setup($options);
$kettenrad->tick();
$ret_array = $kettenrad->getStatusArray();
$kettenrad->resetWarnings();
// So as not to have duplicate warnings reports
Factory::saveState($tag, $backupId);
break;
case 'step':
Factory::loadState($tag, $backupId);
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
$kettenrad->tick();
$ret_array = $kettenrad->getStatusArray();
$kettenrad->resetWarnings();
// So as not to have duplicate warnings reports
Factory::saveState($tag, $backupId);
if ($ret_array['HasRun'] == 1) {
// Clean up
Factory::nuke();
$tempVarsTag = $tag;
$tempVarsTag .= empty($backupId) ? '' : '.' . $backupId;
Factory::getFactoryStorage()->reset($tempVarsTag);
}
break;
default:
break;
}
return $ret_array;
}
示例14: parseScanArray
private function parseScanArray($array)
{
$kettenrad = \Akeeba\Engine\Factory::getKettenrad();
$kettenrad->resetWarnings();
if ($array['HasRun'] != 1 && empty($array['Error'])) {
// Still have work to do
return array('status' => true, 'done' => false, 'error' => '');
} elseif (!empty($array['Error'])) {
// Error!
return array('status' => false, 'done' => true, 'error' => $array['Error']);
} else {
// All done
\Akeeba\Engine\Factory::getFactoryStorage()->reset(AKEEBA_BACKUP_ORIGIN);
return array('status' => true, 'done' => true, 'error' => '');
}
}
示例15: stepBackup
/**
* Steps through a backup.
*
* State variables expected (MUST be set):
* backupid The ID of the backup.
* tag The backup tag, e.g. "frontend".
* profile (optional) The profile ID of the backup.
*
* @param bool $requireBackupId Should the backup ID be required?
*
* @return array An Akeeba Engine return array
*/
public function stepBackup($requireBackupId = true)
{
// Get the tag. If not specified use the AKEEBA_BACKUP_ORIGIN constant.
$tag = $this->getState('tag', null, 'string');
if (is_null($tag) && defined('AKEEBA_BACKUP_ORIGIN')) {
$tag = AKEEBA_BACKUP_ORIGIN;
}
// Get the Backup ID. If not specified use the AKEEBA_BACKUP_ID constant.
$backupId = $this->getState('backupid', null, 'string');
if (is_null($backupId) && defined('AKEEBA_BACKUP_ID')) {
$backupId = AKEEBA_BACKUP_ID;
}
// Get the profile from the session, the AKEEBA_PROFILE constant or the model state – in this order
$session = $this->container->session;
$profile = $session->get('profile', null);
$profile = defined('AKEEBA_PROFILE') ? AKEEBA_PROFILE : $profile;
$profile = $this->getState('profile', $profile, 'int');
$profile = max(0, (int) $profile);
if (empty($profile)) {
$profile = $this->getLastBackupProfile($tag, $backupId);
}
// Set the active profile
$session->set('profile', $profile);
if (!defined('AKEEBA_PROFILE')) {
define('AKEEBA_PROFILE', $profile);
}
// Run a backup step
$ret_array = array('Error' => '');
try {
// Reload the configuration
Platform::getInstance()->load_configuration($profile);
// Load the engine from storage
Factory::loadState($tag, $backupId, $requireBackupId);
// Set the backup ID and run a backup step
$kettenrad = Factory::getKettenrad();
$kettenrad->setBackupId($backupId);
$kettenrad->tick();
$ret_array = $kettenrad->getStatusArray();
// Prevent duplicate reporting of warnings
$kettenrad->resetWarnings();
} catch (\Exception $e) {
$ret_array['Error'] = $e->getMessage();
}
try {
if (empty($ret_array['Error']) && $ret_array['HasRun'] != 1) {
Factory::saveState($tag, $backupId);
}
} catch (\RuntimeException $e) {
$ret_array['Error'] = $e->getMessage();
}
if (!empty($ret_array['Error']) || $ret_array['HasRun'] == 1) {
// Clean up
Factory::nuke();
$tempVarsTag = $tag;
$tempVarsTag .= empty($backupId) ? '' : '.' . $backupId;
Factory::getFactoryStorage()->reset($tempVarsTag);
}
return $ret_array;
}