aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/namespaceDupes.php
Commit message (Collapse)AuthorAgeFilesLines
...
* Make use of array deconstruction directly in foreach, if possibleThiemo Kreuz2020-11-121-2/+1
| | | | | | | | | | | Deconstructing non-sparse, numerically indexed arrays directly in foreach (a.k.a. using the list() syntax in foreach) is possible since PHP 5.5. The possibility to use string array keys as well as non-sequential numeric keys in array deconstruction was added in PHP 7.1. Change-Id: I56a48552a45f61cedc291b306cad8548fc70d485
* Make use of native array_column() function where possibleThiemo Kreuz2020-11-111-9/+2
| | | | Change-Id: I78108e7dc5a10d892e97b0101c1b72cb8d363e97
* Replace wfWaitForSlaves() with LBFactory::waitForReplication()Reedy2020-05-021-2/+4
| | | | Change-Id: I337147d61e2ec686a8672d0340dff4b6783f78cd
* namespaceDupes.php: Delete links if they still exist after UPDATEReedy2020-05-011-16/+82
| | | | | Bug: T226036 Change-Id: I4db32efdb10bb51b87e5e2116888655e7341b82d
* Hard deprecate Revision::newFromPageIdPetr Pchelko2020-03-181-2/+5
| | | | | | Bug: T246284 Depends-On: I955d9c3478eb5278bdc807d11aab04e8e051d22f Change-Id: I01ac581234980c6e7dbf916558c231ab648cbbae
* languages: Move default $wgNamespaceAliases to MessagesEn.phpTimo Tijhof2020-03-141-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are not configuration but business logic, similar to the canonical names that are in NamespaceInfo.php, these must always exist and cannot be altered or unset. They were previously unconditionally assigned during all requests in Setup.php and passed down as "site configuration". Changes: * Move them to MessagesEn.php where they can be cached and processed the same way as other core-provided aliases. Document and confirm with tests that this is a mergeable attribute that follows the language chain. * Remove the duplicated code in a few places that was reading this variable + Language::getNamespaceAliases(), to instead just call the latter and move the logic there, centralised, and tested. In doing so I noticed that these were applied in an inconsistent order. Sometimes the config won, sometimes not. There's no obvious right or wrong way here, but I've chosen to standardise on the way that Language::getNamespaceIds() did it, which is that config wins. This because that method seems to be most widely used of the three (it decides how URLs and titles are parsed), and thus the one I least want to change the behaviour of. * Document that $wgNamespaceAliases may only be used to define (extra) aliases, it is and never was a way to access the complete list of aliases. Bug: T189966 Change-Id: Ibb14181aba8c1b509264ed40523e9ab4000fd71a
* Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUseJames D. Forrester2020-01-101-1/+1
| | | | Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
* Improve param docsUmherirrender2019-11-281-3/+3
| | | | Change-Id: I746a69f6ed01c3ff000da125457df62b02d13b34
* Use Maintenance::getConfig in some maintenance scriptsUmherirrender2019-09-011-4/+3
| | | | | | This avoid global state Change-Id: Id67d07597159a0bd2721a381775230c3cd1d5509
* maintenance: Cleanup db code and bogus RevisionRecord constants in ↵Aaron Schulz2019-08-241-28/+28
| | | | | | NamespaceDupes Change-Id: Ie31beb183d32663b368a32e4926a3ed55456719c
* maintenance: Avoid usage of deprecated Revision::* constantsDerick Alangi2019-07-211-2/+7
| | | | | | | Update deprecated Revision::* constants to use RevisionRecord::* equivalents. Change-Id: Icae1ebb088e4efadbc7c2806127a2073d337fa05
* Type hint against IResultWrapper in maintenance classesUmherirrender2019-06-191-2/+2
| | | | Change-Id: I6a58e9cfe645056a854c80b2db1e71fb59bd226b
* Mass conversion to NamespaceInfoAryeh Gregor2019-05-071-4/+11
| | | | Change-Id: I2fef157ceec772f304c0923a1cd8c0eef2e82a0f
* Mass conversion of $wgContLang to serviceAryeh Gregor2018-08-111-12/+13
| | | | | | | Brought to you by vim macros. Bug: T200246 Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
* Use PHP 7 '<=>' operator in 'sort()' callbacksBartosz Dziewoński2018-05-301-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | `$a <=> $b` returns `-1` if `$a` is lesser, `1` if `$b` is lesser, and `0` if they are equal, which are exactly the values 'sort()' callbacks are supposed to return. It also enables the neat idiom `$a[x] <=> $b[x] ?: $a[y] <=> $b[y]` to sort arrays of objects first by 'x', and by 'y' if they are equal. * Replace a common pattern like `return $a < $b ? -1 : 1` with the new operator (and similar patterns with the variables, the numbers or the comparison inverted). Some of the uses were previously not correctly handling the variables being equal; this is now automatically fixed. * Also replace `return $a - $b`, which is equivalent to `return $a <=> $b` if both variables are integers but less intuitive. * (Do not replace `return strcmp( $a, $b )`. It is also equivalent when both variables are strings, but if any of the variables is not, 'strcmp()' converts it to a string before comparison, which could give different results than '<=>', so changing this would require careful review and isn't worth it.) * Also replace `return $a > $b`, which presumably sort of works most of the time (returns `1` if `$b` is lesser, and `0` if they are equal or `$a` is lesser) but is erroneous. Change-Id: I19a3d2fc8fcdb208c10330bd7a42c4e05d7f5cf3
* Have class match filename in some maintenance scriptsKunal Mehta2018-05-231-2/+2
| | | | | | | Each of these scripts had a class name that was not referenced outside of the script file itself, and are safe to rename as a result. Change-Id: Id605aca11db51ee433baeaa998a0e33184c930ca
* Use ::class to resolve class names in maintenance scriptsUmherirrender2018-01-231-1/+1
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
* Use short type bool/int in param documentationUmherirrender2017-08-201-3/+3
| | | | | | Enable the phpcs sniffs for this and used phpcbf Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
* Remove empty lines at begin of function, if, foreach, switchUmherirrender2017-07-011-1/+0
| | | | | | Organize phpcs.xml a bit Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
* Use IDatabase type hints in /maintenanceAaron Schulz2017-04-071-3/+4
| | | | | | Relatedly, move lockTables()/unlockTables() to IMaintainableDatabase Change-Id: Ib53e9fa948deb2f9a70f0ce16c002613d0060bf9
* Move ResultWrapper subclasses to RdbmsAaron Schulz2017-03-031-1/+2
| | | | Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
* Removed deprecated usages of Interwiki methods in coreYuriy Shnitkovskiy2017-01-101-1/+2
| | | | Change-Id: Ibd25968660466c44189ccb01df1d8bec6e1b207c
* Replace DatabaseBase => Database in more placesAaron Schulz2016-09-281-1/+1
| | | | Change-Id: If37a7909056bf2c31a8228cbc84f0fbbf5f1c517
* Replace DataUpdate::doUpdates() callers in maintenance/Aaron Schulz2016-09-011-2/+2
| | | | Change-Id: I51df9f419d6ea1e822fd0eef8c5dc4c43f9855e1
* Run LinksDeletionUpdate after commit() in namespaceDupes.phpAaron Schulz2016-08-221-3/+4
| | | | | | | | This DataUpdate (or any for that matter) is not meant to be run in the same transaction as random other stuff. Bug: T143631 Change-Id: Ic40865805c26acc88e613a592b922ffb121962d2
* Namespace LinkTarget under MediaWiki\LinkerKunal Mehta2016-04-211-0/+2
| | | | | | And add a GPL file header while we're at it. Change-Id: I15a6f240124c879b21fb655ade1baaebf4f34ffd
* Many more function case mismatchesReedy2016-03-191-1/+1
| | | | Change-Id: I5d3a5eb8adea1ecbf136415bb9fd7a162633ccca
* Convert all array() syntax to []Kunal Mehta2016-02-171-40/+40
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Use LinkTarget in some namespaceDupes methodsaddshore2016-02-031-12/+12
| | | | Change-Id: I230054fab8c2e2ade9f3ef00bfd820bad2842c80
* Use addDescription() instead of accessing mDescription directlyMax Semenik2016-01-301-1/+1
| | | | Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
* Update wfGetDB calls in Maintenance scripts to use getDB()Reedy2016-01-021-1/+1
| | | | Change-Id: I9ad6745d84506b736dae94747256caac89715899
* Make maintenance scripts use beginTransaction/commitTransactionAaron Schulz2015-12-311-2/+3
| | | | Change-Id: I700437a016a40ad82951ae56d215f6dace2bb612
* namespaceDupes: Ignore duplicate key errors in link table updatesRoan Kattouw2015-11-181-1/+2
| | | | | Bug: T115824 Change-Id: I67f57f680587c2c1e00f63a268019270bf8d5f86
* Change some line comments to multi line commentsumherirrender2015-10-141-24/+25
| | | | | | | This allows empty lines inside the comment as found by the MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.EmptyComment sniff Change-Id: Iac155bbda4a84562db2b452baeae9b8973899453
* In namespaceDupes.php, fix link tablesTim Starling2015-09-071-23/+167
| | | | | | | | | | | | * Fix link destinations where a link was previously made to the pseudo-namespace. Don't do this for --source-pseudo-namespace since it only makes sense when the PDBK is essentially unchanged. * Update pl_from_namespace, il_from_namespace and tl_from_namespace when moving a page. * Run LinksDeletionUpdate::doUpdate() when deleting a page, so that referential integrity is preserved. Change-Id: I584ead93d6267d1a2928ecbcdf8a4cd8e5aeef94
* Improve namespaceDupes.phpTim Starling2015-02-131-135/+255
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | General review and improvement in service of T87645. * Add the option to add a prefix to a page on conflict, instead of a suffix. This makes it easier to find the pages after they are renamed, since [[Special:Prefixindex]] can be used. * Rename options --prefix to --source-pseudo-ns, --suffix to --add-suffix, --key to --dest-ns. * Document --source-pseudo-ns and verify that it does what I think it was meant to do, per T14371, thus allowing me to remove the "todo" note. * Add the option to do a history merge instead of a rename to resolve conflicts. * Pass around an options array instead of an ever-growing list of formal parameters. * Rename resolveConflictOn() to movePage() and remove the $table and $prefix parameters which were unused since MW 1.5. Also get rid of the usage AS in getConflicts(), most instances of which were for MW 1.4 compatibility. * Rename getConflicts() to getTargetList() since "conflict" is a misnomer. A conflict occurs between two entities, really what the code was calling an "unresolvable conflict" is actually a conflict, whereas a "resolvable conflict" is merely a page in the wrong namespace. * Add option --move-talk since checking the talk namespace doesn't make sense in the case of corruption, it only makes sense when introducing a new namespace, when a pseudo-namespace has previously been used. * Use terse, greppable output, with a single line per page. * Replace ksort() followed by asort() with a single uksort(), since I think that is what was intended. PHP's sort functions are not stable, so you can't run two different sort functions on the same array and expect to the first sort to have a predictable effect on the result. * If --fix is not given, give the same output, just don't take the action. * Refactor checkNamespace(). Move target title determination to its own function, was a mixture of SQL and a couple of lines in reportConflict(). Move alternate title determination to its own function, was mostly in resolveConflict(). Get rid of reportConflict() and resolveConflict(), do what's left of them in the main loop. Get rid of modification of page row. * Improve destination namespace calculation logic of --move-talk feature, per comments by PleaseStand. Change-Id: I49921315315e1a29c9559ba221e9903b10b73d68
* Merge "Output number of conflicts"Legoktm2015-01-241-1/+11
|\
| * Output number of conflictsSam Reed2015-01-241-1/+11
| | | | | | | | Change-Id: I1e52db4c3bc60ab41cff3f86aa565a99ffc564ef
* | Fix stdClass typo in namespaceDupes.phpSam Reed2015-01-241-1/+1
|/ | | | Change-Id: I129c0d0ad5770d3d9bcdbc1881757f3c13f37c35
* Correct variable names in @param to match method declarationsumherirrender2014-08-131-2/+2
| | | | | | | Some @param have a typo in the variable name, some @param's were in wrong order. Change-Id: Ie25806831027112b398f6f4a909c59147ac3a5fa
* Remove use of strencode() outside Database classesKevin Israel2014-06-021-25/+19
| | | | Change-Id: Idbc38d8089541e5154b2601297b429f7433fd59e
* Update formatting in maintenance/ (3/4)Siebrand Mazeland2014-04-231-2/+12
| | | | Change-Id: I4390c4ea12a6a626b0e6817b6446635116ca9fe3
* Fixed some @params documentation (maintenance)umherirrender2014-04-171-19/+21
| | | | | | | | | Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I727deec35a712de0f0c676cc87dfa661f1ee965b
* Change URLs to mediawiki.org in comments to HTTPSLadsgroup2014-03-201-1/+1
| | | | | | | These are only documentation fixes http://www.mediawiki.org --> https://www.mediawiki.org Change-Id: I62ad42be1a3aac410cc53e98ce79389ceddd8988
* Remove $wgTitle from all maintenance scriptsChad Horohoe2014-03-121-3/+0
| | | | | | | | Shouldn't be needed and aren't for any core operations. If any extension relies on these $wgTitles being set in maintenance environments those extensions are broken and should be fixed. Change-Id: Ie02a5042ab96e155d783d56d5340dd0da8e3d55c
* phpcs: More require/include is not a functionTimo Tijhof2013-05-211-1/+1
| | | | | | | | | | | | | Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81. Also updated usage in text in documentation and the installer LocalSettingsGenerator. Most of them were handled by this regex: - find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$ - replace: $1 $2; Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
* docs: Remove odd colons after @todoTimo Tijhof2013-05-151-1/+1
| | | | | | | | | | Most were this way already: https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html Ran a find/replace on the odd ones. Also made them all lower case. Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
* phpcs: Fix WhiteSpace.LanguageConstructSpacing warningsTimo Tijhof2013-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Squiz.WhiteSpace.LanguageConstructSpacing: Language constructs must be followed by a single space; expected "require_once expression" but found "require_once(expression)" It is a keyword (e.g. like `new`, `return` and `print`). As such the parentheses don't make sense. Per our code conventions, we use a space after keywords like these. We appeared to have an unwritten exception for `require` that doesn't make sense. About 60% of require/include usage was missing the space and/or had superfluous parentheses. It is as silly as print("foo") or return("foo"), it works because keywords have no significance for whitespace between it and the expression that follows, and since experessions can be wrapped in parentheses for clarity (e.g. when doing string concatenation or mathematical operations) the parenthesis before and after basiclaly just ignored. Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
* Fixed some spacing in maintenance folderumherirrender2013-04-181-5/+5
| | | | | | | Added spaces before if, foreach Added some braces for one line statements Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
* (bug 42269) namespaceDupes.php has to use the interwiki cacheumherirrender2012-12-201-3/+2
| | | | Change-Id: I8fdf3a44bef8044d064db9d4489425e20e04d004