Class JSchemaChangeset

Description

Contains a set of JSchemaChange objects for a particular instance of Joomla.

Each of these objects contains a DDL query that should have been run against the database when this database was created or updated. This enables the Installation Manager to check that the current database schema is up to date.

  • since: 2.5

Located in /libraries/cms/schema/changeset.php (line 26)

JObject
   |
   --JSchemaChangeset
Variable Summary
string $changeItems
string $db
string $folder
Method Summary
static JSchemaChangeSet getInstance (JDatabase $db, string $folder)
JSchemaChangeset __construct (JDatabase $db, [string $folder = null])
array check ()
void fix ()
string getSchema ()
array getStatus ()
array getUpdateFiles ()
array getUpdateQueries (array $sqlfiles)
Variables
string $changeItems = array() (line 33)

Array of JSchemaChangeItem objects

  • access: protected
string $db = null (line 40)

JDatabase object

  • access: protected
string $folder = null (line 47)

Folder where SQL update files will be found

  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static method getInstance (line 81)

Returns the existing JSchemaChangeset object if it exists.

Otherwise, it creates a new one.

  • return: The (possibly chached) instance of JSchemaChangeSet
  • since: 2.5
  • access: public
static JSchemaChangeSet getInstance (JDatabase $db, string $folder)
  • JDatabase $db: The current database object
  • string $folder: The full path to the folder containing the update queries
Constructor __construct (line 58)

Constructor: builds array of $changeItems by processing the .sql files in a folder.

The folder for the Joomla core updates is administrator/components/com_admin/sql/updates/<database>.

  • since: 2.5
  • access: public
JSchemaChangeset __construct (JDatabase $db, [string $folder = null])
  • JDatabase $db: The current database object
  • string $folder: The full path to the folder containing the update queries

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
check (line 100)

Checks the database and returns an array of any errors found.

Note these are not database errors but rather situations where the current schema is not up to date.

  • return: Array of errors if any.
  • since: 2.5
  • access: public
array check ()
fix (line 121)

Runs the update query to apply the change to the database

  • since: 2.5
  • access: public
void fix ()
getSchema (line 171)

Gets the current database schema, based on the highest version number.

Note that the .sql files are named based on the version and date, so the file name of the last file should match the database schema version in the #__schemas table.

  • return: the schema version for the database
  • since: 2.5
  • access: public
string getSchema ()
getStatus (line 137)

Returns an array of results for this set

  • return: associative array of changeitems grouped by unchecked, ok, error, and skipped
  • since: 2.5
  • access: public
array getStatus ()
getUpdateFiles (line 185)

Get list of SQL update files for this database

  • return: list of sql update full-path names
  • since: 2.5
  • access: private
array getUpdateFiles ()
getUpdateQueries (line 213)

Get array of SQL queries

  • return: Array of stdClass objects where: file=filename, update_query = text of SQL update query
  • since: 2.5
  • access: private
array getUpdateQueries (array $sqlfiles)
  • array $sqlfiles: Array of .sql update filenames.

Inherited Methods

Inherited From JObject

JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()

Documentation generated on Mon, 25 Jun 2012 13:53:01 -0500 by phpDocumentor 1.4.4