Make WordPress Core


Ignore:
Timestamp:
02/07/2010 01:59:30 AM (16 years ago)
Author:
dd32
Message:

Standardise return values in WP_Filesystem::dirlist(), ::chmod() and ::exists()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-filesystem-ftpext.php

    r12998 r12999  
    161161                // chmod the file or directory
    162162                if ( ! function_exists('ftp_chmod') )
    163                         return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
    164                 return @ftp_chmod($this->link, $mode, $file);
     163                        return (bool)@ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
     164                return (bool)@ftp_chmod($this->link, $mode, $file);
    165165        }
    166166        function chown($file, $owner, $recursive = false ) {
     
    243243        }
    244244        function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
    245                 if ( !ftp_mkdir($this->link, $path) )
     245                if ( !@ftp_mkdir($this->link, $path) )
    246246                        return false;
    247247                $this->chmod($path);
     
    287287                                return '';
    288288                        $b = array();
    289                         $b['isdir'] = $lucifer[0]{0} === "d";
    290                         $b['islink'] = $lucifer[0]{0} === "l";
     289                        $b['isdir'] = $lucifer[0]{0} === 'd';
     290                        $b['islink'] = $lucifer[0]{0} === 'l';
    291291                        if ( $b['isdir'] )
    292292                                $b['type'] = 'd';
     
    335335                $list = @ftp_rawlist($this->link, '-a ' . $path, false);
    336336
    337                 if ( $list === false )
     337                if ( empty($list) ) // Empty array = non-existant folder(real folder will show . at least
    338338                        return false;
    339339
     
    355355                        $dirlist[ $entry['name'] ] = $entry;
    356356                }
    357 
    358                 if ( ! $dirlist )
    359                         return false;
    360357
    361358                $ret = array();
Note: See TracChangeset for help on using the changeset viewer.