ChangeSet
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 |
---|---|
package |
Joomla CMS |
Methods
__construct
Constructor: builds array of $changeItems by processing the .sql files in a folder.
__construct(\Joomla\Database\DatabaseDriver db, folder = null) :
The folder for the Joomla core updates is administrator/components/com_admin/sql/updates/<database>
.
since |
2.5 |
---|
Arguments
- db
DatabaseDriver
The current database object- folder
string
The full path to the folder containing the update queries
Response
mixed
check
Checks the database and returns an array of any errors found.
check() : mixed||string|int
Note these are not database errors but rather situations where the current schema is not up to date.
since |
2.5 |
---|
Response
array<string|int, mixed>
Array of errors if any.
fix
Runs the update query to apply the change to the database
fix() :
since |
2.5 |
---|
Response
void
getInstance
Returns a reference to the ChangeSet object, only creating it if it doesn't already exist.
getInstance(\Joomla\Database\DatabaseDriver db, folder = null) : \Joomla\CMS\Schema\ChangeSet
since |
2.5 |
---|
Arguments
- db
DatabaseDriver
The current database object- folder
string
The full path to the folder containing the update queries
Response
getSchema
Gets the current database schema, based on the highest version number.
getSchema() :
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.
since |
2.5 |
---|
Response
string
the schema version for the database
getStatus
Returns an array of results for this set
getStatus() : mixed||string|int
since |
2.5 |
---|
Response
array<string|int, mixed>
associative array of changeitems grouped by unchecked, ok, error, and skipped
getUpdateFiles
Get list of SQL update files for this database
getUpdateFiles() : array|bool
since |
2.5 |
---|
Response
array<string|int, mixed>|bool
list of sql update full-path names. False if directory doesn't exist
getUpdateQueries
Get array of SQL queries
getUpdateQueries(mixed||string|int sqlfiles) : mixed||string|int
since |
2.5 |
---|
Arguments
- sqlfiles
array<string|int, mixed>
Array of .sql update filenames.
Response
array<string|int, mixed>
Array of \stdClass objects where:
file=filename,
update_query = text of SQL update query
Properties
db
DatabaseDriver object
since |
2.5 |
---|
Type(s)
DatabaseDriver
folder
Folder where SQL update files will be found
since |
2.5 |
---|
Type(s)
string