/**
  *  This function will recursively create the directories
  *	@param $directory	Directory to create.
  *	@param $mode		(optional) The mode for the directory. By default, this is 0700.
  *
  *	@returns	False on failure, otherwise, it will return a YDFSDirectory object for the new directory.
  *
  *  @static
  */
 function createDirectories($directory, $mode = 0700)
 {
     if (is_null($directory) || $directory === '') {
         return false;
     }
     if (is_dir($directory) || $directory === '/') {
         return true;
     }
     if (YDFSDirectory::createDirectories(dirname($directory), $mode)) {
         return mkdir($directory, $mode);
     }
     return false;
 }