/** * Flush items in the request and retrieve time for executing */ public function flushAction($action) { $start = microtime(true); $collection = null; switch ($action->getData('type')) { case self::TYPE_CATEGORY_ID: $collection = self::$model->getCollectionByCategoryIds($action->getData('ids')); break; case self::TYPE_PRODUCT_ID: $collection = self::$model->getCollectionByProductIds($action->getData('ids')); break; case self::TYPE_REQUEST: break; case self::TYPE_CMS_ID: $collection = self::$model->getCollectionByCmsIds($action->getData('ids')); break; case self::TYPE_REWRITE_ID: break; } if (isset($collection)) { foreach ($collection->getItems() as $item) { if (!$item->isBlocked()) { $item->getFileModel()->downloadPage(); } } } return microtime(true) - $start; }
/** * Function checks download html. Retrieves FALSE when file is too little or * find within 404 code * @param $html checked html * @return bool TRUE when html is correct, otherwise FALSE */ private function _checkHtml(&$html) { if (!is_string($html)) { return false; } if (strlen($html) < Mage::getSingleton('mturbo/config')->getMinimalPageSize()) { return false; } $title = (string) Mage::helper('mturbo')->getNoRouteTitle($this->mturbomodel->getStoreId()); if (strlen($title) > 1) { // if title is empty then quite ignoring if (strpos($html, "<title>{$title}") !== false) { return false; } } return true; }