This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
A terminating line break has not been required in wfDebug() since 2014,
however no migration was done. Some of these line breaks found their way
into LoggerInterface::debug() calls, where they mess up the formatting
of the debug log.
So, remove terminating line breaks from wfDebug() and
LoggerInterface::debug() calls.
Also:
* Fix the stripping of leading line breaks from the log header emitted
by Setup.php. This feature, accidentally broken in 2014, allows
requests to be distinguished in the log file.
* Avoid using the global variable $self.
* Move the logging of the client IP back to Setup.php. It was moved to
WebRequest in the hopes that it would not always be needed, however
$wgRequest->getIP() is now called unconditionally a few lines up in
Setup.php. This means that it is put in its proper place after the
"start request" message.
* Wrap the log header code in a closure so that variables like $name do
not leak into global scope.
* In Linker.php, remove a few instances of an unnecessary second
parameter to wfDebug().
Change-Id: I96651d3044a95b9d210b51cb8368edc76bebbb9e
This is the preferred method as it enforces read-only mode for DB_REPLICA
and handles LoadBalancer::reuseConnection() calls automatically.
Change-Id: Iab9439ba8e0810fa14c302661ed7a3534f6bfc0d
* Instead of returning all zeroes, just use zero for the
negative values in the row.
* Allow large numbers since the fields are BIGINT.
* Clean up the return types to truly be integers.
* Respect the $groups argument in SiteStatsInit::getDB().
Bug: T186947
Change-Id: I51fdc45124c12aba114540fc0ec66a3e63d61e09
* Mark method visibility
* Remove unused code/methods
* Use WAN cache process cache in pagesInNs()
* Remove "m" prefix from SiteStatsInit fields
* Avoid use of $wg variables
Change-Id: Iab4001f02c9b2e8667ca4bac033fd4f6ef272148
This makes it consistent with refresh() and avoids having two rows
on new wikis. Also make the SELECT explicitly look for row 1.
Bug: T186947
Change-Id: I4f952888bf8fecc791366a9698e46d61a4ad4ff3
* Remove unreachable code (field cannot be both null and -1)
* Avoid PHP warnings during test runs in miser mode due to
the $row field being "false".
* Init the site_stats row in unit tests to unbreak miser mode.
Change-Id: Ieb45cb3068b71e01aa12c674e0bfcf13a7f2493c
The method hits the jobrunner backend to find out how many jobs are
enqueued in each of the JobQueue. It is publicly available via the
MediaWiki API request:
/w/api.php?action=query&meta=siteinfo&siprop=statistics
That is often used by bots when querying recent changes among other and
with fast bot cause useless queries toward the jobrunner backend.
Wrap SiteStats::jobs() with a WAN cache under key SiteStats:jobscount.
Drop SiteStats::$jobs private variable that was used for in process
cache. The WAN Cache does it for us via 'pcTTL'.
That is similar to SiteStats::numberingroup().
Set TTL to one minute, which should still give fresh enough results for
public uses.
Cover that behavior with a test.
When writing tests I noticed MediaWikiTestCase generates a few jobs due
to the creation of the UTPage page:
* HTMLCacheUpdateJob to refresh backlinks (eg: history)
* RecentChangesUpdateJob which happens randomly
Pass EDIT_SUPPRESS_RC to doEditContent to prevent the first and blindly
delete entries in the recentChangesUpdate jobqueue for the second.
Change-Id: I95a272d0691d779bfee9e7a671cbab66a113dfa1
Having such comments is worse than not having them. They add zero
information. But you must read the text to understand there is
nothing you don't already know from the class and the method name.
This is similar to I994d11e. Even more trivial, because this here is
about comments that don't say anything but "constructor".
Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
wfSpecialStatistics() used a database to store the jobs. When estimating
the number of row in the `job` table, even when there is no row MySQL
would still do a single row read. Hence it erroneously returned 1.
That got fixed in 7cd0b2e0b (T12228) with a hack.
Nowadays, the functionality has been moved to SiteStats which is backed
up by a JobQueueGroup. It now returns the exact number of jobs and the
hack is no more needed. We failed to remove it when porting it to the
JobQueue system.
Change-Id: I6ef55b3dcff3e47a92e2eeeddcbae078654f815a
This feature flag was added to comply with WMF's schema change policy.
It is no longer needed now that the feature is enabled on WMF sites.
External MW installations will run update.php or manually do DB updates
as required before upgrading MW.
Bug: T162517
Change-Id: I5b532d79fd1e8b178490cf2617499ae62967de2c
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
This fixes a phpunit test error, wherein {{NUMBEROFFILES}} would give
the number of files in the host wiki, not in the temporary database,
when Scribunto was installed, due to a Scribunto phpunit data provider
calling SiteStats::pages().
Change-Id: Ic0d021a72addaa2a13a6b94fd34dccc423de3a8f
SiteStatsInits queries could be long running, and so lead to buffers
and undo table issues.
This change allows SiteStatsInits to connect to vslow host.
Bug: T131475
Change-Id: I63c643ef3cc12f38c24374592c55364ba7569a26
Also consistently use self:: instead of BagOStuff:: for constants
referenced within the BagOStuff class.
Change-Id: I20fde9fa5cddcc9e92fa6a02b05dc7effa846742
These callers don't need to do purges, but can still perfectly
take advantage of this instance over a plain BagOStuff. Namely:
* Replication and snapshot lag awareness
* Preemptive regeneration
* Easy process cache support
The idea is for there to only be one caching class/factory
to use, instead of having rules for picking which one to use.
Change-Id: I8e362df451c0c28731fc853c044c4c4b8e097f01
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.
Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.
Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
It appears not to have worked for some time, as it either calls a protected
function ($counter->refresh()) or an undefined function
($counter->update()) depending on the parameters specified.
Bug: 65214
Change-Id: Ia7d867792b84c98714ec6dbbfef09745e875c8bc
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: I0056b4a8df243cfc0c5f25378de48f7a35170aca