Tech:Removing an extension
If a decision has been made to remove an extension from Miraheze—for example, because it is unmaintained, incompatible with the current MediaWiki version, or any other valid reason—the following procedure should be followed. Any user may submit a pull request to remove an extension, but only a Technology team member with appropriate access can merge and deploy the change.
Gathering community feedback
If an extension is about to be removed due to a perceived lack of community interest, consider asking for feedback on a subpage of Tech:Noticeboard. Affected wikis should be made aware via the NotifyWikiUsers script in MirahezeMagic. This will also give them some time to migrate to other solutions before the extension is removed.
The detailed steps of sending notifications is as follows:
sudo -u www-data mkdir /tmp/exts- For each extension, run
sudo -u www-data php /srv/mediawiki/1.45/maintenance/run.php MirahezeMagic:GenerateExtensionDatabaseList --wiki=metawiki --extension=embedvideo --directory=/tmp/exts --exclude-deletedwith the necessary modifications. - Save the following PHP script somewhere.
<?php
/**
* Merge multiple PHP array files into a single file
* Usage: php dblist_merge.php output.php input1.php input2.php [input3.php ...]
*/
if ($argc < 3) {
echo "Usage: php {$argv[0]} output.php input1.php input2.php [input3.php ...]\n";
exit(1);
}
$outputFile = $argv[1];
$inputFiles = array_slice($argv, 2);
$mergedData = [];
foreach ($inputFiles as $file) {
if (!file_exists($file)) {
echo "Warning: File '$file' does not exist, skipping...\n";
continue;
}
$data = include $file;
if (!is_array($data)) {
echo "Warning: File '$file' does not return an array, skipping...\n";
continue;
}
$mergedData = array_merge_recursive($mergedData, $data);
}
// Generate output file
$output = "<?php\n// Automatically generated\nreturn " . var_export($mergedData, true) . ";\n";
file_put_contents($outputFile, $output);
echo "Successfully merged " . count($inputFiles) . " files into '$outputFile'\n";- Run the PHP script in the previous step:
php dblist_merge.php output.php /tmp/exts/*.php - Manually remove testwiki from output.php if it exists. PTW doesn’t need to be notified.
- Run the following script:
foreachwikiindblist output.php /srv/mediawiki/1.45/maintenance/run.php MirahezeMagic:NotifyWikiUsers \
--header='Extension removal notice' \
--message='The technology team plans to remove one or more extensions currently used by your wiki. Please check the tech noticeboard on Meta to discuss.' \
--link='m:Tech:Noticeboard/Removing_extensions_for_the_MediaWiki_1.46_upgrade' \
--link-label='Discussion page' \
--group=bureaucrat \
--group=sysopRemoving an extension
The steps below must be followed in order:
- First, make sure the extension is temporarily restricted so that no new installs can occur during the removal process. To do this, follow the instructions at the Globally Disabling Extensions section.
- Run:
mwscript ManageWiki:ToggleExtension loginwiki --name=<extension> --disable --all-wikis --execute- Remove any associated settings using:
mwscript ManageWiki:PopulateWikiSettings loginwiki --setting=<setting> --remove --all-wikis --execute- Perform the last 2 steps for test151 as well.
- Delete any related configuration from the following files:
ManageWikiExtensions.phpLocalWiki.phpLocalSettings.phpGlobalSettings.php
- Note: If the extension also has entries in
ManageWikiSettings.phporManageWikiNamespaces.php, remove those as well. - Once configuration has been cleaned up, remove the extension from the
mediawiki-reposGitHub repository.
On mwtask181 and test151, also perform the following:
- Run:
sudo -u www-data rm -rf /srv/mediawiki-staging/*/{repo_path}- Deploy updates with:
mwdeploy --world --config --pull=config --l10n --extension-list --servers=all --versions=allAdditional tasks
It is not required but recommended to remove the extension from mw:Module:Used_by/data.json so that it no longer shows up as being deployed on Miraheze.
Globally Disabling Extensions
If a full removal is not appropriate (e.g., in cases of temporary security concerns), an extension can be globally disabled without deleting user configuration by adding it to the $wi::$disabledExtensions array at the end of LocalSettings.php.
This should follow the format:
'key from ManageWikiExtensions' => 'reason',- The reason may be plain text or a wikitext link to a Phorge task (e.g.,
[[phorge:T12345]]). - This disables the extension in
Special:ManageWiki/extensions, requires themanagewiki-restrictedpermission to modify it, and prevents the extension from being loaded.