27require_once __DIR__ .
'/../../maintenance/Maintenance.php';
76 DeleteDefaultMessages::class,
77 PopulateRevisionLength::class,
78 PopulateRevisionSha1::class,
79 PopulateImageSha1::class,
80 FixExtLinksProtocolRelative::class,
81 PopulateFilearchiveSha1::class,
82 PopulateBacklinkNamespace::class,
83 FixDefaultJsonContentPages::class,
84 CleanupEmptyCategories::class,
85 AddRFCAndPMIDInterwiki::class,
86 PopulatePPSortKey::class,
87 PopulateIpChanges::class,
127 Hooks::run(
'LoadExtensionSchemaUpdates', [ $this ] );
135 global $wgExtNewTables, $wgExtNewFields, $wgExtPGNewFields,
136 $wgExtPGAlteredFields, $wgExtNewIndexes, $wgExtModifiedFields;
138 # For extensions only, should be populated via hooks
139 # $wgDBtype should be checked to specifiy the proper file
140 $wgExtNewTables = [];
141 $wgExtNewFields = [];
142 $wgExtPGNewFields = [];
143 $wgExtPGAlteredFields = [];
144 $wgExtNewIndexes = [];
145 $wgExtModifiedFields = [];
153 if ( !defined(
'MEDIAWIKI_INSTALL' ) || defined(
'MW_EXTENSIONS_LOADED' ) ) {
159 $queue = $registry->getQueue();
161 $registry->clearQueue();
164 $data = $registry->readFromQueue(
$queue );
166 if ( isset( $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
167 $hooks = $data[
'globals'][
'wgHooks'][
'LoadExtensionSchemaUpdates'];
169 if (
$vars && isset(
$vars[
'wgHooks'][
'LoadExtensionSchemaUpdates'] ) ) {
170 $hooks = array_merge_recursive( $hooks,
$vars[
'wgHooks'][
'LoadExtensionSchemaUpdates'] );
173 $wgHooks[
'LoadExtensionSchemaUpdates'] = $hooks;
174 if (
$vars && isset(
$vars[
'wgAutoloadClasses'] ) ) {
190 $class = ucfirst(
$type ) .
'Updater';
194 throw new MWException( __METHOD__ .
' called for unsupported $wgDBtype' );
213 if ( $this->maintenance->isQuiet() ) {
218 $str = htmlspecialchars( $str );
237 $this->extensionUpdates[] = $update;
250 $this->extensionUpdates[] = [
'addTable', $tableName, $sqlPath,
true ];
261 $this->extensionUpdates[] = [
'addIndex', $tableName, $indexName, $sqlPath,
true ];
273 $this->extensionUpdates[] = [
'addField', $tableName, $columnName, $sqlPath,
true ];
285 $this->extensionUpdates[] = [
'dropField', $tableName, $columnName, $sqlPath,
true ];
298 $this->extensionUpdates[] = [
'dropIndex', $tableName, $indexName, $sqlPath,
true ];
309 $this->extensionUpdates[] = [
'dropTable', $tableName, $sqlPath,
true ];
325 $sqlPath, $skipBothIndexExistWarning =
false
327 $this->extensionUpdates[] = [
332 $skipBothIndexExistWarning,
346 $this->extensionUpdates[] = [
'modifyField', $tableName, $fieldName, $sqlPath,
true ];
356 $this->extensionUpdates[] = [
'modifyTable', $tableName, $sqlPath,
true ];
367 return ( $this->db->tableExists( $tableName, __METHOD__ ) );
380 $this->postDatabaseUpdateMaintenance[] = $class;
409 $this->updatesSkipped = [];
412 $func = $funcList[0];
414 $origParams = $funcList[2];
415 call_user_func_array( $func, $arg );
417 $this->updatesSkipped[] = $origParams;
440 public function doUpdates( array $what = [
'core',
'extensions',
'stats' ] ) {
443 $what = array_flip( $what );
444 $this->skipSchema = isset( $what[
'noschema'] ) || $this->fileHandle !==
null;
445 if ( isset( $what[
'core'] ) ) {
448 if ( isset( $what[
'extensions'] ) ) {
453 if ( isset( $what[
'stats'] ) ) {
457 if ( $this->fileHandle ) {
458 $this->skipSchema =
false;
470 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
476 $func = array_shift(
$params );
477 if ( !is_array( $func ) && method_exists( $this, $func ) ) {
478 $func = [ $this, $func ];
479 } elseif ( $passSelf ) {
480 array_unshift(
$params, $this );
484 if (
$ret !==
false ) {
485 $updatesDone[] = $origParams;
486 $lbFactory->waitForReplication();
491 $this->updatesSkipped = array_merge( $this->updatesSkipped,
$updatesSkipped );
503 $row = $this->db->selectRow(
507 [
'ul_key' => $key ],
523 $values = [
'ul_key' => $key ];
525 $values[
'ul_value'] = $val;
527 $this->db->insert(
'updatelog', $values, __METHOD__,
'IGNORE' );
540 return $this->db->tableExists(
'updatelog', __METHOD__ ) &&
541 $this->db->fieldExists(
'updatelog',
'ul_value', __METHOD__ );
562 $this->
output(
"...skipping update to shared table $name.\n" );
578 global $wgExtNewFields, $wgExtNewTables, $wgExtModifiedFields,
583 foreach ( $wgExtNewTables as $tableRecord ) {
585 'addTable', $tableRecord[0], $tableRecord[1],
true
589 foreach ( $wgExtNewFields as $fieldRecord ) {
591 'addField', $fieldRecord[0], $fieldRecord[1],
592 $fieldRecord[2],
true
596 foreach ( $wgExtNewIndexes as $fieldRecord ) {
598 'addIndex', $fieldRecord[0], $fieldRecord[1],
599 $fieldRecord[2],
true
603 foreach ( $wgExtModifiedFields as $fieldRecord ) {
605 'modifyField', $fieldRecord[0], $fieldRecord[1],
606 $fieldRecord[2],
true
629 $this->db->sourceFile(
634 [ $this,
'appendLine' ]
650 if ( fwrite( $this->fileHandle,
$line ) ===
false ) {
665 protected function applyPatch( $path, $isFullPath =
false, $msg =
null ) {
666 if ( $msg ===
null ) {
667 $msg =
"Applying $path patch";
669 if ( $this->skipSchema ) {
670 $this->
output(
"...skipping schema change ($msg).\n" );
675 $this->
output(
"$msg ..." );
677 if ( !$isFullPath ) {
678 $path = $this->
patchPath( $this->db, $path );
680 if ( $this->fileHandle !==
null ) {
683 $this->db->sourceFile( $path );
685 $this->
output(
"done.\n" );
703 if ( file_exists(
"$IP/maintenance/$dbType/archives/$patch" ) ) {
704 return "$IP/maintenance/$dbType/archives/$patch";
706 return "$IP/maintenance/archives/$patch";
718 protected function addTable( $name, $patch, $fullpath =
false ) {
719 if ( !$this->
doTable( $name ) ) {
723 if ( $this->db->tableExists( $name, __METHOD__ ) ) {
724 $this->
output(
"...$name table already exists.\n" );
726 return $this->
applyPatch( $patch, $fullpath,
"Creating $name table" );
741 protected function addField( $table, $field, $patch, $fullpath =
false ) {
742 if ( !$this->
doTable( $table ) ) {
746 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
747 $this->
output(
"...$table table does not exist, skipping new field patch.\n" );
748 } elseif ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
749 $this->
output(
"...have $field field in $table table.\n" );
751 return $this->
applyPatch( $patch, $fullpath,
"Adding $field field to table $table" );
766 protected function addIndex( $table, $index, $patch, $fullpath =
false ) {
767 if ( !$this->
doTable( $table ) ) {
771 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
772 $this->
output(
"...skipping: '$table' table doesn't exist yet.\n" );
773 } elseif ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
774 $this->
output(
"...index $index already set on $table table.\n" );
776 return $this->
applyPatch( $patch, $fullpath,
"Adding index $index to table $table" );
791 protected function dropField( $table, $field, $patch, $fullpath =
false ) {
792 if ( !$this->
doTable( $table ) ) {
796 if ( $this->db->fieldExists( $table, $field, __METHOD__ ) ) {
797 return $this->
applyPatch( $patch, $fullpath,
"Table $table contains $field field. Dropping" );
799 $this->
output(
"...$table table does not contain $field field.\n" );
814 protected function dropIndex( $table, $index, $patch, $fullpath =
false ) {
815 if ( !$this->
doTable( $table ) ) {
819 if ( $this->db->indexExists( $table, $index, __METHOD__ ) ) {
820 return $this->
applyPatch( $patch, $fullpath,
"Dropping $index index from table $table" );
822 $this->
output(
"...$index key doesn't exist.\n" );
841 $skipBothIndexExistWarning, $patch, $fullpath =
false
843 if ( !$this->
doTable( $table ) ) {
848 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
849 $this->
output(
"...skipping: '$table' table doesn't exist yet.\n" );
855 if ( $this->db->indexExists( $table, $newIndex, __METHOD__ ) ) {
856 $this->
output(
"...index $newIndex already set on $table table.\n" );
857 if ( !$skipBothIndexExistWarning &&
858 $this->db->indexExists( $table, $oldIndex, __METHOD__ )
860 $this->
output(
"...WARNING: $oldIndex still exists, despite it has " .
861 "been renamed into $newIndex (which also exists).\n" .
862 " $oldIndex should be manually removed if not needed anymore.\n" );
869 if ( !$this->db->indexExists( $table, $oldIndex, __METHOD__ ) ) {
870 $this->
output(
"...skipping: index $oldIndex doesn't exist.\n" );
879 "Renaming index $oldIndex into $newIndex to table $table"
894 public function dropTable( $table, $patch =
false, $fullpath =
false ) {
895 if ( !$this->
doTable( $table ) ) {
899 if ( $this->db->tableExists( $table, __METHOD__ ) ) {
900 $msg =
"Dropping table $table";
902 if ( $patch ===
false ) {
903 $this->
output(
"$msg ..." );
904 $this->db->dropTable( $table, __METHOD__ );
905 $this->
output(
"done.\n" );
907 return $this->
applyPatch( $patch, $fullpath, $msg );
910 $this->
output(
"...$table doesn't exist.\n" );
925 public function modifyField( $table, $field, $patch, $fullpath =
false ) {
926 if ( !$this->
doTable( $table ) ) {
930 $updateKey =
"$table-$field-$patch";
931 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
932 $this->
output(
"...$table table does not exist, skipping modify field patch.\n" );
933 } elseif ( !$this->db->fieldExists( $table, $field, __METHOD__ ) ) {
934 $this->
output(
"...$field field does not exist in $table table, " .
935 "skipping modify field patch.\n" );
937 $this->
output(
"...$field in table $table already modified by patch $patch.\n" );
939 $apply = $this->
applyPatch( $patch, $fullpath,
"Modifying $field field of table $table" );
957 public function modifyTable( $table, $patch, $fullpath =
false ) {
958 if ( !$this->
doTable( $table ) ) {
962 $updateKey =
"$table-$patch";
963 if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
964 $this->
output(
"...$table table does not exist, skipping modify table patch.\n" );
966 $this->
output(
"...table $table already modified by patch $patch.\n" );
968 $apply = $this->
applyPatch( $patch, $fullpath,
"Modifying table $table" );
984 $zonePath = $repo->getZonePath(
'temp' );
985 if ( $repo->getBackend()->directoryExists( [
'dir' => $zonePath ] ) ) {
987 $status = $repo->getBackend()->secure( [
993 $this->
output(
"Set the local repo temp zone container to be private.\n" );
995 $this->
output(
"Failed to set the local repo temp zone container to be private.\n" );
1007 $this->
output(
"Purging caches..." );
1010 $this->db->delete(
'objectcache',
'*', __METHOD__ );
1019 $blobStore->clear();
1022 $this->db->delete(
'module_deps',
'*', __METHOD__ );
1023 $this->
output(
"done.\n" );
1030 $this->
output(
"...site_stats is populated..." );
1031 $row = $this->db->selectRow(
'site_stats',
'*', [
'ss_row_id' => 1 ], __METHOD__ );
1032 if ( $row ===
false ) {
1033 $this->
output(
"data is missing! rebuilding...\n" );
1034 } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) {
1035 $this->
output(
"missing ss_total_pages, rebuilding...\n" );
1037 $this->
output(
"done.\n" );
1044 # Common updater functions
1050 $activeUsers = $this->db->selectField(
'site_stats',
'ss_active_users',
'', __METHOD__ );
1051 if ( $activeUsers == -1 ) {
1052 $activeUsers = $this->db->selectField(
'recentchanges',
1053 'COUNT( DISTINCT rc_user_text )',
1054 [
'rc_user != 0',
'rc_bot' => 0,
"rc_log_type != 'newusers'" ], __METHOD__
1056 $this->db->update(
'site_stats',
1057 [
'ss_active_users' => intval( $activeUsers ) ],
1058 [
'ss_row_id' => 1 ], __METHOD__, [
'LIMIT' => 1 ]
1061 $this->
output(
"...ss_active_users user count set...\n" );
1070 "Populating log_user_text field, printing progress markers. For large\n" .
1071 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1072 "maintenance/populateLogUsertext.php.\n"
1075 $task = $this->maintenance->runChild( PopulateLogUsertext::class );
1077 $this->
output(
"done.\n" );
1087 "Populating log_search table, printing progress markers. For large\n" .
1088 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1089 "maintenance/populateLogSearch.php.\n" );
1091 $task = $this->maintenance->runChild( PopulateLogSearch::class );
1093 $this->
output(
"done.\n" );
1103 $this->
output(
"...transcache tc_time already converted.\n" );
1108 return $this->
applyPatch(
'patch-tc-timestamp.sql',
false,
1109 "Converting tc_time from UNIX epoch to MediaWiki timestamp" );
1117 if ( $this->db->fieldExists(
'categorylinks',
'cl_collation', __METHOD__ ) ) {
1118 if ( $this->db->selectField(
1125 $this->
output(
"...collations up-to-date.\n" );
1130 $this->
output(
"Updating category collations..." );
1131 $task = $this->maintenance->runChild( UpdateCollation::class );
1133 $this->
output(
"...done.\n" );
1141 if ( $this->db->tableExists(
'user_properties' ) ) {
1142 $cl = $this->maintenance->runChild( ConvertUserOptions::class,
'convertUserOptions.php' );
1144 $this->
output(
"done.\n" );
1154 if ( !$this->
doTable(
'profiling' ) ) {
1158 $profileToDb =
false;
1161 if (
$out ===
'db' ) {
1162 $profileToDb =
true;
1163 } elseif ( is_array(
$out ) && in_array(
'db',
$out ) ) {
1164 $profileToDb =
true;
1168 if ( $profileToDb && !$this->db->tableExists(
'profiling', __METHOD__ ) ) {
1169 $this->
applyPatch(
'patch-profiling.sql',
false,
'Add profiling table' );
1180 $cl = $this->maintenance->runChild(
1181 RebuildLocalisationCache::class,
'rebuildLocalisationCache.php'
1183 $this->
output(
"Rebuilding localisation cache...\n" );
1186 $this->
output(
"done.\n" );
1197 $this->
output(
"Turning off Content Handler DB fields for this part of upgrade.\n" );
1209 if ( $this->holdContentHandlerUseDB ) {
1210 $this->
output(
"Content Handler DB fields should be usable now.\n" );
1225 "Migrating comments to the 'comments' table, printing progress markers. For large\n" .
1226 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1227 "maintenance/migrateComments.php.\n"
1229 $task = $this->maintenance->runChild( MigrateComments::class,
'migrateComments.php' );
1230 $ok = $task->execute();
1231 $this->
output( $ok ?
"done.\n" :
"errors were encountered.\n" );
1245 "Migrating actors to the 'actor' table, printing progress markers. For large\n" .
1246 "databases, you may want to hit Ctrl-C and do this manually with\n" .
1247 "maintenance/migrateActors.php.\n"
1249 $task = $this->maintenance->runChild(
'MigrateActors',
'migrateActors.php' );
1250 $ok = $task->execute();
1251 $this->
output( $ok ?
"done.\n" :
"errors were encountered.\n" );
1260 if ( $this->db->fieldExists(
'archive',
'ar_text', __METHOD__ ) ) {
1261 $this->
output(
"Migrating archive ar_text to modern storage.\n" );
1262 $task = $this->maintenance->runChild( MigrateArchiveText::class,
'migrateArchiveText.php' );
1264 if ( $task->execute() ) {
1265 $this->
applyPatch(
'patch-drop-ar_text.sql',
false,
1266 'Dropping ar_text and ar_flags columns' );
1276 $info = $this->db->fieldInfo(
'archive',
'ar_rev_id', __METHOD__ );
1278 throw new MWException(
'Missing ar_rev_id field of archive table. Should not happen.' );
1280 if ( $info->isNullable() ) {
1281 $this->
output(
"Populating ar_rev_id.\n" );
1282 $task = $this->maintenance->runChild(
'PopulateArchiveRevId',
'populateArchiveRevId.php' );
1283 if ( $task->execute() ) {
1284 $this->
applyPatch(
'patch-ar_rev_id-not-null.sql',
false,
1285 'Making ar_rev_id not nullable' );
$wgCategoryCollation
Specify how category names should be sorted, when listed on a category page.
$wgSharedDB
Shared database for multiple wikis.
int $wgCommentTableSchemaMigrationStage
Comment table schema migration stage.
$wgContentHandlerUseDB
Set to false to disable use of the database fields introduced by the ContentHandler facility.
$wgLocalisationCacheConf
Localisation cache configuration.
int $wgActorTableSchemaMigrationStage
Actor table schema migration stage.
global $wgCommandLineMode
$wgAutoloadClasses['ReplaceTextHooks']
if(!defined( 'MEDIAWIKI')) $wgProfiler
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Class for handling database updates.
purgeCache()
Purge various database caches.
addExtensionTable( $tableName, $sqlPath)
Convenience wrapper for addExtensionUpdate() when adding a new table (which is the most common usage ...
getDB()
Get a database connection to run updates.
setFileAccess()
Set any .htaccess files or equivilent for storage repos.
loadExtensions()
Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates ...
addIndex( $table, $index, $patch, $fullpath=false)
Add a new index to an existing table.
array $updates
Array of updates to perform on the database.
$holdContentHandlerUseDB
Hold the value of $wgContentHandlerUseDB during the upgrade.
modifyExtensionTable( $tableName, $sqlPath)
disableContentHandlerUseDB()
Turns off content handler fields during parts of the upgrade where they aren't available.
bool $skipSchema
Flag specifying whether or not to skip schema (e.g.
populateArchiveRevId()
Populate ar_rev_id, then make it not nullable.
migrateArchiveText()
Migrate ar_text to modern storage.
addField( $table, $field, $patch, $fullpath=false)
Add a new field to an existing table.
addExtensionIndex( $tableName, $indexName, $sqlPath)
modifyTable( $table, $patch, $fullpath=false)
Modify an existing table, similar to modifyField.
doUpdates(array $what=[ 'core', 'extensions', 'stats'])
Do all the updates.
updateRowExists( $key)
Helper function: check if the given key is present in the updatelog table.
runUpdates(array $updates, $passSelf)
Helper function for doUpdates()
getCoreUpdateList()
Get an array of updates to perform on the database.
enableContentHandlerUseDB()
Turns content handler fields back on.
output( $str)
Output some text.
doLogSearchPopulation()
Migrate log params to new table and index for searching.
getPostDatabaseUpdateMaintenance()
doLogUsertextPopulation()
Populates the log_user_text field in the logging table.
getExtensionUpdates()
Get the list of extension-defined updates.
insertUpdateRow( $key, $val=null)
Helper function: Add a key to the updatelog table Obviously, only use this for updates that occur aft...
canUseNewUpdatelog()
Updatelog was changed in 1.17 to have a ul_value column so we can record more information about what ...
patchPath(IDatabase $db, $patch)
Get the full path of a patch file.
copyFile( $filename)
Append an SQL fragment to the open file handle.
string[] $postDatabaseUpdateMaintenance
Scripts to run after database update Should be a subclass of LoggedUpdateMaintenance.
renameIndex( $table, $oldIndex, $newIndex, $skipBothIndexExistWarning, $patch, $fullpath=false)
Rename an index from an existing table.
writeSchemaUpdateFile(array $schemaUpdate=[])
rebuildLocalisationCache()
Rebuilds the localisation cache.
addExtensionField( $tableName, $columnName, $sqlPath)
__construct(Database &$db, $shared, Maintenance $maintenance=null)
dropExtensionTable( $tableName, $sqlPath)
addTable( $name, $patch, $fullpath=false)
Add a new table to the database.
modifyField( $table, $field, $patch, $fullpath=false)
Modify an existing field.
doActiveUsersInit()
Sets the number of active users in the site_stats table.
dropExtensionField( $tableName, $columnName, $sqlPath)
getOldGlobalUpdates()
Before 1.17, we used to handle updates via stuff like $wgExtNewTables/Fields/Indexes.
addPostDatabaseUpdateMaintenance( $class)
Add a maintenance script to be run after the database updates are complete.
dropField( $table, $field, $patch, $fullpath=false)
Drop a field from an existing table.
doCollationUpdate()
Update CategoryLinks collation.
renameExtensionIndex( $tableName, $oldIndexName, $newIndexName, $sqlPath, $skipBothIndexExistWarning=false)
Rename an index on an extension table.
migrateActors()
Migrate actors to the new 'actor' table.
addExtensionUpdate(array $update)
Add a new update coming from an extension.
array $updatesSkipped
Array of updates that were skipped.
Database $db
Handle to the database subclass.
resource $fileHandle
File handle for SQL output.
appendLine( $line)
Append a line to the open filehandle.
dropExtensionIndex( $tableName, $indexName, $sqlPath)
Drop an index from an extension table.
initOldGlobals()
Initialize all of the old globals.
doEnableProfiling()
Enable profiling table when it's turned on.
array $extensionUpdates
List of extension-provided database updates.
checkStats()
Check the site_stats table is not properly populated.
modifyExtensionField( $tableName, $fieldName, $sqlPath)
applyPatch( $path, $isFullPath=false, $msg=null)
Applies a SQL patch.
dropIndex( $table, $index, $patch, $fullpath=false)
Drop an index from an existing table.
doUpdateTranscacheField()
Updates the timestamps in the transcache table.
dropTable( $table, $patch=false, $fullpath=false)
If the specified table exists, drop it, or execute the patch if one is provided.
migrateComments()
Migrate comments to the new 'comment' table.
getSchemaVars()
Get appropriate schema variables in the current database connection.
doTable( $name)
Returns whether updates should be executed on the database table $name.
static newForDB(Database $db, $shared=false, Maintenance $maintenance=null)
doMigrateUserOptions()
Migrates user options from the user table blob to user_properties.
Fake maintenance wrapper, mostly used for the web installer/updater.
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
static getDBTypes()
Get a list of known DB types.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
setDB(IDatabase $db)
Sets database object to be returned by getDB().
This class generates message blobs for use by ResourceLoader modules.
static singleton()
Get a RepoGroup instance.
static doAllAndCommit( $database, array $options=[])
Do all updates and commit them.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these updates(as a Java servelet could)
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
Status::newGood()` to allow deletion, and then `return false` from the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry out custom deletion actions. $tag:name of the tag $user:user initiating the action & $status:Status object. See above. 'ChangeTagsListActive':Allows you to nominate which of the tags your extension uses are in active use. & $tags:list of all active tags. Append to this array. 'ChangeTagsAfterUpdateTags':Called after tags have been updated with the ChangeTags::updateTags function. Params:$addedTags:tags effectively added in the update $removedTags:tags effectively removed in the update $prevTags:tags that were present prior to the update $rc_id:recentchanges table id $rev_id:revision table id $log_id:logging table id $params:tag params $rc:RecentChange being tagged when the tagging accompanies the action or null $user:User who performed the tagging when the tagging is subsequent to the action or null 'ChangeTagsAllowedAdd':Called when checking if a user can add tags to a change. & $allowedTags:List of all the tags the user is allowed to add. Any tags the user wants to add( $addTags) that are not in this array will cause it to fail. You may add or remove tags to this array as required. $addTags:List of tags user intends to add. $user:User who is adding the tags. 'ChangeUserGroups':Called before user groups are changed. $performer:The User who will perform the change $user:The User whose groups will be changed & $add:The groups that will be added & $remove:The groups that will be removed 'Collation::factory':Called if $wgCategoryCollation is an unknown collation. $collationName:Name of the collation in question & $collationObject:Null. Replace with a subclass of the Collation class that implements the collation given in $collationName. 'ConfirmEmailComplete':Called after a user 's email has been confirmed successfully. $user:user(object) whose email is being confirmed 'ContentAlterParserOutput':Modify parser output for a given content object. Called by Content::getParserOutput after parsing has finished. Can be used for changes that depend on the result of the parsing but have to be done before LinksUpdate is called(such as adding tracking categories based on the rendered HTML). $content:The Content to render $title:Title of the page, as context $parserOutput:ParserOutput to manipulate 'ContentGetParserOutput':Customize parser output for a given content object, called by AbstractContent::getParserOutput. May be used to override the normal model-specific rendering of page content. $content:The Content to render $title:Title of the page, as context $revId:The revision ID, as context $options:ParserOptions for rendering. To avoid confusing the parser cache, the output can only depend on parameters provided to this hook function, not on global state. $generateHtml:boolean, indicating whether full HTML should be generated. If false, generation of HTML may be skipped, but other information should still be present in the ParserOutput object. & $output:ParserOutput, to manipulate or replace 'ContentHandlerDefaultModelFor':Called when the default content model is determined for a given title. May be used to assign a different model for that title. $title:the Title in question & $model:the model name. Use with CONTENT_MODEL_XXX constants. 'ContentHandlerForModelID':Called when a ContentHandler is requested for a given content model name, but no entry for that model exists in $wgContentHandlers. Note:if your extension implements additional models via this hook, please use GetContentModels hook to make them known to core. $modeName:the requested content model name & $handler:set this to a ContentHandler object, if desired. 'ContentModelCanBeUsedOn':Called to determine whether that content model can be used on a given page. This is especially useful to prevent some content models to be used in some special location. $contentModel:ID of the content model in question $title:the Title in question. & $ok:Output parameter, whether it is OK to use $contentModel on $title. Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok. 'ContribsPager::getQueryInfo':Before the contributions query is about to run & $pager:Pager object for contributions & $queryInfo:The query for the contribs Pager 'ContribsPager::reallyDoQuery':Called before really executing the query for My Contributions & $data:an array of results of all contribs queries $pager:The ContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'ContributionsLineEnding':Called before a contributions HTML line is finished $page:SpecialPage object for contributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'ContributionsToolLinks':Change tool links above Special:Contributions $id:User identifier $title:User page title & $tools:Array of tool links $specialPage:SpecialPage instance for context and services. Can be either SpecialContributions or DeletedContributionsPage. Extensions should type hint against a generic SpecialPage though. 'ConvertContent':Called by AbstractContent::convert when a conversion to another content model is requested. Handler functions that modify $result should generally return false to disable further attempts at conversion. $content:The Content object to be converted. $toModel:The ID of the content model to convert to. $lossy: boolean indicating whether lossy conversion is allowed. & $result:Output parameter, in case the handler function wants to provide a converted Content object. Note that $result->getContentModel() must return $toModel. 'CustomEditor':When invoking the page editor Return true to allow the normal editor to be used, or false if implementing a custom editor, e.g. for a special namespace, etc. $article:Article being edited $user:User performing the edit 'DatabaseOraclePostInit':Called after initialising an Oracle database $db:the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery':Called before really executing the query for Special:DeletedContributions Similar to ContribsPager::reallyDoQuery & $data:an array of results of all contribs queries $pager:The DeletedContribsPager object hooked into $offset:Index offset, inclusive $limit:Exact query limit $descending:Query direction, false for ascending, true for descending 'DeletedContributionsLineEnding':Called before a DeletedContributions HTML line is finished. Similar to ContributionsLineEnding $page:SpecialPage object for DeletedContributions & $ret:the HTML line $row:the DB row for this line & $classes:the classes to add to the surrounding< li > & $attribs:associative array of other HTML attributes for the< li > element. Currently only data attributes reserved to MediaWiki are allowed(see Sanitizer::isReservedDataAttribute). 'DeleteUnknownPreferences':Called by the cleanupPreferences.php maintenance script to build a WHERE clause with which to delete preferences that are not known about. This hook is used by extensions that have dynamically-named preferences that should not be deleted in the usual cleanup process. For example, the Gadgets extension creates preferences prefixed with 'gadget-', and so anything with that prefix is excluded from the deletion. &where:An array that will be passed as the $cond parameter to IDatabase::select() to determine what will be deleted from the user_properties table. $db:The IDatabase object, useful for accessing $db->buildLike() etc. 'DifferenceEngineAfterLoadNewText':called in DifferenceEngine::loadNewText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before returning true from this function. $differenceEngine:DifferenceEngine object 'DifferenceEngineLoadTextAfterNewContentIsLoaded':called in DifferenceEngine::loadText() after the new revision 's content has been loaded into the class member variable $differenceEngine->mNewContent but before checking if the variable 's value is null. This hook can be used to inject content into said class member variable. $differenceEngine:DifferenceEngine object 'DifferenceEngineMarkPatrolledLink':Allows extensions to change the "mark as patrolled" link which is shown both on the diff header as well as on the bottom of a page, usually wrapped in a span element which has class="patrollink". $differenceEngine:DifferenceEngine object & $markAsPatrolledLink:The "mark as patrolled" link HTML(string) $rcid:Recent change ID(rc_id) for this change(int) 'DifferenceEngineMarkPatrolledRCID':Allows extensions to possibly change the rcid parameter. For example the rcid might be set to zero due to the user being the same as the performer of the change but an extension might still want to show it under certain conditions. & $rcid:rc_id(int) of the change or 0 $differenceEngine:DifferenceEngine object $change:RecentChange object $user:User object representing the current user 'DifferenceEngineNewHeader':Allows extensions to change the $newHeader variable, which contains information about the new revision, such as the revision 's author, whether the revision was marked as a minor edit or not, etc. $differenceEngine:DifferenceEngine object & $newHeader:The string containing the various #mw-diff-otitle[1-5] divs, which include things like revision author info, revision comment, RevisionDelete link and more $formattedRevisionTools:Array containing revision tools, some of which may have been injected with the DiffRevisionTools hook $nextlink:String containing the link to the next revision(if any) $status
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
$wgHooks['ArticleShow'][]
const MIGRATION_WRITE_NEW