本文整理汇总了PHP中Akeeba\Engine\Factory::getPush方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::getPush方法的具体用法?PHP Factory::getPush怎么用?PHP Factory::getPush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Akeeba\Engine\Factory
的用法示例。
在下文中一共展示了Factory::getPush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _finalize
protected function _finalize()
{
// Open the log
$logTag = $this->getLogTag();
Factory::getLog()->open($logTag);
if (!static::$registeredErrorHandler) {
static::$registeredErrorHandler = true;
set_error_handler('\\Akeeba\\Engine\\Core\\akeebaBackupErrorHandler');
}
// Kill the cached array
$this->array_cache = null;
// Remove the memory file
$tempVarsTag = $this->tag . (empty($this->backup_id) ? '' : '.' . $this->backup_id);
Factory::getFactoryStorage()->reset($tempVarsTag);
// All done.
Factory::getLog()->log(LogLevel::DEBUG, "Kettenrad :: Just finished");
$this->setState('finished');
// Send a push message to mark the end of backup
$pushSubjectKey = $this->warnings_issued ? 'COM_AKEEBA_PUSH_ENDBACKUP_WARNINGS_SUBJECT' : 'COM_AKEEBA_PUSH_ENDBACKUP_SUCCESS_SUBJECT';
$pushBodyKey = $this->warnings_issued ? 'COM_AKEEBA_PUSH_ENDBACKUP_WARNINGS_BODY' : 'COM_AKEEBA_PUSH_ENDBACKUP_SUCCESS_BODY';
$platform = Platform::getInstance();
$timeStamp = date($platform->translate('DATE_FORMAT_LC2'));
$pushSubject = sprintf($platform->translate($pushSubjectKey), $platform->get_site_name(), $platform->get_host());
$pushDetails = sprintf($platform->translate($pushBodyKey), $platform->get_site_name(), $platform->get_host(), $timeStamp);
Factory::getPush()->message($pushSubject, $pushDetails);
//restore_error_handler();
}
示例2: 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;
}