Commit graph

452 commits

Author SHA1 Message Date
Aaron Schulz
dcd0a3d534 Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
Use these in place of various wfWikiID() calls.

Also cleanup UserRightsProxy wiki ID variable names and removed unused
and poorly named getDBname() method.

Change-Id: Ib28889663989382d845511f8d34712b08317f60e
2018-10-29 14:53:37 -07:00
Aaron Schulz
e4558d4885 filebackend: let any specific backend value of "readOnly" override the default
Previously, only different reason strings could override, but there was
no way to override the read-only mode to being off.

Change-Id: I4266694034bfbdada90d4be96bcbc1a37f5b5409
2018-07-19 17:11:39 +01: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
Thiemo Kreuz
645d96b0e1 Fix and improve PHPDoc type hints in FileBackend and FileRepo
Change-Id: I311b4a6777946b451d70c6fdb2133dbbd73f159f
2018-04-19 10:32:09 +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
Thiemo Mättig
409da2d8b3 Remove leading backslashes from "use \…" tags
Change-Id: I494b029de089a07e3b946ee78293a12d5036f63e
2017-12-28 16:30:05 +01:00
Reedy
c16af68fb6 Replace MimeMagic::singleton() calls
Change-Id: Ieed41b5d6b0f568fe2872e7754f2feae7868fe7a
2017-11-27 02:13:51 +00:00
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Aaron Schulz
82e2c924e4 Remove "@author Aaron Schulz" annotations
Bug: T139301
Change-Id: Ib5248e8e27d60611c7373bce4b29dd5e85aa3489
2017-06-27 15:24:14 -07: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
WMDE-Fisch
ae3419f532 Replace some of the deprecated wfGetLBFactory() calls
Change-Id: I87aa0ebe273706438f1634167de8c60f51432878
2017-02-07 14:41:09 +01:00
Fomafix
202f695f67 Update weblinks in comments from HTTP to HTTPS
Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link.

Also update some defect links.

Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
2016-11-07 15:24:46 +01:00
Aaron Schulz
88aa91f84a Clean up some ObjectCache factory callers
* Use services container in more places.
* Undeprecated getLocalServerInstance() since $fallback is not
  handled elsewhere.

Change-Id: Id1fcd1c465d2d92653357523f4225f1c4d1ace2f
2016-10-03 11:44:55 -07:00
Aaron Schulz
a2dd3480da Cleanup MemcLockManager and move it to /libs
* Remove wf* function and ObjectCache dependencies.
* Use the base class session field.
* Lower physical lock structure TTL and move it to the base
  class as a constant.
* Resolve TODO about acquiring mixed lock types in one pass.
* Only mark servers down for 30 seconds in case of long-running
  scripts.

Change-Id: Icd4be407e599524cc620975d27e85666d2532b95
2016-09-30 06:33:32 -07:00
Aaron Schulz
99339b4598 Make multi-write backend "template" config work as expected
* FileBackendGroup now applies the usual config for these sub-backends,
  the same config get() applies.
* Also make sure FileBackendMultiWrite::concatenate() uses the status wrapper.

Bug: T146904
Change-Id: I1e9b5027dbac11ea9484cd16851e5db998574429
2016-09-29 13:20:06 -07:00
Aaron Schulz
51f00e3db8 Move SwiftFileBackend to /libs
Change-Id: Ied0be9891d70930caf415d75cb3b89043347f47e
2016-09-24 15:03:56 -07:00
Aaron Schulz
dc522cf0a3 Depedencency cleanups to SwiftFileBackend
* Avoid wf* function MediaWiki dependencies.
* Don't bother with getLocalClusterInstance() caching for the CLI case.
* Give FileBackend a default 'resetOutputBuffer' callback.

Change-Id: I359da1ad77c62880ea799b65cd3a16ad673a64eb
2016-09-24 02:15:32 +00:00
Aaron Schulz
1bf0390fbd Move FSFilebackend and MemoryFileBackend to /libs
Change-Id: Id38a2ef9e0e22537d0267b536f8a4dfd60c5b41d
2016-09-24 00:10:27 +00:00
Aaron Schulz
fee33df849 Remove wf* function usage from FSFileBackend
Change-Id: Iad6471724f8cdc596c755e6194da7556158e9203
2016-09-23 23:10:42 +00:00
jenkins-bot
c9cf1b2763 Merge "Move FileBackendStore and FileOp classes to /libs" 2016-09-23 22:52:46 +00:00
jenkins-bot
305499a998 Merge "Move RedisLockManager to /libs" 2016-09-23 22:09:31 +00:00
jenkins-bot
5680b24b3e Merge "Move RedisConnectionPool to /libs/redis" 2016-09-23 21:57:36 +00:00
Aaron Schulz
6e5329cd8e Move FileBackendStore and FileOp classes to /libs
Change-Id: If490f64bec282e5dfcdaf7feb1cbf46d3dce1064
2016-09-23 14:46:53 -07:00
Aaron Schulz
c796715911 Remove wfDebugLog() dependency from FileOp classes
Change-Id: Ib8ab9edd1afdb28f7444f5e13cf34a696a066234
2016-09-23 21:30:08 +00:00
jenkins-bot
5c529ac835 Merge "Add HTTPFileStreamer class" 2016-09-23 21:28:52 +00:00
Aaron Schulz
24aa72de84 Add HTTPFileStreamer class
* Move most StreamFile code to this new class
* Remove StreamFile depedency from FileBackendStore

Change-Id: I4a272ef49497b589114fc2b37ba800bc26d9161f
2016-09-23 14:22:04 -07:00
Aaron Schulz
616fabe05a Move FileBackendMultiWrite to /libs
Change-Id: I8079693a62db390028cd9f72b2bd7a81ae1164c3
2016-09-23 20:19:11 +00:00
Aaron Schulz
81a0e795ec Dependency cleanups to FileBackendStore
* Inject a PSR logger in place of wf* logging methods.
* Replace wfTimestamp() call with ConvertableTimestamp.
* Inject the Profiler object.
* Rename $wiki => $domain to avoid "wiki" mentions.
* Remove stray FSFile::extractImageSizeInfo() method.

Change-Id: I3e3a43d36506bec341dc5727b52f5f5a5d32bff5
2016-09-23 19:51:04 +00:00
Aaron Schulz
436ee31e0c Code comment and style cleanups to MysqlLockManager
Change-Id: Idf05c0c44f5f6fbb373625c0aebe015e385700ce
2016-09-23 08:01:30 +00:00
Aaron Schulz
49e0691b71 Move RedisLockManager to /libs
Change-Id: Ia476f117243cf0f6984e373d460b24db18584704
2016-09-23 00:30:47 -07:00
Aaron Schulz
10593ffaab Move RedisConnectionPool to /libs/redis
Change-Id: Ied4a85d7172ab76b90f6d9ce4d47a83c3fd7d111
2016-09-23 00:20:19 -07:00
Aaron Schulz
2073a25695 Move more LockManager classes to /libs
Change-Id: I4bfa79f430827b8717a57bb61cb7c36bc7fcb489
2016-09-22 22:26:18 -07:00
jenkins-bot
711fad668b Merge "Inject "srvCache" and local DB connections into LockManagerDB" 2016-09-23 05:13:48 +00:00
Aaron Schulz
c2acd8f642 Simplify and clean up FileBackend exceptions
Use standard exceptions for unexpected errors and remove
FileBackendException class, leaving FileBackendError. The
later is actually intended to be caught in some cases.

Change-Id: I735a525e0b14e518b2da5f18762e0f293064dfc2
2016-09-22 15:28:08 -07:00
Aaron Schulz
724b2cf912 Remove MimeMagic depedency from FSFile and move it to /libs
Change-Id: Ieaae909b49c798b6e9bed65d15961cefbdaec49b
2016-09-22 03:17:04 +00:00
jenkins-bot
53b3c5619d Merge "Migrate callers to new MWFileProps::getPropsFromPath() method" 2016-09-22 02:07:14 +00:00
Aaron Schulz
ff5abb66b4 Migrate callers to new MWFileProps::getPropsFromPath() method
* FSFile should not be responsible for handling this much logic.
* Make more MediaHandler classes aware of the fact that an object
  other than File might be passed in. Use the FSFile instead of a
  useless empty stdClass object.
* Also added more fields to FSFile::placeholderProps to make it
  more complete.

Change-Id: I9fe764b2a7261af507c6555e6a57273cf7d00d36
2016-09-22 00:33:46 +00:00
Aaron Schulz
c11e38e3db Dependency inject $wgTmpDirectory into FileBackend classes
Change-Id: I219daffa67ff672bf5bd38921f4b1ca058d96b0f
2016-09-21 04:00:49 +00:00
jenkins-bot
8afc7161ed Merge "FSFile and TempFSFile cleanups" 2016-09-20 23:21:30 +00:00
Aaron Schulz
f7e3ac3f95 FSFile and TempFSFile cleanups
* Remove wf* function dependencies. This includes wfTempDir().
  Callers now should specify the directory, though it will try to do
  most of the wfTempDir() logic anyway if they do not.
* Update callers to inject wfTempDir() so $wgTmpDirectory is used by
  TempFSFile instead of it probing to find a valid directory itself.
* Move most of the wfTempDir() logic to TempFSFile::getUsableTempDirectory().
* Remove unused getMimeType() method.

Change-Id: Idd55936b07f9448a6c90577708722b7b52b8fe66
2016-09-19 19:55:09 +00:00
Aaron Schulz
0cf832a339 Inject "srvCache" and local DB connections into LockManagerDB
* Also simplified the srvCache variable usage to be unconditional.
* The wfRandomString() call has also been replaced.

Change-Id: I17e83b17ec549906ee200bbe9eb2f0b151423e26
2016-09-19 01:30:17 -07:00
Aaron Schulz
8a573aa1f5 Move some FileBackend related classes to /libs
Change-Id: I0c3a84c2ed8b869519f4d38475a77539c24a88a8
2016-09-19 07:31:25 +00:00
Aaron Schulz
25a1651aad Make LockManager use StatusValue and move classes to /libs
Change-Id: Ifa41fc2939f3515d4a056746b0fcbff79786d25b
2016-09-19 04:34:28 +00:00
Aaron Schulz
740fcb4c58 Remove wf* function dependencies from FSLockManager
Change-Id: I52f08c6e7372ddbbcc1b5f82d505e435b01ff138
2016-09-18 13:45:56 -07:00
Aaron Schulz
c64c3ef9a8 Make Status extend StatusValue and start FileBackend update
* This avoids code duplication.
* Callers can safely start type-hinting StatusValue as well.
* Also moved the wrap() logic out of Status::__construct(), which
  only wrap() was (and should have been) using. Use "static" as
  well, so subclass behave properly.
* The docs and type-hints in /filebackend are updated as an example.
* A migration pattern is to inject a StatusValue wrapper
  into the backend and use it on all returned statuses, so MediaWiki
  will still get Status for message methods.

Change-Id: Iff9255f34870ea6b0c4b91f6ddc69eea95186aba
2016-09-17 15:45:40 -07:00
Aaron Schulz
d32b64235f Switch some callers to WaitConditionLoop
Also fixed up backwards documentation

Change-Id: I00c36aa751a79ca86a754e049a6da78cbb417b81
2016-09-08 19:29:18 -07:00
James D. Forrester
960e4d09ca Documentation: Replace misuse of 'later' when we meant 'latter'
Change-Id: I01bfdb8e0bfaa132533732873f7c840cea7935eb
2016-09-07 13:13:42 -07:00
Amir Sarabadani
381cffb980 Clean array() syntax in docs, part V
Change-Id: Ic65b7b2f1c2396246a3825c8d06d42bd6d06c37e
2016-09-05 02:44:26 +04:30
Aaron Schulz
1ba6d52141 Use WAN cache adaptiveTTL() method in FileBackendStore
Change-Id: I2e8b4e85b12c8892e8640abc63ee13b4b170645d
2016-09-02 15:59:52 -07:00