/** * @param SS_HTTPRequest $request * @return SS_HTTPResponse */ public function run($request) { parent::run($request); // Disable filters if (class_exists('ContentNotifierExtension')) { ContentNotifierExtension::disable_filtering(); } if (class_exists('Post')) { Config::inst()->update('Post', 'allow_reading_spam', true); } // Init tasks $taskGroup = $request->getVar('tasks') ?: 'tasks'; $this->message("Beginning import tasks {$taskGroup}"); $this->connectToRemoteSite(); Versioned::reading_stage('Stage'); // Check if we only want to do a single step if ($pass = $request->requestVar('pass')) { $this->message("Resuming at {$pass} pass"); switch ($pass) { case 'identify': $this->identifyPass($taskGroup); return; case 'import': $this->importPass($taskGroup); return; case 'link': $this->linkPass($taskGroup); return; } } $this->identifyPass($taskGroup); $this->importPass($taskGroup); $this->linkPass($taskGroup); }
public function send() { if (!$this->records) { $this->setRecords(ContentNotifierQueue::get_unnotified()); } ContentNotifierExtension::disable_filtering(); $total = $this->records->count(); $grouped = GroupedList::create($this->records->limit($this->config()->items_limit))->GroupedBy('Category'); $this->emailer->populateTemplate(array('Headline' => $this->config()->headline, 'GroupedItems' => $grouped, 'Total' => $total, 'Link' => Controller::join_links(Director::absoluteBaseURL(), 'admin', 'content-notifications'))); $this->emailer->send(); foreach ($this->records as $record) { $record->HasNotified = true; $record->write(); } ContentNotifierExtension::enable_filtering(true); }
public static function disable_filtering() { self::$filter_unapproved = false; }