class vB_SiteMapRunner_Cron extends vB_SiteMapRunner

Sitemap runner that uses cron-specific checks and triggers.

Properties

protected vB_Registry $registry The vBulletin registry object from vB_SiteMapRunner
protected array $session The current sitemap runner session. Tracks progress across pages. from vB_SiteMapRunner
protected bool|null $environment_ok Stores if the environment is ok for execution. from vB_SiteMapRunner
bool $is_finished If the entire sitemap generation process is known to be finished. from vB_SiteMapRunner
string $written_filename Name of the written out filename from vB_SiteMapRunner
protected array $cron_item Information about the cron item that triggers the sitemap builds.
protected array $build_info Information about the cron-triggered sitemap builds (particularly last build time).

Methods

__construct(vB_Registry $registry)

Constructor. Fetches session (via parent) and populates build_info.

static array
fetch_session_from_db(vB_Registry $registry)

Fetches the session info for this run from the database.

array
fetch_session()

Fetches the current, "in progress" session. This may differ from the state in the DB if changes are pending.

array
check_environment()

Check that the environment is ok for building the sitemap.

array
check_environment_internal()

Internal function for checking the environment. Checks cron-specific items like being enabled and the last build time.

bool
generate()

Generates one "page" worth of a sitemap and prepares for the next page or finalizes.

set_state()

Sets the session state to running and updates the last build time if necessary.

static vB_Sitemap
get_content_handler($type, vB_Registry $registry)

Fetches the handler class for a particular type of content.

boolean
write_sitemap(vB_Sitemap $sitemap_obj)

Writes out the sitemap file for the current content.

boolean
is_finished(vB_Sitemap $sitemap_obj)

Determines if the sitemap generation is finished. This manipulates the session and helps prepare for the next page.

step_content_type_forward()

Moves forward to the next content type.

boolean
finalize(vB_Sitemap $sitemap_obj)

Finalizes the sitemap build by writing an index and contacting the selected search engines.

boolean
prepare_next_page()

Prepares for the next "page" of building. Handles parent functions and updates the cron to run almost immediately (to allow a multi-page build to be completed quickly.

write_session()

Writes the sitemap session out. Only needed when not finished.

trigger_failure(string $error_phrase)

Triggers a failure event. This prevents the sitemap from being built any further until the error is resolved. Calling this updates the sitemap session automatically.

set_cron_item(array $cron_item)

Sets the cron item property.

Details

at line 398
__construct(vB_Registry $registry)

Constructor. Fetches session (via parent) and populates build_info.

Parameters

vB_Registry $registry Registry object

in vB_SiteMapRunner at line 73
static array fetch_session_from_db(vB_Registry $registry)

Fetches the session info for this run from the database.

Parameters

vB_Registry $registry

Return Value

array Array of session info; new session is created if needed

in vB_SiteMapRunner at line 111
array fetch_session()

Fetches the current, "in progress" session. This may differ from the state in the DB if changes are pending.

Return Value

array

in vB_SiteMapRunner at line 121
array check_environment()

Check that the environment is ok for building the sitemap.

Return Value

array Array of status information. Check 'error' key.

at line 430
protected array check_environment_internal()

Internal function for checking the environment. Checks cron-specific items like being enabled and the last build time.

Return Value

array Array of status info. Check 'error' key.

in vB_SiteMapRunner at line 164
bool generate()

Generates one "page" worth of a sitemap and prepares for the next page or finalizes.

Return Value

bool True on success

at line 460
protected set_state()

Sets the session state to running and updates the last build time if necessary.

in vB_SiteMapRunner at line 224
static vB_Sitemap get_content_handler($type, vB_Registry $registry)

Fetches the handler class for a particular type of content.

Parameters

$type
vB_Registry $registry

Return Value

vB_Sitemap Subclass of vB_Sitemap

in vB_SiteMapRunner at line 247
protected boolean write_sitemap(vB_Sitemap $sitemap_obj)

Writes out the sitemap file for the current content.

Parameters

vB_Sitemap $sitemap_obj Current sitemap object

Return Value

boolean

in vB_SiteMapRunner at line 271
protected boolean is_finished(vB_Sitemap $sitemap_obj)

Determines if the sitemap generation is finished. This manipulates the session and helps prepare for the next page.

Parameters

vB_Sitemap $sitemap_obj Current sitemap object

Return Value

boolean

in vB_SiteMapRunner at line 295
protected step_content_type_forward()

Moves forward to the next content type.

in vB_SiteMapRunner at line 311
protected boolean finalize(vB_Sitemap $sitemap_obj)

Finalizes the sitemap build by writing an index and contacting the selected search engines.

Parameters

vB_Sitemap $sitemap_obj Sitemap object

Return Value

boolean

at line 484
protected boolean prepare_next_page()

Prepares for the next "page" of building. Handles parent functions and updates the cron to run almost immediately (to allow a multi-page build to be completed quickly.

Return Value

boolean

in vB_SiteMapRunner at line 352
protected write_session()

Writes the sitemap session out. Only needed when not finished.

in vB_SiteMapRunner at line 364
protected trigger_failure(string $error_phrase)

Triggers a failure event. This prevents the sitemap from being built any further until the error is resolved. Calling this updates the sitemap session automatically.

Parameters

string $error_phrase Phrase key (in "error messages") that describes the error

at line 419
set_cron_item(array $cron_item)

Sets the cron item property.

Parameters

array $cron_item Cron item info