From 07ce08d970a63fe7554f2cc40696434658849a14 Mon Sep 17 00:00:00 2001 From: John Was Date: Sun, 26 Jan 2014 15:28:55 +0100 Subject: [PATCH] updated helpers/BaseFileHelper::findFiles description and comments in messages/config.php --- framework/helpers/BaseFileHelper.php | 22 +++++++++++++--------- framework/messages/config.php | 5 +++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/framework/helpers/BaseFileHelper.php b/framework/helpers/BaseFileHelper.php index 2616e22..57ab251 100644 --- a/framework/helpers/BaseFileHelper.php +++ b/framework/helpers/BaseFileHelper.php @@ -239,17 +239,21 @@ class BaseFileHelper * * false: the directory or file will NOT be returned (the "only" and "except" options will be ignored) * * null: the "only" and "except" options will determine whether the directory or file should be returned * - * - only: array, list of patterns that the file paths should match if they want to be returned. - * A path matches a pattern if it contains the pattern string at its end. - * For example, '.php' matches all file paths ending with '.php'. - * Note, the '/' characters in a pattern matches both '/' and '\' in the paths. - * If a file path matches a pattern in both "only" and "except", it will NOT be returned. - * - except: array, list of patterns that the file paths or directory paths should match if they want to be excluded from the result. - * A path matches a pattern if it contains the pattern string at its end. + * - except: array, list of patterns excluding from the results matching file or directory paths. * Patterns ending with '/' apply to directory paths only, and patterns not ending with '/' * apply to file paths only. For example, '/a/b' matches all file paths ending with '/a/b'; - * and '.svn/' matches directory paths ending with '.svn'. Note, the '/' characters in a pattern matches - * both '/' and '\' in the paths. + * and '.svn/' matches directory paths ending with '.svn'. + * If the pattern does not contain a slash /, it is treated as a shell glob pattern and checked for a match against the pathname relative to $dir. + * Otherwise, the pattern is treated as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. + * For example, "views/*.php" matches "views/index.php" but not "views/controller/index.php". + * A leading slash matches the beginning of the pathname. For example, "/*.php" matches "index.php" but not "views/start/index.php". + * An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. + * If a negated pattern matches, this will override lower precedence patterns sources. Put a backslash ("\") in front of the first "!" + * for patterns that begin with a literal "!", for example, "\!important!.txt". + * Note, the '/' characters in a pattern matches both '/' and '\' in the paths. + * - only: array, list of patterns that the file paths should match if they are to be returned. Directory paths are not checked against them. + * Same pattern matching rules as in the "except" option are used. + * If a file path matches a pattern in both "only" and "except", it will NOT be returned. * - recursive: boolean, whether the files under the subdirectories should also be looked for. Defaults to true. * @return array files found under the directory. The file list is sorted. * @throws InvalidParamException if the dir is invalid. diff --git a/framework/messages/config.php b/framework/messages/config.php index 8decfbd..8790c7d 100644 --- a/framework/messages/config.php +++ b/framework/messages/config.php @@ -29,7 +29,7 @@ return [ // the '*.svn' will match all files and directories whose name ends with '.svn'. // and the '.svn' will match all files and directories named exactly '.svn'. // Note, the '/' characters in a pattern matches both '/' and '\'. - // If a file/directory matches both a pattern in "only" and "except", it will NOT be processed. + // See helpers/FileHelper::findFiles() description for more details on pattern matching rules. 'except' => [ '.svn', '.git', @@ -39,9 +39,10 @@ return [ '.hgkeep', '/messages', ], - // array, list of patterns that specify which files should be processed. + // array, list of patterns that specify which files (not directories) should be processed. // If empty or not set, all files will be processed. // Please refer to "except" for details about the patterns. + // If a file/directory matches both a pattern in "only" and "except", it will NOT be processed. 'only' => ['*.php'], // Generated file format. Can be either "php" or "po". 'format' => 'php',