Commit graph

85 commits

Author SHA1 Message Date
Erik Bernhardson
d67197fa11 Cleanup some incorrect return annotations
Most of these are simply changing annotations to reflect
reality. If a function can return false to indicate failure
the @return should indicate it.

Some are fixing preg_match calls, preg match returns 1, 0 or false,
but the functions all claim to return booleans.

This is far from all the incorrect return types in mediawiki, there
are around 250 detected by phan, but have to start somewhere.

Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
2016-12-12 10:15:05 -08: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
5daf81eb20 Fixed method name casing and IDEA warnings in FileRepo
Change-Id: I463885a9f425491cd040cb1cdbc4c16925522848
2016-09-19 07:54:52 +00:00
Amir Sarabadani
efa0d7af44 Clean up array() syntax in docs, part III
Also fixing some typos here and there

Change-Id: I29c29acf87f84ba9993ba75ebf2ad8091d981574
2016-08-13 05:40:40 +04:30
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
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
Aaron Schulz
5085a4b5cf Made wfFindFile/wfLocalFile callers use explicit "latest" flags
* Callers that should not use caches won't
* Aliased the old "bypassCache" param to "latest"

bug: T89184
Change-Id: I9f79e5942ced4ae13ba4de0b4c62908cc746e777
2015-03-06 04:18:50 +00:00
Aaron Schulz
7508b86ad3 Made the "bypassCache" flag for file locator methods use the master DB
* Added a File::load() stub method
* Cleaned up the File loading flags bitfield a bit

bug: T89184
Change-Id: I1aa4b096c0cad5f5ca34321cc897019005c53a76
2015-03-04 17:02:05 -08:00
umherirrender
7c6a25856c Add missing @return to function docs
Change-Id: I45b9d02f94ecc58372268ec5e6a0b572a0b7e2a9
2014-08-23 23:14:57 +02:00
umherirrender
b1e5d32908 Remove unmatched @param
There is no method parameter for this @param

Change-Id: I42d1e3439e5b767be09920d536bee34bcd017ec9
2014-08-16 22:50:02 +02:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
Yuri Astrakhan
703464a88c Cleanup - let's make IDEs more useful
http://phpdoc.org/docs/latest/references/phpdoc/types.html

If IDEs have many warnings, we don't look at them.
Let's minimize the number of warnings, and make them useful again.

* Some function docs fixes
* Removed unused $iwprefixes var in ApiQuerySearch.php
* declared private $blockStatusByUid in SpecialActiveusers
* declared private $repo in UploadFromChunks

Change-Id: Ifd20f78b168b9a913fdb8d89dc26a76a173b1c29
2014-08-13 16:02:59 -04:00
umherirrender
b883e8c7c0 Cleanup some docs (includes/[e-l])
- 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: I41a84e8e1dec39170aa655250325ffc485eaeaef
2014-07-24 19:43:03 +02:00
Brian Wolff
2897061d1e Fix RepoGroup::hasForeignRepos() and RepoGroup::forEachForeignRepo()
Also add unit tests for those methods.

Change-Id: Ic72be60d13820492efc90b5925bb5cfc1813d28a
2014-07-03 03:12:27 -03:00
umherirrender
957adbef22 Fixed some @params documentation (includes/[file...|upload])
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: I8804ebe0922d3a414863b162a2110e0b9e49b80f
2014-04-19 17:19:17 +02:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
jenkins-bot
12cc7a6791 Merge "Made RepoGroup use ProcessCacheLRU" 2013-12-13 15:51:15 +00:00
Aaron Schulz
e216fe5501 Changed TIME_ONLY to NAME_AND_TIME_ONLY in FileRepo
* This now returns a (final DB key, timestamp) map for each file.
  This makes proper redirect handling easier for callers.
* Also fixed the case where ucfirst normalization is different in the
  repo versus the local wiki.
* Also added $flags to RepoGroup::findFiles() as expected.

Change-Id: I978a1cc0a0589179c46e477cfd06c8bff4c08fa9
2013-12-11 11:54:31 -08:00
Siebrand Mazeland
01d41a7ccb Add more type hints in comments for static code analysis
This resolves a little over 100 "undefined method" warnings on
includes/filerepo/.

Change-Id: I87b6d875a4304d7beadfbc26a66e9a3f358707e6
2013-12-06 00:23:05 +01:00
Siebrand Mazeland
417d4fbbfa Update documentation for file repo related classes
Change-Id: I626d972f92934afc9349e11d3a5550c4044dcb53
2013-12-04 23:06:53 +01:00
Aaron Schulz
a0368b3762 Made RepoGroup use ProcessCacheLRU
Change-Id: I322a6cf15566bde4fc5ee5bfa1be5fdc680cd763
2013-12-03 12:24:50 -08:00
Siebrand Mazeland
c3bef4243e Declare visibility on class properties of file repo classes
Change-Id: Ia608df217bb893dddae3219b3315cb44e82f5092
2013-11-25 06:40:42 +01:00
Siebrand Mazeland
bb39b5a6e4 Update formatting of file repo classes
Change-Id: I780070e07352d84d7cda7628994b28b04e8a1ebf
2013-11-23 21:00:11 +01:00
umherirrender
1bfc8feb25 Fixed spacing in actions/cache/filebackend/filerepo/job folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Idb93d34e314e5f314223b79208968d6bcd30c40e
2013-04-20 19:18:13 +02:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
umherirrender
6ef0901a4e (bug 27567) Add file repo support to prop=duplicatefiles
This adds a new method findBySha1s to the FileRepo classes to support
the multiple hash search against all repos (with only one query for each
db repo).

Change-Id: I745cae7a1db3a32c20aa0067b744402fcf1a3122
2012-07-23 18:45:38 +02:00
umherirrender
d6e31f68b1 Sort result of FileRepo::findBySha1
This sorts the result on Special:FileDuplicateSearch, which is unsorted,
when merged from different repos.

Adding File::compare similar to Title::compare for this

Change-Id: I32e8be92c6067f9e13f3ecd1039c337b0fc3e840
2012-07-13 11:11:39 -07:00
Reedy
68f50015c7 Improved/added parameter documentation
Change-Id: Ie48852acb434f6b62fda0b13b13e076f833d8975
2012-05-18 03:58:15 +01:00
Alexandre Emsenhuber
d5381d0ea0 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Iad15427368d13a6cc11c8512b7265e8c7b8878a5
2012-05-07 09:11:33 +02:00
Aaron Schulz
5d585a423f [FileRepo] Added some cache code based on the problems in r97512.
* Made RepoGroup avoid caching files with large metadata and also reduced max cache size to 500 to avoid OOMs.
* Factored out a pingCache() function in RepoGroup.

Change-Id: I52f6413b9eb8b11fbffbde0f0e7acf97c7a2ff89
2012-04-06 12:39:58 -07:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Sam Reed
7b25f8231f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:30:01 +00:00
Sam Reed
e1d83d5721 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:54 +00:00
Antoine Musso
394c8b5234 enhance filerepo doc structure 2012-02-08 15:51:16 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
Aaron Schulz
607171cb91 FU r102073:
* (bug 32367) Fixed SpecialMovePage to not call wfLocalFile() on a non file title and expect an actual File back. Previously "worked" due to an old file title checking loophole (File objects with non File: titles).
* Use File::normalizeTitle() in some more functions that were still doing their own incomplete normalization.
* Updated FileRepo::newFile() docs to reflect that it can return null; wfLocalFile() docs already mentioned this.
2011-11-11 22:14:21 +00:00
Aaron Schulz
47f4d0ec24 * Added File::normalizeTitle() function and used it to consolidate file title validity checks and sanitation. (bug 32195)
* Broke a few long lines.
2011-11-04 23:49:03 +00:00
Russ Nelson
b3881a28c1 Some docs and a test for FileRepo::storeBatch() 2011-10-11 19:49:29 +00:00
Aaron Schulz
4068bb0e85 Clear findFile() process cache of file moves (issue came up with bug bug 31056) 2011-09-21 21:32:24 +00:00
Aaron Schulz
910e2f14a6 Made trimCache() protected 2011-09-21 20:51:26 +00:00
Sam Reed
bdc31bb9bc Change usages of $wgUser->getSkin() in special pages to use $this->getSkin()
Fix trailing whitespace
2011-07-01 02:25:19 +00:00
Sam Reed
296f3d3f4f And even more documentation 2011-05-28 18:59:42 +00:00
Aaron Schulz
87de57b3f2 Reverted r84918 per CR 2011-03-28 21:40:50 +00:00
Russ Nelson
b97d2c8527 findFileFromKey, newFileFromKey, $fileFactoryKey, and $oldFileFactoryKey weren't used by anything in .../extensions nor .../phase3 2011-03-28 19:57:48 +00:00
Russ Nelson
8566872b1d Some docs, a spelin eror and fixing a mw1.15 compatibility bug. 2011-03-21 18:38:45 +00:00
Aaron Schulz
89ef115660 More comments on hash inputs 2011-03-20 20:50:05 +00:00
Aaron Schulz
37616e98ec * Added findFileFromKey() function
* Added doc comments to findBySha1()
2011-03-20 20:34:03 +00:00
Sam Reed
daa41d319b More function level documentation 2011-02-18 23:56:08 +00:00
Sam Reed
f3caa365e2 Document return type.
Explicit class member variable definition
2011-01-12 00:29:17 +00:00