/** * @param integer $id * @return ImportTopic|null */ public function getTopic($id) { // reset our internal cached data every 100 topics. Otherwise imports // of any considerable size will take up large amounts of memory for // no reason, running into swap on smaller machines. $this->cachedTopics++; if ($this->cachedTopics > 100) { $this->threadData->reset(); $this->pageData->reset(); $this->cachedTopics = 0; } $data = $this->threadData->get($id); switch ($data['type']) { // Standard thread case self::THREAD_TYPE_NORMAL: return new ImportTopic($this, $data); // The topic no longer exists at the queried location, but // a stub was left behind pointing to it. This modified // version of ImportTopic gracefully adjusts the #REDIRECT // into a template to keep a similar output to lqt. // The topic no longer exists at the queried location, but // a stub was left behind pointing to it. This modified // version of ImportTopic gracefully adjusts the #REDIRECT // into a template to keep a similar output to lqt. case self::THREAD_TYPE_MOVED: return new MovedImportTopic($this, $data); // To get these back from the api we would have to send the `showdeleted` // query param. As we are not requesting them, just ignore for now. // To get these back from the api we would have to send the `showdeleted` // query param. As we are not requesting them, just ignore for now. case self::THREAD_TYPE_DELETED: return null; // Was assigned but never used by LQT. // Was assigned but never used by LQT. case self::THREAD_TYPE_HIDDEN: return null; } }