/**
  * 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
0
 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
0
 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
0
 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
0
 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;
 }
 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;
 }
 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
0
 /**
  *
  * @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
0
 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
0
 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
0
 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);
 }
 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
0
 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
0
 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);
     }
 }
 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;
 }
示例#16
0
 public function insertTranscodeQueue(array $data)
 {
     XenForo_Application::getDb()->insert('xengallery_transcode_queue', array('queue_data' => @serialize($data), 'queue_date' => XenForo_Application::$time));
     if (!$this->isDeferredQueued()) {
         try {
             XenForo_Application::defer('XenGallery_Deferred_TranscodeQueue', array(), 'TranscodeQueue');
         } catch (Exception $e) {
             // need to just ignore this and let it get picked up later
             XenForo_Error::logException($e, false);
         }
     }
     return true;
 }
示例#17
0
 public function insertMailQueue(Zend_Mail $mailObj)
 {
     XenForo_Application::getDb()->insert('xf_mail_queue', array('mail_data' => serialize($mailObj), 'queue_date' => XenForo_Application::$time));
     if (!self::$_deferredQueued) {
         try {
             XenForo_Application::defer('MailQueue', array(), 'MailQueue');
             self::$_deferredQueued = true;
         } catch (Exception $e) {
             // need to just ignore this and let it get picked up later;
             // not doing this could lose email on a deadlock
         }
     }
     return true;
 }
示例#18
0
 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']) {
         $obj = XenForo_Deferred_Abstract::create($input['cache']);
         if ($obj) {
             XenForo_Application::defer($input['cache'], $input['options'], 'Rebuild' . $input['cache'], true);
         }
     }
     $this->_request->setParam('redirect', XenForo_Link::buildAdminLink('xengallery/rebuilds', false, array('success' => 1)));
     return $this->responseReroute('XenForo_ControllerAdmin_Tools', 'runDeferred');
 }
 public function onAddonActiveSwitch(array $addon)
 {
     $titles = $this->getModificationTemplateTitlesForAddon($addon['addon_id']);
     /** @var $templateModel XenForo_Model_EmailTemplate */
     $templateModel = $this->getModelFromCache('XenForo_Model_EmailTemplate');
     $templates = $templateModel->getEmailTemplatesByTitles($titles);
     $templateIds = array();
     foreach ($templates as $template) {
         $templateIds[] = $template['template_id'];
     }
     if ($templateIds) {
         XenForo_Application::defer('EmailTemplatePartialCompile', array('reparseTemplateIds' => $templateIds, 'recompileTemplateIds' => $templateIds), null, true);
         return true;
     }
     return false;
 }
示例#20
0
    public function markThreadGlobalRead(array $thread, array $forum)
    {
        $db = $this->_getDb();
        $readDate = XenForo_Application::$time;
        /* @var $userModel XenForo_Model_User */
        $userModel = $this->getModelFromCache('XenForo_Model_User');
        $userIds = $userModel->getUserIds(array());
        $values = array();
        $rowLength = 0;
        $rows = array();
        foreach ($userIds as $userId) {
            $row = '(' . $userId . ',' . $thread['thread_id'] . ',' . $readDate . ')';
            $rows[] = $row;
            $rowLength += strlen($row);
            if ($rowLength > 500000) {
                $db->query('
					INSERT INTO xf_thread_read
						(user_id, thread_id, thread_read_date)
					VALUES
						' . implode(',', $rows) . '
        			ON DUPLICATE KEY UPDATE thread_read_date = VALUES(thread_read_date)
        		');
                $rows = array();
                $rowLength = 0;
            }
        }
        if ($rows) {
            $db->query('
    			INSERT INTO xf_thread_read
    				(user_id, thread_id, thread_read_date)
    			VALUES
    				' . implode(',', $rows) . '
    			ON DUPLICATE KEY UPDATE thread_read_date = VALUES(thread_read_date)
    		');
        }
        if ($readDate < $thread['last_post_date']) {
            // we haven't finished reading this thread - forum won't be read
            return false;
        }
        XenForo_Application::defer('ThemeHouse_MarkAsRead_Deferred_MarkAsRead', array('forum_id' => $forum['node_id']), 'ThemeHouseMarkForumRead_' . $forum['node_id']);
        return true;
    }
示例#21
0
 public function notifyTaggedUsers3($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, array $taggedUsers, array $noAlertUserIds = array(), array $noEmailUserIds = array(), XenForo_Model $someRandomModel = null, array $options = array())
 {
     $options = array_merge(array(self::OPTION_MAX_TAGGED_USERS => bdTagMe_Option::get('max')), $options);
     if ($someRandomModel != null) {
         /* @var $userModel XenForo_Model_User */
         $userModel = $someRandomModel->getModelFromCache('XenForo_Model_User');
     } else {
         /* @var $userModel XenForo_Model_User */
         $userModel = XenForo_Model::create('XenForo_Model_User');
     }
     $neededUserIds = array();
     $taggableUserGroups = $this->getTaggableUserGroups();
     foreach ($taggedUsers as $taggedUserId => $taggedUserName) {
         if (is_numeric($taggedUserId)) {
             $neededUserIds[] = $taggedUserId;
         } else {
             if (strpos($taggedUserId, 'ug_') === 0) {
                 $userGroupId = substr($taggedUserId, 3);
                 if (isset($taggableUserGroups[$userGroupId])) {
                     $neededUserIds += array_keys($taggableUserGroups[$userGroupId]['userIds']);
                 }
             }
         }
     }
     if (!empty($neededUserIds)) {
         if ($options[self::OPTION_MAX_TAGGED_USERS] > 0) {
             // there are limit of maximum tagged users
             $userIds = array_slice($neededUserIds, 0, $options[self::OPTION_MAX_TAGGED_USERS]);
         } else {
             $userIds = $neededUserIds;
         }
     } else {
         $userIds = array();
     }
     if (count($userIds) > self::USERS_PER_BATCH) {
         $deferredUserIds = array_slice($userIds, self::USERS_PER_BATCH);
         $userIds = array_slice($userIds, 0, self::USERS_PER_BATCH);
         XenForo_Application::defer('bdTagMe_Deferred_NotifyUserIds', array($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, $deferredUserIds, $noAlertUserIds, $noEmailUserIds, $options));
     }
     return $this->notifyUserIds($contentType, $contentId, $contentUserId, $contentUserName, $alertAction, $userIds, $noAlertUserIds, $noEmailUserIds, $userModel, $options);
 }
 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_AdminTemplateModification', array(), 'BRASS_adminTemplateModeficationRebuild', true);
     } elseif ($this->isUpdate()) {
         $brModefication = $this->_getBrModificationModel()->getModificationByKey($this->get('modification_key'));
         if (!empty($brModefication)) {
             $xfModefication = $this->getMergedData();
             if (isset($xfModefication['modification_id'])) {
                 unset($xfModefication['modification_id']);
             }
             $dw = XenForo_DataWriter::create('Brivium_AdminStyleSystem_DataWriter_AdminTemplateModification');
             $dw->setExistingData($brModefication);
             $dw->bulkSet($xfModefication);
             $dw->save();
         }
     }
     return parent::_postSave();
 }
示例#23
0
 public static function frontControllerPreView(XenForo_FrontController $fc, XenForo_ControllerResponse_Abstract &$controllerResponse, XenForo_ViewRenderer_Abstract &$viewRenderer, array &$containerParams)
 {
     $dependencies = $fc->getDependencies();
     if ($dependencies instanceof XenForo_Dependencies_Admin) {
         if ($controllerResponse->controllerAction == 'RunDeferred') {
             return;
         }
         $xenAddons = XenForo_Application::get('addOns');
         if (empty($xenAddons['Brivium_AdminStyleSystem'])) {
             return;
         }
         $dataRegistryModel = self::getModelFromCache('XenForo_Model_DataRegistry');
         $dataRegistries = $dataRegistryModel->getMulti(array('adminStyles', 'BRASS_rebuildTemplate'));
         $adminStyles = !empty($dataRegistries['adminStyles']) ? $dataRegistries['adminStyles'] : false;
         if (!is_array($adminStyles)) {
             $styleModel = XenForo_Model::create('XenForo_Model_Style');
             $styleModel->setAdminStyles(true);
             $adminStyles = $styleModel->rebuildStyleCache();
         }
         XenForo_Application::set('adminStyles', $adminStyles);
         if (!empty($dataRegistries['BRASS_rebuildTemplate']) && $dataRegistries['BRASS_rebuildTemplate'] < XenForo_Application::$time - 60) {
             XenForo_Application::defer('Atomic', array('simple' => array('Brivium_AdminStyleSystem_Deferred_RebuildAllAdminTemplate', 'Brivium_AdminStyleSystem_Deferred_AdminTemplateReparse', 'Brivium_AdminStyleSystem_Deferred_AdminTemplate')), 'BRASS_rebuildAllAdminTemplates', true);
             return;
         }
         $brAdminTemplateModel = self::getModelFromCache('Brivium_AdminStyleSystem_Model_AdminTemplate');
         if (!$brAdminTemplateModel->isRebuildTemplate()) {
             return;
         }
         $tmpDependencies = new Brivium_AdminStyleSystem_Dependencies_Admin();
         list(self::$_defaultTemplateParams, self::$_setStyleProperties) = $tmpDependencies->preRenderView();
         if ($viewRenderer instanceof XenForo_ViewRenderer_HtmlAdmin) {
             $viewRenderer = new Brivium_AdminStyleSystem_ViewRenderer_HtmlAdmin($dependencies, $fc->getResponse(), $fc->getRequest());
         } elseif ($viewRenderer instanceof XenForo_ViewRenderer_Json) {
             $viewRenderer = new XenForo_ViewRenderer_Json($tmpDependencies, $fc->getResponse(), $fc->getRequest());
         }
     }
 }
示例#24
0
文件: Tools.php 项目: Sywooch/forums
 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']) {
         $obj = XenForo_Deferred_Abstract::create($input['cache']);
         if ($obj && $obj->canTriggerManually()) {
             switch (get_class($obj)) {
                 case 'XenForo_Deferred_Atomic':
                 case 'XenForo_Deferred_ThreadAction':
                 case 'XenForo_Deferred_ThreadDelete':
                 case 'XenForo_Deferred_UserAction':
                 case 'XenForo_Deferred_UserGroupDelete':
                 case 'XenForo_Deferred_UserRevertMessageEdit':
                     break;
                 default:
                     XenForo_Application::defer($input['cache'], $input['options'], 'Rebuild' . $input['cache'], true);
             }
         }
     }
     $this->_request->setParam('redirect', XenForo_Link::buildAdminLink('tools/rebuild', false, array('success' => 1)));
     return $this->responseReroute(__CLASS__, 'runDeferred');
 }
示例#25
0
 /**
  * Recompiles all templates that include the named phrase.
  *
  * @param string $phraseTitle
  * @param bool $deferred If true, defer this
  *
  * @return array List of template map IDs including the phrase
  */
 public function compileTemplatesThatIncludePhrase($phraseTitle, $deferred = false)
 {
     $mapIds = $this->getTemplateMapIdsThatIncludePhrase($phraseTitle);
     if ($deferred) {
         XenForo_Application::defer('TemplatePartialCompile', array('recompileMapIds' => $mapIds), null, true);
     } else {
         $this->compileMappedTemplatesInStyleTree($mapIds);
     }
     return $mapIds;
 }
示例#26
0
 public function run($manual = false, $targetRunTime = null, &$status = '', &$canCancel = null)
 {
     $runnable = $this->getRunnableDeferreds($manual);
     $continued = $this->_runInternal($runnable, $targetRunTime, $status, $canCancel);
     if (!$manual) {
         $nextRun = $this->updateNextDeferredTime();
         if ($nextRun && $nextRun <= time()) {
             $continued = true;
         }
         if (!$nextRun) {
             XenForo_Application::defer('Cron', array(), 'cron', false, time() + 300);
         }
     }
     return $continued;
 }
示例#27
0
 protected function _updateJustUninstalled()
 {
     if (isset($this->_data['addon_id'])) {
         if (XenForo_Application::$versionId < 1020000 && defined('Waindigo_Listener_InitDependencies::JUST_UNINSTALLED_SIMPLE_CACHE_KEY')) {
             $justUninstalled = XenForo_Application::getSimpleCacheData(Waindigo_Listener_InitDependencies::JUST_UNINSTALLED_SIMPLE_CACHE_KEY);
             if (!$justUninstalled) {
                 $justUninstalled = array();
             }
             if (!in_array($this->_data['addon_id'], $justUninstalled)) {
                 $justUninstalled[] = $this->_data['addon_id'];
             }
             XenForo_Application::setSimpleCacheData(Waindigo_Listener_InitDependencies::JUST_UNINSTALLED_SIMPLE_CACHE_KEY, $justUninstalled);
         } elseif (XenForo_Application::$versionId >= 1020000) {
             XenForo_Application::defer('Waindigo_Deferred', array_merge($this->_data, array('uninstall' => true)));
         }
     }
 }
示例#28
0
 /**
  * Compiles any admin templates that include the specified phrase title.
  *
  * @param string $phraseTitle
  * @param boolean $deferred
  */
 public function compileAdminTemplatesThatIncludePhrase($phraseTitle, $deferred = true)
 {
     $templates = $this->getAdminTemplatesThatIncludePhrase($phraseTitle);
     if ($deferred) {
         XenForo_Application::defer('AdminTemplatePartialCompile', array('recompileTemplateIds' => array_keys($templates)), null, true);
     } else {
         $this->compileParsedAdminTemplates($templates);
     }
 }
示例#29
0
文件: Thread.php 项目: Sywooch/forums
 public function actionBatchUpdate()
 {
     if ($this->isConfirmedPost()) {
         $criteria = $this->_input->filterSingle('criteria', XenForo_Input::JSON_ARRAY);
         $criteria = $this->_filterThreadSearchCriteria($criteria);
         $criteriaPrepared = $this->_prepareThreadSearchCriteria($criteria);
         $threadIds = $this->_input->filterSingle('thread_ids', XenForo_Input::JSON_ARRAY);
         $threadModel = $this->_getThreadModel();
         $totalThreads = $threadIds ? count($threadIds) : $threadModel->countThreads($criteriaPrepared);
         if (!$totalThreads) {
             return $this->responseError(new XenForo_Phrase('no_items_matched_your_filter'));
         }
         $actions = $this->_input->filterSingle('actions', XenForo_Input::ARRAY_SIMPLE);
         if ($this->_input->filterSingle('confirmUpdate', XenForo_Input::UINT) && $actions) {
             $defer = array('actions' => $actions, 'total' => $totalThreads);
             if ($threadIds) {
                 $defer['threadIds'] = $threadIds;
             } else {
                 if ($totalThreads > 10000) {
                     $defer['criteria'] = $criteriaPrepared;
                 } else {
                     $defer['threadIds'] = $threadModel->getThreadIds($criteriaPrepared);
                 }
             }
             XenForo_Application::defer('ThreadAction', $defer, null, true);
             return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('tools/run-deferred', null, array('redirect' => XenForo_Link::buildAdminLink('threads/batch-update', null, array('success' => 1)))));
         } else {
             return $this->responseView('XenForo_ViewAdmin_Thread_BatchUpdateConfirm', 'thread_batch_update_confirm', array('criteria' => $criteria, 'threadIds' => $threadIds, 'totalThreads' => $totalThreads, 'linkParams' => array('criteria' => $criteria, 'order' => 'last_post_date', 'direction' => 'desc'), 'nodes' => $this->_getNodeModel()->getAllNodes(), 'prefixes' => $this->getModelFromCache('XenForo_Model_ThreadPrefix')->getPrefixOptions()));
         }
     } else {
         $viewParams = array('nodes' => $this->_getNodeModel()->getAllNodes(), 'prefixes' => $this->getModelFromCache('XenForo_Model_ThreadPrefix')->getPrefixOptions(), 'criteria' => array('discussion_state' => array('visible' => true, 'deleted' => true, 'moderated' => true), 'discussion_open' => array(0 => true, 1 => true), 'sticky' => array(0 => true, 1 => true), 'reply_count_end' => -1, 'view_count_end' => -1, 'first_post_likes_end' => -1, 'node_id' => array(0), 'prefix_id' => array(0)), 'success' => $this->_input->filterSingle('success', XenForo_Input::UINT));
         return $this->responseView('XenForo_ViewAdmin_Thread_BatchUpdateSearch', 'thread_batch_update_search', $viewParams);
     }
 }
示例#30
0
 public function isRebuildTemplate()
 {
     if (XenForo_Application::isRegistered('adminStyles')) {
         $adminStyles = XenForo_Application::get('adminStyles');
     }
     if (empty($adminStyles)) {
         XenForo_Application::defer('Brivium_AdminStyleSystem_Deferred_AdminStyle', array(), 'BRASS_adminStyle', true);
         return false;
     }
     $notRunDeferred = $this->getAdminStyleDeferred();
     if (!empty($notRunDeferred)) {
         foreach ($notRunDeferred as $deferred) {
             $executeData = unserialize($deferred['execute_data']);
             $executeData = !empty($executeData) ? $executeData : array();
             XenForo_Application::defer($deferred['execute_class'], $executeData, $deferred['unique_key'], $deferred['manual_execute']);
         }
         return false;
     }
     return true;
 }