Commit graph

360 commits

Author SHA1 Message Date
Aaron Schulz
14863b9aa5 Cleaned up some references to FSRepo in code and comments. This should have no noticeable functional changes. 2011-12-20 19:25:23 +00:00
Aaron Schulz
8bf318d90f FU r106752: Fixed directory b/c for ForeignAPIRepo, which was moved to Setup.php 2011-12-20 07:53:48 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
John Du Hart
0de3082ca4 Adding new debugging toolbar
Needs a UI cleanup still, but for the most part is working.
2011-12-04 18:29:57 +00:00
Bryan Tong Minh
7f61f319ff Per r97671, add $wgEnableAutoRotation setting that can be used to explicitly disable auto-rotation. 2011-10-15 20:30:37 +00:00
Niklas Laxström
d19db48793 Followup r98135
* Added gender parameter to newuserlog-create2-entry
* Hide old comments (for all log types!)
* logentry-newusers-newusers needs a message after all
* Move user tool links away from the action links and drop the User: prefix from create2
2011-09-28 20:28:40 +00:00
Niklas Laxström
5ad4536ef2 Converted display part of new user log to new system 2011-09-26 15:12:44 +00:00
Roan Kattouw
fbc65f8972 Per CR on r44412 and my promise in the commit summary of r94990, stop abusing $wgInternalServer (intended for Squid URLs) for IRC/e-mail URLs and introduce $wgCanonicalServer for these purposes instead. This revision introduces two new hooks for WMF hacks, in exchange for making the core code saner.
* Introduce $wgCanonicalServer, which should typically be a fully qualified version of $wgServer but in practice can be anything that you'd like to be used in IRC/e-mail notifs
** Default value is $wgServer, expanded to http:// if protocol-relative
** This means you can easily set HTTPS as the 'default' protocol to use in IRC and e-mail notifs by setting $wgCanonicalServer to https://example.com
* Introduce Title::getCanonicalURL(). Similar to getInternalURL(), including a hook for WMF usage (which will be needed as long as secure.wikimedia.org is used)
** Also add escapeCanonicalURL(). Due to some ridiculous accident of history, the other escapeFooURL() functions don't have a $variant parameter; I decided not to follow that bad example
* Reinstate the spirit of r44406 and r44412: instead of calling getInternalURL() (or getCanonicalURL()) and regexing the title parameter out, obtain the path to index.php using $wgCanonicalServer . $wgScript and append params to that. Sadly, we need to add a hook here to support the secure server hack for WMF, but that's the price of saner code in this case
* Introduce the {{canonicalurl:}} and {{canonicalurle:}} parser functions, which work just like {{fullurl:}} and {{fullurle:}} except that they use getCanonicalURL() instead of getFullURL()
* Use {{canonicalurl:}} in the enotif_body message, fixing bug 29993 (protocol-relative URLs appear in e-mail notifications)
2011-08-19 11:23:17 +00:00
Alexandre Emsenhuber
2f7f99b1f1 * Don't create a WebRequest obhject in CLI mode but a FauxRequest; avoids some useless notices about headers already sent (I know this is more a PHP silliness, but anyway)
* Added HTTP response code parsing (sending a "HTTP/1.x code" header was throwing a NOTICE about undefined index on the result of the explode() call) and storage; added FauxResponse::getStatusCode() to retrieve it
2011-07-05 15:05:14 +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
Chad Horohoe
0bafff5109 Misc. exception handling cleanup--moved it out of global function namespace
Also removed htmlHeader() and htmlFooter() since it has zero callers anywhere.
Not sure why useOutputPage() was checking isArticleRelated(), we should be able do use it with other stuff too
2011-05-30 00:18:10 +00:00
Alexandre Emsenhuber
6494121882 Now that Hooks.php contains a class, moved wfRunHooks() definition to GlobalFunctions.php and removed its inclusion from Setup.php 2011-05-28 16:11:40 +00:00
Tim Starling
4c63ef444a Some HipHop fixes:
* Scan the C++ for volatile classes and show a warning with a list of them
* Fixed volatile classes Revision, CoreLinkFunctions and FileRepoStatus, made them non-volatile by patching the referring code
* Added some configuration for the build process to DefaultSettings.php. 
* Split a few functions off MakeHipHop::execute()
* Only include UtfNormalDefines.php in interpreted mode, since in compiled mode, the constants exist from startup
* Apparently HipHop does not support set_exception_handler(). Added a try/catch block around the main part of index.php instead.
* Fixed ini_get() dependencies in Special:Upload. Upload now works, if you disable ZipDirectoryReader.
2011-05-27 06:25:21 +00:00
Brion Vibber
c37da68754 Revert r87964: destroyed standard segregation of non-view action links outside of $wgArticlePath, which would have created huge extra search spider traffic to sites and put more bogus URLs into indexes.
This also reverts some convenience functions that were being added at the same time (??) to attempt to parse local links from JS.
2011-05-23 19:03:17 +00:00
Chad Horohoe
3e11266ae5 $wgArticle is deprecated! Possible removal in 1.20 or 1.21!
* Encapsulate index.php in wfIndexMain() (similar to r77873)
* Kill $wgArticle check in Exception, not necessary anymore
* Kill $wgArticle in Setup, also not necessary
* Add angry note about $wgArticle to rebuildFileCache.
* Remove note about $wgArticle in Parser since it's dying anyway
2011-05-22 17:59:47 +00:00
Antoine Musso
3899d898bd wgIniGetBool -> wfIniGetBool (typo, fu 88391) 2011-05-19 17:23:35 +00:00
Antoine Musso
d8c59f8f0d Makes sure wgAdditionalMailParams is null in safe mode
The global is used for a call to PHP mail() function as a way to add
additional parameters.  This will cause mail() to send E_NOTICE when
using safe mode.

Since we could use the global at different places, it makes sens to
ensure it has a sane value through Setup.php

Follow up r75557
2011-05-18 20:28:44 +00:00
Niklas Laxström
bf947a61f4 Whitespace changes 2011-05-16 09:40:19 +00:00
Rob Lanphier
9e2e94da92 Changing !isset to is_null (thanks Roan!) and fixing some coding style stuff
Followup to r88178
2011-05-15 13:56:12 +00:00
Rob Lanphier
c7999388a4 Setting $wgLocalTZoffset based on $wgLocaltimezone, using code that used to
be in a comment in DefaultSettings.  Pair programmed with hashar.
2011-05-15 13:42:10 +00:00
Tim Starling
69f2c2edee Fix for HipHop breakage in r87748 etc. Please do not use require_once(dirname(__FILE__)...) to fetch class, function or define() dependencies anymore. You do not need to have HipHop to know that doing so will break it. 2011-05-15 13:36:59 +00:00
Tim Starling
6fec4e3fde Revert r87635, r87637, r87639, r87643 (MW_MIN_PHP_VERSION etc.): breaks HipHop support. 2011-05-15 13:21:16 +00:00
Alexandre Emsenhuber
421948c238 Rewrote the article counting code and related:
* (bug 26033, bug 24754) Added $wgArticleCountMethod to have a more flexible way to define which method to use to define if a page is an article or not and deprecated $wgUseCommaCount. There is now a new 'any' method to count any article that is in a content namespace and not a redirect.
* (bug 11868) If using links to count articles, Article::isCountable() will now use the ParserOutput to check if there's a link instead of checking for the "[[" string. Changed Article::isCountable() to take a stdObject or false for the first parameters. If false is passed, the result will be based on the current article's state (i.e. database). The only call outside of the Article class is in DeleteAction (including extensions).
* Removed this horror of Article::$mGoodAdjustment and Article::$mTotalAdjustment, replaced by the new $created parameter on Article::editUpdates(); simplified Article::createUpdates()
* Updated Import.php to take advantage of the new parameter and make a single call to Article::editUpdates()
2011-05-14 17:11:32 +00:00
Antoine Musso
efd83c55fc merge in prettyURL patch
This is basicly a merge of r84386 & r84491, see their commit messages for
more details.

r84386 makes wikilinks nicer by updating the URL forge implemented by r2621
r84491 fix an issue with the (un)?watch links. getParamValue should not be
used to guess 'title' or 'action'
2011-05-13 11:41:17 +00:00
Alexandre Emsenhuber
f40fb98c10 Moved inclusion of UtfNormalDefines.php near other inclusions 2011-05-10 19:03:23 +00:00
Happy-melon
fd34d0354b * Implement MW_VERSION constant in Defines.php and use it in preference to $wgVersion. Defines.php will have been loaded anywhere that DefaultSettings.php has been loaded.
* Move the declaration of $wgFeedClasses from Defines.php to WebStart.php
2011-05-07 14:53:08 +00:00
Sam Reed
66f31cc203 Kill $wgAllowUserSkin 2011-05-06 23:18:11 +00:00
Alexandre Emsenhuber
0cd07c7ce7 Removed LogPageValidTypes, LogPageLogName, LogPageLogHeader and LogPageActionText hooks. They are deprecated since 1.6 or so. 2011-05-06 18:17:52 +00:00
Chad Horohoe
157466dc55 Kill $wgSkinExtensionFunctions. Way back in r4934 when it was introduced, it was near the beginning of Setup.php, and $wgExtensionFunctions was near the end. Thus, they served two different purposes for doing extension setup. Refactoring over time has brought these processes side-by-side and thus the unused (and less-featured) one is getting the axe.
-1 more awful global \o/
2011-05-05 06:29:33 +00:00
Happy-melon
21813a563c Follow-up r86775: restub $wgLang. Not because it's a good idea, but because I can't see how to avoid the circular dependencies on it *without* stubbing it. Probably easier to just continue the drive to deprecate the global variable altogether. 2011-04-24 10:50:51 +00:00
Happy-melon
c80535ae10 Stop stubbing $wgLang and $wgContLang. There are no major code paths which do not call either $wgLang or $wgContLang at least once. All index.php calls unstub $wgContLang from MediaWiki::parseTitle() except in the edgecase of viewing pages referenced only by "curid=123", and since those will end up calling OutputPage::output() they will eventually be unstubbed at some point as well. All calls through load.php unstub $wgLang in ResourceLoaderContext::getLanguage() from ResouceLoader::respond() --> ResourceLoader::preloadModuleInfo(). All calls through api.php unstub $wgContLang in ApiResult::cleanUpUTF8() from ApiMain::printResult(). 2011-04-23 15:19:38 +00:00
Happy-melon
545d854a39 Documentation and type hinting. 2011-04-23 13:55:27 +00:00
Sam Reed
32e0b59150 Followup r85944, move UtfNormalDefins stuff out of extensions profiling area 2011-04-14 21:21:28 +00:00
Happy-melon
8779f4b55f r86001, now with less scariness :P I took out the delete action and did purge instead, which is a much more self-contained action-with-a-form. Also implement a few changes suggested by Brion on IRC last night. 2011-04-14 10:38:29 +00:00
Happy-melon
bc4a096805 Revert r86001: Brion says it's too scary :D will recommit in pieces 2011-04-13 23:36:27 +00:00
Happy-melon
6dc8136d12 New infrastructure for actions, as discussed on wikitech-l. Fairly huge commit.
* Actions come in two flavours: the show-a-form-then-do-something-with-the-result (delete, protect, edit, etc) and the just-do-something (watch, rollback, patrol, etc).  Create abstract base classes Action and FormlessAction to support these two cases.  HTMLForm is an integral part of the form-based structure.
* Look mum, no globals!  :D  Fully context-based.
* Implement watch/unwatch, credits and delete actions in the new system as proof-of-concept.  This also gives the delete frontend a much-needed overhaul.
* Stub out the newly-deprecated functions from Article.php.  This already reduces its linecount by about 15%, and there are plenty more actions still to do.
* Centralising actions like this is going to render a lot of hooks type-incompatible.  There's simply nowhere you can put the ArticleConfirmDelete hook, for instance, where it can be passed an OutputPage as the second parameter.  On the other hand, we can implement new hooks like ActionModifyFormFields and ActionBeforeFormDisplay, which can do much prettier stuff to the forms, like adding extra fields the 'right' way.  Update LiquidThreads to use these new hooks where appropriate.
2011-04-13 23:04:07 +00:00
Sam Reed
d762deeb7b Related to bug 28470 (Doxygen not updating)
Move require_once( MWInit::compiledPath( 'includes/normal/UtfNormalDefines.php' ) ); to Setup.php

Might want relocating in Setup.php though
2011-04-13 13:09:17 +00:00
Brion Vibber
ff0524b3bc Initial stab at breaking math/texvc out to Math extension.
* (bug 14202) $wgUseTeX has been superseded by the Math extension. To re-enable
  math conversion after upgrading, obtain the Math extension from SVN or from
  http://www.mediawiki.org/wiki/Extension:Math and add to LocalSettings.php:
  require_once "$IP/extensions/Math/Math.php";

This is an initial stab, and a few things remain to be cleaned up:
* messages need to be moved from core to extension
* MW_MATH_* constants should be moved to the extension from core
* old back-compat math names interfaces using those constants should be removed from message files
* classic edit toolbar's math button should be added from the extension (or else dropped) -- currently there's not a clean hook, but could do it by JS
* couple of things like the 'armourMath' function on Language & LanguageConverter may want to be redone just as an unconditional, if that's simpler.

Setting $wgUseTeX alone will no longer have any affect. The var's still there for the moment as a few bits still need to be fully moved out from core.
2011-04-09 00:39:40 +00:00
Alexandre Emsenhuber
45339d4d54 No need to force inclusion of Namespace.php since r85327 2011-04-08 07:19:26 +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
Daniel Friesen
ff33175e96 Update index.php and Wiki.php to make better use of the context. 2011-04-04 00:18:33 +00:00
Happy-melon
4a0500a514 Follow-up to r85240:
* Don't stub RequestContext.  The chances of us getting away without needing to access *any* of the six major globals is nil, and in the meantime it's screwing up strong function typing and throwing catchable fatals everywhere.  

* Stop stubbing $wgOut.  The only path where we can avoid unstubbing it is if we immediately die due to maxlag overflow, and that's a) a pretty uncommon code path, and b) a DB issue which won't be affected by a tiny bit of extra apache load.  That allows us to do strong typing on function parameters with it, which is a Good Thing (TM).

Also make OutputPage::getContext() private; I'm not convinced that a context belongs here (it's *part of* the context, not a consumer of it), let's work through it a it more before we advertise its existence.
2011-04-03 20:40:27 +00:00
Daniel Friesen
c08158368c Implement the RequestContext class. Some credit to IAlex, ;) other credit for me and that plethora of bugs and hicoughs I had to deal with in impelenting it.
http://www.mediawiki.org/wiki/Requests_for_comment/Context_object (it's little different though)
2011-04-03 10:41:14 +00:00
Sam Reed
f65dde3bf8 Adding some type documentation to some well used globals 2011-03-24 00:48:22 +00:00
Aaron Schulz
91fb54d0f9 Reverted r84386; breakage too severe 2011-03-20 21:30:24 +00:00
Antoine Musso
5da14533aa Makes wikilinks nicer when possible
This patch mostly impact Title:getLocalUrl() with two changes:

1) Abstraction:

$wgActionPath related code is now in Title::resolveActionPath(). It now
interprets query parameters using an array which is easier to read than
playing with a regexp and the evil $matches[].


2) Tweaking:

Change the 7 years old (r2621) URL forge:
  "{$wgScript}?title={$dbkey}&{$query}"
  => /w/index.php?title=FOO&q=2

To a nicer
  "str_replace( '$1', $dbkey, $wgArticlePath )"
  => /wiki/FOO?q=2


Additional changes:

* Parser tests were modified to reflect the changes.
* PHPUnit TitleTest amended to test getLocalUrl() (add more!!)
* When using wgActionPaths, makes sure the 'view' action is a sane default
2011-03-20 14:57:49 +00:00
Brian Wolff
5220bd4fbb If $wgEnotifMinorEdits=false, the enotifminoredits pref does nothing, so put it in $wgHiddenPrefs.
Its confusing to have it as an option, if its disabled, especially since there is no indication to the
user that it is disabled.
2011-03-06 04:13:46 +00:00
Tim Starling
be76d86932 * Rewrote ObjectCache.php to conform to the modern coding style, and to be less convoluted about how CACHE_ANYTHING and CACHE_ACCEL are resolved. Moved most functionality to static members of a new ObjectCache class.
* Moved the global functions to GlobalFunctions.php, where they are now just convenience wrappers. Made them return non-references. Updated callers (none found in extensions). 
* Added an advanced configuration method, $wgObjectCaches, which allows a lot more detail in the object cache configuration than $wgMainCacheType. 
* Made all object cache classes derive from BagOStuff. 
* Split the MWMemcached class into a generic client class and a MediaWiki-specific wrapper class. The wrapper class presents a simple BagOStuff interface to calling code, hiding memcached client internals, and will simplify the task of supporting the PECL extension.
* Added some extra constructor parameters to MWMemcached, configurable via $wgObjectCaches.
* Removed the *_multi() methods from BagOStuff, my grepping indicates that they are not used.
* Rewrote FakeMemCachedClient as a BagOStuff subclass, called EmptyBagOStuff.
* Added an optional "server" parameter to SQLBagOStuff. This allows the server holding the objectcache table to be different from the server holding the core DB.
* Added MultiWriteBagOStuff: a cache class which writes to multiple locations, and reads from them in a defined fallback sequence. This can be used to extend the cache space by adding disk-backed storage to existing in-memory caches.
* Made MWMemcached::get() return false on failure instead of null, to match the BagOStuff documentation and the other BagOStuff subclasses. Anything that was relying on it returning null would have already been broken with SqlBagOStuff.
* Fixed a bug in the memcached client causing keys with spaces or line breaks in them to break the memcached protocol, injecting arbitrary commands or parameters. Since the PECL client apparently also has this flaw, I implemented the fix in the wrapper class.
* Renamed BagOStuff::set_debug() to setDebug(), since we aren't emulating the memcached client anymore
* Fixed spelling error in MWMemcached: persistant -> persistent
2011-03-03 09:37:37 +00:00
Tim Starling
af04dde290 Start of ObjectCache reorganisation. Moved the object cache files to includes/objectcache/. Split BagOStuff.php into single-class files. 2011-03-03 04:38:17 +00:00
Alexandre Emsenhuber
8e7741c77d Merged retrieval of request URL and header from WebRequest and Setup.php to avoid duplicate code and reduced the number of wfDebug() calls in Setup.php.
The only side effect is that headers name are in uppercase in the debug log.
2011-02-19 13:09:17 +00:00