Commit graph

105 commits

Author SHA1 Message Date
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
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
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
Siebrand Mazeland
36f42c9b15 (bug 44) Rename Image namespace to File. Based on a patch by brion.
* Parser tests updated. 14 failing parser tests before the change, added one, and the same 14 failing parser tests are remaining
* added namespace aliases for Image and Image_talk for backward compatibility purposes
2008-11-17 21:27:00 +00:00
Brion Vibber
201a3fc978 Revert 37530 -- removes the control option for image moving 2008-07-10 21:53:14 +00:00
Victor Vasiliev
75bebd2364 * Make image moving no longer experimental 2008-07-10 20:28:52 +00:00
Aryeh Gregor
4ed81df65f Code simplification (-205 bytes :P):
* Add MWNamespace::hasSubpages() and use that instead of $wgNamespacesWithSubpages everywhere
* Put early returns first, and don't else { } the rest of the code
2008-05-23 22:00:14 +00:00
Alexandre Emsenhuber
b5debc4f65 Doc tweaks:
* @ingrouo -> @ingroup (whoops!)
* Fix doxygen warnings
* Remove duplicate definition of $wgMetaNamespaceTalk in DefaultSettings.php, thanks to VasilievVV for pointing this out
2008-05-21 18:18:58 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Victor Vasiliev
8d85629c58 * (bug 709) Cannot rename/move images and other media files.
Currently in experimental mode, use $wgAllowImageMoving to enable it.
Known issues:
* Doesn't work with rev_deleted
* May also have some security and caching issues.
2008-05-03 13:09:34 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Aryeh Gregor
b9a8ffba8b Actually, revert r32370. It might be a good idea, but it breaks the UserGetRights hook (more than it already is). Could use some more thought. 2008-03-24 13:47:16 +00:00
Aryeh Gregor
73c025c25c Moving some optimization code into User::isAllowed instead of higher up in Title.php. Also, adding a comment so that people maybe aren't going to randomly remove it without thinking what it does. ;) 2008-03-24 13:40:45 +00:00
Brion Vibber
deb2045611 * (bug 12294) Namespace class renamed to MWNamespace for PHP 5.3 compatibility
* PHP 5.3 compatibility fix for wfRunHooks() called with no parameters

An autoloaded 'Namespace' class alias is retained for compatibility with
extensions which haven't updated to the new class name... however they too
will break on PHP 5.3. Yay!
2008-03-21 23:13:34 +00:00