public static function chmod($file, $mode, array &$ignored = array())
    {
        if (is_file($file)) {
            if (!chmod($file, $mode)) {
                array_push($ignored, $file);
                return false;
            }

        } else if (is_dir($file)) {
            $items = self::getDirTree($file, true);

            foreach ($items as $item) {
                if (!chmod($item, $mode)) {
                    array_push($ignored, $item);
                }
            }

        } else {
            throw new UnexpectedValueException(sprintf(
                '%s expects a path to be a directory or a file as first argument', __METHOD__
            ));
        }

        return true;
    }
public static function chmod($file, $mode, array &$ignored = array())
    {
        if (is_file($file)) {
            if (!chmod($file, $mode)) {
                array_push($ignored, $file);
                return false;
            }

        } else if (is_dir($file)) {
            $items = self::getDirTree($file, true);

            foreach ($items as $item) {
                if (!chmod($item, $mode)) {
                    array_push($ignored, $item);
                }
            }

        } else {
            throw new UnexpectedValueException(sprintf(
                '%s expects a path to be a directory or a file as first argument', __METHOD__
            ));
        }

        return true;
    }
public static function chmod ( $ file , $ mode , array & $ ignored = array ( ) ) { if ( is_file ( $ file ) ) { if ( ! chmod ( $ file , $ mode ) ) { array_push ( $ ignored , $ file ) ; return false ; } } else if ( is_dir ( $ file ) ) { $ items = self :: getDirTree ( $ file , true ) ; foreach ( $ items as $ item ) { if ( ! chmod ( $ item , $ mode ) ) { array_push ( $ ignored , $ item ) ; } } } else { throw new UnexpectedValueException ( sprintf ( '%s expects a path to be a directory or a file as first argument' , __METHOD__ ) ) ; } return true ; }
Recursively applies chmod to given directory

@param string $file
@param integer $mode
@param array $ignored Items that unreadable or accessible
@throws \UnexpectedValueException if $file is neither a directory and a file
@return boolean Depending on success
Recursively applies chmod to given directory