This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  4b4bccb9ae53aabbde1b682f0c22e875d2871c79 (commit)
      from  71990bdf7965b38307b907ff7921f517bb4a1be2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=4b4bccb9ae53aabbde1b682f0c22e875d2871c79

commit 4b4bccb9ae53aabbde1b682f0c22e875d2871c79
Author: Franck Villaume <[email protected]>
Date:   Tue Jan 24 21:20:24 2017 +0100

    internal ls function to support filtering filename based on regex

diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index bf55fd6..0fa2c8c 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -8,7 +8,7 @@
  * Copyright (c) 2010, 2011, 2012
  *     Thorsten Glaser <[email protected]>
  * Copyright 2010-2012, Alain Peyrat - Alcatel-Lucent
- * Copyright 2013,2016, Franck Villaume - TrivialDev
+ * Copyright 2013,2016-2017, Franck Villaume - TrivialDev
  * Copyright 2016, Stéphane-Eymeric Bredthauer - TrivalDev
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -799,9 +799,10 @@ function human_readable_bytes($bytes, $base10 = false, 
$round = 0, $labels = arr
  * ls - lists a specified directory and returns an array of files
  * @param      string  $dir    the path of the directory to list
  * @param      bool    $filter whether to filter out directories and illegal 
filenames
+ * @param      string  $regex  filter filename based on this regex
  * @return     array   array of file names.
  */
-function &ls($dir, $filter = false) {
+function &ls($dir, $filter = false, $regex = false) {
        $out = array();
 
        if (is_dir($dir) && ($h = opendir($dir))) {
@@ -814,6 +815,11 @@ function &ls($dir, $filter = false) {
                                )
                                        continue;
                        }
+                       if ($regex !== false) {
+                               if (!preg_match($regex, $f)) {
+                                       continue;
+                               }
+                       }
                        $out[] = $f;
                }
                closedir($h);

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/utils.php | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to