public static function autocreate_directory($directory)
    {
        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }

        if (!is_writable($directory)) {
            throw new \Exception("Directory \"{$directory}\" is not writable");
        }
    }
public static function autocreate_directory($directory)
    {
        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }

        if (!is_writable($directory)) {
            throw new \Exception("Directory \"{$directory}\" is not writable");
        }
    }
public static function autocreate_directory ( $ directory ) { if ( ! file_exists ( $ directory ) ) { mkdir ( $ directory , 0777 , true ) ; } if ( ! is_writable ( $ directory ) ) { throw new \ Exception ( "Directory \"{$directory}\" is not writable" ) ; } }
Check if a directory does not exist, create it, otherwise check if it is writable.

@param string $directory

@throws Exception If directory is not writable
Check if a directory does not exist create it otherwise check if it is writable .