Fix Bug #32047: in table with class="sortable", thead is before
[lhc/web/wiklou.git] / includes / Setup.php
index 58b9002..afde02f 100644 (file)
@@ -41,6 +41,18 @@ if ( $wgArticlePath === false ) {
        }
 }
 
+if ( !empty($wgActionPaths) && !isset($wgActionPaths['view']) ) {
+       # 'view' is assumed the default action path everywhere in the code
+       # but is rarely filled in $wgActionPaths
+       $wgActionPaths['view'] = $wgArticlePath;
+}
+
+if ( !empty($wgActionPaths) && !isset($wgActionPaths['view']) ) {
+       # 'view' is assumed the default action path everywhere in the code
+       # but is rarely filled in $wgActionPaths 
+       $wgActionPaths['view'] = $wgArticlePath ;
+}
+
 if ( $wgStylePath === false ) $wgStylePath = "$wgScriptPath/skins";
 if ( $wgLocalStylePath === false ) $wgLocalStylePath = "$wgScriptPath/skins";
 if ( $wgStyleDirectory === false ) $wgStyleDirectory   = "$IP/skins";
@@ -175,6 +187,11 @@ if ( $wgUseInstantCommons ) {
        );
 }
 
+if ( is_null( $wgEnableAutoRotation ) ) {
+       // Only enable auto-rotation when the bitmap handler can rotate
+       $wgEnableAutoRotation = BitmapHandler::canRotate();
+}
+
 if ( $wgRCFilterByAge ) {
        # # Trim down $wgRCLinkDays so that it only lists links which are valid
        # # as determined by $wgRCMaxAge.
@@ -286,6 +303,10 @@ if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
 # Blacklisted file extensions shouldn't appear on the "allowed" list
 $wgFileExtensions = array_diff ( $wgFileExtensions, $wgFileBlacklist );
 
+if ( $wgArticleCountMethod === null ) {
+       $wgArticleCountMethod = $wgUseCommaCount ? 'comma' : 'link';
+}
+
 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
        $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
 }
@@ -299,10 +320,12 @@ if ( $wgNewUserLog ) {
        $wgLogTypes[]                        = 'newusers';
        $wgLogNames['newusers']              = 'newuserlogpage';
        $wgLogHeaders['newusers']            = 'newuserlogpagetext';
-       $wgLogActions['newusers/newusers']   = 'newuserlogentry'; // For compatibility with older log entries
-       $wgLogActions['newusers/create']     = 'newuserlog-create-entry';
-       $wgLogActions['newusers/create2']    = 'newuserlog-create2-entry';
-       $wgLogActions['newusers/autocreate'] = 'newuserlog-autocreate-entry';
+       # newusers, create, create2, autocreate
+       $wgLogActionsHandlers['newusers/*']  = 'NewUsersLogFormatter';
+}
+
+if ( $wgCookieSecure === 'detect' ) {
+       $wgCookieSecure = ( substr( $wgServer, 0, 6 ) === 'https:' );
 }
 
 if ( !defined( 'MW_COMPILED' ) ) {
@@ -311,17 +334,23 @@ if ( !defined( 'MW_COMPILED' ) ) {
        }
 
        wfProfileIn( $fname . '-exception' );
-       require_once( "$IP/includes/Exception.php" );
-       wfInstallExceptionHandler();
+       MWExceptionHandler::installHandler();
        wfProfileOut( $fname . '-exception' );
 
        wfProfileIn( $fname . '-includes' );
+       require_once( "$IP/includes/normal/UtfNormalUtil.php" );
        require_once( "$IP/includes/GlobalFunctions.php" );
-       require_once( "$IP/includes/Hooks.php" );
        require_once( "$IP/includes/ProxyTools.php" );
        require_once( "$IP/includes/ImageFunctions.php" );
+       require_once( "$IP/includes/normal/UtfNormalDefines.php" );
        wfProfileOut( $fname . '-includes' );
 }
+
+# Now that GlobalFunctions is loaded, set the default for $wgCanonicalServer
+if ( $wgCanonicalServer === false ) {
+       $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
+}
+
 wfProfileIn( $fname . '-misc1' );
 
 # Raise the memory limit if it's too low
@@ -332,18 +361,27 @@ wfMemoryLimit();
  * that happens whenever you use a date function without the timezone being
  * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
  */
-wfSuppressWarnings();
-date_default_timezone_set( date_default_timezone_get() );
-wfRestoreWarnings();
+if ( is_null( $wgLocaltimezone) ) {
+       wfSuppressWarnings();
+       $wgLocaltimezone = date_default_timezone_get();
+       wfRestoreWarnings();
+}
 
-# Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
-$wgRequest = new WebRequest;
+date_default_timezone_set( $wgLocaltimezone );
+if( is_null( $wgLocalTZoffset ) ) {
+       $wgLocalTZoffset = date( 'Z' ) / 60;
+}
 
 # Useful debug output
 global $wgCommandLineMode;
 if ( $wgCommandLineMode ) {
+       $wgRequest = new FauxRequest( array() );
+
        wfDebug( "\n\nStart command line script $self\n" );
 } else {
+       # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor
+       $wgRequest = new WebRequest;
+
        $debug = "Start request\n\n{$_SERVER['REQUEST_METHOD']} {$wgRequest->getRequestURL()}";
 
        if ( $wgDebugPrintHttpHeaders ) {
@@ -423,10 +461,15 @@ if ( !is_object( $wgAuth ) ) {
 
 # Placeholders in case of DB error
 $wgTitle = null;
-$wgArticle = null;
 
 $wgDeferredUpdateList = array();
 
+// We need to check for safe_mode, because mail() will throw an E_NOTICE
+// on additional parameters
+if( !is_null($wgAdditionalMailParams) && wfIniGetBool('safe_mode') ) {
+       $wgAdditionalMailParams = null;
+}
+
 wfProfileOut( $fname . '-globals' );
 wfProfileIn( $fname . '-extensions' );
 
@@ -454,8 +497,6 @@ foreach ( $wgExtensionFunctions as $func ) {
 
 wfDebug( "Fully initialised\n" );
 $wgFullyInitialised = true;
-wfProfileOut( $fname . '-extensions' );
-
-require_once( MWInit::compiledPath( 'includes/normal/UtfNormalDefines.php' ) );
 
+wfProfileOut( $fname . '-extensions' );
 wfProfileOut( $fname );