public function findOrCreateDirectory($path) { if (!file_exists($path)) { if (!@mkdir($path, 0755, true)) { throw new Exception("Unable to create directory: {$path}: check permissions."); } } }