Index: trunk/phase3/includes/Setup.php |
— | — | @@ -175,6 +175,98 @@ |
176 | 176 | ); |
177 | 177 | } |
178 | 178 | |
| 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 | + |
179 | 271 | if ( !class_exists( 'AutoLoader' ) ) { |
180 | 272 | require_once( "$IP/includes/AutoLoader.php" ); |
181 | 273 | } |
— | — | @@ -247,60 +339,6 @@ |
248 | 340 | } |
249 | 341 | } |
250 | 342 | |
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 | | - |
305 | 343 | wfProfileOut( $fname.'-misc1' ); |
306 | 344 | wfProfileIn( $fname.'-memcached' ); |
307 | 345 | |
— | — | @@ -317,28 +355,12 @@ |
318 | 356 | ## Most of the config is out, some might want to run hooks here. |
319 | 357 | wfRunHooks( 'SetupAfterCache' ); |
320 | 358 | |
321 | | -wfProfileIn( $fname.'-SetupSession' ); |
| 359 | +wfProfileIn( $fname.'-session' ); |
322 | 360 | |
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 | | - |
339 | 361 | # 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' ) ) { |
342 | 363 | session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' ); |
| 364 | +} |
343 | 365 | |
344 | 366 | if( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) { |
345 | 367 | if( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix.'Token'] ) ) { |
— | — | @@ -351,7 +373,7 @@ |
352 | 374 | } |
353 | 375 | } |
354 | 376 | |
355 | | -wfProfileOut( $fname.'-SetupSession' ); |
| 377 | +wfProfileOut( $fname.'-session' ); |
356 | 378 | wfProfileIn( $fname.'-globals' ); |
357 | 379 | |
358 | 380 | $wgContLang = new StubContLang; |
— | — | @@ -366,37 +388,27 @@ |
367 | 389 | $wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache', |
368 | 390 | array( $messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry ) ); |
369 | 391 | |
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 | | - |
381 | 392 | if( !is_object( $wgAuth ) ) { |
382 | 393 | $wgAuth = new StubObject( 'wgAuth', 'AuthPlugin' ); |
383 | 394 | wfRunHooks( 'AuthPluginSetup', array( &$wgAuth ) ); |
384 | 395 | } |
385 | 396 | |
386 | | -wfProfileOut( $fname.'-User' ); |
387 | | - |
388 | | -wfProfileIn( $fname.'-misc2' ); |
389 | | - |
390 | | -$wgDeferredUpdateList = array(); |
391 | | - |
392 | | -if ( $wgAjaxUploadDestCheck ) $wgAjaxExportList[] = 'SpecialUpload::ajaxGetExistsWarning'; |
393 | | - |
394 | 397 | # Placeholders in case of DB error |
395 | 398 | $wgTitle = null; |
396 | 399 | $wgArticle = null; |
397 | 400 | |
398 | | -wfProfileOut( $fname.'-misc2' ); |
| 401 | +$wgDeferredUpdateList = array(); |
| 402 | + |
| 403 | +wfProfileOut( $fname.'-globals' ); |
399 | 404 | wfProfileIn( $fname.'-extensions' ); |
400 | 405 | |
| 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 | + |
401 | 413 | # Extension setup functions for extensions other than skins |
402 | 414 | # Entries should be added to this variable during the inclusion |
403 | 415 | # of the extension file. This allows the extension to perform |
— | — | @@ -425,17 +437,6 @@ |
426 | 438 | wfRunHooks( 'LogPageLogHeader', array( &$wgLogHeaders ) ); |
427 | 439 | wfRunHooks( 'LogPageActionText', array( &$wgLogActions ) ); |
428 | 440 | |
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 | | - |
440 | 441 | wfDebug( "Fully initialised\n" ); |
441 | 442 | $wgFullyInitialised = true; |
442 | 443 | wfProfileOut( $fname.'-extensions' ); |