Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(update): take into account the removal of older conf.php (#7952)
Browse files Browse the repository at this point in the history
* fix(update): take into account the removal of older conf.php

* fix(update): change bindParams to bindValue and make code strict mode
compliant
  • Loading branch information
adr-mo authored Oct 9, 2019
1 parent 20590c5 commit e8fc4fe
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/CentreonLegacy/Core/Module/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public function upgrade()
usort($orderedUpgrades, 'version_compare');
foreach ($orderedUpgrades as $upgradeName) {
$upgradePath = $upgradesPath . $upgradeName;
if (!preg_match('/^(\d+\.\d+\.\d+)/', $upgradeName, $matches) ||
!$this->services->get('filesystem')->exists($upgradePath . '/conf.php')) {
if (!preg_match('/^(\d+\.\d+\.\d+)/', $upgradeName, $matches)) {
continue;
}

Expand Down Expand Up @@ -103,14 +102,14 @@ private function upgradeModuleConfiguration()

$sth = $this->services->get('configuration_db')->prepare($query);

$sth->bindParam(':name', $this->moduleConfiguration['name'], \PDO::PARAM_STR);
$sth->bindParam(':rname', $this->moduleConfiguration['rname'], \PDO::PARAM_STR);
$sth->bindParam(':is_removeable', $this->moduleConfiguration['is_removeable'], \PDO::PARAM_STR);
$sth->bindParam(':infos', $this->moduleConfiguration['infos'], \PDO::PARAM_STR);
$sth->bindParam(':author', $this->moduleConfiguration['author'], \PDO::PARAM_STR);
$sth->bindParam(':svc_tools', $this->moduleConfiguration['svc_tools'], \PDO::PARAM_STR);
$sth->bindParam(':host_tools', $this->moduleConfiguration['host_tools'], \PDO::PARAM_STR);
$sth->bindParam(':id', $this->moduleId, \PDO::PARAM_INT);
$sth->bindValue(':name', $this->moduleConfiguration['name'], \PDO::PARAM_STR);
$sth->bindValue(':rname', $this->moduleConfiguration['rname'], \PDO::PARAM_STR);
$sth->bindValue(':is_removeable', $this->moduleConfiguration['is_removeable'], \PDO::PARAM_STR);
$sth->bindValue(':infos', $this->moduleConfiguration['infos'], \PDO::PARAM_STR);
$sth->bindValue(':author', $this->moduleConfiguration['author'], \PDO::PARAM_STR);
$sth->bindValue(':svc_tools', $this->moduleConfiguration['svc_tools'] ?? '0', \PDO::PARAM_STR);
$sth->bindValue(':host_tools', $this->moduleConfiguration['host_tools'] ?? '0', \PDO::PARAM_STR);
$sth->bindValue(':id', $this->moduleId, \PDO::PARAM_INT);

$sth->execute();

Expand All @@ -130,8 +129,8 @@ private function upgradeVersion($version)

$sth = $this->services->get('configuration_db')->prepare($query);

$sth->bindParam(':mod_release', $version, \PDO::PARAM_STR);
$sth->bindParam(':id', $this->moduleId, \PDO::PARAM_INT);
$sth->bindValue(':mod_release', $version, \PDO::PARAM_STR);
$sth->bindValue(':id', $this->moduleId, \PDO::PARAM_INT);

$sth->execute();

Expand Down

0 comments on commit e8fc4fe

Please sign in to comment.