Commit graph

43 commits

Author SHA1 Message Date
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Fomafix
6866cfec37 Simplify PHP by using ?? and ?:
Also remove not necessary surrounding parentheses.

Change-Id: I0eb5c9c1bdfb09a800258379cdcefb5fd4d3d21c
2018-07-10 20:03:17 +00:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Umherirrender
a3da44c7df Change ResultWrapper to IResultWrapper in pagers and special pages
There is no need for a specific type, the interface implementation is
enough

Change-Id: I22ec4d3a9a19fc86efc9a2deb06f810695d38c85
2018-04-04 14:52:10 +02:00
Umherirrender
3124a990a2 Use ::class to resolve class names in includes files
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
2018-01-27 20:34:29 +01:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
Umherirrender
b5cddfb27b Remove empty lines at begin of function, if, foreach, switch
Organize phpcs.xml a bit

Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
2017-07-01 11:34:16 +00:00
Aaron Schulz
dd359741cc Move DB errors to Rdbms namespace
Change-Id: I463bd86123501abc68fdb78b4cda6110f7af2549
2017-04-15 10:47:41 -07:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
Eddie Greiner-Petter
4fdfe27aa6 Follow-up Improve sorting on SpecialWanted*-Pages
Change the SpecialWanted*-Pages so that they do sort
1. by the number of links to a site (as is now) and
2. alphabetically for entries which have the same number of links (new)

This is a follow-up for commit 5b15728.
The previous patch was reverted because using getOrderFields and
prefixing each order field with qc_ in fetchFromCache threw DB errors in
production. This follow-up differs in introducing a new function
getCacheOrderFields that defines order fields only for fetching from the
cache and doesn't reuse getOrderFields which is for the raw query
(without cache). It returns ['value'] by default and thus keeps the
known behaviour.

Bug: T4335
Change-Id: Ic01a3c28892c78ba9a9f0a7d665937efe87b44bd
2017-03-23 18:31:00 +00:00
jenkins-bot
0b6930c621 Merge "Revert "Improve sorting on SpecialWanted*-Pages"" 2017-03-15 20:07:49 +00:00
20after4
27bcac72e2 Revert "Improve sorting on SpecialWanted*-Pages"
This reverts commit 5b15728478. The change causes db query errors:
DBQueryError: 1054 Unknown column qc_ra.rd_namespace in order clause

Change-Id: I068beeae70037c959d42419791911c54ca9908a1
2017-03-15 19:41:55 +00:00
jenkins-bot
8151aebc68 Merge "Improve sorting on SpecialWanted*-Pages" 2017-03-09 00:25:46 +00:00
Eddie Greiner-Petter
5b15728478 Improve sorting on SpecialWanted*-Pages
Change the SpecialWanted*-Pages so that they do sort
1. by the number of links to a site (as is now) and
2. alphabetically for entries which have the same number of links (new)

Bug: T4335
Change-Id: If54cd52b69007ee81af4733a14be3fd893c4abfe
2017-03-08 17:13:55 +00:00
Timo Tijhof
3a2a707546 Clean up remaining get_class() uses
* get_class()        -> __CLASS__ (same as self::class)
* get_called_class() -> static::class
* get_class($this)   -> static::class

Change-Id: I1888a1897ecf4548a2e5a67a942e5c080dd7e3d3
2017-03-07 22:03:47 +00:00
Aaron Schulz
e01fd44388 Move ResultWrapper subclasses to Rdbms
Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
2017-03-03 00:44:41 +00:00
James D. Forrester
9635dda73a includes: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
2017-02-21 18:13:24 +00:00
Florian Schmidt
88db9249f2 Move LinkBatch operations for QueryPage to a helper function
This is easier to maintain as duplicated code everywhere.

This change also adds LinkBatch operations to specialpages, that does
not had it so far, but where it's useful.

Change-Id: I4936ecfb2be3a7709d99570c0561ab0cc9cd754f
2016-10-29 23:09:06 +02:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Ricordisamoa
e64035522d Fix and standardize Doxygen tags
* Use "@param datatype $paramname description" format

* String → string, Integer → int etc.

* @return $string → @return string

Change-Id: I860d222382cb4c5699d313b0600bd22503c8c385
2016-04-30 12:10:17 +02:00
Brian Wolff
b89e3dd182 Follow-up e33d6f45a. Fix some mistakes w/ limit on QueryPage
Fix some rather embarrassing mistakes. See comments on e33d6f45a.

Also change the behaviour when someone sets an offset higher than
max allowed. Returning a page with 0 results and broken prev/next
links is poor UI imo.

Change-Id: Ibfc983675ae0c600eeccd5e361550e9b5f96f5fd
2016-03-03 15:53:55 -05:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
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
2016-02-17 01:33:00 -08:00
Ricordisamoa
0455368c0c Stop doing $that = $this in includes/specialpage
Closures support $this as of PHP 5.4

Change-Id: Ib586150a50751873e9c3d12239f6ff8adedf70af
2016-02-11 00:29:22 +01:00
Marius Hoch
08548cbf39 Slightly simplify QueryPage::outputResults
By removing/ deprecating unused things.

Change-Id: Ib9f7439eeeb261a60903eb23f13c65038ebe4945
2016-01-03 20:46:20 +01:00
Aaron Schulz
3ab0c7d4d7 Added IDatabase::doAtomicSection() convenience method
This can replace startAtomic/endAtomic pairs.

Bug: T122115
Change-Id: I01c8e4773ec2b42dbe87a5508a10b997be103c11
2015-12-28 23:11:56 +00:00
Brian Wolff
e33d6f45a4 Make query pages not accept offset > 10000 in miser mode
Most query pages use LIMIT/OFFSET paging, which is inefficient
if someone puts an offset of a billion. Add a limit for the
max offset size that will be respected.

Bug: T107265
Change-Id: I422f9e446d1ee1aebb4057234c829192cf44b953
2015-11-03 17:03:50 -07:00
Aaron Schulz
0dbc4fc2e0 Removed used of resultObject() in QueryPage
Change-Id: I7aa6902a7e1a0c93e28b209de995976d5891cdfb
2015-09-26 10:54:43 -07:00
Thiemo Mättig
a5c9c9607e Add public keywords to the QueryPage base class
A lot more methods do not have visibility keywords. Some probably
should be private, a lot need to be protected, but all this will be
a breaking change. In this patch I'm focusing on methods that are
already used as public methods. The added public keyword is not a
breaking change because it's the default anyway.

Change-Id: I52e34209557b00f97a4e68250afbeb7647b64146
2015-07-18 14:51:07 -05:00
daniel
9f34e31d33 Allow limit and offset to be restricted in subclasses of QueryPage.php
Change-Id: Ib54b50619a0f412e53f92d48821221a243f19756
2015-06-18 19:51:10 +00:00
Vivek Ghaisas
9f5b6f5aeb Fix whitespace issues around parentheses
Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.

Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
2015-06-16 22:14:02 +03:00
Jack Phoenix
37bab4a45a Allow QueryPage subclasses to use a different "no results" message than "specialpage-empty"
Child classes wishing to show a different message, such as wikiHow's
NewArticleBoost extension, need to override showEmptyText() to display
their custom message via the appropriate OutputPage method(s).

Change-Id: If488e2c81b225eb651e52bcca0fea08b8e685286
2015-05-03 02:18:43 +03:00
Aaron Schulz
f57044aa87 Made QueryPage::preprocessResults also use the vslow group
Change-Id: If5893ef9e2a18684c8cd1ce1b6149742b392a3c3
2015-04-10 02:31:35 -07:00
Kevin Israel
74faccfa26 Change case of class names to match declarations
Found by running tests under a version of PHP patched to report
case mismatches as E_STRICT errors.

User classes:
* MIMEsearchPage
* MostlinkedTemplatesPage
* SpecialBookSources
* UnwatchedpagesPage

Internal classes:
* DOMXPath
* stdClass
* XMLReader

Did not change:
* testautoLoadedcamlCLASS
* testautoloadedserializedclass

Change-Id: Idc8caa82cd6adb7bab44b142af2b02e15f0a89ee
2014-12-19 16:01:26 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Aaron Schulz
a4a44f7731 Changed some DatabaseBase type hints to IDatabase
Change-Id: I1158c71f110b140473f56d5cbe352da1f4513ad9
2014-12-09 01:05:22 -08:00
Chad Horohoe
90d90dad6e Remove hitcounters and associated code
The hitcounter implementation in MediaWiki is flawed
and needs removal. For proper metrics, it is suggested to use
something like Piwik or Google Analytics.

RFC: https://www.mediawiki.org/wiki/Requests_for_comment/Removing_hit_counters_from_MediaWiki_core
Change-Id: I0e5006a7e8a09c800f8fa4effa9399e8afdd7a57
2014-10-20 13:01:55 -07:00
Kevin Israel
3daf61814d Remove redundant $db->resultObject() calls
DatabaseBase::query() already passes the value returned by the
database driver (usually an object or resource for SELECT queries)
through $db->resultObject(). There is no need to pass it through
the method a second time to get a ResultWrapper.

Change-Id: I5d34ab2bffb7f236d2f824b4ef0e8670f89d4599
2014-09-19 20:35:55 +00:00
jenkins-bot
30646afb36 Merge "Add Special:MediaStatistics page for file type stats" 2014-09-19 08:03:42 +00:00
Brian Wolff
e632eba946 Add Special:MediaStatistics page for file type stats
There used to be a bot on commons that did this, but it broke, and
this seems like the sort of thing that should be built in to
MediaWiki anyhow.

In order to do this, it abuses the querycache table somewhat
(Storing non-titles things in the title column).

Also changes the link on Special:Statistics for number of
uploads to link to new page. It seemed appropriate to link
to more detailed statistics instead of to Special:ListFiles.

Change-Id: I9ab768584b02a32b450d5f3981ff775ee07fecfa
2014-09-18 14:28:57 -03:00
Aaron Schulz
8abeaaf24a Made QueryPage use startAtomic() for trx handling
Change-Id: I0a2e8e05c96dbc582ecc045876497737020f441a
2014-09-16 17:29:19 -07:00
Kunal Mehta
21424161ba includes/specialpage: Use Config instead of globals (almost!)
SpecialPageFactory is very scary and will need some refactoring
to be de-globalified.

Change-Id: I1de6301e195d94faddf134a53b456029b1079ec8
2014-08-07 18:28:22 +01:00
umherirrender
e262d63d3e Remove return value from QueryPage::execute
The parent SpecialPage::execute also has no return and not all return
statements in QueryPage::execute actual return a value

Change-Id: If7a38ca5ed1107b6a5a740acae54295534950696
2014-07-27 15:48:19 +00:00
Kevin Israel
ffa3518ed5 Move QueryPage and abstract subclasses to specialpage folder
... now that f508561f7b ("Moved $wgQueryPages stuff out of the global
scope and into a function") has been merged, which eliminated hardcoding
of the pathname except in the AutoLoader.

WantedQueryPage is moved to a separate file.

Bug: 60445
Change-Id: If2019492722083819b82afa6302670b94b181098
2014-06-24 20:03:21 -04:00
Renamed from includes/QueryPage.php (Browse further)