Commit graph

1038 commits

Author SHA1 Message Date
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
umherirrender
161c35bcb4 Remove deprecated 1.16 wfLoadExtensionMessages
Change-Id: I9b9ecc9818d17c98748f39177c28554f8c485de5
2012-10-05 22:41:22 +02:00
umherirrender
99159fd750 wfTimestamp should not die on bogus input [Regression]
Followup I68eb9f27

No caller of wfTimestamp can handle the exception, false is always used,
as the method comment says.

See bug 40037 for File related timestamps.
The api result is also not b/c:
<api servedby="mw70">
  <error code="internal_api_error_TimestampException" info="Exception
Caught: MWTimestamp::setTimestamp : Invalid timestamp - te"
xml:space="preserve" />
</api>

Change-Id: I1e8c785941d35678f3d12824bdde0ce245572592
2012-09-14 18:28:22 +02:00
IAlex
8634014e86 Merge "Replace some occurrences of wfMsg* by alternatives. Undeprecated wfMsgReplaceArgs." 2012-09-10 17:33:37 +00:00
Tim Starling
653ee32ed2 Remove @deprecated from wfTimestamp()
Adding abbreviated wrappers for lengthy function invocations is good
practice, it improves code readability. If all we ever had was
MWTimestamp, and we had a million instances of

$timestamp = new MWTimestamp( $ts );
$mwTimestamp = $timestamp->getTimestamp( TS_MW );

I would introduce a global function or class static method wrapper to
clean up those invocations. But I don't have to, because we already have
the wrapper.

Change-Id: I9149a7626676a0115a0a877f27d8b65e6e868de9
2012-09-07 15:13:38 +10:00
Fran McCrory
d6028a1811 (bug 34939) Handle mixed-case URL protocols in wikitext
This patch marks the regex matching url protocol as being case
insensitive. We will from now render links like [HTTP://ww].

Tests added.

Change-Id: I706acb7a0ae194b50d2318763beae4e5e83671f3
2012-09-04 16:26:46 +02:00
Siebrand Mazeland
475a1daa03 Replace some occurrences of wfMsg* by alternatives. Undeprecated wfMsgReplaceArgs.
* wfMsgReplaceArgs isn't really i18n related. It just replaces text parts.
* Updated language.txt. Now refers to mediawiki.org.
* Removed deprecated Block::formatExpiry(). Merge Id7d057a4 first.
* Reformatted weirdly formatted array in ApiBase.php.
* Removed wfMsg() in RandomTest.php.

Change-Id: Ied5cfda8fa5d9283dfeebdcb0e1af8453d47e7a9
2012-09-03 11:49:58 +02:00
Tyler Anthony Romeo
e738203a8e Added PHP complement for mw.Time.
Figured since a JS Timestamp class was being implemented
it might be appropriate to create a complementary PHP
Timestamp class. Much of code is taken from wfTimestamp().

Note: Another change (I53dcf547) is attempting a related
issue. Not sure how much of scope overlap there is.

Change-Id: I68eb9f27eebe80df757187f634392e1bcba5551f
Signed-off-by: Tyler Romeo <tylerromeo@gmail.com>
2012-08-30 20:44:09 -04:00
Alexandre Emsenhuber
b455e43276 Fix wfGetCaller() and wfFormatStackFrame() documentation
These two functions cannot return a boolean.

Also simplified wfGetCaller() to not use the $caller local
variable which is totally useless in that case.

Change-Id: I81707a8292afc1829921b58cdaae81b3147ee3cb
2012-08-29 21:36:37 +02:00
Alexandre Emsenhuber
5af2159512 Moved warning stuff into MWDebug class.
- Group common code in one instead of doing checks one
  time in GlobalFunctions.php and another time in Debug.php
- Remove the code catching the fact that a warning is due
  to a deprecation warning, no longer needed
- Pass the caller offset from wfDeprecated() to
  MWDebug::deprecated(); this was breaking deprecation
  notices for global objects.
- Changed PHP error level for deprecation notices (when
  $wgDevelopmentWarnings is set to true) from E_USER_NOTICE
  to E_USER_DEPRECATED since we now require PHP 5.3+
- Added E_USER_DEPRECATED to wfSuppressWarnings() and
  removed the check for the E_DEPRECATED constant being set
  now that we require PHP 5.3+
- Fixed MWDebugTest by calling wfSuppressWarnings() and
  wfRestoreWarnings() in setUp() and tearDown()

Change-Id: I6810b57c90d384de55a2cf177047767cdb734f79
2012-08-28 15:33:44 +02:00
Nikerabbit
d6b9b27492 Merge "Use the MWDebug class to display debug log back in the request." 2012-08-28 05:49:41 +00:00
Tim Starling
ad03f2f753 Revert Uri class due to bug 39710
Revert 94f623363b. Apparently all
ReverseChronologicalPager subclasses were broken by the unexplained
interface change in wfArrayToCgi(): changing the interpretation of
null array values from "omit this key" to "include this key with no
value". The function has always been called with the former
interpretation, that's why the special case was in there.

Also reverted dependent changes 4b517fa and part of 3d97704.

Change-Id: I41dadbde5d0e0e4c54cc76bfc13c263c15c73828
2012-08-28 10:53:09 +10:00
Alexandre Emsenhuber
61dd1d037b Use the MWDebug class to display debug log back in the request.
- This removes the duplication of MWDebug::$debug and
  OutputPage::$mDebugtext, so there's no need to store two times
  the same text
- Removed OutputPage::debug() since it's no longer used
- Had to keep OutputPage::$mDebugtext because it's still
  referenced by SemanticPageMaker extension
- Moved Skin::formatDebugHTML() to MWDebug::GetHTMLDebugLog()
  and replaced the call in Skin::generateDebugHTML() to use it
- Also check $logonly before sending entries to the debug
  toolbar in wfDebug(), for consistency
- Changed MWDebug::getDebugHTML() to also return the debug log
  in an HTML comment if $wgDebugComments is set to true and
  changed the location of this call to BaseTemplate::printTrail()
  so that its result is the latest possible. This also includes
  the debug toolbar.
- Removed MockOutputPage and related test cases since they are
  no longer accurate

Change-Id: Ie0f389f8566457b1c938c627ed930040741ac9d9
2012-08-27 23:47:19 +02:00
Aaron Schulz
a17e263c81 Added sanity check to StreamFile for mwstore paths.
Change-Id: Id402f077037f3e84c9158f7d48be0ed82ba4a1cf
2012-08-22 20:46:54 -07:00
Catrope
8b1b82f396 Make wfScript()/mw.util.wikiScript() respect $wgScript/$wgLoadScript
mw.util.wikiScript() and mw.util.wikiScript( 'index' ) now return the
value of $wgScript rather than building the path to index.php manually;
the latter is incorrect if $wgScript is customized. Similarly,
mw.util.wikiScript( 'load' ) now uses $wgLoadScript.

Same for wfScript(), wfScript( 'index' ) and wfScript( 'load' )

The qunit tests already had a test case for wgScript, but wgScript was
set in a way that didn't trigger the bug. Changed it to use customized
wgScript and wgLoadScript values and added test cases for 'index' and
'load'

This fixes bug 39103 (wfScript/mw.util.wikiScript do not respect custom
$wgScript/$wgLoadScript) as well as bug 39102 ("Entry points" on
Special:Version do not respect custom $wgScript/$wgLoadScript)

Change-Id: I5c9e82849e314dc7a87f8ae91150cc412b4011cf
2012-08-21 14:27:04 -07:00
Siebrand Mazeland
6fe1f0509b Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains reviewable.

Change-Id: Ib15e670badd3f6aecae8b60e2f9129a31341ce16
2012-08-21 18:38:44 +02:00
Reedy
2e0be64b93 Bug 39516 - Call to a member function format() on a non-object
Workaround for php bug [1], reported in 5.3.2, fixed already

Workaround can be removed when our minimum PHP version is > 5.3.2

[1] https://bugs.php.net/bug.php?id=52063

Change-Id: Ia60e64300787d0b683829765e8eeac1535e9d0a4
2012-08-20 23:41:18 +01:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
Siebrand Mazeland
4b517facdd Add version of deprecation for wfAppendQuery() and suggest alternative.
Change-Id: I31f03aa38d029ca19d8e6655d05c4d201dccae47
2012-08-18 00:00:06 +02:00
Platonides
ef498e793e Replace $wgDBerrorLogInUTC with a $wgDBerrorLogTZ variable which
can be set to any other timezone.
Also avoids the ugly default-changing that was being used by c15605.

Change-Id: I7a5086f84310f50a1929e07bd2e6527a518424b2
2012-08-08 15:51:39 +01:00
Aaron Schulz
e7a615ad7c Merge "Allow session storage to be configured independently" 2012-08-08 00:35:59 +00:00
Tim Starling
6eb6313b6f Allow session storage to be configured independently
* Introduce $wgSessionCacheType to allow the session storage to be
  configured independently of $wgMemc.
* Renamed $wgSessionsInMemcached to $wgSessionsInObjectCache to reflect
  the new versatility.
* Modernized the relevant code, removing the explicit require_once(),
  used the autoloader instead. Moved it to ObjectCacheSessionHandler.
* Tested with memcached, external sharded MySQL and APC, it all seems to
  work just fine.

Change-Id: I473334bb56cafb4e21ac1c1304d69095676fc0c4
2012-08-08 10:25:56 +10:00
Waldir Pimenta
1e769a5f9a improve wfStripIllegalFilenameChars()'s readability
make the preg_replace regex more readable,
and expand documentation a little.

Change-Id: Id26d9d42be7d3f2780e82da27dd2477d62d8e106
2012-08-07 20:09:26 +01:00
Aaron Schulz
3d60b479de Merge "Add a Uri class." 2012-08-07 03:37:30 +00:00
Daniel Friesen
94f623363b Add a Uri class.
Add a Uri class matching our mw.Uri JS class for handling uris.
This class should be helpful in a bunch of places where we end up doing manual
concatenation of things like the path + '?' + query of a url parsed with wfParseUrl.

[tylerromeo@gmail.com: Removed cat() function, fixed wfWarn() usage for aliases
 and added visibility to all functions. Also added test for aliases.]
Signed-off-by: Tyler Romeo <tylerromeo@gmail.com>

Change-Id: Iefdedb7c80cf1d4aab58050edab3ab44ba868a58
2012-08-06 22:46:25 -04:00
jeroendedauw
2b65df98fe Add @deperecation stuff to message functions
Change-Id: I69168ed9d850baf02b3dd7c8bd0e820f3f00f43f
2012-08-06 19:32:52 +02:00
Jan Gerber
2a02b44b59 add optional limits argument to wgShellExec
add optional limits argument to overwrite
filesize, memory and time limits or a command
executed with wfShellExec.
Just having once size fits all $wgMaxShell* options
is not good enough for tasks that take long
or create large files (i.e. video transcoding)

Change-Id: I54148907bfd103fd28aff69baae03437efcfe1ee
2012-07-16 14:35:51 -07:00
Antoine Musso
ef9534313e prevents some doxygen warnings
This patch fix misc issues reported by doxygen. Nothing fancy.

Change-Id: I98edc8c877019f1dc4a82a37bca518df2eb904fc
2012-07-15 22:32:48 +02:00
Reedy
fb9cbb1b4c Fix casing of wgDBerrorLogInUtc
Change-Id: I644ea64b1a40160f3468ec35836ee9aa003c03de
2012-07-13 19:02:12 +01:00
Antoine Musso
bc6d5fb88a dbErrorLog can now be forced to UTC
$wgDBerrorLog is used to log database error. It is using
$wgLocalTimezone to format the date which might not always be wanted in
a multi Timezone cluster of wiki.

wgDBerrorLogInUTC , when true, will override the Wiki timezone to uses
UTC whenever a database error is logged.

Change-Id: I091d6029272b69db0aefdebfc37896d0a8e8770e
2012-07-13 16:56:36 +02:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Antoine Musso
4d1324f47d setting to completely override server hostname
Labs has instances hostnames forged in sequences which make them not
that much useful for human readable output. Labs does publish a
meaningful instance name as an env variable though, so we could use it
to get better output.

This patch introduce $wgOverrideHostname (default false) which when
set will override the hostname returned by wfHostname().

Change-Id: Ibdba007cc4025fa0b0ebef39b5669c32852a95a7
2012-06-26 22:27:02 +02:00
Mark A. Hershberger
99fdc6e838 Bug 24985 use $wgTmpDirectory when available
We had two way to get a temporary directory:

 - $wgTempDirectory: more or less stable accross sessions
 - wfTempDir(): set through environnement variable and could potentially
   vary from a session to another one thanks to tempnam()

This patch makes wfTempDir() to always use the global $wgTempDirectory
first when it is available. Thus explicitly overriding tempnam() or any
environnement variable such as TMP or TEMP.

Hence, people who don't have access to a system wide directory
specificed by their environnement (such as /tmp) can specify an
alternative straight from the MediaWiki configuration.

The patch remove references to $wgTmpDirectory and replace them with
calls to wfTempDir().  Make wfTempDir() use $wgTmpDirectory first.

The default setting of $wgTmpDirectory was removed in favor of having it
initialized through Setup.php by calling wfTempDir.

Note: this may also address Bug 36475 - Generating thumbnails does not
work when there is no access to /tmp

Change-Id: Ifdc79e9c5d95f978025b237a5eeb95fd75092f46
2012-06-13 21:30:22 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Platonides
2e506c4809 PHP >= 5.4.0 started taking advantage of $limit optimization of wfDebugBacktrace(),
which we weren't treating right.

* $limit in wfDebugBacktrace() is the number of returned frames,
we thus need to take into account the wfDebugBacktrace() frame, which
is sliced from debug_backtrace().

* wfGetCaller() needs to add a level for itself.

* MWDebug::warning() was logging itself as the warning issuer,
which is useless (the call a few lines before was right, though)
MWDebugTest.php changed accordingly.

* Removed double call to wfGetCaller( $callerOffset + 1 )

* Documented the meaning of wfGetCaller() parameter

* Added unit test

Change-Id: Ief50f4c810bad8b03bb2bf9dc6d945d9acb29851
2012-05-31 17:32:33 +02:00
Aaron Schulz
2dbea5d278 Removed dead code since PHP minimum is > 5.2.1.
Change-Id: I565ff44e5e058ce72cd2eaeaec9ea1e441d01010
2012-05-29 22:23:07 +02:00
Alexandre Emsenhuber
b6c04726c6 Removed function_exists() check for header_remove() since it's now always available.
header_remove() was added in PHP 5.3.0 which is below that our minimum requirement; also fixed a comment for the minimum required PHP version.

Change-Id: Ib6992ed772f1a707f96020fdfe6eb6152102402a
2012-05-26 21:31:30 +02:00
Alexandre Emsenhuber
15e9fcca01 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Iaebd4e253ff3b35b568e9b394231a5691445ac95
2012-05-14 19:59:58 +02:00
Timo Tijhof
6b8a256d5d (bug 36537) Rename wfArrayToCGI to wfArrayToCgi
- For consistency with wfCgiToArray()
  This way instead of the other way around to keep lowerCamelCase natural.

Change-Id: If4528f6572afeab42ef0602a427ac44da9830a3f
2012-05-05 19:02:58 +02:00
Reedy
c1ed53da6c Kill off pre php 5.3.2 back compat hacks
Change-Id: I5b806a5d8fd4ec6914e3786a4a9aefba4ad6faa6
2012-05-05 00:23:35 +01:00
Hashar
13224921a2 Merge "wfAssembleUrl lacked '@since 1.19' comment" 2012-04-19 19:30:49 +00:00
Reedy
f1ca21306c wfAssembleUrl lacked '@since 1.19' comment
Related to Bug 36084 - PHP Fatal error: Call to undefined function wfAssembleUrl()

Change-Id: Ief6077ab60ec8613d744e6e2e2e72043a6b3dd96
2012-04-19 11:53:48 +02:00
Platonides
1e70d71fe0 wfMkdirParents() should display mode in octal.
Patchset 2: Address issue pointed out by CR

Change-Id: Ia156903131612f3faa93a7010de2e034d528ec7d
2012-04-19 11:04:11 +02:00
Catrope
458f162b63 Merge "[LanguageConverter] Added some cache code based on the problems in r97512." 2012-04-09 22:25:24 +00:00
Reedy
97257d4e9a wfLocalFile returns a LocalFile (or null) not a File
Change-Id: Ib016f16c1b5528d9f6af4189ca8459cacb54cf10
2012-04-07 21:51:53 +01:00
Aaron Schulz
0c2a0e4d6b Merged ImageFunctions.php into GlobalFunctions.php
Change-Id: I02d468f9c54a6a0448a6d99505d0201a7949855a
2012-04-06 16:43:27 -07:00
Aaron Schulz
10f49bd065 [LanguageConverter] Added some cache code based on the problems in r97512.
* Added $wgLanguageConverterCacheType global to control LC cache type. We can use it to enable direct apc use for language converter (to match the live hack).
* Added $wgLangConvMemc object, available via Setup.php

Change 1:
* Updated unit tests
* Minor documentation cleanup in DefaultSettings.php

Change-Id: Icd5dd28407e9759ce294c784ec41d9ca15c89616
2012-04-06 13:26:17 -07:00
Aaron Schulz
770c9d8c2e Renamed "wfShellMaintenanceCmd" function and new, unused, het-deploy, hook
to "wfShellWikiCmd". The old function now remains as a wrapper. The term "maintenance" is too restrictive.

Change-Id: I5c23d6475fd1aca374ee57b89212eee3a0d8cea1
2012-04-04 16:48:55 -07:00
Santhosh Thottingal
c56cca551e (bug 32748) unicode URL for articles print version
Printer friendly version of article must encode URL in unicode.

- Patch originally written by Brion Vibber
  https://bugzilla.wikimedia.org/attachment.cgi?id=9593
- introduces wfExpandIRI() global function, uses wfExpandIRI_callback.
- phpunit test.

Change-Id: I348b9f1d2ce65cb14f20d4a5751ac9359c8b8316
2012-04-02 18:14:41 +02:00