Commit graph

58 commits

Author SHA1 Message Date
Umherirrender
d30b3d8926 Fix various documentation related to scalar types
Found by phan strict checks

Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
2022-03-09 20:49:51 +00:00
Timo Tijhof
f21caa41d3 externalstore: Improve overall documentation
* Consolidate various duplicate docs to the main entry point.
  Especially the duplication that followed after ExternalStoreFactory
  and ExternalStoreAccess were introduced with ExternalStore
  left as deprecated wrapper.

* Officially mark ExternalStoreFactory as internal, pointing
  to ExternalStoreAccess instead. And document why the latter exists,
  since it seems all its methods could trivially move to the factory
  class. Follows-up I40c3b553, where it was explained that the factory
  is meant to be an internal implementation detail, with the access
  class meant to resemble ExternalStoreMedium.

* Use consistent terms for "protocol", "location" and "object"
  (reduce use of words like medium, backend, type, blob, revision,
  etc. within this code).

* Document that ExternalStore is fundamentally designed as an
  append-only store (per T247383).

Bug: T247383
Change-Id: I1094af7d35a14f9e47b8791f3e4cc888e8cbfc7f
2021-12-15 02:03:47 +00:00
jenkins-bot
3690fb0f5d Merge "Use DeletePage in FileDeleteForm and fix output of ApiDelete" 2021-11-23 09:55:55 +00:00
Reedy
7bf779524a Remove or replace usages of "sanity"
Bug: T254646
Change-Id: I2b120f0b9c9e1dc1a6c216bfefa3f2463efe1001
2021-11-19 23:19:42 +00:00
Daimona Eaytoy
b77ae63e48 Use DeletePage in FileDeleteForm and fix output of ApiDelete
- Use DeletePage in FileDeleteForm instead of
  WikiPage::doDeleteArticleReal
- Properly handle scheduled deletions in FileDeleteForm: previously, a
  null status value could indicate a missing page OR a scheduled
  deletion, but the code always assumed the first, and it would generate
  a duplicated log entry. The API response would also not contain the
  "delete-scheduled" message. This has been broken since the introduction
  of scheduled deletion.
- In ApiDelete, for file deletions, check whether the status is OK not
  good. The two might be equivalent, but this way it's more consistent.
- Add some documentation for the Status objects returned by file-related
  methods. This is still incomplete, as there are many methods using
  Status and none of them says what the status could be. In particular,
  this means that for now we keep checking whether the status is OK
  instead of good, even though it's unclear what could produce a
  non-fatal error.
- In LocalFileDeleteBatch, avoid using a class property for the returned
  status, as that's hard to follow. Instead, use a local variable and
  pass it around when needed.

Bug: T288758
Change-Id: I22d60c05bdd4a3ea531e63dbb9e49efc36935137
2021-11-18 01:41:51 +01:00
James D. Forrester
20fd877da4 Drop experimental FileJournal system without deprecation
The feature was introduced in 2012 with d19f54602f (just before
the gerrit migration).

Change-Id: Ia3f59ad0ddeb1f610947b14e22b0694ff4c6ed84
2021-11-01 14:08:09 +11:00
Umherirrender
78cc6d77ff build: Swap deprecated @codingStandardsIgnore to phpcs:ignore
Bug: T278594
Change-Id: I09a6175917090593e6e0055203a890c32bea03a5
2021-04-04 21:18:22 +02:00
Umherirrender
e4d1a2c8bd Use __CLASS__/::class to define callback for array_map/_filter/usort
Change-Id: I3519dd5a1ce1ea688de602190cd74755c400c717
2021-01-22 16:39:29 +00:00
jenkins-bot
39705eb311 Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
jenkins-bot
0270990f0b Merge "Replace "@stable for calling" by "@stable to call"" 2020-07-13 09:27:04 +00:00
daniel
3c50afa46b Replace "@stable for subclassing" with "@stable to extend"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4
2020-07-13 11:00:30 +02:00
daniel
f7116bb3a2 Replace "@stable for overriding" with "@stable to override"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: I5ffbb91882ecce2019ab644839eab5e8fb8a1c5f
2020-07-13 10:57:12 +02:00
daniel
272db6afde Replace "@stable for calling" by "@stable to call"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: If560596f5e1e0a3da91afc36e656e7c27f040968
2020-07-13 08:55:28 +00:00
daniel
897aa56054 Mark file backend base classes as stable for subclassing
Bug: T247862
Change-Id: Iee9a655f29f499fb6ace6f9d5bb1e01432bd70e1
2020-07-10 00:11:50 +02:00
Reedy
07faedc8c6 Fix more libs PSR12.Properties.ConstantVisibility.NotFound
Change-Id: If3bac6b0ff6fbb89bfa2b9fa91809135a76c610b
2020-05-16 20:13:22 +00:00
Max Semenik
47f6b73231 FileBackend: Avoid undefined offset notices
While I'm at it, remove a pointless else.

Bug: T248925
Change-Id: I3107cff5aaf07779aa900e8325f30a6a44bface9
2020-05-05 20:55:33 +03:00
James D. Forrester
4f2d1efdda Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUse
Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
2020-01-10 09:32:25 -08:00
Kunal Mehta
8aa7041761 FileBackend: fix phan docs for doQuickOperations()
The current docs for $ops was wrong, because it was missing the
op/src/dst keys, and more importantly, it's not one array with those
keys, it's a list of those arrays.

Needed to make Score pass the newer version of phan.

Change-Id: If0e2c534466d5579c955a6cffbe5f89cfa275937
2020-01-01 14:31:10 +00:00
jenkins-bot
57951ea9cf Merge "100% unit test coverage for FileBackend" 2019-11-01 01:47:02 +00:00
jenkins-bot
605bf24772 Merge "docs: Convert class-level documentation files to Markdown" 2019-11-01 01:43:29 +00:00
apaskulin
80221c0aff docs: Convert class-level documentation files to Markdown
The FileRepo, FileBackend, and JobQueue classes include documentation
files that don’t appear in the generated Doxygen docs. This PR:

* Converts these files to Markdown
* Links to each file from the respective class description
* Adds an ingroup tag so the files appear in the sidebar at the
  module level
* Updates the exclude pattern in the Doxyfile to surface these pages

Bug: T87796
Change-Id: I94f0636ab489d741ab505f15da43a5d63c1ca61a
2019-10-31 11:03:13 -07:00
Aryeh Gregor
77cceb644a 100% unit test coverage for FileBackend
Bug: T234227
Change-Id: I2bfd975e9af78f4ee792d024ad7c1dd06902a284
2019-10-30 13:32:29 +02:00
Aryeh Gregor
c250d07bac Unit tests for FileBackend
Currently 62.79% coverage, 108/172 lines.

One oddity discovered during testing was that the "quick" variants of
most methods don't have an $opts parameter. It seems like just an
oversight, so I added it.

Bug: T234227
Change-Id: If2978065392cd6dcf693a588bb1ce6b5d43828f2
2019-10-30 09:35:13 +02:00
Daimona Eaytoy
9f072ed60e Fix new phan errors, part 4
Still doc-only, this ends the easy part.

Bug: T231636
Change-Id: I51f180edc57d96322b9cd46e6a32aeffcbdc3bed
2019-10-12 10:35:31 +00:00
Aaron Schulz
903f1810c8 filebackend: improve internal use of FileBackend constants
Add more result constants and split up FileBackend::UNKNOWN for
clarity. This follows up 5719815f3b, which added that constant.

Make internal FileBackendStore::doGet* methods distinguish I/O errors
from missing files; the return types of public FileBackend methods are
unchanged. Avoid process caching any mtime/size/sha1 values in the
case of I/O errors. Use error constants consistently for stat methods
when given invalid paths.

Also:
* Factor out FileBackendStore::processCacheAndPersistStatEntries() method
  to reduce significant code duplication.
* Consolidate duplicated isPathUsable() checks in FileOp subclasses to
  FileOp::precheck().
* Remove null process cache value check from FileBackend::getFileStat()
  as null values are never stored in the process cache to begin with.
* Reformat some oddly wrapped lines to look cleaner.

Change-Id: Id0e4b0da0bb2ed3184847b35142d587c7f3d953d
2019-09-03 19:31:17 -07:00
Daimona Eaytoy
327e8ea416 Unsuppress phan issues part 6
Bug: T231636
Depends-On: I50377746f01749b058c39fd8229f9d566224cc43
Change-Id: I2cd24e73726394e3200a570c45d5e86b6849bfa9
2019-09-01 09:48:45 +00:00
jenkins-bot
26d49f9426 Merge "filebackend: fix @throws comment in FileBackend::makeContentDisposition()" 2019-08-29 18:02:14 +00:00
Aaron Schulz
5719815f3b filebackend: add idiom constant to FileBackend for null results
Change-Id: I65f043e87d82192c13d3627fb45ef222f0290bf8
2019-08-29 01:19:33 -07:00
Aaron Schulz
b4640b643c filebackend: fix @throws comment in FileBackend::makeContentDisposition()
Change-Id: I653b0c9b28939a0976328ed1de6444dd38b7fa55
2019-08-28 22:32:59 -07:00
Aaron Schulz
95e68098ca filebackend: update code comments and break some long lines
Change-Id: I072e15c7c51490888284561260958e405fb061ca
2019-08-24 03:32:12 -07:00
Aryeh Gregor
a83b33582a TempFSFileFactory service
This replaces TempFSFile::factory(), which is now deprecated.

Change-Id: I9e65c3867e26c16687560dccc7d9f3e195a8bdd6
2019-08-21 16:26:05 +03:00
Aaron Schulz
5e744cbe6a filebackend: deprecate FileBackend::getWikiId()
Change-Id: Ib593178e95c572c28c873645128ef85513ef2de7
2019-08-07 14:10:37 +00:00
Aaron Schulz
81d611a808 Import PSR NullLogger instead of using absolute class references
Change-Id: Ie09170f51e203e0a4c9a780a53cc9f3829139c31
2019-07-13 23:35:52 -07:00
Aryeh Gregor
7b4489e019 Get rid of unnecessary func_get_args() and friends
HHVM does not support variadic arguments with type hints.  This is
mostly not a big problem, because we can just drop the type hint, but
for some reason PHPUnit adds a type hint of "array" when it creates
mocks, so a class with a variadic method can't be mocked (at least in
some cases).  As such, I left alone all the classes that seem like
someone might like to mock them, like Title and User.  If anyone wants
to mock them in the future, they'll have to switch back to
func_get_args().  Some of the changes are definitely safe, like
functions and test classes.

In most cases, func_get_args() (and/or func_get_arg(), func_num_args() )
were only present because the code was written before we required PHP
5.6, and writing them as variadic functions is strictly superior. In
some cases I left them alone, aside from HHVM compatibility:

* Forwarding all arguments to another function. It's useful to keep
  func_get_args() here where we want to keep the list of expected
  arguments and their meanings in the function signature line for
  documentation purposes, but don't want to copy-paste a long line of
  argument names.
* Handling deprecated calling conventions.
* One or two miscellaneous cases where we're basically using the
  arguments individually but want to use them as an array as well for
  some reason.

Change-Id: I066ec95a7beb7c0665146195a08e7cce1222c788
2019-04-12 20:17:01 +00:00
Kunal Mehta
e604abd49a Fix PhanPluginDuplicateConditional* errors (#1)
Change-Id: I61e4d4a60dda27f43debab71a9c02f14c1468311
2019-03-23 18:06:35 -07:00
Aaron Schulz
c25d8111be filebackend: change "profiler" parameter in FileBackend so it works again
The Profiler::profileIn and Profiler::profileOut methods are just stubs.
Use a callback to the Profile::scopedProfileIn method instead.

Change-Id: I7b493c145357994f61faebfbe3f65d38d2e6da42
2019-03-14 23:03:09 +00:00
Shreyas Minocha
d5b2a1621b
Fix small typos
"publically" → "publicly"

Change-Id: I712d97c0504d52c96532b4aac4f332ef39670955
2019-01-27 17:40:18 +05:30
jenkins-bot
3082005f00 Merge "Safe replacement of a lot of !count() with === []" 2019-01-16 07:03:47 +00:00
Thiemo Kreuz
65bbe6c7dc Add missing "@return StatusValue" to all abstract do… methods
All implementations do this, and all callers expect this. I wonder how
the documentation for this detail got lost?

Change-Id: If4977c9f4032ca5d93ea91f49cdc70f7ef1175ba
2019-01-15 20:03:28 +00:00
Thiemo Kreuz
734a969d55 Safe replacement of a lot of !count() with === []
This was originally a global search and replace. I manually checked all
replacements and reverted them if (due to the lack of type hints) either
null (that would be 0 when counted) or a Countable object can end in the
variable or property in question.

Now this patch only touches places where I'm sure nothing can break.

For the sanity of the honorable reviewers this patch is exclusively touching
negated counts. You should not find a single `!== []` in this patch, that
would be a mistake.

Change-Id: I5eafd4d8fccdb53a668be8e6f25a566f9c3a0a95
2019-01-15 17:28:49 +01:00
stibba
3ee7eee360 Use new ScopedCallback::newScopedIgnoreUserAbort helper function
Introduced in Ib6e307d76f93.

This patch updates FileBackend, LoadBalancer and LBFactory to use a public
function newScopedIgnoreUserAbort in ScopedCallback instead of all using
the exact same function but duplicated.

Bug: T184044
Change-Id: I27d7dc16abfe4b9447d7f3d8bd89f0de3ddeb662
2018-11-01 17:18:01 -07:00
Umherirrender
d5c659cb95 Replace @remarks by @note
@remarks is uncommon and blacklist in phpcs

Change-Id: Ia21f340ad75f0f007fea8b1b79e16ab889a74d0c
2018-08-07 12:12:13 +02:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Max Semenik
6e956d55aa Replace call_user_func_array(), part 2
Uses new PHP 5.6 syntax like ...parameter unpacking and
calling anything looking like a callback to make the code more readable.
There are much more occurrences but this commit is intentionally limited
to an easily reviewable size.

In one occurrence, a simple conditional instead of trickery was much more readable.

This patch finishes all the easy stuf in the core, the remainder is either unobvious
or would result in smaller readability gains. It will be carefully dealt with in
further commits.

Change-Id: I79a16c48bfb98b75e5b99f2f6f4fa07b3ae02c5b
2018-06-07 20:19:26 -07: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
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
ace44e2064 Use correct variable name in @param documentation
For some varargs a variable name is added with suffix ,... as seen for
many other varargs

Some @param are swapped, because there are in the wrong order

Enable Sniff MediaWiki.Commenting.FunctionComment.ParamNameNoMatch

Change-Id: I60fec6025bce824d5c67563ab7b65ad6cd628ad8
2017-08-11 19:27:19 +02:00
Aaron Schulz
82e2c924e4 Remove "@author Aaron Schulz" annotations
Bug: T139301
Change-Id: Ib5248e8e27d60611c7373bce4b29dd5e85aa3489
2017-06-27 15:24:14 -07:00
jenkins-bot
69ae945e8d Merge "Update weblinks in comments from HTTP to HTTPS" 2016-11-08 21:32:00 +00: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