aboutsummaryrefslogtreecommitdiffstats
path: root/maintenance/attachLatest.php
Commit message (Collapse)AuthorAgeFilesLines
* Fix attachLatest --regenerate-all creating invalid SQL commandRedjard2025-01-061-1/+1
| | | | Change-Id: Iabb55be7b7c55dad072b53147570ae71ed382081
* maintenance: Use more of namespaced Maintenance classReedy2024-10-161-0/+1
| | | | Change-Id: I53f2e32c73c92cc3a0deee48ebe6d13329a7a0cf
* Add namespace to IDBAccessObject and DBAccessObjectUtilsJames D. Forrester2024-09-271-0/+1
| | | | | Bug: T353458 Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
* Exclude boilerplate maintenance code from code coverage reportsDreamy Jazz2024-08-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Maintenance scripts in core have bolierplate code that is added before and after the class to allow directly running the maintenance script. * Running the maintenance script directly has been deprecated since 1.40, so this boilerplate code is only to support a now deprecated method of running maintenance scripts. * This code cannot also be marked as covered, due to PHPUnit not recognising code coverage for files. * Therefore, it is best to ignore this boilerplate code in code coverage reports as it cannot be marked as covered and also is for deprecated code. What: * Wrap the boilerplate code (requiring Maintenance.php and then later defining the maintenance script class and running if the maintenance script was called directly) with @codeCoverageIgnore comments. * Some files use a different boilerplate code, however, these should also be marked as ignored for coverage for the same reason that coverage is not properly reported for files. Bug: T371167 Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
* Update name & email for bvibberBrooke Vibber2024-02-081-1/+1
| | | | | | | | | | | | | Updating name & email addresses for Brooke Vibber. Re-ran updateCredits.php as well so there are some new entries in there as well. There are a couple of files in resources/libs that will have to be changed upstream to keep tests happy, I will do patches later. :D Change-Id: I2f2e75d3fa42e8cf6de19a8fbb615bac28efcd54
* Remove more indirect calls to IDBAccessObject::READ_* constantsAmir Sarabadani2024-01-231-2/+1
| | | | | | | | | | Found via (?<!IDBAccessObject)::READ_ We are planning to deprecate and remove implementing IDBAccessObject interface just to use the constants. Bug: T354194 Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
* maintenance: Introduce getReplicaDB() and getPrimaryDB()Amir Sarabadani2024-01-181-1/+1
| | | | | | | | | | | | And start using them instead of wfGetDB(), LB/LBF connection methods or worse, $this->getDB(). $this->getDB() reuses the database object regardless of whether you're calling a replica or primary, leading to returning a replica on a primary and other way around. Bug: T330641 Change-Id: I9e2cf85ca277022284fc26b9f37db57bd12aaa81
* maintenance: Add missing parenthesis to SQL in attachLatest.phpUmherirrender2023-12-121-1/+1
| | | | | | | | | | | | Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM `revision` WHERE rev_page = 42 LIMIT 1' at line 1 Function: AttachLatest::execute Query: SELECT MAX(rev_timestamp FROM `revision` WHERE rev_page = 42 LIMIT 1 Follow-Up: Idfe83b900de3fbc6a251a5a78d8af1a4cd88970f Change-Id: Ibdb4bdc68f10f87c53ae648674c1c1729e2ba2b2
* maintenance: Begin using `Maintenance::getServiceContainer()`Derick Alangi2023-09-041-2/+1
| | | | | | | | | | | Maintenance class provides a method for getting a fresh reference of the MW services container instance. Let's make use of these in maintenance scripts now that we have it. NOTE: There are still some static methods like in refreshLinks.php that makes use of services that we can't use this method for now. Change-Id: Idba744057577896fc97c9ecf4724db27542bf01c
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* maintenance: Use $this->waitForReplication()Amir Sarabadani2022-10-241-3/+2
| | | | | | | This adds reconfiguring db pools in case a replica gets depooled Bug: T298485 Change-Id: Id052ce8ed45c51e51b071778858d27b48605bf93
* maintenance: Use SelectQueryBuilder to construct queriesDerick Alangi2022-07-191-8/+12
| | | | | | | Part 1 of migrating files in `maintenance/` from IDatabase::select() to SelectQueryBuilder. Change-Id: Idfe83b900de3fbc6a251a5a78d8af1a4cd88970f
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-1/+1
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* Replace deprecated WikiPage::factory/newFromID in maintenance scriptsUmherirrender2020-11-121-5/+6
| | | | Change-Id: I5b2d4313f986484368da9b63c9a19892c2328dae
* WikiPage::updateRevisionOn - replace uses, hard deprecate Revision useDannyS7122020-05-011-4/+3
| | | | | | | | | | | | See codesearch - only deployed call outside of core is in flaggedrevs, and already passes a RevisionRecord: https://codesearch.wmflabs.org/deployed/?q=-%3EupdateRevisionOn%5C(&i=nope&files=&repos= Also fixed a use of Revision::newFromId in orphans.php Bug: T249561 Bug: T249021 Change-Id: I5933a278de8645b7005c11026c87ae27c0373770
* Hard deprecate Revision::loadFromTimestampPetr Pchelko2020-03-251-2/+7
| | | | | | Bug: T246284 Depends-On: Ia8d49b3158baf578ccd3476d6537be36dcea7e13 Change-Id: Ic4df02a7e21d4d1c0140e0f5a985a90f66983fab
* Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNullJames D. Forrester2020-01-101-1/+1
| | | | Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
* Migrate various callers away from wfWikiId() to WikiMapAaron Schulz2019-07-121-4/+7
| | | | Change-Id: Idc2980c05873c428fb5ffa6ab89f723d33217a8e
* Make attachLatest.php wait for DB replica lagReedy2019-02-101-0/+4
| | | | Change-Id: I4f402ba772d0b0dda8360eaacf11e318f659efc0
* 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
* Convert all array() syntax to []Kunal Mehta2016-02-171-3/+3
| | | | | | | | | | 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 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
* Pass phpcs-strict on maintenance/ (8/8)Siebrand Mazeland2014-04-231-2/+2
| | | | | | Woo! Change-Id: I6c591492db363dfab81e5ddfa4a03213347ff5cb
* 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
* Add --regenerate-all optionNathan2014-03-121-1/+7
| | | | | Bug: 62565 Change-Id: I98e052120c4f64d6a11f8363fa17de9c69656183
* 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
* 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
* Use __DIR__ instead of dirname( __FILE__ )jeroendedauw2012-08-271-1/+1
| | | | | | We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :) Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
* Improve documentation of maintenance scripts.Alexandre Emsenhuber2012-06-161-2/+7
| | | | Change-Id: I328a3d42a09f2b082ebc153c2f399793e23942d7
* Use WikiPage instead of Article to call updateRevisionOn()Alexandre Emsenhuber2011-12-261-2/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/107330
* Fix concern raised by Brion in r74108 (but has really existed since the ↵Chad Horohoe2011-01-131-1/+1
| | | | | | | | | | | maintenance rewrite). Right now, including a maintenance script causes it to execute. This is bad when you want to reuse the particular class but not have it start executing all by itself. Until now, we relied on setting MW_NO_SETUP which was a) hacky, b) irreversable, and c) likely to be forgotten if you didn't use one of the wrappers like runChild(). Instead, move the freaky magic to doMaintenance and have *it* check if it's in a specific call stack that indicates this is being run from the file scope and should be executed. Rename DO_MAINTENANCE to RUN_MAINTENANCE_IF_MAIN so it's nice and clear what magic happens behind the require_once(). Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/80205
* Whitespace fixup under tha maint directory.Mark A. Hershberger2010-12-041-3/+3
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/77711
* * Standardised file description headersAlexandre Emsenhuber2010-09-051-1/+2
| | | | | | | | * added @file where needed * added file description headers where needed Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/72421
* Big commit: kill almost every freeResult() call as uselessChad Horohoe2010-08-081-1/+0
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/70686
* Stylize maintenance folder..Sam Reed2010-05-221-9/+9
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/66751
* * batch change for "while ( $row = $db->fetchObject( $res ) )" and similar ↵Alexandre Emsenhuber2009-08-171-1/+1
| | | | | | | | | to "foreach ( $res as $row )" * identation fix in nukeNS.php Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/55204
* Revert r54244 which was stupid and fix this properly. Require ↵Chad Horohoe2009-08-031-1/+1
| | | | | | | commandLine.inc/Maintenance.php using the full path every time. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/54312
* Merge maintenance-work branch (now with less errors!):Chad Horohoe2009-08-021-44/+52
| | | | | | | | | | | * Docs have been updated to indicate the standard on how to write maintenance scripts (MW.org docs will follow) Have ported vast majority of maintenance scripts to new format. Remaining ones (mostly FiveUpgrade-related) are a bit more tricky. commandLine.inc is untouched for now. Many have gotten code-style updates as well. Deleted .inc files were only used by their .php counterparts, and have been merged into single files. * (bug 11867) Lock error on redirect table when running orphans.php * (bug 16322) Allow maintenance scripts to accept DB user/pass over input or params * (bug 18566) Maintenance script to un/protect pages * initStats overhaul, now uses class SiteStatsInit. Also fixes bug 18930 Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/54225
* Revert r52336 "Merge maintenance-work branch:"Brion Vibber2009-06-241-49/+40
| | | | | | | | Seems to have broken a bunch of stuff. Don't commit giant non-critical changes that break Setup.php and all maint scripts. Thanks! Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/52340
* Merge maintenance-work branch:Chad Horohoe2009-06-241-40/+49
| | | | | | | | | | | | * (bug 16322) Allow maint scripts to accept DB user/pass over input or params if no AdminSettings.php * (bug 18768) Remove AdminSettings.php from MediaWiki core * (bug 19157) createAndPromote error on bad password * (bug 14201) Create AdminSettings.php during wiki installation, in the same way as LocalSettings.php * Introduce new Maintenance class framework and port a good number of scripts over; the ones that are left are a little more complicated. Read the docs. * Not deleting "unused" files yet, don't want to break everything at once :) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/52336
* WARNING: HUGE COMMITAlexandre Emsenhuber2008-05-201-1/+2
| | | | | | | | | | | | | | | | | | Doxygen documentation update: * Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group. * Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file. * Removed some empty comments * Removed some ?> Added following groups: * ExternalStorage * JobQueue * MaintenanceLanguage One more thing: there are still a lot of warnings when generating the doc. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/35098
* Remove ?>'s from files. They're pointless, and just asking for people to ↵Aryeh Gregor2007-06-291-1/+1
| | | | | | | mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/23531
* The war on redundant ampersand usage!Nick Jenkins2007-01-221-1/+1
| | | | | | | | | | | | * Convert "$dbw =& wfGetDB( DB_MASTER );" --> "$dbw = wfGetDB( DB_MASTER );" * convert "$skin =& $wgUser->getSkin();" --> "$skin = $wgUser->getSkin();" For the time being have not changed the function definitions of wfGetDB() or User::getSkin() [i.e. they are still both return-by-ref], so as to ensure the interface does not change for extensions [some of which may still be trying to run on PHP4 environments]. However presumably at some point this can be changed too. Also includes tiny tweak to newlines in parserTests - will show 1 rather than 2 newlines between the "Reading tests from" strings when in quiet mode. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/19598
* Use Doxygen @addtogroup instead of phpdoc @package && @subpackageAntoine Musso2007-01-201-2/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/19502
* Abolished $wgDBname as a unique wiki identifier, it doesn't work with the ↵Tim Starling2006-10-041-3/+3
| | | | | | | | | new-fangled feature we call "table prefixes". Instead use wfWikiID() for an identifier containing the DB name and the prefix if there is one, and wfMemcKey() for cache key construction. Caches for wikis with table prefixes will be lost on upgrade, caches for wikis without table prefixes will be preserved. Custom cache keys in extensions can be migrated at leisure. Extensions which write to core cache keys should be migrated ASAP, as I have done with Special:Makesysop. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/16791
* Update the FSF's address in all these GPL stub headersBrion Vibber2006-04-051-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/13489
* * s~\t+$~~Ævar Arnfjörð Bjarmason2006-01-071-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/12476
* quick hackjob to fix damages imports on wikisourceBrion Vibber2005-09-161-0/+73
page records have page_latest wrong (0); find the current rev for each such page and fix it up. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/11030