r79754 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79753‎ | r79754 | r79755 >
Date:21:00, 6 January 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
Group settings modifications at the top of the file
Modified paths:
  • /trunk/phase3/includes/Setup.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -175,6 +175,98 @@
176176 );
177177 }
178178
 179+if ( $wgRCFilterByAge ) {
 180+ ## Trim down $wgRCLinkDays so that it only lists links which are valid
 181+ ## as determined by $wgRCMaxAge.
 182+ ## Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
 183+ sort( $wgRCLinkDays );
 184+ for( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
 185+ if( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
 186+ $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
 187+ break;
 188+ }
 189+ }
 190+}
 191+
 192+if ( $wgSkipSkin ) {
 193+ $wgSkipSkins[] = $wgSkipSkin;
 194+}
 195+
 196+# Set default shared prefix
 197+if ( $wgSharedPrefix === false ) {
 198+ $wgSharedPrefix = $wgDBprefix;
 199+}
 200+
 201+if ( !$wgCookiePrefix ) {
 202+ if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
 203+ $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
 204+ } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
 205+ $wgCookiePrefix = $wgSharedDB;
 206+ } elseif ( $wgDBprefix ) {
 207+ $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
 208+ } else {
 209+ $wgCookiePrefix = $wgDBname;
 210+ }
 211+}
 212+$wgCookiePrefix = strtr( $wgCookiePrefix, "=,; +.\"'\\[", "__________" );
 213+
 214+$wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
 215+
 216+if ( $wgMetaNamespace === false ) {
 217+ $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
 218+}
 219+
 220+# These are now the same, always
 221+# To determine the user language, use $wgLang->getCode()
 222+$wgContLanguageCode = $wgLanguageCode;
 223+
 224+# Easy to forget to falsify $wgShowIPinHeader for static caches.
 225+# If file cache or squid cache is on, just disable this (DWIMD).
 226+if ( $wgUseFileCache || $wgUseSquid ) {
 227+ $wgShowIPinHeader = false;
 228+}
 229+
 230+# $wgAllowRealName and $wgAllowUserSkin were removed in 1.16
 231+# in favor of $wgHiddenPrefs, handle b/c here
 232+if ( !$wgAllowRealName ) {
 233+ $wgHiddenPrefs[] = 'realname';
 234+}
 235+
 236+if ( !$wgAllowUserSkin ) {
 237+ $wgHiddenPrefs[] = 'skin';
 238+}
 239+
 240+if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
 241+ # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
 242+ if ( $wgMimeType == 'application/xhtml+xml' ) {
 243+ $wgHtml5Version = 'XHTML+RDFa 1.0';
 244+ } else {
 245+ $wgHtml5Version = 'HTML+RDFa 1.0';
 246+ }
 247+}
 248+
 249+# Blacklisted file extensions shouldn't appear on the "allowed" list
 250+$wgFileExtensions = array_diff ( $wgFileExtensions, $wgFileBlacklist );
 251+
 252+if ( $wgInvalidateCacheOnLocalSettingsChange ) {
 253+ $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
 254+}
 255+
 256+if ( $wgAjaxUploadDestCheck ) {
 257+ $wgAjaxExportList[] = 'SpecialUpload::ajaxGetExistsWarning';
 258+}
 259+
 260+if ( $wgNewUserLog ) {
 261+ # Add a new log type
 262+ $wgLogTypes[] = 'newusers';
 263+ $wgLogNames['newusers'] = 'newuserlogpage';
 264+ $wgLogHeaders['newusers'] = 'newuserlogpagetext';
 265+ $wgLogActions['newusers/newusers'] = 'newuserlogentry'; // For compatibility with older log entries
 266+ $wgLogActions['newusers/create'] = 'newuserlog-create-entry';
 267+ $wgLogActions['newusers/create2'] = 'newuserlog-create2-entry';
 268+ $wgLogActions['newusers/autocreate'] = 'newuserlog-autocreate-entry';
 269+}
 270+
179271 if ( !class_exists( 'AutoLoader' ) ) {
180272 require_once( "$IP/includes/AutoLoader.php" );
181273 }
@@ -247,60 +339,6 @@
248340 }
249341 }
250342
251 -if( $wgRCFilterByAge ) {
252 - ## Trim down $wgRCLinkDays so that it only lists links which are valid
253 - ## as determined by $wgRCMaxAge.
254 - ## Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
255 - sort($wgRCLinkDays);
256 - for( $i = 0; $i < count($wgRCLinkDays); $i++ ) {
257 - if( $wgRCLinkDays[$i] >= $wgRCMaxAge / ( 3600 * 24 ) ) {
258 - $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i+1, false );
259 - break;
260 - }
261 - }
262 -}
263 -
264 -if ( $wgSkipSkin ) {
265 - $wgSkipSkins[] = $wgSkipSkin;
266 -}
267 -
268 -$wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
269 -
270 -if($wgMetaNamespace === FALSE) {
271 - $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
272 -}
273 -
274 -# These are now the same, always
275 -# To determine the user language, use $wgLang->getCode()
276 -$wgContLanguageCode = $wgLanguageCode;
277 -
278 -# Easy to forget to falsify $wgShowIPinHeader for static caches.
279 -# If file cache or squid cache is on, just disable this (DWIMD).
280 -if( $wgUseFileCache || $wgUseSquid ) $wgShowIPinHeader = false;
281 -
282 -# $wgAllowRealName and $wgAllowUserSkin were removed in 1.16
283 -# in favor of $wgHiddenPrefs, handle b/c here
284 -if( !$wgAllowRealName ) {
285 - $wgHiddenPrefs[] = 'realname';
286 -}
287 -
288 -if( !$wgAllowUserSkin ) {
289 - $wgHiddenPrefs[] = 'skin';
290 -}
291 -
292 -if ( !$wgHtml5Version && $wgHtml5 && $wgAllowRdfaAttributes ) {
293 - # see http://www.w3.org/TR/rdfa-in-html/#document-conformance
294 - if ( $wgMimeType == 'application/xhtml+xml' ) $wgHtml5Version = 'XHTML+RDFa 1.0';
295 - else $wgHtml5Version = 'HTML+RDFa 1.0';
296 -}
297 -
298 -if ( $wgInvalidateCacheOnLocalSettingsChange ) {
299 - $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
300 -}
301 -
302 -# Blacklisted file extensions shouldn't appear on the "allowed" list
303 -$wgFileExtensions = array_diff ( $wgFileExtensions, $wgFileBlacklist );
304 -
305343 wfProfileOut( $fname.'-misc1' );
306344 wfProfileIn( $fname.'-memcached' );
307345
@@ -317,28 +355,12 @@
318356 ## Most of the config is out, some might want to run hooks here.
319357 wfRunHooks( 'SetupAfterCache' );
320358
321 -wfProfileIn( $fname.'-SetupSession' );
 359+wfProfileIn( $fname.'-session' );
322360
323 -# Set default shared prefix
324 -if( $wgSharedPrefix === false ) $wgSharedPrefix = $wgDBprefix;
325 -
326 -if( !$wgCookiePrefix ) {
327 - if ( $wgSharedDB && $wgSharedPrefix && in_array('user',$wgSharedTables) ) {
328 - $wgCookiePrefix = $wgSharedDB . '_' . $wgSharedPrefix;
329 - } elseif ( $wgSharedDB && in_array('user',$wgSharedTables) ) {
330 - $wgCookiePrefix = $wgSharedDB;
331 - } elseif ( $wgDBprefix ) {
332 - $wgCookiePrefix = $wgDBname . '_' . $wgDBprefix;
333 - } else {
334 - $wgCookiePrefix = $wgDBname;
335 - }
336 -}
337 -$wgCookiePrefix = strtr($wgCookiePrefix, "=,; +.\"'\\[", "__________");
338 -
339361 # If session.auto_start is there, we can't touch session name
340 -#
341 -if( !wfIniGetBool( 'session.auto_start' ) )
 362+if ( !wfIniGetBool( 'session.auto_start' ) ) {
342363 session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
 364+}
343365
344366 if( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
345367 if( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix.'Token'] ) ) {
@@ -351,7 +373,7 @@
352374 }
353375 }
354376
355 -wfProfileOut( $fname.'-SetupSession' );
 377+wfProfileOut( $fname.'-session' );
356378 wfProfileIn( $fname.'-globals' );
357379
358380 $wgContLang = new StubContLang;
@@ -366,37 +388,27 @@
367389 $wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache',
368390 array( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry ) );
369391
370 -wfProfileOut( $fname.'-globals' );
371 -wfProfileIn( $fname.'-User' );
372 -
373 -# Skin setup functions
374 -# Entries can be added to this variable during the inclusion
375 -# of the extension file. Skins can then perform any necessary initialisation.
376 -#
377 -foreach ( $wgSkinExtensionFunctions as $func ) {
378 - call_user_func( $func );
379 -}
380 -
381392 if( !is_object( $wgAuth ) ) {
382393 $wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' );
383394 wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) );
384395 }
385396
386 -wfProfileOut( $fname.'-User' );
387 -
388 -wfProfileIn( $fname.'-misc2' );
389 -
390 -$wgDeferredUpdateList = array();
391 -
392 -if ( $wgAjaxUploadDestCheck ) $wgAjaxExportList[] = 'SpecialUpload::ajaxGetExistsWarning';
393 -
394397 # Placeholders in case of DB error
395398 $wgTitle = null;
396399 $wgArticle = null;
397400
398 -wfProfileOut( $fname.'-misc2' );
 401+$wgDeferredUpdateList = array();
 402+
 403+wfProfileOut( $fname.'-globals' );
399404 wfProfileIn( $fname.'-extensions' );
400405
 406+# Skin setup functions
 407+# Entries can be added to this variable during the inclusion
 408+# of the extension file. Skins can then perform any necessary initialisation.
 409+foreach ( $wgSkinExtensionFunctions as $func ) {
 410+ call_user_func( $func );
 411+}
 412+
401413 # Extension setup functions for extensions other than skins
402414 # Entries should be added to this variable during the inclusion
403415 # of the extension file. This allows the extension to perform
@@ -425,17 +437,6 @@
426438 wfRunHooks( 'LogPageLogHeader', array( &$wgLogHeaders ) );
427439 wfRunHooks( 'LogPageActionText', array( &$wgLogActions ) );
428440
429 -if( !empty($wgNewUserLog) ) {
430 - # Add a new log type
431 - $wgLogTypes[] = 'newusers';
432 - $wgLogNames['newusers'] = 'newuserlogpage';
433 - $wgLogHeaders['newusers'] = 'newuserlogpagetext';
434 - $wgLogActions['newusers/newusers'] = 'newuserlogentry'; // For compatibility with older log entries
435 - $wgLogActions['newusers/create'] = 'newuserlog-create-entry';
436 - $wgLogActions['newusers/create2'] = 'newuserlog-create2-entry';
437 - $wgLogActions['newusers/autocreate'] = 'newuserlog-autocreate-entry';
438 -}
439 -
440441 wfDebug( "Fully initialised\n" );
441442 $wgFullyInitialised = true;
442443 wfProfileOut( $fname.'-extensions' );

Comments

#Comment by Aaron Schulz (talk | contribs)   22:46, 14 June 2011

The order of AuthPluginSetup and $wgExtensionFunctions switched. Are all auth extensions OK with that?

#Comment by 😂 (talk | contribs)   01:21, 1 July 2011

Only $wgSkinExtensionFunctions was moved, and I killed that in r87487 anyway. $wgExtensionFunctions was already at the end of Setup.php before this commit.

#Comment by Aaron Schulz (talk | contribs)   05:36, 1 July 2011

Ah, right.

Status & tagging log