本文整理汇总了PHP中XenForo_Application::defer方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::defer方法的具体用法?PHP XenForo_Application::defer怎么用?PHP XenForo_Application::defer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::defer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runUserDowngrade
/**
* Runs the cron-based check for new promotions that users should be awarded.
*/
public static function runUserDowngrade()
{
/* @var $promotionModel XenForo_Model_UserGroupPromotion */
$promotionModel = XenForo_Model::create('XenForo_Model_UserGroupPromotion');
$promotionModel->processExpiredPromotions();
XenForo_Application::defer('UserGroupPromotion', array('batch' => '100'));
}
示例2: rebuildAddOnCaches
public function rebuildAddOnCaches()
{
parent::rebuildAddOnCaches();
if ($this->_addOnId != 'Brivium_AdminStyleSystem') {
XenForo_Application::defer('Atomic', array('simple' => array('Brivium_AdminStyleSystem_Deferred_RebuildAllAdminTemplate', 'Brivium_AdminStyleSystem_Deferred_AdminTemplateReparse', 'Brivium_AdminStyleSystem_Deferred_AdminTemplate')), 'BRASS_adminTemplateRebuild', true);
}
}
示例3: reInsertQueue
public function reInsertQueue(array $queueRecord, $queueDate)
{
if (is_callable(array('XenForo_Application', 'defer'))) {
XenForo_Application::defer('bdSocialShare_Deferred_ShareQueue', array(), 'bdSocialShare_ShareQueue', false, $queueDate + 1);
}
$this->_getDb()->update('xf_bdsocialshare_share_queue', array('queue_date' => $queueDate), array('share_queue_id = ?' => $queueRecord['share_queue_id']));
}
示例4: _postSave
protected function _postSave()
{
if (XenForo_Application::isRegistered('brass_importOrDelete') && XenForo_Application::get('brass_importOrDelete')) {
return parent::_postSave();
}
if ($this->isInsert()) {
XenForo_Application::defer('Brivium_AdminStyleSystem_Deferred_AdminTemplateMaster', array(), 'BRASS_adminTemplateMasterRebuild', true);
} elseif ($this->isUpdate()) {
$title = $this->getExisting('title');
$brTemplate = $this->_getBrAdminTemplateModel()->getAdminTemplateInStyleByTitle($title, 0);
if (!empty($brTemplate)) {
$xfTemplate = $this->getMergedData();
$templateName = (string) $xfTemplate['title'];
$dw = XenForo_DataWriter::create('Brivium_AdminStyleSystem_DataWriter_AdminTemplate');
$dw->setExistingData($brTemplate);
$dw->setOption(Brivium_AdminStyleSystem_DataWriter_AdminTemplate::OPTION_DEV_OUTPUT_DIR, '');
$dw->setOption(Brivium_AdminStyleSystem_DataWriter_AdminTemplate::OPTION_FULL_COMPILE, false);
$dw->setOption(Brivium_AdminStyleSystem_DataWriter_AdminTemplate::OPTION_TEST_COMPILE, false);
$dw->setOption(Brivium_AdminStyleSystem_DataWriter_AdminTemplate::OPTION_CHECK_DUPLICATE, false);
$dw->setOption(Brivium_AdminStyleSystem_DataWriter_AdminTemplate::OPTION_REBUILD_TEMPLATE_MAP, false);
$dw->bulkSet(array('style_id' => 0, 'title' => $templateName, 'template' => $xfTemplate['template'], 'addon_id' => $xfTemplate['addon_id']));
$dw->save();
}
}
return parent::_postSave();
}
示例5: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$s = microtime(true);
/* @var $cronModel XenForo_Model_Cron */
$cronModel = XenForo_Model::create('XenForo_Model_Cron');
XenForo_Application::defer('Cron', array(), 'cron', false, XenForo_Application::$time + 300);
$entries = $cronModel->getCronEntriesToRun();
foreach ($entries as $entry) {
if (!$cronModel->updateCronRunTimeAtomic($entry)) {
continue;
}
try {
$cronModel->runEntry($entry);
} catch (Exception $e) {
// suppress so we don't get stuck
XenForo_Error::logException($e);
}
$runTime = microtime(true) - $s;
if ($targetRunTime && $runTime > $targetRunTime) {
break;
}
}
$cronModel->updateMinimumNextRunTime();
return false;
}
示例6: install
public static function install($existingAddOn, $addOnData)
{
$version = isset($existingAddOn['version_id']) ? $existingAddOn['version_id'] : 0;
if ($version && $version < 1000300) {
// migrate to remove the 'use' from the bad tag list
$tags = XenForo_Application::getOptions()->SV_AttachImpro_badTags;
$tags = explode(',', $tags);
if (($key = array_search('use', $tags)) !== false) {
unset($tags[$key]);
}
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Option', XenForo_DataWriter::ERROR_SILENT);
$dw->setExistingData('SV_AttachImpro_badTags');
$dw->setOption(XenForo_DataWriter_Option::OPTION_REBUILD_CACHE, false);
$dw->set('option_value', implode(',', $tags));
$dw->save();
XenForo_Application::defer(self::AddonNameSpace . 'Deferred_SVGAttachmentThumb', array());
} else {
if ($version == 0) {
$addon = XenForo_Model::create('XenForo_Model_AddOn')->getAddOnById('SV_SVGAttachment');
if (!empty($addon)) {
XenForo_Application::defer(self::AddonNameSpace . 'Deferred_SVGAttachmentThumb', array());
}
}
}
$addonsToUninstall = array('SV_SVGAttachment' => array(), 'SV_XARAttachment' => array());
SV_Utils_Install::removeOldAddons($addonsToUninstall);
return true;
}
示例7: execute
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
/* @var $queueModel XenGallery_Model_Transcode */
$queueModel = XenForo_Model::create('XenGallery_Model_Transcode');
if (!$queueModel->countQueue()) {
return false;
// no more work to do
}
$options = XenForo_Application::getOptions();
$transcodingLimit = $options->get('xengalleryVideoTranscoding', 'limit');
$count = $queueModel->countQueue('processing');
if ($count >= $transcodingLimit) {
XenForo_Application::defer('XenGallery_Deferred_TranscodeQueue', array(), 'TranscodeQueue', false, time() + 30);
return false;
// Currently busy. Re-queue and check again in half a minute.
}
$hasMore = $queueModel->runTranscodeQueue($transcodingLimit - $count);
if ($hasMore) {
// wait a little bit as our queue is likely full
XenForo_Application::defer('XenGallery_Deferred_TranscodeQueue', array(), 'TranscodeQueue', false, time() + 30);
return false;
} else {
return false;
// no more work to do
}
}
示例8: execute
/**
*
* @see XenForo_Deferred_Permission
*/
public function execute(array $deferred, array $data, $targetRunTime, &$status)
{
$return = parent::execute($deferred, $data, $targetRunTime, $status);
if ($return === false) {
XenForo_Application::defer('ThemeHouse_FuturePerm_Deferred_FuturePermission', array(), 'FuturePermission', true);
}
return $return;
}
示例9: _installVersion4
protected function _installVersion4()
{
try {
XenForo_Application::getDb()->query("\n\t\t\t\tALTER TABLE xf_thread\n\t\t\t\t\tADD block_adsense TINYINT UNSIGNED NOT NULL DEFAULT '0'\n\t\t\t");
} catch (Zend_Db_Exception $e) {
}
// we can't insert a random string into an option because the options are installed after this install process
XenForo_Application::defer('DigitalPointAdPositioning_Deferred_RandomGenerator', array(), 'dp_adpos_random', false, time() + 30);
}
示例10: insertMailQueue
public function insertMailQueue(Zend_Mail $mailObj)
{
if (!self::$_deferredQueued) {
XenForo_Application::defer('MailQueue', array(), 'MailQueue');
self::$_deferredQueued = true;
}
XenForo_Application::getDb()->insert('xf_mail_queue', array('mail_data' => serialize($mailObj), 'queue_date' => XenForo_Application::$time));
return true;
}
示例11: _postDelete
protected function _postDelete()
{
$userGroupId = $this->get('user_group_id');
$userGroupModel = $this->_getUserGroupModel();
$this->_db->delete('xf_permission_entry', 'user_group_id = ' . $this->_db->quote($userGroupId));
$this->_db->delete('xf_permission_entry_content', 'user_group_id = ' . $this->_db->quote($userGroupId));
$userGroupModel->deletePermissionCombinationsForUserGroup($userGroupId);
$data = array('userGroupId' => $userGroupId, 'displayPriority' => $this->get('display_style_priority'));
XenForo_Application::defer('UserGroupDelete', $data, "groupDelete_{$userGroupId}", true);
}
示例12: actionTriggerDeferred
public function actionTriggerDeferred()
{
$this->_assertPostOnly();
$this->assertAdminPermission('rebuildCache');
$input = $this->_input->filter(array('cache' => XenForo_Input::STRING, 'options' => XenForo_Input::ARRAY_SIMPLE));
if ($input['cache'] == 'AttachmentThumb') {
XenForo_Application::defer('SV_AttachmentImprovements_Deferred_SVGAttachmentThumb', $input['options'], 'Rebuild' . $input['cache'], true);
}
return parent::actionTriggerDeferred();
}
示例13: insertQueue
public function insertQueue($callback, $objectType, array $data, $expireDate = 0, $queueDate = 0)
{
$this->_getDb()->insert('xf_bdapi_ping_queue', array('callback_md5' => md5($callback), 'callback' => $callback, 'object_type' => $objectType, 'data' => serialize($data), 'queue_date' => $queueDate, 'expire_date' => $expireDate));
if (is_callable(array('XenForo_Application', 'defer'))) {
$triggerDate = null;
if ($queueDate > 0) {
$triggerDate = $queueDate;
}
XenForo_Application::defer('bdApi_Deferred_PingQueue', array(), __CLASS__, false, $triggerDate);
}
}
示例14: _postDelete
protected function _postDelete()
{
parent::_postDelete();
$nodeId = $this->get('node_id');
$db = $this->_db;
$db->delete('xf_forum_prefix', 'node_id = ' . $db->quote($nodeId));
$db->delete('xf_forum_watch', 'node_id = ' . $db->quote($nodeId));
if ($this->getOption(self::OPTION_DELETE_THREADS)) {
XenForo_Application::defer('ThreadDelete', array('node_id' => $nodeId), "threadDelete_{$nodeId}", true);
}
}
示例15: onAddonActiveSwitch
public function onAddonActiveSwitch(array $addon)
{
$titles = $this->getModificationTemplateTitlesForAddon($addon['addon_id']);
/** @var $templateModel XenForo_Model_Template */
$templateModel = $this->getModelFromCache('XenForo_Model_Template');
$templateIds = array_keys($templateModel->getTemplatesByTitles($titles));
if ($templateIds) {
XenForo_Application::defer('TemplatePartialCompile', array('reparseTemplateIds' => $templateIds, 'recompileMapIds' => $templateModel->getMapIdsToCompileByTitles($titles)), null, true);
return true;
}
return false;
}