PHP Class Nexcessnet_Turpentine_Helper_Cron

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Inheritance: extends Mage_Core_Helper_Abstract
Show file Open project: nexcess/magento-turpentine

Protected Properties

Property Type Description
$_crawlerClient Varien_Http_Client Crawler client singleton

Public Methods

Method Description
addCategoryToCrawlerQueue ( Mage_Catalog_Model_Category $category ) : integer Add URLs to the queue by category model
addCmsPageToCrawlerQueue ( integer $cmsPageId ) : integer Add URLs to queue by CMS page ID
addProductToCrawlerQueue ( Mage_Catalog_Model_Product $product ) : integer Add URLs to the queue by product model
addUrlToCrawlerQueue ( string $url ) : boolean Add a single URL to the queue, returns whether it was actually added to the queue or not (false if it was already in the queue)
addUrlsToCrawlerQueue ( array $urls ) : integer Add a list of URLs to the queue, returns how many unique URLs were actually added to the queue
getAllUrls ( ) : array Get the list of all URLs
getAllowedRunTime ( ) : integer Get the max execution time (or 0 if unlimited)
getCrawlerBatchSize ( ) : integer Get number of urls to crawl per batch
getCrawlerClient ( ) : Varien_Http_Client Get the crawler http client
getCrawlerDebugEnabled ( ) : boolean Get if crawler debugging is enabled
getCrawlerEnabled ( ) : boolean Get if the crawler is enabled
getCrawlerWaitPeriod ( ) : integer Get time in seconds to wait between url batches
getNextUrl ( ) : string | null Pop a URL to crawl off the queue, or null if no URLs left
getRunTime ( ) : integer Get the execution time used so far
getUrlQueue ( ) : array Get the current URL queue

Protected Methods

Method Description
_readUrlQueue ( ) : array Get the crawler URL queue from the cache
_writeUrlQueue ( array $urls ) : null Save the crawler URL queue to the cache

Method Details

_readUrlQueue() protected method

Get the crawler URL queue from the cache
protected _readUrlQueue ( ) : array
return array

_writeUrlQueue() protected method

Save the crawler URL queue to the cache
protected _writeUrlQueue ( array $urls ) : null
$urls array
return null

addCategoryToCrawlerQueue() public method

Add URLs to the queue by category model
public addCategoryToCrawlerQueue ( Mage_Catalog_Model_Category $category ) : integer
$category Mage_Catalog_Model_Category
return integer

addCmsPageToCrawlerQueue() public method

Add URLs to queue by CMS page ID
public addCmsPageToCrawlerQueue ( integer $cmsPageId ) : integer
$cmsPageId integer
return integer

addProductToCrawlerQueue() public method

Add URLs to the queue by product model
public addProductToCrawlerQueue ( Mage_Catalog_Model_Product $product ) : integer
$product Mage_Catalog_Model_Product
return integer

addUrlToCrawlerQueue() public method

Add a single URL to the queue, returns whether it was actually added to the queue or not (false if it was already in the queue)
public addUrlToCrawlerQueue ( string $url ) : boolean
$url string
return boolean

addUrlsToCrawlerQueue() public method

Add a list of URLs to the queue, returns how many unique URLs were actually added to the queue
public addUrlsToCrawlerQueue ( array $urls ) : integer
$urls array
return integer

getAllUrls() public method

Get the list of all URLs
public getAllUrls ( ) : array
return array

getAllowedRunTime() public method

Get the max execution time (or 0 if unlimited)
public getAllowedRunTime ( ) : integer
return integer

getCrawlerBatchSize() public method

Get number of urls to crawl per batch
public getCrawlerBatchSize ( ) : integer
return integer

getCrawlerClient() public method

Get the crawler http client
public getCrawlerClient ( ) : Varien_Http_Client
return Varien_Http_Client

getCrawlerDebugEnabled() public method

Get if crawler debugging is enabled
public getCrawlerDebugEnabled ( ) : boolean
return boolean

getCrawlerEnabled() public method

Get if the crawler is enabled
public getCrawlerEnabled ( ) : boolean
return boolean

getCrawlerWaitPeriod() public method

Get time in seconds to wait between url batches
public getCrawlerWaitPeriod ( ) : integer
return integer

getNextUrl() public method

Pop a URL to crawl off the queue, or null if no URLs left
public getNextUrl ( ) : string | null
return string | null

getRunTime() public method

Get the execution time used so far
public getRunTime ( ) : integer
return integer

getUrlQueue() public method

Get the current URL queue
public getUrlQueue ( ) : array
return array

Property Details

$_crawlerClient protected property

Crawler client singleton
protected Varien_Http_Client $_crawlerClient
return Varien_Http_Client