UpdateUtil
in package
UpdateUtil
Tags
Table of Contents
Methods
- check_column_type() : mixed
- column_exist() : mixed
- DefaultActionHandler() : mixed
- drop_table() : mixed
- get_constraints() : array<string|int, mixed>
- Get constraints of database table
- insert() : mixed
- migrateContentPage() : mixed
- Replace certain strings in a content page
- migrateContentPageUsingRegex() : mixed
- Replace certain data of a content page using regexp
- migrateContentPageUsingRegexCallback() : mixed
- Replace content using preg_replace_callback()
- record_count() : int
- Returns the record count for the given table name
- set_constraints() : mixed
- Set constraints to database table
- setSourceModeOnContentPage() : mixed
- sql() : ADORecordset
- Execute an SQL query
- table() : mixed
- Creates or modifies a table to the given specification.
- table_empty() : bool
- Returns true if the table is empty
- table_exist() : mixed
- table_rename() : bool
- Rename the table $table_name_old to $table_name_new
- _check_column() : mixed
- Checks the given column and ALTERS what's needed. Returns true if a change has been done.
- _colspec() : mixed
- _drop_unspecified_columns() : mixed
- _dropkey() : mixed
- _getprimaries() : array<string|int, mixed>
- Picks the primary key names (and optional key lengths) from the field specifications
- _keyspec() : mixed
- check_columns() : mixed
- check_dbtype() : mixed
- check_indexes() : mixed
- create_table() : mixed
- cry() : mixed
Methods
check_column_type()
public
static check_column_type(mixed $name, mixed $col, mixed $type) : mixed
Parameters
- $name : mixed
- $col : mixed
- $type : mixed
column_exist()
public
static column_exist(mixed $name, mixed $col) : mixed
Parameters
- $name : mixed
- $col : mixed
DefaultActionHandler()
public
static DefaultActionHandler(mixed $e) : mixed
Parameters
- $e : mixed
drop_table()
public
static drop_table(mixed $name) : mixed
Parameters
- $name : mixed
get_constraints()
Get constraints of database table
public
static get_constraints(mixed $name) : array<string|int, mixed>
Parameters
- $name : mixed
Return values
array<string|int, mixed> —constraints - Constraints definitions. This is an associative array where the keys represent the foreign keys and the values are arrays defining the constraint on the foreign keys: array( 'foreign_key' => array( 'table' => 'foreign_table', # table of foreign key constraint 'column' => 'foreign_column', # table's column of foreign key constraint 'onDelete' => 'CASCADE|SET NULL|NO ACTION|RESTRICT', # constraint action on foreign relation' delete 'onUpdate' => 'CASCADE|SET NULL|NO ACTION|RESTRICT', # constraint action on foreign relation' update ), )
insert()
public
static insert(mixed $statement) : mixed
Parameters
- $statement : mixed
migrateContentPage()
Replace certain strings in a content page
public
static migrateContentPage(int $module, string $cmd, mixed $search, mixed $replace[, string $changeVersion = null ]) : mixed
This method will replace $search with $replace in the content page(s) specified by the module ID $moduleId and CMD $cmd. If $cmd is set to NULL, the replacement will be done on every content page of the specified module. $search and $replace can either be a single string or an array of strings. $changeVersion specifies the Cloudrexx version in which the replacement should take place. Latter means that the replace will only be done if the installed Cloudrexx version is older than the one specified by $changeVersion.
Parameters
- $module : int
-
Module
- $cmd : string
-
CMD
- $search : mixed
-
Search string or array of strings
- $replace : mixed
-
Replacement string or array of strings
- $changeVersion : string = null
-
Cloudrexx version of the content page
Tags
migrateContentPageUsingRegex()
Replace certain data of a content page using regexp
public
static migrateContentPageUsingRegex(array<string|int, mixed> $criteria, mixed $pattern, mixed $replacement, mixed $subject[, string $changeVersion = null ]) : mixed
This method will do a preg_replace() on pages (filtered by $criteria) data specified by $subject using $pattern as PATTERN and $replacement as REPLACEMENT. Subject is either a string or an array referencing attributes of a page. The behaviour of $pattern and $replacement is exactly the same as implemented by preg_replace(). $changeVersion specifies the Cloudrexx version in which the replacement should take place. Latter means that the replace will only be done if the installed Cloudrexx version is older than the one specified by $changeVersion.
Parameters
- $criteria : array<string|int, mixed>
-
Argument list to filter page objects. Will be passed to Cx\Core\ContentManager\Model\Repository\PageRepository->findBy()
- $pattern : mixed
-
The pattern to search for. It can be either a string or an array with strings.
- $replacement : mixed
-
The string or an array with strings (pattern) to replace
- $subject : mixed
-
A string or array containing the name of an attribute of the page object
- $changeVersion : string = null
-
Cloudrexx version of the content page
Tags
migrateContentPageUsingRegexCallback()
Replace content using preg_replace_callback()
public
static migrateContentPageUsingRegexCallback(mixed $criteria, mixed $pattern, mixed $callback, mixed $subject[, mixed $changeVersion = null ]) : mixed
Parameters
- $criteria : mixed
- $pattern : mixed
- $callback : mixed
- $subject : mixed
- $changeVersion : mixed = null
Tags
record_count()
Returns the record count for the given table name
public
static record_count(string $table_name) : int
If the table cannot be accessed, returns null.
Parameters
- $table_name : string
-
The table name
Tags
Return values
int —The record count on success, null otherwise
set_constraints()
Set constraints to database table
public
static set_constraints(mixed $name[, mixed $constraints = array() ]) : mixed
Parameters
- $name : mixed
- $constraints : mixed = array()
setSourceModeOnContentPage()
public
static setSourceModeOnContentPage(mixed $criteria[, mixed $changeVersion = null ]) : mixed
Parameters
- $criteria : mixed
- $changeVersion : mixed = null
sql()
Execute an SQL query
public
static sql(string $statement[, array<string|int, mixed> $inputarray = false ]) : ADORecordset
Raises an Update_DatabaseException on error. Returns a recordset on success. Note that the recordset may be an empty one. You may provide a query template plus an optional input array as with ADOConnection::Execute().
Parameters
- $statement : string
-
The query string
- $inputarray : array<string|int, mixed> = false
-
The optional query parameters
Tags
Return values
ADORecordsettable()
Creates or modifies a table to the given specification.
public
static table(mixed $name, mixed $struc[, mixed $idx = array() ][, mixed $engine = 'MyISAM' ][, mixed $comment = '' ][, mixed $constraints = array() ]) : mixed
Parameters
- $name : mixed
- $struc : mixed
- $idx : mixed = array()
- $engine : mixed = 'MyISAM'
- $comment : mixed = ''
- $constraints : mixed = array()
table_empty()
Returns true if the table is empty
public
static table_empty(string $table_name) : bool
If the table cannot be accessed, returns null. Hint: call table_exists first.
Parameters
- $table_name : string
-
The table name
Tags
Return values
bool —True if the table is empty, null on error, or false
table_exist()
public
static table_exist(mixed $name) : mixed
Parameters
- $name : mixed
table_rename()
Rename the table $table_name_old to $table_name_new
public
static table_rename(string $table_name_old, string $table_name_new) : bool
Parameters
- $table_name_old : string
-
The current table name
- $table_name_new : string
-
The new table name
Tags
Return values
bool —True on success, false otherwise
_check_column()
Checks the given column and ALTERS what's needed. Returns true if a change has been done.
private
static _check_column(mixed $name, mixed $col_info, mixed $col, mixed $spec) : mixed
Parameters
- $name : mixed
- $col_info : mixed
- $col : mixed
- $spec : mixed
_colspec()
private
static _colspec(mixed $spec[, mixed $create_tbl_operation = false ]) : mixed
Parameters
- $spec : mixed
- $create_tbl_operation : mixed = false
_drop_unspecified_columns()
private
static _drop_unspecified_columns(mixed $name, mixed $struc, mixed $col_info) : mixed
Parameters
- $name : mixed
- $struc : mixed
- $col_info : mixed
_dropkey()
private
static _dropkey(mixed $table, mixed $name) : mixed
Parameters
- $table : mixed
- $name : mixed
_getprimaries()
Picks the primary key names (and optional key lengths) from the field specifications
private
static _getprimaries(array<string|int, mixed> $struc) : array<string|int, mixed>
If the "primary" element value is numeric, it is assumed to be the length of the key, and appended to the name in parentheses.
Parameters
- $struc : array<string|int, mixed>
-
The field specification array
Return values
array<string|int, mixed> —The array of primary key names
_keyspec()
private
static _keyspec(mixed $table, mixed $name, mixed $spec) : mixed
Parameters
- $table : mixed
- $name : mixed
- $spec : mixed
check_columns()
private
static check_columns(mixed $name, mixed $struc) : mixed
Parameters
- $name : mixed
- $struc : mixed
check_dbtype()
private
static check_dbtype(mixed $name, mixed $engine) : mixed
Parameters
- $name : mixed
- $engine : mixed
check_indexes()
private
static check_indexes(mixed $name, mixed $idx[, mixed $struc = null ]) : mixed
Parameters
- $name : mixed
- $idx : mixed
- $struc : mixed = null
create_table()
private
static create_table(mixed $name, mixed $struc, mixed $idx, mixed $engine[, mixed $comment = '' ]) : mixed
Parameters
- $name : mixed
- $struc : mixed
- $idx : mixed
- $engine : mixed
- $comment : mixed = ''
cry()
private
static cry(mixed $msg, mixed $sql) : mixed
Parameters
- $msg : mixed
- $sql : mixed