Commit graph

39 commits

Author SHA1 Message Date
Umherirrender
06947613d7 maintenance: Use namespaced classes
This does not include use of MediaWiki\Maintenance\Maintenance,
assuming the maintenance scripts going into the same namespace

Change-Id: I488f95b537ce86eb5e463be7bce3653610dd13d9
2024-10-21 19:08:08 +02:00
Umherirrender
c8ec25a961 maintenance: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I7dec01892a987a87b1b79374a1c28f97d055e8fa
2024-09-13 19:29:24 +02:00
Dreamy Jazz
e7393b3cc7 Exclude boilerplate maintenance code from code coverage reports
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
2024-08-27 13:22:29 +01:00
Ebrahim Byagowi
4c270a72ac Add namespace to WikitextContent
It adds MediaWiki\Content namespace to WikitextContent
and two classes related.

Change-Id: Ib74e4c5b3edac6aa0e35d3b2093ce1d0b794cb6d
2024-08-06 17:42:51 +03:30
James D. Forrester
1d0b7ae1e2 Namespace User under \MediaWiki\User
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
2023-09-19 19:18:16 +00:00
Tim Starling
359ce91a12 Move DiffEngine and helpers to includes/libs/Diff and put them in a namespace
I will address the dependencies on MW core in a followup.

Bug: T339184
Change-Id: I892364b0c9f15c9de4cfc29c683670c172d71764
2023-06-20 15:15:13 +10:00
Matěj Suchánek
e47c441078 Fix many typos in comments
Found using IntelliJ's "Typo" code inspection.

Change-Id: I746220ebe6e1e39f6cb503390ec9053e6518cf16
2022-05-10 12:46:11 +00:00
Umherirrender
112e9f3895 parser: Fix various scalar types to match documentation
Found by phan strict checks

Change-Id: I0a1d1eeb6ee63ce8f6f6fd7dc6fe9273847609af
2022-03-14 20:20:06 +00:00
Thiemo Kreuz
e2a2a393f9 Move property initialisation out of the constructor
When the value is a constant, the initialization can be done
way up together with the property declaration. I believe
this makes the code easier to read because it's not spread
out so much.

Change-Id: I5af482feccb746c144c0f318e119165cf5a56cbe
2022-01-27 18:50:58 +00:00
Ammar Abdulhamid
c1432b39dc Remove usages of global function wfDiff()
Deprecated in 1.25 and used only by two maintenance scripts.

Bug: T249061
Change-Id: Ib20a9fbcc2b40e21bc9e99c1197991569b149b00
2020-07-22 08:00:08 +01:00
DannyS712
883469ad6f Fix parameter documentation for dump methods for handling revisions
The only caller passes a WikiRevision, which does not extend the
Revision class; the parameter is a WikiRevision, not a Revision

Bug: T246284
Change-Id: Iaf25b692e6093eab6e12439864bae97c96a3b9db
2020-05-05 02:04:32 +00:00
C. Scott Ananian
83a22b7fcd Remove codepaths which ran parser in 'untidy' mode
Disabling tidy has been deprecated since 1.33.  This cleans up the code
paths which still used untidy output.

Bug: T198214
Change-Id: I821ef3b8f59b272d983583d407b2f0794fe1e791
2020-04-13 21:34:04 +00:00
Umherirrender
b4fe9c4bcc Set method visibility on maintenance scripts
Change-Id: I44c82fbe65e1d002803ce065df6563f06dd39cd4
2019-11-16 22:54:17 +00:00
Daimona Eaytoy
5d40cff293 maintenance: Explicitly declare all used properties
All uses were checked with codesearch, and the visibility was chosen as
strict as possible.

Change-Id: I56666299cc04ccc418e05949422876583982eb3c
2019-09-09 09:47:41 +00:00
Daimona Eaytoy
c659bc6308 Unsuppress another phan issue (part 7)
Bug: T231636
Depends-On: I2cd24e73726394e3200a570c45d5e86b6849bfa9
Depends-On: I4fa3e6aad872434ca397325ed7a83f94973661d0
Change-Id: Ie6233561de78457cae5e4e44e220feec2d1272d8
2019-09-03 17:19:21 +00:00
Bill Pirkle
d993f499ee Refactor calls to deprecated function Content::getNativeData()
Function Content::getNativeData() was deprecated.  Replace with
calls to new function TextContent::getText() in most places.

Bug: T155582
Change-Id: I2bd508c72aac4faf474ba45ab1f92e2e8d2eb9be
2019-02-15 17:48:01 +00:00
C. Scott Ananian
6f8431c4f5 Hard-deprecate the $wgUseTidy option
This has been soft-deprecated since MW 1.26; this hard-deprecation
sets the stage for future removal of this old cruft.

Bug: T198214
Depends-On: Idf246d05d116f63a73105b50a1929a7721fbe7b9
Change-Id: I2e7d990da1da378eb6e828d4b3c0f5a41791dd92
2018-09-20 11:08:40 -04:00
Umherirrender
ad776c7d5f Use ::class to resolve class names in maintenance scripts
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
2018-01-23 17:40:16 +00:00
Bryan Davis
9e34eeff23 Maintenance: add fatalError() method
Deprecate the second argument to Maintenance::error() in favor of a new
Maintenance::fatalError() method. This is intended to make it easier to
review flow control in maintenance scripts.

Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
2017-11-21 21:34:16 -07:00
Max Semenik
59db24e90b Use addDescription() instead of accessing mDescription directly
Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
2016-01-30 01:28:32 -08:00
Siebrand Mazeland
f2f31fadc7 Update formatting in maintenance/ (2/4)
Change-Id: I2b791d3bff0de464b6bdaaeae0622c065389c31c
2014-04-23 20:08:42 +02:00
Siebrand Mazeland
752c708149 Pass phpcs-strict on maintenance/ (6/8)
Change-Id: Icefd7660072aedb963fe3082ec40fb8ffcfd6286
2014-04-23 09:27:41 +00:00
umherirrender
e78776373e Fixed some @params documentation (maintenance)
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
2014-04-17 22:48:32 +02:00
Ladsgroup
16a5102765 Change URLs to mediawiki.org in comments to HTTPS
These are only documentation fixes
http://www.mediawiki.org --> https://www.mediawiki.org

Change-Id: I62ad42be1a3aac410cc53e98ce79389ceddd8988
2014-03-20 16:59:46 +00:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
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
2013-05-21 23:26:28 +02:00
Timo Tijhof
50e7985d4d phpcs: Fix WhiteSpace.LanguageConstructSpacing warnings
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
2013-05-09 05:56:26 +02:00
umherirrender
b114f5e1c1 Fixed some spacing in maintenance folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I9657f72996358f8c1c154cea1ea97970d973723c
2013-04-18 20:48:44 +02:00
daniel
ff03cf38cc get rid of Revision::getText
Change-Id: Ia0b16813fa1688b6faccbe8ca81b1099001b1f3b
2012-09-14 18:23:21 +02:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00
Daniel Kinzler
392af46809 Revert "merged master"
This reverts commit 67bfdc7a68
2012-08-29 13:14:49 +00:00
daniel
67bfdc7a68 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 12:06:38 +02:00
Alexandre Emsenhuber
f7c4c52ba0 Improve documentation of maintenance scripts.
Change-Id: I1c911eb0fd6108fdee0b4e96363d87b926aba396
2012-06-25 21:54:41 +02:00
Niklas Laxström
2cdd7f9584 Unbreak multiple maintenance scripts 2011-06-26 15:40:14 +00:00
Sam Reed
94bf573c03 Remove some unused variables, add/improve some documentation 2011-06-01 16:27:46 +00:00
Platonides
fe36327916 Refactor the common code of compareParsers.php and preprocessDump.php into a dumpIterator.php script.
Implement a simple 'search into this dump'
2011-05-26 18:49:25 +00:00
Sam Reed
8b1bdb6e68 Remove unreachable line in DifferenceEngine
Documentation for ObjectCache.php

Remove unused variables from CompareParsers and PreprocessDump
2011-02-18 01:06:04 +00:00
Chad Horohoe
26505b170a Fix concern raised by Brion in r74108 (but has really existed since the 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().
2011-01-13 22:58:55 +00:00
Platonides
8d4a1c105f Spacing 2011-01-13 17:43:45 +00:00
Platonides
fa0c723a63 I had this parser comparer in my working copy since the summer. 2011-01-13 17:32:42 +00:00