Commit graph

915 commits

Author SHA1 Message Date
Niklas Laxström
1c268c87a3 Committed a polished local hack I've been using.
At times useful to see if something is hogging much memory.
Didn't really want to add a new global for this.
2011-09-19 11:05:10 +00:00
Krinkle
6123e27a07 Minor whitespace fixes in GlobalFunctions.php
* And some adjustments to documentation (sentence ended with "use the wikis", adjusted to "use the wikis' content language")
[svnblameutil:] r97136,r88447,r86368,r81597,r72134,r2969
2011-09-18 23:21:46 +00:00
Sam Reed
a9d458a2cc Noticed in apache error logs (see below). If the length of the message is longer than the maximum length, only send what will fit
Sep 16 20:07:28 10.0.2.193 apache2[28441]: PHP Warning:  socket_sendto() [<a href='function.socket-sendto'>function.socket-sendto</a>]: unable to write to socket [90]: Message too long in /home/wikipedia/common/php-1.17-test/includes/GlobalFunctions.php on line 464
Sep 16 20:07:29 10.0.2.193 apache2[26511]: PHP Warning:  socket_sendto() [<a href='function.socket-sendto'>function.socket-sendto</a>]: unable to write to socket [90]: Message too long in /home/wikipedia/common/php-1.17-test/includes/GlobalFunctions.php on line 464
2011-09-16 20:08:33 +00:00
Sam Reed
4d8c6dee24 Moar documentations 2011-09-16 17:58:50 +00:00
Daniel Friesen
738e98cc56 Add support for a second argument to wfDeprecated so we can start using it right away and let users limit what warnings they get if they need to, instead of delaying warnings for an entire release or more. 2011-09-15 02:10:44 +00:00
Chad Horohoe
22b599e06c Refactor deferrable updates into classes & interfaces, also add helper method for the most common use case:
$wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, "sometable" );

I kept b/c with $wgDeferredUpdateList for now, but seeing as only 3 exts in svn use it (FileSearch, FlaggedRevs and WikiScripts), I'd like to deprecate it pretty soon :)
2011-09-10 06:50:30 +00:00
Roan Kattouw
ee24d7b289 Actually fix bug 30792, despite my earlier claims. SquidUpdate::purge('//upload.wikimedia.org/foo') would return 'http://commons.wikimedia.org//upload.wikimedia.org/foo'
Introduce PROTO_INTERNAL much like PROTO_CANONICAL, and use it in SquidUpdate::purge()
2011-09-07 14:15:03 +00:00
Sam Reed
5a2c65e7a7 Followup r90361, r90362
Document $limit parameter

Pass $limit parameter through if $limit && php > 5.4.0

Else false back to the default version, which sets the same parameters
2011-08-25 16:40:49 +00:00
Roan Kattouw
b4ae56dea1 Per r90849, factor out most of the code that's duplicated between Parser::getExternalLinkAttribs() and Skin::addToSidebarPlain() into wfMatchesDomainList(). Change a loose comparison to a strict one, and add a FIXME comment about how whitelisting nl.wikipedia.org also whitelists nds-nl.wikipedia.org due to the function's simplistic substring approach. 2011-08-20 10:18:09 +00:00
Roan Kattouw
39f8bf86cd Add a PROTO_CANONICAL mode to wfExpandUrl(), which uses $wgCanonicalServer 2011-08-19 15:25:50 +00:00
Roan Kattouw
5581a5e837 Followup r94502: per CR, use two caching variables instead of an array indexed with true or false 2011-08-15 13:16:10 +00:00
Roan Kattouw
48bbe8b848 (bug 30269) Strings like foobar//barfoo are linked to become foobar[//barfoo]
* Introduce a boolean parameter to wfUrlProtocols() which, if set to false, will cause '//' to be dropped from the returned regex so it doesn't match protocol-relative URLs
* Introduce wfUrlProtocolsWithoutProtRel() as a wrapper for wfUrlProtocols( false ). The latter should not be used directly because the former is much clearer
* Use this new function in Parser::doMagicLinks() to fix the original bug. Also use it in ApiFormatBase::formatHTML() and CodeCommentLinker::link(), which probably had similar bugs
2011-08-15 12:20:00 +00:00
Chad Horohoe
1a1e917c86 Move wfStreamFile() into a class, update all callers in core (only 3 extensions use it afaict), leave wfStreamFile() as a b/c alias for now.
Yay less global functions, autoloading and less manual require()s.
2011-08-13 19:03:51 +00:00
Robin Pepermans
9797463d22 Mark wfMsgWikiHtml() as an interface message so it doesn't get converted according to the content language (see also r94279) 2011-08-12 23:14:32 +00:00
Roan Kattouw
0be8934126 Guard against parse_url() returning weird things in wfParseUrl(). This is not a problem in practice unless you mess up your local copy badly enough that it tries to do wfParseUrl("%0Ahttp://example.com") like mine just did, but wfParseUrl() should handle all invalid input gracefully without throwing notices. 2011-08-12 14:45:37 +00:00
Platonides
6e87d4001f Follow-up r93258, r93266, r93266: Move the defines to Defines.php 2011-08-03 18:25:04 +00:00
Roan Kattouw
75afbc3ff7 Followup r93266: also rename PROT_* to PROTO_* in the comments 2011-08-03 12:52:17 +00:00
Platonides
efa0a5013f Rename PROT_* constants to PROTO_*
Follow up r93258
2011-07-27 14:06:43 +00:00
Roan Kattouw
e2b9cc8899 (bug NNNNN) Rewrite most of wfExpandUrl() to handle protocol-relative URLs properly and more flexibly
* Fix a bug in rNNNNN where URLs like '/wiki/Foo' weren't expanded completely if $wgServer was protocol-relative. This caused bug NNNNN.
* Add an optional second parameter to wfExpandUrl(), which takes one the PROT_* constants. This allows the caller to determine which protocol should be used if the given URL is protocol-relative, or the given URL is domain-relative but $wgServer is protocol-relative. The options are PROT_HTTP (use http), PROT_HTTPS (use https), PROT_RELATIVE (keep the URL as protocol-relative), and PROT_CURRENT (use http if the current request is http, or https if the current request is https; this is the default).
* Factor the protocol/port detection part of WebRequest::detectServer() out into detectProtocolAndStdPort(), and add detectProtocol() as a wrapper. The latter is used by wfExpandUrl() in PROT_CURRENT mode.
* Rewrite the test suite to test all possible combinations of $wgServer, $defaultProto, $url and HTTP/HTTPS mode. This means the test suite now has 120 test cases rather than 4.
2011-07-27 08:21:40 +00:00
Platonides
53b0052df1 Make wfUrlEncode(null) reset the static. Two skipped tests work now. 2011-07-23 20:14:12 +00:00
Sam Reed
ead9055a62 Update code comments that point to 1.18 to point to 1.19 2011-07-18 23:01:08 +00:00
Roan Kattouw
10630cf572 Now that wfParseUrl() can handle protocol-relative URLs, make wfExpandUrl() work in cases where it's fed a protocol-relative URL and $wgServer is also protocol-relative. 2011-07-13 00:03:27 +00:00
Roan Kattouw
df2306b971 Extend wfParseUrl() to handle protocol-relative URLs. parse_url() doesn't handle these either so it needs more workaround logic 2011-07-12 23:52:43 +00:00
Robin Pepermans
488e21072d Fix r91685: add space at the right place.
(Also removing unused variable in protectedtitles.)
2011-07-07 21:07:51 +00:00
Mark A. Hershberger
d336a8c161 Bug #29752: add back a space that SPQRobin missed. 2011-07-07 20:58:04 +00:00
Chad Horohoe
b91ace27d9 Clean up the mess that is wfDie (resolves r85918). wfDie() doesn't exist anymore, so don't use it.
The only two usages left since r91590 are php version checks for index/load/api.php, and $wgAPIEnabled check in api.php. Consolidate all of the "bailing for invalid version" into PHPVersionError.php. Leaving $wgAPIEnabled as the only user was silly, so just echo and die like wfDie() would've done
2011-07-06 21:01:12 +00:00
Brion Vibber
0572c46e6d Partial revert of r91106: followup to r91127.
Suppressing all warning output from unserialize() in ExifBitmap::formatMetadata will hide actual errors; we're now checking explicitly for the bad-metadata and no-metadata markers so the case this was added for should not happen.
2011-07-06 18:47:35 +00:00
Chad Horohoe
46ef4b3961 Move wfShowingResultsNum() back into SpecialSearch where it belongs. No need for a global function for something thats only used once in core or extensions 2011-07-06 18:13:06 +00:00
Robin Pepermans
7c624542f0 (bug 6100; follow-up to r91315) Being bold and removing $wgBetterDirectionality (and dependent wfUILang) in core, as most or all work is finished.
Also:
* Introduce classes mw-float-end, mw-float-start so we don't have to use inline css depending on wfUILang()/$wgLang (see HistoryPage and SpecialFileDuplicateSearch)
* Add direction mark to protection log
* Remove specialpageattributes as it is obsoleted by this commit (also fixes bug 28572)
* Add two direction marks in wfSpecialList, which makes ltr links on rtl wiki (and vice versa) display nicely as well (only on those special pages however)
* Revert r91340 partially: use mw-content-ltr/rtl class anyway in shared.css. Both ways have their [dis]advantages...
* Set the direction of input fields by default to the content language direction (except buttons etc.) in shared.css
2011-07-06 02:26:06 +00:00
Sam Reed
6102b8fab8 More return documentation and trimming trailing whitespace 2011-06-30 02:59:43 +00:00
Bryan Tong Minh
c87574b7b4 Add wfUnserialize() wrapper around unserialize to prevent E_NOTICE and use it in ExifBitmap.php. There are probably many more places that could use this. This should fix Platonides' problem at r90421, but also added a check for $wgShowExif to prevent the test from failing. 2011-06-29 20:24:53 +00:00
Chad Horohoe
92ba47064b * Remove Exception.php's reliance on wfDie(), as well as the awful constant MEDIAWIKI_INSTALL (holdover from old installer)
* Rm checking for MEDIAWIKI_INSTALL in wfOut(), no codepath leads here from the installer anymore
2011-06-28 19:46:23 +00:00
Matěj Grabovský
09da27efa2 wfArrayToCGI() and wfCgiToArray() now handle nested and associative arrays almost correctly
The only problem is that all the indexes have to be set, thus "key[]=value" won't get parsed correctly and array( 'key' => array( 'value' ) ) will transform to "key[0]=value".

Related bug 28928 and bug 22989.
2011-06-23 15:25:07 +00:00
Robin Pepermans
15f3df018f * Improvements as part of bug 6100: Use wfUILang() instead of $wgContLang where appropriate
* Remove $wgContLang in SpecialVersion per r90302
2011-06-21 10:14:34 +00:00
Alexandre Emsenhuber
c92b3ee4a9 * Made $useDB parameter of wfMsgGetKey() optional as in wfMsgReal() and removed it where possible
* Removed it from the call to wfMsgReal() in wfMsg() too
2011-06-21 07:43:27 +00:00
Alexandre Emsenhuber
750b3928d6 Removed deprecated functions wfMsgNoDB(), wfMsgNoDBForContent() and wfMsgWeirdKey(); no remaining use in core or extensions. 2011-06-20 07:26:14 +00:00
Platonides
6be5bc3b63 Follow up r90361 2011-06-18 20:15:48 +00:00
Platonides
1f71f306a3 There is a nice $limit parameter in PHP 5.4, but calling debug_backtrace on earlier versions with too much parameters, it errors returning null, so we need a PHP_VERSION comparison. 2011-06-18 20:11:45 +00:00
Alexandre Emsenhuber
54a246f1e0 In wfBacktrcae(): print "->" or "::" whether the function was called dynamically or statically instead of always "::" 2011-06-17 17:13:43 +00:00
Sam Reed
3d3d027ce9 Minor doc fix to r84741
Remove unreachable code from WatchAction

Documentation added to Init.php
2011-06-16 23:40:13 +00:00
Alexandre Emsenhuber
658492e596 Groupped URL-related functions 2011-06-16 19:09:03 +00:00
Alexandre Emsenhuber
9027c35dca Removed usage of error suppression operator 2011-06-16 17:38:26 +00:00
Tim Starling
9420ff446e Removed $wgProto. Previously, setting this undocumented global variable to anything other than the part of $wgServer before the first colon would cause various things to subtly screw up. Similarly, forgetting to set it when you override $wgServer in LocalSettings.php would break things too.
Exposing it in the default LocalSettings.php as I did in r90105 was not a good solution, really the only way to avoid breakage is to just get the protocol from $wgServer whenever you need the protocol.

Fixed $wgCookieSecure so that it will be enabled automatically if the user sets $wgServer to an https URL in LocalSettings.php. Added documentation for other cookie-related globals.

Grep indicates that $wgProto is not used by any extensions. $wgCookieSecure is used, hence the need for the Setup.php patch.
2011-06-16 05:13:29 +00:00
Alexandre Emsenhuber
d9bceab097 Per Brion, follow-up r86784: doucment that wfMsg() and related also accept message parameters as an array in the second parameter 2011-06-15 16:33:13 +00:00
Platonides
41f3cb897b Revert r86897 in wfMakeUrlIndex() and solve the issue in wfParseUrl() 2011-06-14 20:57:42 +00:00
Sam Reed
202f4d7443 Fixup error message
Remove {} (documentation tweaks)

Remove whitespace
2011-06-05 23:44:37 +00:00
Chad Horohoe
5cca2119e3 rvv: r89398. Tim wants me to wait 2011-06-03 05:44:28 +00:00
Chad Horohoe
3465e3f083 Kill off action=raw from index.php
* One less entry point to worry about
* Completely obsolete by load.php and api.php
* Left $wgDebugRawPage in place, also affects load.php requests (docs already reflect)
* Affects dumpHTML (probably broken anyway, has anyone RL-ified this?), and two abandoned/obsolete extensions
2011-06-03 05:39:32 +00:00
Tim Starling
c00d63dda3 Make $wgDebugRawPage=false also ignore load.php, so that debug logs can be readable again. 2011-05-31 05:55:06 +00:00
Sam Reed
4065e65d03 Even more documentation in various files 2011-05-29 14:24:27 +00:00