die( "This file is part of MediaWiki, it is not a valid entry point" );
}
-require_once dirname( __FILE__ ) . '/normal/UtfNormalUtil.php';
+if ( !defined( 'MW_COMPILED' ) ) {
+ require_once( dirname( __FILE__ ) . '/normal/UtfNormalUtil.php' );
+}
// Hide compatibility functions from Doxygen
/// @cond
$exists = file_exists( $file );
$size = $exists ? filesize( $file ) : false;
if ( !$exists || ( $size !== false && $size + strlen( $text ) < 0x7fffffff ) ) {
- error_log( $text, 3, $file );
+ file_put_contents( $file, $text, FILE_APPEND );
}
wfRestoreWarnings();
}
*/
function wfMessageFallback( /*...*/ ) {
$args = func_get_args();
- return call_user_func_array( array( 'Message', 'newFallbackSequence' ), $args );
+ return MWFunction::callArray( 'Message::newFallbackSequence', $args );
}
/**
}
/**
- * Print a simple message and die, returning nonzero to the shell if any.
- * Plain die() fails to return nonzero to the shell if you pass a string.
+ * Print an error message and die, returning nonzero to the shell if any. Plain die()
+ * fails to return nonzero to the shell if you pass a string. Entry points may customise
+ * this function to return a prettier error message, but implementations must not assume
+ * access to any of the usual MediaWiki infrastructure (AutoLoader, localisation, database,
+ * etc). This should not be called directly once $wgFullyInitialised is set; instead,
+ * throw an exception and let Exception.php handle whether or not it's possible to show
+ * a prettier error.
* @param $msg String
*/
-function wfDie( $msg = '' ) {
- echo $msg;
- die( 1 );
+if( !function_exists( 'wfDie' ) ){
+ function wfDie( $msg = '' ) {
+ echo $msg;
+ die( 1 );
+ }
}
/**
return $isWindows;
}
+/**
+ * Check if we are running under HipHop
+ */
+function wfIsHipHop() {
+ return function_exists( 'hphp_thread_set_warmup_enabled' );
+}
+
/**
* Swap two variables
*/
global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain,
$wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler;
if( $wgSessionsInMemcached ) {
- require_once( 'MemcachedSessions.php' );
+ if ( !defined( 'MW_COMPILED' ) ) {
+ require_once( 'MemcachedSessions.php' );
+ }
+ session_set_save_handler( 'memsess_open', 'memsess_close', 'memsess_read',
+ 'memsess_write', 'memsess_destroy', 'memsess_gc' );
+
+ // It's necessary to register a shutdown function to call session_write_close(),
+ // because by the time the request shutdown function for the session module is
+ // called, $wgMemc has already been destroyed. Shutdown functions registered
+ // this way are called before object destruction.
+ register_shutdown_function( 'memsess_write_close' );
} elseif( $wgSessionHandler && $wgSessionHandler != ini_get( 'session.save_handler' ) ) {
# Only set this if $wgSessionHandler isn't null and session.save_handler
# hasn't already been set to the desired value (that causes errors)