Last modified: 2011-04-30 01:16:46 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20656, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18656 - wfMkdirParents doesn't work on Windows
wfMkdirParents doesn't work on Windows
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.14.x
PC Windows XP
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-02 20:01 UTC by Chris Crook
Modified: 2011-04-30 01:16 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Chris Crook 2009-05-02 20:01:34 UTC
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
}
Comment 1 Chad H. 2009-05-14 20:45:37 UTC
Fixed in r50602

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links