<commit_before><?php
namespace Phakebuilder;
/**
 * File class
 * 
 * @author <NAME> <<EMAIL>>
 */
class FileSystem {

	const DEFAULT_DIR_MODE  = 0775;
	const DEFAULT_FILE_MODE = 0664;

	const DEFAULT_USER  = 'nginx';
	const DEFAULT_GROUP = 'nginx';

	/**
	 * Make directory (recursively)
	 * 
	 * @param string $path Path to make
	 * @param numeric $mode Permission mask
	 * @return boolean True on success, false otherwise
	 */
	public static function makeDir($path, $mode = self::DEFAULT_DIR_MODE) {
		$mode = $mode ? self::valueToOct($mode) : self::DEFAULT_DIR_MODE;
		$result = mkdir($path, octdec($mode), true);
		return $result;
	}

	/**
	 * Remove file or folder (recursively)<commit_msg>Fixed the permission bug with mkdir (issue #31)<commit_after><?php
namespace Phakebuilder;
/**
 * File class
 * 
 * @author <NAME> <<EMAIL>>
 */
class FileSystem {

	const DEFAULT_DIR_MODE  = 0775;
	const DEFAULT_FILE_MODE = 0664;

	const DEFAULT_USER  = 'nginx';
	const DEFAULT_GROUP = 'nginx';

	/**
	 * Make directory (recursively)
	 * 
	 * Thanks to: http://stackoverflow.com/questions/6229353/permissions-with-mkdir-wont-work
	 * 
	 * @param string $path Path to make
	 * @param numeric $mode Permission mask
	 * @return boolean True on success, false otherwise
	 */
	public static function makeDir($path, $mode = self::DEFAULT_DIR_MODE) {
		$mode = $mode ? self::valueToOct($mode) : self::DEFAULT_DIR_MODE;
		$oldUmask = umask(0);
		$result = mkdir($path, $mode, true);
		umask($oldUmask);
		return $result;
	}

	/**
	 * Remove file or folder (recursively)
{'fraction_non_alphanumeric': 0.13607188703465983, 'fraction_numerical': 0.01668806161745828, 'mean_word_length': 4.128289473684211, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2925992', 'n_tokens_mistral': 566, 'n_tokens_neox': 501, 'n_words': 140}