/** * Init checkpoints data file. * * We'd like to store them separately, because in some scenarios patches * may be run simultanously. E.g. * 1. Run patch B without success - checkpoint file is left * 2. Create patch A (before B) * 3. Running patch A could overwrite B's checkpoints. * That's the reason why patch id is in the filename */ private function init_checkpoints() { $dir = rtrim(DATA_DIR, '/\\') . '/patch_' . $this->get_identifier(); self::$checkpoints_dir = $dir; if (file_exists($dir)) { if (!is_dir($dir)) { throw new ErrorException('Cannot create patch checkpoints dir'); } } else { mkdir($dir); } }