Requests for comment/OutputPage refactor

The current OutputPage class mixes hard-coded HTML/header statements with function calls and hooks in a way that makes it monolithic and hard to modify. Things also happen in a specific order and frequently can’t be changed or modified after being executed. We have worked around most of these issues and added some features. We changed how redirects and head elements work, added configurable top/bottom page script injection, changed some session related code, changed the display of permissions errors, and added helper functions to manipulate the page meta keywords. Most of these changes could be merged to core or refactored to be hooks.

Ideally OutputPage will have no HTML or metadata that cannot be skipped or manipulated in some way, it will just pass data to the skin for inclusion in the page.

Modifications to OutputPage

 * protected $mJQueryDone = true;
 * var $mRedirectsEnabled = true;
 * var $topScripts = '' ; (we allow scripts to be loaded at top and bottom of page)
 * wfRunHooks('SkinGetHeadScripts', array(&$scripts));
 * $scripts = $this->topScripts . $scripts;
 * # Cache permanent redirects for 20 minutes
 * # Changed cache-control header for anon vs logged in users
 * Added hook: AfterFormatPermissionsErrorMessage
 * if( $wgDevelEnvironment ) { $this->addMeta( 'robots', 'noindex, nofollow' ); (headElement function)
 * $this->setHTMLTitle( $this->getWikiaPageTitle( $this->getPageTitle ) );
 * $context->setSkipMessages(true); // in private modules, this caused performance problems
 * added functions: getScriptsOnly, enableRedirects, getWikiaPageTitle, addKeywords( &$parserOutput ), tagWithSurrogateKeys

Locations of hardcoded HTML/metadata/functions that need more flexibility
mVaryHeader

formatPermissionsErrorMessage

readOnlyPage

headElement

getHeadLinks

sendCacheControl