/** * * @param array $module * @return boolean */ public static function checkDependency($module) { $dependencySatisfied = false; $db = Di::getDefault()->get('db_centreon'); $sql = "SELECT name, version FROM cfg_modules WHERE name = :moduleName"; $stmt = $db->prepare($sql); $stmt->bindParam(':moduleName', $module['name'], \PDO::PARAM_STR); $stmt->execute(); $dependency = $stmt->fetchAll(\PDO::FETCH_ASSOC); if (is_array($dependency) && count($dependency) > 0) { if (Versioning::compareVersion($dependency[0]['version'], $module['version'])) { $dependencySatisfied = true; } } return $dependencySatisfied; }
/** * * @param type $object * @cmdObject string module Module name * @cmdObject string version version to compare */ public function compareVersionAction($object) { $module = $object['module']; $version = $object['version']; $versionManager = new Versioning($module); $versionManager->compareVersion($version); }