本文整理汇总了PHP中Akeeba\Engine\Factory::nuke方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::nuke方法的具体用法?PHP Factory::nuke怎么用?PHP Factory::nuke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akeeba\Engine\Factory
的用法示例。
在下文中一共展示了Factory::nuke方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: com_akeeba_postinstall_angie_action
/**
* Apply the ANGIE upgrade
*/
function com_akeeba_postinstall_angie_action()
{
// Necessary defines for Akeeba Engine
if (!defined('AKEEBAENGINE')) {
define('AKEEBAENGINE', 1);
// Required for accessing Akeeba Engine's factory class
define('AKEEBAROOT', dirname(__FILE__) . '/../akeeba');
define('ALICEROOT', dirname(__FILE__) . '/../alice');
}
// Load the factory
require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/engine/Factory.php';
\Akeeba\Engine\Platform::addPlatform('joomla25', JPATH_ADMINISTRATOR . '/components/com_akeeba/platform/joomla25');
if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_akeeba/alice/factory.php')) {
@(require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/alice/factory.php');
}
// Get all profiles
include_once JPATH_SITE . '/libraries/f0f/include.php';
if (!defined('F0F_INCLUDED') || !class_exists('F0FForm', true)) {
JError::raiseError('500', 'Your Akeeba Backup installation is broken; please re-install. Alternatively, extract the installation archive and copy the fof directory inside your site\'s libraries directory.');
return;
}
$model = F0FModel::getTmpInstance('Cpanels', 'AkeebaModel');
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select(array($db->qn('id')))->from($db->qn('#__ak_profiles'))->order($db->qn('id') . " ASC");
$db->setQuery($query);
$profiles = $db->loadColumn();
// Save the current profile number
$session = JFactory::getSession();
$oldProfile = $session->get('profile', 1, 'akeeba');
// Upgrade all profiles
foreach ($profiles as $profile_id) {
\Akeeba\Engine\Factory::nuke();
\Akeeba\Engine\Platform::getInstance()->load_configuration($profile_id);
$config = \Akeeba\Engine\Factory::getConfiguration();
$config->set('akeeba.advanced.embedded_installer', 'angie');
\Akeeba\Engine\Platform::getInstance()->save_configuration($profile_id);
}
// Restore the old profile
\Akeeba\Engine\Factory::nuke();
\Akeeba\Engine\Platform::getInstance()->load_configuration($oldProfile);
com_akeeba_postinstall_common_savesettings(1);
}
示例3: 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;
}
示例4: markOldProfilesConfigured
/**
* Akeeba Backup 4.3.2 displays a popup if your profile is not already configured by Configuration Wizard, the
* Configuration page or imported from the Profiles page. This bit of code makes sure that existing profiles will
* be marked as already configured just the FIRST time you upgrade to the new version from an old version.
*/
public function markOldProfilesConfigured()
{
// Get all profiles
$db = F0FPlatform::getInstance()->getDbo();
$query = $db->getQuery(true)->select(array($db->qn('id')))->from($db->qn('#__ak_profiles'))->order($db->qn('id') . " ASC");
$db->setQuery($query);
$profiles = $db->loadColumn();
// Save the current profile number
$session = JFactory::getSession();
$oldProfile = $session->get('profile', 1, 'akeeba');
// Update all profiles
foreach ($profiles as $profile_id) {
\Akeeba\Engine\Factory::nuke();
\Akeeba\Engine\Platform::getInstance()->load_configuration($profile_id);
$config = \Akeeba\Engine\Factory::getConfiguration();
$config->set('akeeba.flag.confwiz', 1);
\Akeeba\Engine\Platform::getInstance()->save_configuration($profile_id);
}
// Restore the old profile
\Akeeba\Engine\Factory::nuke();
\Akeeba\Engine\Platform::getInstance()->load_configuration($oldProfile);
}
示例5: 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);
}
}
}
示例6: runBackup
//.........这里部分代码省略.........
}
// 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();
}
$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;
}
示例7: 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;
}
示例8: 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;
}
示例9: processEngineReturnArray
/**
* Used by the tasks to process Akeeba Engine's return array. Depending on the result and the component options we
* may throw text output or send an HTTP redirection header.
*
* @param array $array The return array to process
* @param string $backupId The backup ID (used to step the backup process)
*/
private function processEngineReturnArray($array, $backupId)
{
if ($array['Error'] != '') {
@ob_end_clean();
echo '500 ERROR -- ' . $array['Error'];
flush();
$this->container->platform->closeApplication();
}
if ($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();
$this->container->platform->closeApplication();
}
$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 -- BACKUPID ###{$backupId}###";
flush();
$this->container->platform->closeApplication();
}
$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?
$language = $this->container->platform->getLanguage();
$languageTag = $language->getTag();
$uri->setVar('lang', $languageTag);
$redirectionUrl = $uri->toString();
$this->customRedirect($redirectionUrl);
}