Commit graph

116 commits

Author SHA1 Message Date
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
umherirrender
bf9bd497f0 (bug 42089) meta=siteinfo should output the default content model
Adding MWNamespace::getNamespaceContentModel which returns the namespace
content model from the global, if set

Change-Id: Ie012fd0ff846d50cae8081fc32b76900dbcad209
2012-12-13 21:05:15 +01:00
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
daniel
d87135d706 merged master
Change-Id: Iad12ee382d6aeb1fab6fefb611d290b74865ea4b
2012-07-23 22:07:18 +02:00
Antoine Musso
e06ad28e7a helpers to get subjects/talk namespaces
Introduce two new methods to easily get array of namespaces indices
which are subjects or talks:

 MWNamespace::getSubjectNamespaces()
 MWNamespace::getTalkNamespaces()

Change-Id: I975db344afd97713521713a708368d37cd633c50
2012-06-26 22:25:59 +02:00
daniel
181641792a merged master after 1.20wmf3 2012-05-15 08:46:34 +02:00
Aaron Schulz
348767cae2 Merge "Adding NamespaceIsMovable hook to isMovable in MWNamespace, much like done in Title::isMovable." 2012-05-14 22:23:46 +00:00
daniel
01f36b721f merged latest master 2012-05-14 23:24:18 +02:00
Alexandre Emsenhuber
a682b7335a Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I0db3461139284edcb6ac02923eb83d54e6756ffb
2012-05-12 22:33:51 +02:00
umherirrender
e9fa97f76e Add unit test for MWNamespace::isNonincludable
rename MWNamespace::isNonincludableNamespace
to MWNamespace::isNonincludable, because "Namespace" is already in the
class name

Change-Id: Ie982835c7dc84cb10c823996e5360cc1b342f704
2012-05-11 19:52:34 +02:00
jeroendedauw
717e93bd81 Adding NamespaceIsMovable hook to isMovable in MWNamespace, much like done in Title::isMovable.
Change-Id: I72c19be541391857aa25ff2433c017e5d63a8ecd
2012-05-11 16:13:30 +02:00
umherirrender
cd40d0040c Add MWNamespace::isNonincludableNamespace
Method is a wrapper around $wgNonincludableNamespaces,
replaced the one place in parser and
add it as info to api's meta=siteinfo

Change-Id: I501b811137c39f5c2d9ea35c78fef8ae22d21bfe
2012-05-05 10:22:28 +02:00
daniel
b18cce5784 allow namespace caches to be reset for testing 2012-04-26 12:08:21 +02:00
Antoine Musso
73247df204 Remove backslash from @return types
Ping r111103
2012-02-13 16:35:59 +00:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Sam Reed
f3cc77aaee Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:41:50 +00:00
Niklas Laxström
a1eb5c3f77 Stylize 2011-12-16 10:58:20 +00:00
Brion Vibber
0800a2fe7f * (bug 32512) Include 'associated namespace' checkbox on Special:Contributions
patch by MrBlueSky - https://bugzilla.wikimedia.org/attachment.cgi?id=9705&action=diff


This also restructures some pieces of the form in order to better accomodate the extra checkbox (as well as those like 'deleted only' that not everybody sees)
2011-12-15 01:02:25 +00:00
Jeroen De Dauw
0b105ebf1d added missing deprecation notices 2011-12-13 19:51:03 +00:00
John Du Hart
6d8d4d9efe Type hinting please 2011-12-05 02:29:08 +00:00
Daniel Friesen
3414e91bae Implement a number of namespace related equals functions:
* MWNamespace::equals to test equivalence of two namespaces (forward compatible with any changes we may make like introducing namespace keys like 'USER')
* MWNamespace::subjectEquals to test equivalence of the subject of two namespaces e.g.: MWNamespace::subjectEquals( NS_USER, $ns ); instead of testing for equivalence to both NS_USER and NS_USER_TALK
* Title::inNamespace to use instead of $title->getNamespace() == NS_???
* Title::inNamespaces for use like $title->inNamespaces( NS_USER, NS_PROJECT ) when you only care if it's in one of a number of namespaces (also accepts an array)
* Title::hasSubjectNamespace for use instead of testing for equivalence to both the subject and talk such as NS_USER and NS_USER_TALK.

Include phpunit tests for all this new code, and also add some tests for some existing code.
2011-11-22 13:34:55 +00:00
Roan Kattouw
80633b7759 Fix typo 2011-08-20 12:47:17 +00:00
Sam Reed
a9554c1677 More adding, updating and tweaking of documentation 2011-05-21 19:07:24 +00:00
Tim Starling
7bb50c630a The beginnings of HipHop compiled mode support. It works now for parser cache hits.
* Work around HipHop issue 314 (volatile broken) and issue 308 (no compilation detection) by adding some large and ugly compilation detection code to WebStart.php and doMaintenance.php.
* Provide an MW_COMPILED constant which can be used to detect compiled mode throughout the codebase.
* Introduced wfIsHipHop(), which detects either compiled or interpreted mode. Used this to work around unusual eval() return value in eval.php.
* Work around lack of ini_get() in Maintenance.php, by duplicating wfIsHipHop(). 
* In Maintenance::shouldExecute(), accept "include" as an inclusion function name, since all kinds of inclusion give this string in HipHop.
* Introduced new class MWInit, which provides some static functions in the pre-autoloader environment.
* Introduced MWInit::compiledPath(), which provides a relative path for invoking a compiled file, and MWInit::interpretedPath(), which provides an absolute path for interpreting a PHP file. Used these new functions in the appropriate places.
* When we are running compiled code, don't include files which would generate duplicate class, function or constant definitions. Documented the new requirements on the contents of Defines.php and UtfNormalDefines.php.
* In HipHop compiled mode, it's not possible to have executable code in the same file as a class definition. 
  ** Moved MimeMagic initialisation to the constructor.
  ** Moved Namespace.php global variable initialisation to Setup.php.
  ** Moved MemcachedSessions.php initialisation to the caller in GlobalFunctions.php.
  ** Moved Sanitizer.php constants and global variables to static class members. Introduced an accessor function for the attribs regex, as a new place to put code formerly at file level. 
  ** Moved Language.php initialisation of $wgLanguageNames to Language::getLanguageNames(). Removed the global variable, marked "private" since forever.

* In two places: don't use error_log() with type=3 to append to a file, HipHop doesn't support it. Use file_put_contents() with FILE_APPEND instead.
* Work around the terrible breakage of class_exists() by using MWInit::classExists() instead in various places. In WebInstaller::getPageByName(), the class_exists() was marked with a fixme comment already, so I replaced it with an autoloader solution.
2011-04-04 12:59:55 +00:00
Sam Reed
b3d0f35aee Remove unreachable return
Swap "dieout" for "die" in DatabaseMssql
2011-02-27 00:29:21 +00:00
Antoine Musso
8d104eb45a Minor typos
(Trow -> Throw, Sens->sense), follow up CR on r82577
2011-02-23 19:56:33 +00:00
Antoine Musso
f909c62d64 improve namespace related methods
MWNamespace::getTalk() could give erroneus results when using it on specials
namespaces (NS_MEDIA, NS_SPECIAL). It now use MWNamespace::isMethodValidFor()
which will throw an exception if a special namespace was given.

MWNamespace::getSubject() is now returning identity for specials namespaces.

New MWNamespace::getAssociated() used to find out the subject page of a talk
page and vice versa. Special namespaces will results in an exception.


TESTS:

Added tests for almost complete code coverage. Functions relying on global
$wgCanonicalNamespaces are still incomplete though.
MWNamespace::isMovable() needs more assertions.

Tests results (ignoring incomplete tests output):

$ php phpunit.php --filter MWNamespace
PHPUnit 3.5.10 by Sebastian Bergmann.

.........IIIII..........

Time: 1 second, Memory: 31.75Mb

OK, but incomplete or skipped tests!
Tests: 24, Assertions: 99, Incomplete: 5.
2011-02-21 22:17:06 +00:00
Niklas Laxström
7694c67c99 * (bug 17160) Gender specific display text for User namespace
Second attempt for this thing..
2011-02-12 20:40:40 +00:00
Roan Kattouw
e854b4a374 (bug 26762) Fix order of namespace list 2011-01-21 03:48:00 +00:00
Roan Kattouw
56b5aa18ed Merge querypage-work2 branch from trunk. The most relevant changes are:
* QueryPage now uses array-based query building instead of raw SQL
* Converted all QueryPage-based special pages that were using old-style wfSpecialFoo functions to new-style SpecialPage subclasses; this is possible because QueryPage is changed to extend SpecialPage
* Backward compatibility for extensions is partly preserved: getSQL() is fallen back on for QueryPage subclasses that don't implement getQueryInfo(), but getOrder() will be ignored (implement getOrderFields() instead). This also means that dual compatibility (1.18 compat and b/c with pre-1.18) is trivial

Extension changes will be merged after this commit.

These changes make it easier to write an API module for QueryPages (bug 14869); this wasn't done in the branch but will be done in trunk soon.
2010-12-22 14:16:25 +00:00
Sam Reed
8a01281913 Remove some unreachable code (usually returns after throwing exceptions)
Fixup call of method after return in DatabaseMssql by using a temp
2010-08-24 22:03:18 +00:00
Niklas Laxström
ea8428af0f Added a hook into MWNamespace::getCanonicalNamespaces() to provide safe way to
define new namespaces in extensions.

Without the hook the list could be initialised too early and some namespaces
would be left undefined. Was causing problems at translatewiki.net.
2010-08-24 19:58:55 +00:00
Niklas Laxström
2b19fa7e3d Fix yet another regression in r71342: NS_MAIN was dropped from valid namespaces, breaking at least opensearch 2010-08-23 08:46:13 +00:00
Niklas Laxström
aa383d282d Missing else condition was breaking namespaces for everyone else but me. Followup r71342 2010-08-20 16:28:02 +00:00
Niklas Laxström
ee4669878e Of course didn't mean to commit var_dump 2010-08-20 10:30:24 +00:00
Niklas Laxström
b7824e03cf Trying to clean up the mess with $wgCanonicalNamespaceNames and $wgExtraNamespaces.
Now those two together define the set of namespaces used in the wiki.
$wgExtraNamespaces is for user configuration and overrides, while
$wgCanonicalNamespaceNames is for extension adding their own namespaces.
No code should access those two directly for reading. Instead they should use
MWNamespace::getCanonicalNamespaces.

Also fixed indentation with spaces to tabs in Language.php
2010-08-20 10:25:10 +00:00
Platonides
5833c105d0 Move getValidNamespaces() to Namespace.php 2010-07-25 22:29:05 +00:00
Mark A. Hershberger
5162f49f97 Random whitespace cleanup 2010-02-05 04:25:30 +00:00
Mark A. Hershberger
faac46493e follow up 61775 -- REVERT REVERT 2010-02-01 04:57:42 +00:00
Mark A. Hershberger
29ed343b4c Fix parsertests so that they work even when server-side thumbnailing isn't configured. 2010-02-01 04:55:15 +00:00
Mark A. Hershberger
f16507a49c Make tests work, note skipped tests, update autoloader for FakeMemcachedClient, take care of strange variable scoping issues in autoloaded Namespace.php. 2010-01-11 03:47:04 +00:00
Tim Starling
6e6023740c Add NS_USER to MWNamespace::$alwaysCapitalizedNamespaces, as suggested by Happy-melon on CR r57558. Untested, but should be beneficial, allowing easier linking to users on wikis with $wgCapitalLinks=false. But redirects from invalid names to valid names, e.g. [[User:tim]] -> [[User:Tim]] will become inaccessible. r57558 itself suffers similar problems, inaccessible pages should really be cleaned up with a maintenance script. 2009-12-15 04:20:17 +00:00
Chad Horohoe
a4e5e935b6 Mass convert NULL -> null. Left strings and comments alone, obviously. 2009-12-11 21:07:27 +00:00
Chad Horohoe
6afbf91101 bug 9982. Encapsulate wgCanonicalNamespaceNames. Patch by Scott Colcord, with updates 2009-10-16 04:06:30 +00:00
Chad Horohoe
c319cc8968 (bug 13750) $wgCapitalLinks should be a per-namespace setting 2009-10-09 12:52:16 +00:00
Brion Vibber
2f1cee5b91 Cleanup r44683 -- fix E_NOTICE bug in MWNamespace::getCanonicalName() instead of replicating the function. :)
(Also note -- using MWNamespace instead of Namespace for PHP 5.3 compat.)
2008-12-16 23:57:21 +00:00
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00