From a43e3687cb4b0406310fdba1bfafa214e92014e6 Mon Sep 17 00:00:00 2001 From: hjonathan Date: Tue, 8 Aug 2017 10:16:02 -0400 Subject: [PATCH] remove the getLastVersion method --- framework/src/Maveriks/Util/Common.php | 40 -------------------------- 1 file changed, 40 deletions(-) diff --git a/framework/src/Maveriks/Util/Common.php b/framework/src/Maveriks/Util/Common.php index 9ad136593..afe8a6b75 100644 --- a/framework/src/Maveriks/Util/Common.php +++ b/framework/src/Maveriks/Util/Common.php @@ -69,46 +69,6 @@ class Common return $files; } - /** - * Returns the last version given a pattern of file name - * - * @param string $pattern a valid pattern for glob(...) native function - * @param int $flag php flags for glob(...) native function - * @return int|string - * - * Example: - * - Given the following files inside a directory: - * /example/path/myApplication-v1.tar - * /example/path/myApplication-v2.tar - * /example/path/myApplication-v3.tar - * /example/path/myApplication-v5.tar - * /example/path/myApplication-v7.tar - * - * $lastVer = ProcessMaker\Util\Common::getLastVersion("/example/path/myApplication-*.tar"); - * - * It will returns: 7 - */ - public static function getLastVersion($pattern, $flag = 0) - { - $files = glob($pattern, $flag); - $maxVersion = 0; - - $pattern = str_replace("*", '([0-9\.]+)', basename($pattern)); - - foreach ($files as $file) { - $filename = basename($file); - - if (preg_match('/' . $pattern . '/', $filename, $match)) { - - if ($maxVersion < $match[1]) { - $maxVersion = $match[1]; - } - } - } - - return $maxVersion; - } - /** * This method get the last version of file when exists a special characters * @param $pattern