Commit graph

89 commits

Author SHA1 Message Date
Matthew Flaschen
2cb0f735e2 Also support skin.json for updating JSON AutoloadClasses
Bug: T88194
Change-Id: Ib56680e6e0e983184e31c336dcac174922a86551
2015-06-25 01:05:16 -04:00
jenkins-bot
e94f7ef8e7 Merge "Check for link-local addresses in isPublic" 2015-06-12 23:36:50 +00:00
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.

Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.

Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.

Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
2015-06-11 18:49:29 +00:00
jenkins-bot
faab8d66d9 Merge "AutoloadGenerator.php: Update 'AutoloadClasses' in extension.json" 2015-06-11 03:23:17 +00:00
Darian Anthony Patrick
a0616269a1 Check for link-local addresses in isPublic
Bug: T102032
Change-Id: Id1b6b9efc2c47a94a1a81cf4479cd756d22a2c80
2015-06-10 12:14:57 -07:00
Smriti.Singh
cbcbbf2bf1 AutoloadGenerator.php: Update 'AutoloadClasses' in extension.json
AutoloadGenerator.php until now only updated autoload.php. As we shift
to extension registration, it would be cleaner if AutoloadGenerator.php
directly updates 'AutoloadClasses' in extension.json.

Bug: T88194
Change-Id: Idd601d7897634fae8c69f4d5338d9fc8f8b8f89b
2015-06-05 11:41:59 +03:00
Kunal Mehta
06cf009d88 Remove deprecated MWFunction::newObj()
Change-Id: I180e9e1e0bcf17c9e72b607c69cae00f47de6579
2015-05-31 23:22:57 +00:00
daniel
7081228214 Start using the Assert helper class for checking parameters.
This introduces https://github.com/wmde/Assert as a dependency,
as discussed in the RFC T91071.

This change uses assertions to check some parameters in some places,
to showcase the main intended use case for assertions in MediaWiki.

Bug: T91071
Change-Id: I93ac39b7c146f10532e37b51d973b59b9c424b2f
2015-05-11 17:54:07 +00:00
Timo Tijhof
e5f0884ec4 Ignore phpcs in autoload.php
Causes 20 warnings for line length
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-HEAD/13849/console

As being autogenerated, migth as well ignore so we can have
mediawiki-core pass.

Change-Id: Iedbe527456144c9b09b7ba93a8ce67edf0b47015
2015-03-16 19:09:28 +01:00
Kunal Mehta
4675950b19 StringUtils: throw InvalidArgumentException and move into libs/
Bug: T87863
Change-Id: Iac5bd958c27cad834e35930d0b99adb75c60411b
2015-01-29 10:30:57 -08:00
Kunal Mehta
89b3502322 Move ReplacementArray into includes/libs/
Change-Id: I95b748c77522027753fb5bd0237f25e254938c16
2015-01-28 21:21:46 -08:00
Kunal Mehta
e4950e51f2 Move ExplodeIterator into includes/libs/
Change-Id: Ibb3b36dbce223454b9cd485743d7e7845f729bfb
2015-01-28 20:59:50 -08:00
Kunal Mehta
2659a67054 Move "Replacers" into includes/libs/replacers/
Split into separate files while we're at it

Change-Id: I0bba4dcea686de088bd96964833fe6fb649a41e9
2015-01-28 20:42:25 -08:00
Aaron Schulz
6921770414 Updated some try-catch statements: MWException -> Exception
Change-Id: I76601a86e30f4984e3b1a8c8ec5ef5a0f652433a
2015-01-09 17:20:22 -08:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Aaron Schulz
4ff8136807 Removed remaining profile calls
Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
2015-01-08 02:49:33 -08:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
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
2015-01-07 11:14:24 -08:00
Reedy
4d9143c7f5 Add lots of @throws
Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995
2014-12-24 13:49:20 +00:00
Bryan Davis
5e2c34fec3 Fix AutoloadGenerator to work on MediaWiki-Vagrant (again)
The patch set from I5d502b5 re-introduced the use of realpath() within
AutoloadGenerator::readFile() as part of a set of changes to ensure that
path separators are normalized across Unix and Windows systems. As noted
previously in I4623b3d, the use of realpath() in this function will
cause fatal exceptions to be thrown when a file such as
LocalSettings.php is a symlink to a file outside to $IP.

This patch separates the path normalization functionality from
realpath() expansion and uses only the path normalization component
within AutoloadGenerator::readFile(). It also introduces a cautionary
comment in AutoloadGenerator::readFile() that will hopefully keep
realpath() from being reintroduced there.

Change-Id: I4923dfa8370a7bd6077f42ff4c437d7293fdad66
2014-12-20 21:45:43 +00:00
This, that and the other
3e975cfc94 Make the autoload generator use forward slashes on all OSs
It was previously using the platform-specific directory separator, meaning
that we got backslashes on Windows and forward slashes on other OSs.

Bug: T77004
Change-Id: I5d502b54fddd55272e63d4a2a14b6d5de541263a
2014-12-19 16:11:35 +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
umherirrender
489d793882 Fixed spacing
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file

Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
2014-12-05 22:28:07 +01:00
Reedy
7b20bb4401 Add IP::isInRanges()
cf https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/throttle.php#L43-L58

Change-Id: I8ae145035de9d349710971f17551da637e4d2242
2014-11-28 16:51:33 +00:00
Bryan Davis
179854c3ce Fix AutoloadGenerator to work on MediaWiki-Vagrant
The use of realpath() in AutoloadGenerator::readFile() causes the
LocalSettings.php symlink to be dereferenced. Since the target file
lives outside of $IP, AutoloadGenerator would fail with an exception.

Change-Id: I4623b3da9b984026999189d70349ffb4754812a5
2014-11-20 16:05:07 -07:00
Erik Bernhardson
24a72730d6 Bug: Append to wgAutoloadClasses
When generating $wgAutoloadClasses for an extension the generator
currently outputs an assignment (=), but it is unlikely this is
the desired result. An extension wants to append to the existing
$wgAutoloadClasses. This bug is an unintended consequence of I75403ace
which changed the generator from assigning one key per line to using
an array literal.

This patch changes the output only when generating $wgAutoloadClasses
to the += operator which adds to the array any value that is not
already in the array.

Change-Id: I7d42ee5dc829991c6562878f0c90a06fadb1b6a6
2014-11-19 06:33:51 +00:00
Erik Bernhardson
5711d81126 Doc: Mention the php command in autoload.php to regenerate it
Adds a comment to the top of the generated autoload.php directing
developers to the command to regenerate the file so they may just
copy and paste the command.

Change-Id: If098a1eb51ed732378677215c0e438c73d506697
2014-11-17 16:35:32 +00:00
Kevin Israel
44ea55c41f AutoloadGenerator: Add newline at end of output file
Change-Id: I2b5a1adc115afd9430c1ea91285516c9c4290875
2014-11-15 21:44:52 +00:00
Kunal Mehta
3d11157294 AutoloadGenerator: Don't throw MWExceptions
The class won't have been autoloaded, so it can't be used.

Change-Id: I54a9be600839c7bffe7debb8ee35ac46694390b4
2014-11-14 11:47:52 -08:00
Erik Bernhardson
5a5d910a35 Performance improvements for autoload generator
Both zend and HHVM run through the autoload file faster when it
is a single array literal rather than individual key assignments.

The __DIR__ string concatenation remains because HHVM and Zend >= 5.5.0
optimize away constant string concatenation.

Change-Id: I75403ace264b09930d5cc545e62b8d7c3f1ad064
2014-11-14 10:18:13 -08:00
Erik Bernhardson
396a76f2ff Generate $wgAutoloadLocalClasses with a maint script
Currently all new classes in core need to be registered
with the autoloader.  This is acceptable but inconvenient.

This patch adds a script to read the output of php's tokenizer
to determine the names of all the classes within mediawiki core.
Patches with new or removed classes will just need to rerun
the maint script rather than manually adjusting the arrays.

A full conversion to psr-0 + composer would solve this as well,
but this is a very non-intrusive patch that can get us some
portion of the benefit(reduced manual maintenance) today rather
than months down the line once we figure out all the intricacies
of mediawiki + composer.

Change-Id: I8b1bdb84a9699de79f8b9951fa61e5437d083c55
2014-11-13 15:41:31 -08:00
Kunal Mehta
102fc2ac7b Move Cdb classes into includes/libs/cdb/
Change-Id: I2c4fa605acf5e0cf1fdd4821fe6bcdd690b02759
2014-11-10 10:42:30 -08:00
Kunal Mehta
d5563db924 Deprecate MWFunction::newObj() in favor of ObjectFactory
Change-Id: Iaa803311409cf7b649f64f69bafe2935a418d31c
2014-11-06 13:41:18 -07:00
Kunal Mehta
e1bd68f032 Move ArrayUtils into libs/ as there is nothing tying it to MediaWiki
Change-Id: I6910c85279858895f5462324134bade580a0cae7
2014-11-06 16:17:23 +00:00
Kunal Mehta
96a16f2e80 Remove deprecated functions from MWFunction
* MWFunction::call()
* MWFunction::callArray()

Change-Id: I9b3acd59bc85d54298711e596397b61e4deeff75
2014-11-05 22:14:43 -07:00
Kunal Mehta
c536ad24c9 Use "callable" instead of "array" in doc block for ArrayUtils::findLowerBound()
Change-Id: I1207963c53941a8f94350aaced414c8e601fb4e4
2014-11-06 00:08:56 +00:00
Aaron Schulz
d82ce50741 Fixed UID comment
Change-Id: I2e44bd69f4acafa032e0c4207749008409afcd53
2014-08-27 16:19:11 -07:00
umherirrender
7c6a25856c Add missing @return to function docs
Change-Id: I45b9d02f94ecc58372268ec5e6a0b572a0b7e2a9
2014-08-23 23:14:57 +02:00
umherirrender
6b4c44c2db Add missing @param to function docs
Change-Id: Ib26407bc55dff7969d8a3b1e2ae51751b202d8fb
2014-08-18 16:24:59 +00:00
umherirrender
21e0c1c533 Correct variable names in @param to match method declarations
Some @param have a typo in the variable name,
some @param's were in wrong order.

Change-Id: Ie25806831027112b398f6f4a909c59147ac3a5fa
2014-08-13 21:48:28 +02:00
umherirrender
768ac15c70 Cleanup some docs (includes/[s-z])
- 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: Ie419638e909a47aa72a274043604247830ee1a81
2014-07-24 19:43:44 +02:00
jenkins-bot
d61a436ac7 Merge "Fixed some @params documentation (includes/utils)" 2014-07-23 18:33:25 +00:00
umherirrender
d435aa2c58 Fixed some @params documentation (includes/utils)
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.

Change-Id: I9bd4ef370016cbbcce42d2612031a264eb3de61b
2014-07-21 20:58:14 +02:00
Kevin Israel
d3b172af3b Remove Fallback::iconv()
The iconv fallback is, for the most part, a remnant of PHP 4 support.
Though iconv was not enabled by default in PHP 4, it is in PHP 5. This
is the case even for Windows builds, which use GNU libiconv.

As for the major Linux distributions:

* Debian, CentOS, Ubuntu -> always enabled
* Fedora, Slackware -> .so in the same package, enabled by default
* Arch -> .so in the same package, disabled by default
* openSUSE -> separate package

Change-Id: Ie1112a5742646a0e1f951e188480c23851859320
2014-07-21 00:36:22 -04:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
Aaron Schulz
211d6062e1 Add some casts for sanity before BagOStuff::add() calls
Change-Id: I6ecb609c88e4fc1ef614e94c551199bd610ca360
2014-06-26 16:25:31 -07:00
withoutaname
5e48ad2e78 Remove $wgProxyKey
Change-Id: I1748164f108fab701c79532ede13ae387b12769d
2014-06-11 14:39:28 -07:00
jenkins-bot
9c9d948fbf Merge "Add HKDF as a fast, random number source" 2014-06-09 18:50:06 +00:00
csteipp
af66c04d39 Add HKDF as a fast, random number source
This adds an RFC 5869 compatible library for quickly generating
cryptographically secure random keys/numbers. An attacker should be
unable to predict the next number generated, as long as the secret
key (set to wgSecretKey if not explicitly defined for a wiki) remains
secret.

In my testing, this is generating random numbers about 7x faster than
MWCryptRand for 32 hex characters, and shouldn't drain openssl's
entropy source.

This will hopefully speed up maintenance tasks that require secure
random numbers, such as resetting login token, and wrapping user's
passwords in a new format.

Change-Id: I437d9aec0122a0533b0d8723fe8a8624898af909
2014-06-09 11:32:26 -07:00
Aaron Schulz
34cb13e6b0 Renamed $ipSet static variable in IP to something better
Change-Id: Ie7e049c9b114d2a76e1e8e985c3500bda4bbc0ef
2014-06-03 10:42:56 -07:00
Aaron Schulz
96c5cd8d9b Removed clumsy unused IP::toUnsigned() method
* Also avoid calling ip2long() on invalid addresses in toHex()
* Also use native base_convert() in toHex() for IPv4

Change-Id: I4fe4e1ac3c91edb9812e4c5bd173e4b54e315934
2014-05-31 00:20:27 +00:00