Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe ChangeItem
+ Graphe d'héritage de ChangeItem:

Fonctions membres publiques

 __construct ($db, $file, $query)
 
 check ()
 
 fix ()
 

Fonctions membres publiques statiques

static getInstance ($db, $file, $query)
 

Champs de données

 $file = null
 
 $updateQuery = null
 
 $checkQuery = null
 
 $checkQueryExpected = 1
 
 $db = null
 
 $queryType = null
 
 $msgElements = array()
 
 $checkStatus = 0
 
 $rerunStatus = 0
 

Fonctions membres protégées

 buildCheckQuery ()
 

Description détaillée

Each object represents one query, which is one line from a DDL SQL query. This class is used to check the site's database to see if the DDL query has been run. If not, it provides the ability to fix the database by re-running the DDL query. The queries are parsed from the update files in the folder administrator/components/com_admin/sql/updates/<database>. These updates are run automatically if the site was updated using com_installer. However, it is possible that the program files could be updated without updating the database (for example, if a user just copies the new files over the top of an existing installation).

This is an abstract class. We need to extend it for each database and add a buildCheckQuery() method that creates the query to check that a DDL query has been run.

Depuis
2.5

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $db,
  $file,
  $query 
)

Constructor: builds check query and message from $updateQuery

Paramètres
DatabaseDriver$dbDatabase connector object
string$fileFull path name of the sql file
string$queryText of the sql query (one line of the file)
Depuis
2.5

Références $db, et $query.

Documentation des fonctions membres

◆ buildCheckQuery()

buildCheckQuery ( )
abstractprotected

Checks a DDL query to see if it is a known type If yes, build a check query to see if the DDL has been run on the database. If successful, the $msgElements, $queryType, $checkStatus and $checkQuery fields are populated. The $msgElements contains the text to create the user message. The $checkQuery contains the SQL query to check whether the schema change has been run against the current database. The $queryType contains the type of DDL query that was run (for example, CREATE_TABLE, ADD_COLUMN, CHANGE_COLUMN_TYPE, ADD_INDEX). The $checkStatus field is set to zero if the query is created

If not successful, $checkQuery is empty and , and $checkStatus is -1. For example, this will happen if the current line is a non-DDL statement.

Renvoie
void
Depuis
2.5

◆ check()

check ( )

Runs the check query and checks that 1 row is returned

Renvoie
integer 1 if success, -1 if skipped, -2 if check failed
Depuis
2.5

Références $rows, et Factory\getApplication().

◆ fix()

fix ( )

Runs the update query to apply the change to the database

Renvoie
void
Depuis
2.5

Références $query.

◆ getInstance()

static getInstance (   $db,
  $file,
  $query 
)
static

Returns a reference to the ChangeItem object.

Paramètres
DatabaseDriver$dbDatabase connector object
string$fileFull path name of the sql file
string$queryText of the sql query (one line of the file)
Renvoie
ChangeItem instance based on the database driver
Depuis
2.5
Exceptions

Références $class, $db, et $query.

Référencé par ChangeSet\__construct().

Documentation des champs

◆ $checkQuery

$checkQuery = null

◆ $checkQueryExpected

$checkQueryExpected = 1

◆ $checkStatus

$checkStatus = 0

◆ $db

$db = null

◆ $file

$file = null

◆ $msgElements

$msgElements = array()

◆ $queryType

$queryType = null

◆ $rerunStatus

$rerunStatus = 0

◆ $updateQuery


La documentation de cette classe a été générée à partir du fichier suivant :