class vB_Template_Merge

Class to act as a wrapper for mass (data-based) template merges. Its primary usage is during a template XML import.

Properties

protected vB_Registry $registry Registry object
protected int $processed_count Number of templates processed in this invokation. This includes every template returned from the data object, even those that it decides to skip.
protected int $start_time Microtime when the merge was started. Allows for time-based loop breaking.
float $time_limit Time limit (in seconds) to limit a merge run to. Use this to paginate the merging process.
bool $show_output Controls whether text should be output during the merge process.
string $merge_version Sets the version written to the template when a successful merge happens.

Methods

__construct(vB_Registry $registry)

Constructor.

bool
merge_templates(vB_Template_Merge_Data $data, array $output)

Actively merge the set of templates matched by the data object.

merge_start()

Merge setup method. By default, simply starts the timer.

bool
break_merge_early()

Determines whether the merge process should be broken early.

merge_success(string $merged_text, array $template_info)

Called when a merge succeeds (no conflicts).

output_merge_success(string $merged_text, array $template_info)

If output is enabled, called to output info about a successful merge.

merge_conflict(array $template_info)

Called when a merge fails (conflicts).

output_merge_conflict(array $template_info)

If output is enabled, called to output info about a failed merge.

int
fetch_processed_count()

Returns the number of templates processed in this execution.

Details

at line 80
__construct(vB_Registry $registry)

Constructor.

Parameters

vB_Registry $registry Main registry object

at line 96
bool merge_templates(vB_Template_Merge_Data $data, array $output)

Actively merge the set of templates matched by the data object.

May be paginated by setting members correctly. Does not error; return value indicates whether more data needs to be processed.

Parameters

vB_Template_Merge_Data $data Potential merge candidates
array $output Output data, in array form

Return Value

bool True when all templates are processed, false when more remain

at line 157
protected merge_start()

Merge setup method. By default, simply starts the timer.

at line 167
protected bool break_merge_early()

Determines whether the merge process should be broken early.

Return Value

bool True to break early, false to continue

at line 183
protected merge_success(string $merged_text, array $template_info)

Called when a merge succeeds (no conflicts).

Parameters

string $merged_text Final merged text
array $template_info Array of template info. Record returned by data method.

at line 242
protected output_merge_success(string $merged_text, array $template_info)

If output is enabled, called to output info about a successful merge.

Parameters

string $merged_text Final merged text
array $template_info Array of template info. Record returned by data method.

at line 263
protected merge_conflict(array $template_info)

Called when a merge fails (conflicts).

Parameters

array $template_info Array of template info. Record returned by data method.

at line 288
protected output_merge_conflict(array $template_info)

If output is enabled, called to output info about a failed merge.

Parameters

array $template_info Array of template info. Record returned by data method.

at line 309
int fetch_processed_count()

Returns the number of templates processed in this execution.

Return Value

int