global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
static $recursion = 0;
+ static $cache = array(); // Cache of unoutputted messages
+
# Check for raw action using $_GET not $wgRequest, since the latter might not be initialised yet
if ( isset( $_GET['action'] ) && $_GET['action'] == 'raw' && !$wgDebugRawPage ) {
return;
}
if ( $wgDebugComments && !$logonly ) {
+ $cache[] = $text;
+
if ( !isset( $wgOut ) ) {
return;
}
$wgOut->_unstub();
$recursion--;
}
- $wgOut->debug( $text );
+
+ // add the message and possible cached ones to the output
+ array_map( array( $wgOut, 'debug' ), $cache );
+ $cache = array();
}
if ( '' != $wgDebugLogFile && !$wgProfileOnly ) {
# Strip unprintables; they can switch terminal modes when binary data
$langCode = $options['language'];
$validCodes = array_keys( Language::getLanguageNames() );
if( !in_array($options['language'], $validCodes) ) {
- $langCode = false;
+ # Fallback to en, instead of whatever interface language we might have
+ $langCode = 'en';
}
} else {
$forContent = false;
return true;
} elseif ( $currentDir === false ) {
# Went all the way back to root and it apparently doesn't exist
+ wfDebugLog( 'mkdir', "Root doesn't exist?\n" );
return false;
}
-
# Now go forward creating directories
$createList = array_reverse( $createList );
+
+ # Is the parent directory writable?
+ if ( $currentDir === '' ) {
+ $currentDir = '/';
+ }
+ if ( !is_writable( $currentDir ) ) {
+ wfDebugLog( 'mkdir', "Not writable: $currentDir\n" );
+ return false;
+ }
+
foreach ( $createList as $dir ) {
- # Check first to avoid spamming with warnings
- if ( !is_writable( $dir ) ) {
- return false;
- }
# use chmod to override the umask, as suggested by the PHP manual
if ( !mkdir( $dir, $mode ) || !chmod( $dir, $mode ) ) {
wfDebugLog( 'mkdir', "Unable to create directory $dir\n" );
return $round ? round( $ret, $acc ) . '%' : "$ret%";
}
-/**
- * Encrypt a username/password.
- *
- * @param string $userid ID of the user
- * @param string $password Password of the user
- * @return string Hashed password
- */
-function wfEncryptPassword( $userid, $password ) {
- global $wgPasswordSalt;
- $p = md5( $password);
-
- if($wgPasswordSalt)
- return md5( "{$userid}-{$p}" );
- else
- return $p;
-}
-
/**
* Appends to second array if $value differs from that in $default
*/