/** * Update database * * @return boolean */ public function executeScripts() { if (empty($this->adapter)) { return false; } $files = array(); $updatePath = GC_APPLICATION_PATH . '/data/update'; $path = glob($updatePath . '/*'); foreach ($path as $file) { $version = str_replace($updatePath . '/', '', $file); if (version_compare($version, Version::VERSION, '>')) { $fileList = glob($file . '/*.php'); if (!empty($fileList)) { $files[] = $fileList; } } } if (empty($files)) { return true; } $script = new Script(); foreach ($files as $fileList) { foreach ($fileList as $filename) { try { $this->adapter->addMessage($script->execute($filename)); } catch (\Exception $e) { ob_get_clean(); $this->setError($e->getMessage()); } } } return true; }