Page MenuHomePhabricator

wfMkdirParents doesn't work on Windows
Closed, ResolvedPublic

Description

Author: chriscrook

Description:
Installed mediawiki 1.14 onto XP windows computer running IIS version 6, php version 5.1.2 (isapi), and mysql 5.0.51a-community-nt.

Every upload failed with a message "Unable to create public/x/xy".

The problem appears to be the php recursive mkdir function on windows, which only works with windows type path delimiters (backslash).

I was able to fix this by inserting an extra line of code in the includes/GlobalFunctions.php as below

function wfMkdirParents( $dir, $mode = null ) {
global $wgDirectoryMode;

if( strval( $dir ) === '' || file_exists( $dir ) )

		return true;

if ( is_null( $mode ) )

		$mode = $wgDirectoryMode;

Fix for windows

$dir = str_replace("/",DIRECTORY_SEPARATOR,$dir);

return mkdir( $dir, $mode, true ); // PHP5 <3
}


Version: 1.14.x
Severity: major
OS: Windows XP
Platform: PC

Details

Reference
bz18656

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:36 PM
bzimport set Reference to bz18656.
bzimport added a subscriber: Unknown Object (MLST).