Index: wp-admin/includes/class-wp-filesystem-direct.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-direct.php	(revision 11664)
+++ wp-admin/includes/class-wp-filesystem-direct.php	(working copy)
@@ -17,37 +17,93 @@
 class WP_Filesystem_Direct extends WP_Filesystem_Base {
 	var $permission = null;
 	var $errors = null;
+	/**
+	 * constructor
+	 * 
+	 * @param $arg mixed ingored argument
+	 */
 	function WP_Filesystem_Direct($arg) {
 		$this->method = 'direct';
 		$this->errors = new WP_Error();
-		$this->permission = umask();
+		$this->permission = 0777;
 	}
+	/**
+	 * connect filesystem.
+	 * 
+	 * @return bool Returns true on success or false on failure (always true for WP_Filesystem_Direct).
+	 */
 	function connect() {
 		return true;
 	}
+	/**
+	 * default permission setter
+	 * 
+	 * @param $perm int default permission mask (octal).
+	 * @return void
+	 */
 	function setDefaultPermissions($perm) {
 		$this->permission = $perm;
 	}
+	/**
+	 * Reads entire file into a string
+	 * 
+	 * @param $file string Name of the file to read.
+	 * @return string|bool The function returns the read data or false on failure. 
+	 */
 	function get_contents($file) {
 		return @file_get_contents($file);
 	}
+	/**
+	 * Reads entire file into an array
+	 * 
+	 * @param $file string Path to the file. 
+	 * @return array|bool the file in an array. Each element of the array corresponds to a line in the file, with the newline still attached. Upon failure, get_contents_array returns false. 
+	 */
 	function get_contents_array($file) {
 		return @file($file);
 	}
+	/**
+	 * Write a string to a file
+	 * 
+	 * @param $file string Path to the file where to write the data. 
+	 * @param $contents string The data to write.
+	 * @param $mode int (optional) The mode parameter consists of three octal number components specifying access restrictions for the owner, the user group in which the owner is in, and to everybody else in this order. One component can be computed by adding up the needed permissions for that target user base. Number 1 means that you grant execute rights, number 2 means that you make the file writeable, number 4 means that you make the file readable. Add up these numbers to specify needed rights. You can also read more about modes on Unix systems with 'man 1 chmod' and 'man 2 chmod'.
+	 * @param $type string (optional) The type parameter specifies an additional type of access you require to the file. It may be any of the following: +
+	 * @return bool False upon failure.
+	 */
 	function put_contents($file, $contents, $mode = false, $type = '') {
 		if ( ! ($fp = @fopen($file, 'w' . $type)) )
 			return false;
 		@fwrite($fp, $contents);
 		@fclose($fp);
-		$this->chmod($file,$mode);
+		$this->chmod($file, $mode);
 		return true;
 	}
+	/**
+	 * Gets the current working directory
+	 * 
+	 * @return string|bool the current working directory on success, or false on failure. 
+	 */
 	function cwd() {
 		return @getcwd();
 	}
+	/**
+	 * Change directory
+	 *
+	 * @param $dir string The new current directory. 
+	 * @return bool Returns true on success or false on failure.
+	 */
 	function chdir($dir) {
 		return @chdir($dir);
 	}
+	/**
+	 * Changes file group
+	 * 
+	 * @param $file string Path to the file. 
+	 * @param $group mixed A group name or number.
+	 * @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False. 
+	 * @return bool Returns true on success or false on failure.
+	 */
 	function chgrp($file, $group, $recursive = false) {
 		if ( ! $this->exists($file) )
 			return false;
@@ -63,13 +119,21 @@
 
 		return true;
 	}
+	/**
+	 * Changes file mode
+	 * 
+	 * @param $file string Path to the file.
+	 * @param $mode int (optional) The mode parameter consists of three octal number components specifying access restrictions for the owner, the user group in which the owner is in, and to everybody else in this order. One component can be computed by adding up the needed permissions for that target user base. Number 1 means that you grant execute rights, number 2 means that you make the file writeable, number 4 means that you make the file readable. Add up these numbers to specify needed rights. You can also read more about modes on Unix systems with 'man 1 chmod' and 'man 2 chmod'.
+	 * @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False. 
+	 * @return bool Returns true on success or false on failure.
+	 */
 	function chmod($file, $mode = false, $recursive = false) {
 		if ( ! $mode )
 			$mode = $this->permission;
 		if ( ! $this->exists($file) )
 			return false;
 		if ( ! $recursive )
-			return @chmod($file,$mode);
+			return @chmod($file, $mode);
 		if ( ! $this->is_dir($file) )
 			return @chmod($file, $mode);
 		//Is a directory, and we want recursive
@@ -80,6 +144,14 @@
 
 		return true;
 	}
+	/**
+	 * Changes file owner
+	 * 
+	 * @param $file string Path to the file. 
+	 * @param $owner mixed A user name or number.
+	 * @param $recursive bool (optional) If set True changes file owner recursivly. Defaults to False. 
+	 * @return bool Returns true on success or false on failure.
+	 */
 	function chown($file, $owner, $recursive = false) {
 		if ( ! $this->exists($file) )
 			return false;
@@ -94,6 +166,12 @@
 		}
 		return true;
 	}
+	/**
+	 * Gets file owner
+	 * 
+	 * @param $file string Path to the file. 
+	 * @return string Username of the user. This is a short, usually less than 16 character "handle" of the user, not the real, full name. 
+	 */
 	function owner($file) {
 		$owneruid = @fileowner($file);
 		if ( ! $owneruid )
@@ -103,6 +181,14 @@
 		$ownerarray = posix_getpwuid($owneruid);
 		return $ownerarray['name'];
 	}
+	/**
+	 * Gets file permissions
+	 * 
+	 * FIXME does not handle errors in fileperms()
+	 * 
+	 * @param $file string Path to the file. 
+	 * @return string Mode of the file (3 chars).
+	 */
 	function getchmod($file) {
 		return substr(decoct(@fileperms($file)),3);
 	}
@@ -202,6 +288,7 @@
 
 		if ( ! @mkdir($path, $chmod) )
 			return false;
+		chmod($path, $chmod); // chmod $path because mkdir applies umask to $chmod 
 		if ( $chown )
 			$this->chown($path, $chown);
 		if ( $chgrp )
