class vB_FilesystemXml_Template

Helper class to facilitate storing templates on the file system

Traits

Properties

protected vB_Registry $registry The vBulletin registry object
protected array $errors holds error string
protected $base_svn_url If we are not operating on a working directory we need an svn directory do the log lookups from.
protected array $productinfo Array that template information by product
protected array $templatelist Cached list of templates read from the file system
protected array $exclude List of templates to be excluded from file writes
protected boolean $enableSvnDataCache Enable local caching of svn data

Methods

__sleep()

No description

__wakeup()

No description

__construct()

Constructor - caches registry object

string
get_templatedirectory()

Gets the template directory

get_svn_template_source()

Gets the source for the svn template lookup. If an svn url is given, use that Otherwise assume that the templates are in an svn working directory.

mixed
get_xmlpath(string $product)

Returns the path to a products xml file

array
get_all_products()

Outputs an array of all products this helper class is setup up to process

set_base_svn_url($url)

No description

get_xml_list($xmlarray)

wraps empty xml element in an array (copied from adminfunctions_template

array
parse_xml_from_file(string $filename)

Takes a the file name of an xml file, and parses it into an xml object

array
get_template_xml(string $product)

Returns the parsed xml data that is pertinent to product

bool
write_template_to_file(string $name, string $text, string $product, string $version, string $username, string $datestamp, string $oldname = "", array $extra = array())

Writes a single template to the file system

delete_template_file($name)

No description

bool
write_product_to_files(string $product)

Writes an entire product's templates to the filesystem from master xml

bool
rollup_product_templates(string $product)

Rolls up all the template files for a product

bool
remove_product_templates(string $product)

Rolls up all the template files for a product

array
get_template_lists(string $product = null)

Gets all the templates from the file system and puts it into an array

get_vbulletin_template_xml($templates)

No description

get_product_template_xml($templates)

No description

get_template_list()

No description

get_svn_data($template_filenames, $minsvnversion = 1, $skip_revisions = array())

No description

array|bool
get_svn_data_from_cache(string $template_dir)

Returns cached SVN data

bool
save_svn_data_to_cache(string $template_dir, array $data, int $max_revision, int $update_count)

Saves SVN data to file cache

string|bool
get_svn_data_cache_filename(string $template_dir)

Returns the cache filename, attempting to create the directory and file if they don't exist.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 84
__construct()

Constructor - caches registry object

at line 95
string get_templatedirectory()

Gets the template directory

Return Value

string
  • path to the template directory

at line 105
protected get_svn_template_source()

Gets the source for the svn template lookup. If an svn url is given, use that Otherwise assume that the templates are in an svn working directory.

at line 124
protected mixed get_xmlpath(string $product)

Returns the path to a products xml file

Parameters

string $product
  • name of the product

Return Value

mixed
  • path to the product's xml file, false if not found

at line 142
array get_all_products()

Outputs an array of all products this helper class is setup up to process

Return Value

array
  • strings of all product names with xml files

at line 150
set_base_svn_url($url)

Parameters

$url

at line 158
protected get_xml_list($xmlarray)

wraps empty xml element in an array (copied from adminfunctions_template

Parameters

$xmlarray

at line 181
protected array parse_xml_from_file(string $filename)

Takes a the file name of an xml file, and parses it into an xml object

Parameters

string $filename
  • file name (including path) of the xml file

Return Value

array
  • parsed xml object of the file

at line 207
protected array get_template_xml(string $product)

Returns the parsed xml data that is pertinent to product

Parameters

string $product
  • the product name

Return Value

array
  • parsed xml pertinent to the product

at line 251
bool write_template_to_file(string $name, string $text, string $product, string $version, string $username, string $datestamp, string $oldname = "", array $extra = array())

Writes a single template to the file system

Parameters

string $name
  • template
string $text
  • the actual contents of the template
string $product
  • the product to which the template belongs
string $version
  • the version string
string $username
  • the username of last editor
string $datestamp
  • the datestamp of last edit
string $oldname
  • the old title if available
array $extra
  • additional attributes, such as "textonly"

Return Value

bool
  • true if successful, false otherwise

at line 337
delete_template_file($name)

Parameters

$name

at line 354
bool write_product_to_files(string $product)

Writes an entire product's templates to the filesystem from master xml

Parameters

string $product
  • product name

Return Value

bool
  • true if successful, false otherwise

at line 402
bool rollup_product_templates(string $product)

Rolls up all the template files for a product

Parameters

string $product
  • the product id

Return Value

bool
  • true if successful

at line 453
bool remove_product_templates(string $product)

Rolls up all the template files for a product

Parameters

string $product
  • the product id

Return Value

bool
  • true if successful

at line 489
protected array get_template_lists(string $product = null)

Gets all the templates from the file system and puts it into an array

Parameters

string $product
  • (Optional) the product id, returns all products by default

Return Value

array
  • information about all the templates stored in the file system

at line 577
protected get_vbulletin_template_xml($templates)

Parameters

$templates

at line 668
protected get_product_template_xml($templates)

Parameters

$templates

at line 697
get_template_list()

at line 718
get_svn_data($template_filenames, $minsvnversion = 1, $skip_revisions = array())

Parameters

$template_filenames
$minsvnversion
$skip_revisions

at line 817
protected array|bool get_svn_data_from_cache(string $template_dir)

Returns cached SVN data

Parameters

string $template_dir Path to the template directory

Return Value

array|bool Cache data or false on failure

at line 858
protected bool save_svn_data_to_cache(string $template_dir, array $data, int $max_revision, int $update_count)

Saves SVN data to file cache

Parameters

string $template_dir Path to the template directory
array $data SVN data to cache
int $max_revision Max SVN revision we have
int $update_count Number of templates that were updated

Return Value

bool Success/failure

at line 884
protected string|bool get_svn_data_cache_filename(string $template_dir)

Returns the cache filename, attempting to create the directory and file if they don't exist.

Parameters

string $template_dir Path to the template directory

Return Value

string|bool The cache path/filename or false on failure.