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
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
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
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>
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
- 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
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
- 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
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
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
can be set to any other timezone.
Also avoids the ugly default-changing that was being used by c15605.
Change-Id: I7a5086f84310f50a1929e07bd2e6527a518424b2
* 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
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
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
$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
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
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
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
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
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
- For consistency with wfCgiToArray()
This way instead of the other way around to keep lowerCamelCase natural.
Change-Id: If4528f6572afeab42ef0602a427ac44da9830a3f
* 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
to "wfShellWikiCmd". The old function now remains as a wrapper. The term "maintenance" is too restrictive.
Change-Id: I5c23d6475fd1aca374ee57b89212eee3a0d8cea1
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
- MWCryptRand: A new api for generating cryptographic randomness for security tokens. Uses whatever cryptographic source is available and if not falls back to using random state and clock drift.
- wfRandomString - A simple non-cryptographic pesudo-random string generation function to replace wfGenerateToken which was written pretending to be secure when it's really not.
- Core updates to use MWCryptRand in various places:
-- user_token generation (to do this we stop generating user_token implicitly and only generate it when needed to avoid depleting the system's entropy pool by reading random data we'll never use)
-- email confirmation token generation
-- password salt generation
-- temporary password generation
-- Generation of the automatic watchlist token
-- login and create user tokens
-- session ids when php's entropy sources are not set
-- the installer when generating wgSecretKey and the upgrade key