public function calculateBatchId() { $batchs = array(); $dir = Config::getSqlCodeDir(); $handle = opendir($dir . "."); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $batchs[] = $this->getBatchIdByFileName($file); } } closedir($handle); if (count($batchs) > 0) { return max($batchs) + 1; } else { return 1; } }