class vB_SiteMapRunner

Helper class for running a multi-page sitemap generation process.

Properties

protected vB_Registry $registry The vBulletin registry object
protected array $session The current sitemap runner session. Tracks progress across pages.
protected bool|null $environment_ok Stores if the environment is ok for execution.
bool $is_finished If the entire sitemap generation process is known to be finished.
string $written_filename Name of the written out filename

Methods

__construct(vB_Registry $registry)

Constructor. Automatically sets up the session.

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. This is where specific checks should be run.

bool
generate()

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

set_state()

Sets the session state at the beginning of generating a "page".

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. This is only called when the build isn't finished.

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.

Details

at line 60
__construct(vB_Registry $registry)

Constructor. Automatically sets up the session.

Parameters

vB_Registry $registry Registry object

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

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

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 134
protected array check_environment_internal()

Internal function for checking the environment. This is where specific checks should be run.

Return Value

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

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 215
protected set_state()

Sets the session state at the beginning of generating a "page".

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

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

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

at line 295
protected step_content_type_forward()

Moves forward to the next content type.

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 342
protected boolean prepare_next_page()

Prepares for the next page. This is only called when the build isn't finished.

Return Value

boolean

at line 352
protected write_session()

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

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