HOR-2933
HOR-2933-B update
This commit is contained in:
@@ -52,16 +52,18 @@ class Common
|
||||
}
|
||||
|
||||
$files = glob("$path/$singlePattern", $flags);
|
||||
$dirs = glob("$path/*", GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
|
||||
$dirs = glob("$path/*", GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT);
|
||||
|
||||
if(is_array($dirs)){
|
||||
if (is_array($dirs)) {
|
||||
foreach ($dirs as $dir) {
|
||||
$files = array_merge($files, self::rglob("$dir/$singlePattern", $flags));
|
||||
}
|
||||
}
|
||||
|
||||
if ($onlyFiles) {
|
||||
$files = array_filter($files, function($v) { return is_dir($v) ? false : true;});
|
||||
$files = array_filter($files, function ($v) {
|
||||
return is_dir($v) ? false : true;
|
||||
});
|
||||
}
|
||||
|
||||
return $files;
|
||||
@@ -96,7 +98,7 @@ class Common
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file);
|
||||
|
||||
if (preg_match('/'.$pattern.'/', $filename, $match)) {
|
||||
if (preg_match('/' . $pattern . '/', $filename, $match)) {
|
||||
|
||||
if ($maxVersion < $match[1]) {
|
||||
$maxVersion = $match[1];
|
||||
@@ -107,6 +109,29 @@ class Common
|
||||
return $maxVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method get the last version of file when exists a special characters
|
||||
* @param $pattern
|
||||
* @param $extension
|
||||
* @param int $flag
|
||||
* @return int
|
||||
*/
|
||||
public static function getLastVersionSpecialCharacters($dir, $pattern, $extension, $flag = 0)
|
||||
{
|
||||
$files = glob($dir . quotemeta($pattern) . "-*." . $extension, $flag);
|
||||
$maxVersion = 0;
|
||||
$pattern = preg_quote(basename($pattern)) . '-([0-9\.]+)pmx';
|
||||
foreach ($files as $file) {
|
||||
$filename = basename($file);
|
||||
if (preg_match('/' . $pattern . '/', $filename, $match)) {
|
||||
if ($maxVersion < $match[1]) {
|
||||
$maxVersion = $match[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $maxVersion;
|
||||
}
|
||||
|
||||
public static function parseIniFile($filename)
|
||||
{
|
||||
$data = @parse_ini_file($filename, true);
|
||||
@@ -141,8 +166,8 @@ class Common
|
||||
}
|
||||
|
||||
while ($parent_folder_path = array_pop($folder_path)) {
|
||||
if (! @is_dir($parent_folder_path)) {
|
||||
if (! @mkdir($parent_folder_path, $rights)) {
|
||||
if (!@is_dir($parent_folder_path)) {
|
||||
if (!@mkdir($parent_folder_path, $rights)) {
|
||||
umask($oldumask);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user