private function checkPermissionsOrCreate($folder, $mode = 0755){
		if(!file_exists($folder)){
			mkdir($folder, $mode, true);
			return chmod($folder, $mode);
		}

		if(is_dir($folder)){
			if(!is_writable($folder)){
				return chmod($folder, $mode);
			}

			return true;
		}

		throw new Exception("You have no permission to write in folder: {$folder}");
	}