Commit graph

384 commits

Author SHA1 Message Date
Tim Starling
4405aaf040 Use eval "$4" instead of "$@", so that shell metacharacters such as "(" are understood 2007-04-24 18:09:53 +00:00
Ilmari Karonen
c4db61bcd8 actually, there's no need to make it so complicated after all... :/ 2007-04-19 10:54:48 +00:00
Ilmari Karonen
a5d5a6b5b8 make Special:Random retry (once, but more carefully) if the chosen random offset was too high, provide error message if there really are no pages to choose from rather than going to the main page. rewrite Special:Randomredirect to reuse code from Special:Random. 2007-04-19 10:19:27 +00:00
Nick Jenkins
9648f3b4d0 Some small doc tweaks to reduce Doxygen warnings, namely:
* @link. You might think @link would surely mean "here comes a web URL" ... but @link is a valid command 
  in Doxygen, which means an entirely different kind of link (an internal link to somewhere, so that you can separate 
  documentation and implementation). The result is a mess, and the best solution I can see is to use "@see" instead of "@link".
* Warning: argument `nourl' of command @param is not found in the argument list of Linker::makeMediaLinkObj($title,$text='')
* Moving few class descriptions to right above classes, and/or formatting into Javadoc style.
* "@addtogroup Special Pages" --> "@addtogroup SpecialPage" so that all special pages have the same @addtogroup tag.
* @fixme --> @todo (must have missed these before)
* "@param $specialPage @see" remove the "@" in the "@see" to stop warning.
* @throws wants type, then a brief description, to stop warning.

This last one is for PHPdocumentor only, but it fixes something for PHPDocumentor, and should be neutral for Doxygen:
* WARNING in includes/api/ApiFormatYaml_spyc.php on line 860: docblock template never terminated with /**#@-*/
2007-04-18 09:50:10 +00:00
Aaron Schulz
bbe420ed17 *Add param to doc comment 2007-04-13 17:26:47 +00:00
Nick Jenkins
113bb1c772 Documentation tweaks to help documentation systems (Doxygen + PHPDocumentor)
pick up the appropriate tags, and documentation blobs for classes. This is 
the same as per r20769, but with the grouping changes (e.g. removing "@{{") omitted.
Please be advised that more related documentation tweaks may follow later - e.g. 
Doxygen generates a log file of warnings that is 574 Kb in size, when run over 
the just the trunk/phase3 code ... eek! Thankfully, much of that is just 
whining about functions without documentation   ;-)
2007-04-04 05:22:37 +00:00
Brion Vibber
3a6ac5a3c3 Revert r20769: we don't use PHPDocumentor anymore, we use doxygen.
If making mass changes to tweak to its preferences, probably better to do it for the tool we actually generate docs with. :)
2007-03-28 14:16:43 +00:00
Nick Jenkins
5fef2333d4 PHPDocumentor [http://en.wikipedia.org/wiki/PhpDocumentor] documentation tweaking stuff.
Minor doc tweaks to prevent some PHPDocumentor warnings or errors when run on the includes/ directory. PHPDocumentor uses a syntax very similar to javadoc - mostly we already use this, but there were a few scattered places that were adjusted to make them consistent with the rest of the code. In practical terms, these changes were made:
* @url becomes @link
* @fixme becomes @todo
* HTML tags in descriptions must be closed / balanced.
* @bug was removed (where the bug was long fixed), or changed into a @todo (in the few situations where the bug was still pending)
* @obsolete becomes @deprecated
* Things like "/**@{{" and "/**@}}*/" which cause "unknown tag" warnings were removed
* @access must be a valid access level.
* @desc tag not needed, removed.
* Doesn't seem to like @licence, will accept @license however.
* Use full comment block notation in a few places (i.e. open block with "/**", start each line with " *", and end block with " */")

Then additional to this, to get some class docs associated with their respective classes:
* Moved some docs to right above those classes (deleting blank lines, or moving descriptions from the file headers)
* Marked some classes without docs as "@todo document"
* (done up to "class MIMEsearchPage" on the "classtrees_MediaWiki.html" page for the includes/ directory)
2007-03-28 08:53:02 +00:00
Brion Vibber
4475d36182 Revert $wgDBtimezone commits: r20688, 20689, 20690, 20691.
Alters behavior of wfTimestamp() and wfTimestampNow() in clearly broken ways, such that current time would not return current time anymore.
2007-03-27 19:39:37 +00:00
Brion Vibber
57570fae3d good thing we're not actually using this fallback func, huh 2007-03-27 19:25:26 +00:00
Brion Vibber
629435171a * (bug 9411) Fix for shared image descriptions using query-string titles
Extracted URL-query-append logic from Title to wfAppendQuery(), using this in two places now.
2007-03-26 14:33:08 +00:00
Greg Sabino Mullane
96c5543647 Account for wgDBtimezone if set. DBs not using it (mysql) will have it = 0 and return same time as always. 2007-03-26 02:32:33 +00:00
Raimond Spekking
7a69366288 * (bug 8324) LinkSearch: search for all protocols defined in wgUrlProtocols incl. email
Make LinkFilter and GlobalFunctions more flexible
2007-03-19 16:19:13 +00:00
Nick Jenkins
f1fb0bc169 * Prevent E_STRICT error when '$wgDebugDumpSql = true', and a path has been defined for $wgDebugLogFile,
but $wgDebugLogFile does not exist yet: "filesize(): stat failed for sql-log.txt in includes/GlobalFunctions.php on line 219"
* Removing unused global $IP.
* Indentation of an if/else block.
* Trivial comment typo.
* Prevent PHP Fatal error: "Call to a member function getText() on a non-object in includes/SpecialListusers.php on line 46", 
  when opening a URL such as http://192.168.0.64/wiki/index.php/Special:Listusers?username=%22%27%3E 
  (i.e. when "Display users starting at:" username supplied in Special:Listusers is not a valid MediaWiki title).
* Fix HTML validation of protection form (i.e. when "action=protect").
2007-03-19 07:08:58 +00:00
Raimond Spekking
ba14ef8ecd * (bug 8324) LinkSearch: search for https/ftp/irc/news weblinks
Make LinkFilter and GlobalFunctions more flexible for other than http
2007-03-16 21:49:43 +00:00
Aaron Schulz
2f2700c089 *Add case option to base convert 2007-03-12 20:55:08 +00:00
Brion Vibber
2c9cb9dcbd * Fix fallback implementation of mb_strlen so it works and isn't insanely
slow for large strings, since it's used for page edit lengths
2007-03-09 16:22:24 +00:00
River Tarnell
4afd40843e need to use mb_strlen, not strlen, for article length
provide stub mb_strlen for installations missing mb
2007-03-08 03:53:32 +00:00
Tim Starling
31303f3493 wfErrorLog: Safer method to log to a file 2007-03-05 12:11:55 +00:00
Raimond Spekking
259417b79d * (bug 8918) Enable PLURAL option for MediaWiki:showingresults and
MediaWiki:showingresultsnum
* RELEASE-NOTES forgotten in r20075
* Update URL for CategoryTree
2007-02-27 22:39:04 +00:00
Brion Vibber
2d5ac3c276 * Add 'charset' to Content-Type headers on various HTTP error responses
to forestall additional UTF-7-autodetect XSS issues. Probably not an
  issue on Apache 2.0+, but most servers send only 'text/html' by default
  when the script didn't specify more details.
    This fixes an issue with the Ajax interface error message on MSIE when
  $wgUseAjax is enabled (not default configuration); this UTF-7 variant
  on a previously fixed attack vector was discovered by Moshe BA from BugSec:
  http://www.bugsec.com/articles.php?Security=24

* Trackback responses now specify XML content type
2007-02-21 01:02:47 +00:00
Brion Vibber
62ef8829fb * Further fix to Special:Export etc; instead of trying to suppress those
Content-Encoding and Content-Length headers, just don't send them 
  in the first place!
* Suppress Content-Length from wfOutputHandler if $wgDisableOutputCompression set
* Fix typo that caused $wgDisableOutputCompression to *enable* instead of *disable* compression ;)
2007-02-20 04:46:07 +00:00
Brion Vibber
e76c53c065 Erase the Content-Encoding and Content-Length for the new output buffer/compression handler.
Fixes Special:Export and probably other things when the HTTP 1.0 stuff engages
2007-02-20 02:25:27 +00:00
Antoine Musso
939ad82cac Fixes some tests:
* use dirname instead of $IP
* define MEDIAWIKI before requiring
2007-02-17 13:30:28 +00:00
Aaron Schulz
8fadd2ad12 * parsemag comment 2007-02-13 20:56:31 +00:00
Brion Vibber
5fa40fe0fb Revert r19877; no reason is given for it but it breaks things such as parameter substitution of text that includes {{braces}}. An example of breakage is the automated deletion comments, where it expands template contents unexpectedly 2007-02-12 21:33:22 +00:00
Aaron Schulz
123f2fe6e5 * Get messages to actually transform (use magic phrases) 2007-02-11 06:31:06 +00:00
Tim Starling
5b487b32c0 Reducing the number of stat calls is all very well, but please don't introduce any remote inclusion vulnerabilities while you're at it. 2007-02-09 09:28:35 +00:00
Nick Jenkins
baaee13afc Prevent some unnecessary lstat system calls, generated by include or require directives.
This can be done either by:
* Using explicit full paths, using the $IP global for the installation directory full path, and then working down the tree from there.
* Using explicit full paths, using the "dirname(__FILE__)" directive to get a full directory path for the includer file. 
* Occasionally removing the line altogether, and then for some files the inclusion is handled by the autoloader.

For example, if the "extensions/wikihiero/wh_main.php" file does an include or require on "wh_list.php", then PHP does the following:
* tries to open "wiki/wh_list.php", and fails.
* tries to open "wiki/includes/wh_list.php", and fails.
* tries to open "wiki/languages/wh_list.php", and fails.
* tries to open "wiki/extensions/wikihiero/wh_list.php", and succeeds.

So in this example, the first 3 calls can be prevented if PHP is told where the file is.

Testing Method: On a Linux box, run these commands to attach strace to all the apache2 processes, and log their system calls to a temporary file, then generate some activity, and then stop the strace:
-----------------------------------
rm /tmp/strace-log.txt
strace -tt -o /tmp/strace-log.txt -p `pidof apache2 | sed 's/ / -p /g'` &
php maintenance/fuzz-tester.php --keep-passed-tests --include-binary --max-runtime=3 > /tmp/strace-tests.txt
killall -9 strace
grep "No such file or directory"  /tmp/strace-log.txt | sort -u
-----------------------------------

Any failed file stats will be marked with: "-1 ENOENT (No such file or directory)".

Also:
* Strict Standards: Undefined offset:  230 in includes/normal/UtfNormal.php on line 637
* Strict Standards: iconv() [<a href='function.iconv'>function.iconv</a>]: Detected an illegal character in input string in languages/Language.php on line 776
  [Note: Partial only - despite adding "//IGNORE", it still seems to be possible with some
         messed- up binary input to cause PHP 5.1.2's iconv() function to squeal like a stuck pig].
* Update one $fname variable (method belongs to HistoryBlobStub class).
2007-02-09 05:36:56 +00:00
Brion Vibber
2f43eec318 * (bug 8751) Set session cookies to HTTPS-only to match other cookies
patch from http://bugzilla.wikimedia.org/attachment.cgi?id=3132
2007-01-24 17:19:25 +00:00
Antoine Musso
c771fc9c96 Use Doxygen @addtogroup instead of phpdoc @package && @subpackage 2007-01-20 15:09:52 +00:00
Brion Vibber
7aa8054979 Normalize / to DIRECTORY_SEPARATOR in wfRelativePath() input, plays nicer on Windows 2007-01-19 10:40:57 +00:00
Brion Vibber
d88bf87284 Apply most of the code tweaks from the live site:
* use configured cache servers for mctest.php
* bucket details in mcc.php
* fix input validation and remove debugging code in compressOld
* full ID range for moveToExternal
* fix resolveStubs.php for compatibility with older serialized data
* maximum line length for bar graphs in getLagTimes.php
* recognize specieswiki in rebuildInterwiki.inc
* --purge option to do additional parser-cache purging for purgeList.php
* default changed in MiniDonation extension
* profile unicode cleanup in Xml
* log slow parses in Article.php
* profile wfMsgReal
* log mkdir failures
* profile AutoLoader
* rebuild empty DjVu metadata containing ''
* security fix for DjVu metadata retrieval
2007-01-17 00:54:54 +00:00
Brion Vibber
de72df4032 * (bug 3000) Fall back to SCRIPT_NAME plus QUERY_STRING when REQUEST_URI is
not available, as on IIS with PHP-CGI
2007-01-16 01:45:51 +00:00
Brion Vibber
7e3a05ecb0 Pretty up parser test output:
* include old failing tests in --record output, at the end of the changed items
* suppress failure notices during run if --record and --quiet are both specified, so they're not duped
* show relative paths for the test input files
* moved FiveUpgrade::relativize() to wfRelativePath() for wider use; using DIRECTORY_SEPARATOR instead of '/' but might explode on windows, haven't tried it ;) won't handle different drives/UNC servers right, probably
2007-01-12 00:35:26 +00:00
Tim Starling
49cda846a7 Don't create a new parser on every call to wfMsgExt(), that's slow. 2007-01-07 16:44:06 +00:00
Tim Starling
c637d59c92 Watchlist query group. 2007-01-07 02:08:55 +00:00
Brion Vibber
b62d4ed32d * Attempt to detect redirect loops for the canonical title redirect, and
give some hints to the poor confused administrator.
2007-01-03 09:15:11 +00:00
Brion Vibber
1a6a78a0aa * (bug 8041) Work around bug with debug_backtrace when Zend Optimizer is
loaded by skipping the function. Use wfDebugBacktrace() wrapper function.
2007-01-02 23:50:56 +00:00
Antoine Musso
4aaeeee3b0 Add a doctype to error pages (based on www.apache.org error message) 2007-01-02 20:05:13 +00:00
Rob Church
03534e7e5b * (bug 6690) wfMsgNoTrans() transforms messages 2006-12-17 02:36:44 +00:00
Rob Church
5f5abd454b * (bug 8153) <nowiki> doesn't work in site notice
The fix for this was to use wfMsgForContentNoTrans() in wfGetCachedNotice(). Since we pass the text through the parser, there's no point in doing message transformations up front, and it allows users to do magic things.
2006-12-17 01:05:03 +00:00
Brion Vibber
a9fb3b981b * Make $wgSiteNotice value wikitext again, for consistency with editable
MediaWiki:Sitenotice and MediaWiki:Anonnotice.
2006-12-16 09:13:43 +00:00
Antoine Musso
fe3edeaf8f Some doxygen patches:
* fuzz-tester : @desc not needed
* remove some @global statements
2006-12-14 21:05:15 +00:00
Antoine Musso
df74b236f7 Fix #8121 : wfRandom() is not between 0 and 1 2006-12-11 21:05:14 +00:00
Brion Vibber
2148b1c90f fix typo in comment 2006-12-11 19:54:34 +00:00
Brion Vibber
a7dfa5da71 * (bug 8148) Handle non-removable output buffers gracefully when cleaning
buffers for HTTP 304 responses, StreamFile, and Special:Export.
  Duplicated code merged into wfResetOutputBuffers() and wfClearOutputBuffers()
2006-12-11 01:51:21 +00:00
Nick Jenkins
74ea267553 Prevent the following strict-standards warnings - i.e. when running with error_logging(E_ALL | E_STRICT); - which seems to disable the yucky "@" operator, as well as maxing out the pedantry of warnings. Nothing major found, just nice to be as explicit and as forward-compatible as possible.
* Strict Standards: Undefined index: switch in includes/Parser.php on line 3849
* Strict Standards: Undefined index: ref in includes/Parser.php on line 3818
* Strict Standards: Non-static method OutputPage::setEncodings() should not be called statically in index.php on line 11
* Strict Standards: Only variables should be assigned by reference in includes/Skin.php on line 888
* Strict Standards: Non-static method Title::newFromURL() should not be called statically in includes/SpecialContributions.php on line 178
* Strict Standards: Only variables should be assigned by reference in includes/GlobalFunctions.php on line 2054
* Strict Standards: Undefined index:  contributions-summary in languages/Language.php on line 764
* Strict Standards: Undefined index:  trackbackhtml in skins/MonoBook.php on line 86
* Strict Standards: Undefined index:  blockip in skins/MonoBook.php on line 204
* Strict Standards: Undefined index:  tagline in skins/MonoBook.php on line 261
* Strict Standards: Undefined index: uselang in includes/SkinTemplate.php on line 1159
* Strict Standards: Non-static method CoreParserFunctions::plural() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  0 in includes/SkinTemplate.php on line 196
* Strict Standards: Undefined index:  USE INDEX in includes/Database.php on line 1015
* Strict Standards: Undefined index:  image_tests in includes/Parser.php on line 3488
* Strict Standards: Undefined offset:  0 in includes/Parser.php on line 3507
* Strict Standards: Non-static method ChangesList::newFromUser() should not be called statically in includes/SpecialWatchlist.php on line 361
* Strict Standards: Non-static method RecentChange::newFromCurRow() should not be called statically in includes/SpecialWatchlist.php on line 367
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/Exception.php on line 168
* Strict Standards: Non-static method LogPage::logName() should not be called statically in includes/SpecialContributions.php on line 325
* Strict Standards: ob_end_flush(): failed to delete and flush buffer. No buffer to delete or flush. in maintenance/commandLine.inc on line 191
* Strict Standards: Undefined index:  meatball in languages/Language.php on line 234
* Strict Standards: rmdir(/tmp/mwParser-2108164586-images/thumb): Directory not empty in maintenance/parserTests.inc on line 605
* Cleaning out some new temp files left over by parserTests (there were one or two straggler dirs/files that would persist after the test run ended, due to new tests being added over time)
* Strict Standards: Non-static method CoreParserFunctions::special() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Declaration of ListUsersPage::preprocessResults() should be compatible with that of QueryPage::preprocessResults() in includes/SpecialListusers.php on line 38
* Strict Standards: Only variables should be passed by reference in includes/SpecialBlockip.php on line 175
* Strict Standards: Skin::include_once(skins/Standard.deps.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in includes/Skin.php on line 121
* Strict Standards: Declaration of ApiMain::getResult() should be compatible with that of ApiBase::getResult() in includes/api/ApiMain.php on line 35
* Strict Standards: is_a(): Deprecated. Please use the instanceof operator in includes/WikiError.php on line 63
* Strict Standards: Non-static method WikiError::isError() should not be called statically in includes/SpecialImport.php on line 64
* Strict Standards: Non-static method ImportStreamSource::newFromInterwiki() should not be called statically in includes/SpecialImport.php on line 58<b
* Strict Standards: Only variables should be assigned by reference in includes/SpecialUndelete.php on line 501
* Strict Standards: Non-static method Image::newFromName() should not be called statically in thumb.php on line 56
* Strict Standards: Non-static method CoreParserFunctions::numberoffiles() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Non-static method CoreParserFunctions::statisticsFunction() should not be called statically in includes/CoreParserFunctions.php on line 139
* Strict Standards: Non-static method CoreParserFunctions::isRaw() should not be called statically in includes/CoreParserFunctions.php on line 128
* Strict Standards: Non-static method CoreParserFunctions::grammar() cannot be called statically in includes/Parser.php on line 2902
* Strict Standards: Undefined offset:  1 in includes/SpecialMIMEsearch.php on line 130
* Strict Standards: Undefined index:  recentchangeslinked in skins/MonoBook.php on line 184
* Strict Standards: Declaration of DumpNotalkFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 612
* Strict Standards: Declaration of DumpNamespaceFilter::pass() should be compatible with that of DumpFilter::pass() in includes/Export.php on line 665
* Strict Standards: Non-static method ImportStreamSource::newFromUpload() should not be called statically in includes/SpecialImport.php on line 46
* Strict Standards: Undefined offset:  5 in includes/Sanitizer.php on line 396
* Strict Standards: Undefined index:  wikidbUserName in includes/SpecialUserlogin.php on line 562
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 95
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryBase.php on line 116
* Strict Standards: Only variables should be assigned by reference in includes/api/ApiQueryWatchlist.php on line 128
* Strict Standards: Undefined property:  stdClass::$rc_id in includes/api/ApiQueryBase.php on line 131
* Strict Standards: Undefined property:  stdClass::$rc_last_oldid in includes/api/ApiQueryBase.php on line 164
* Strict Standards: Undefined property:  stdClass::$rc_moved_to_ns in includes/api/ApiQueryBase.php on line 285
* Strict Standards: Undefined property:  stdClass::$rc_patrolled in includes/api/ApiQueryBase.php on line 176
* Strict Standards: Undefined index:  comment in includes/api/ApiFeedWatchlist.php on line 85
* Strict Standards: Undefined offset:  0 in includes/Skin.php on line 302
* Strict Standards: Non-static method User::SetupSession() should not be called statically in includes/SpecialUserlogin.php on line 15

... There are certain to be other things too, so this is not intended to be comprehensive, rather the above just stops most of the notifications I observed.
2006-11-29 05:45:03 +00:00
Tim Starling
b1cd1b035c Fixed inefficient use of array_keys() introduced by Nick in r17880. If this is setting off alarms, then fix the alarms. 2006-11-25 17:11:58 +00:00
Tim Starling
bb333c1c6f Removed wfRangeStartEnd() and wfIsAddressInRange() -- avoid proliferation of global functions. 2006-11-25 16:27:33 +00:00