Revision c60a37ae
Corrections pour la sup. des logiciels prédéfinis
Change-Id: I393c3ffc20c8ed01602b302e0fad88db45983a62
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/2378
Tested-by: Build system <qa@vigilo-dev.si.c-s.fr>
Reviewed-by: Francois POIROTTE <francois.poirotte@c-s.fr>
src/plugins/vigilo/inc/monitoredcomputer.class.php | ||
---|---|---|
79 | 79 |
|
80 | 80 |
protected function monitorSoftwares() |
81 | 81 |
{ |
82 |
$computerSoftwareVersion = new Computer_SoftwareVersion();
|
|
83 |
$ids = $computerSoftwareVersion->find('computers_id=' . $this->item->getID());
|
|
84 |
foreach ($ids as $id) {
|
|
85 |
if (!$id['softwareversions_id']) {
|
|
82 |
$installations = new Computer_SoftwareVersion();
|
|
83 |
$installations = $installations->find('computers_id=' . $this->item->getID());
|
|
84 |
foreach ($installations as $installation) {
|
|
85 |
if (!$installation['softwareversions_id']) {
|
|
86 | 86 |
continue; |
87 | 87 |
} |
88 | 88 |
|
89 |
$softwareVersion = new SoftwareVersion();
|
|
90 |
$ids2 = $softwareVersion->find('id=' . $id['softwareversions_id']);
|
|
91 |
foreach ($ids2 as $id2) {
|
|
92 |
if (!$id2['softwares_id']) {
|
|
89 |
$versions = new SoftwareVersion();
|
|
90 |
$versions = $versions->find('id=' . $installation['softwareversions_id']);
|
|
91 |
foreach ($versions as $version) {
|
|
92 |
if (!$version['softwares_id']) {
|
|
93 | 93 |
continue; |
94 | 94 |
} |
95 | 95 |
|
96 | 96 |
$software = new Software(); |
97 |
$software->getFromDB($id2['softwares_id']); |
|
98 |
|
|
97 |
$software->getFromDB($version['softwares_id']); |
|
99 | 98 |
$lcname = strtolower($software->getName()); |
100 | 99 |
if (isset(static::$softwares[$lcname])) { |
101 | 100 |
// Gestion des logiciels supervisés automatiquement. |
... | ... | |
108 | 107 |
continue; |
109 | 108 |
} |
110 | 109 |
|
111 |
$type = ucfirst(strtolower($parts[3]));
|
|
112 |
$args = isset($parts[4]) ? $parts[4] : null;
|
|
110 |
$type = ucfirst(strtolower($parts[2]));
|
|
111 |
$args = isset($parts[3]) ? $parts[3] : null;
|
|
113 | 112 |
$method = 'monitorCustom' . $type; |
114 | 113 |
if (method_exists($this, $method)) { |
115 | 114 |
$this->$method($software, $args); |
... | ... | |
121 | 120 |
|
122 | 121 |
protected function monitorCustomService($software, $service) |
123 | 122 |
{ |
123 |
if (!$service) { |
|
124 |
return; |
|
125 |
} |
|
126 |
|
|
124 | 127 |
$this->children[] = new VigiloTest('Service', array('svcname' => $service)); |
125 | 128 |
} |
126 | 129 |
|
127 | 130 |
protected function monitorCustomTcp($software, $port) |
128 | 131 |
{ |
132 |
if (!$port) { |
|
133 |
return; |
|
134 |
} |
|
135 |
|
|
129 | 136 |
$port = (int) $port; |
130 | 137 |
if ($port > 0 && $port <= 65535) { |
131 | 138 |
$this->children[] = new Vigilotest('TCP', array('port' => $port)); |
... | ... | |
134 | 141 |
|
135 | 142 |
protected function monitorCustomProcess($software, $process) |
136 | 143 |
{ |
144 |
if (!$process) { |
|
145 |
return; |
|
146 |
} |
|
147 |
|
|
137 | 148 |
$this->children[] = new VigiloTest('Process', array('processname' => $process)); |
138 | 149 |
} |
139 | 150 |
|
src/plugins/vigilo/vigilo_hooks.php | ||
---|---|---|
133 | 133 |
|
134 | 134 |
public function refreshSoftware($software) |
135 | 135 |
{ |
136 |
$softwareVer = new SoftwareVersion(); |
|
137 |
$idSoftwareVersion = $softwareVer->find('softwares_id=' . $software->getID());
|
|
138 |
foreach ($idSoftwareVersion as $idVersion) {
|
|
139 |
if (!$idVersion['id']) {
|
|
136 |
$softwareVer = new SoftwareVersion();
|
|
137 |
$versions = $softwareVer->find('softwares_id=' . $software->getID());
|
|
138 |
foreach ($versions as $version) {
|
|
139 |
if (!$version['id']) {
|
|
140 | 140 |
continue; |
141 | 141 |
} |
142 | 142 |
|
143 |
$computerVer = new Computer_SoftwareVersion(); |
|
144 |
$goodField = 'softwareversions_id=' . $idVersion['id']; |
|
145 |
$updateComp = $computerVer->find($goodField); |
|
146 |
|
|
147 |
foreach ($updateComp as $idComputer) { |
|
148 |
if (-1 === $idComputer['computers_id']) { |
|
143 |
$installations = new Computer_SoftwareVersion(); |
|
144 |
$filter = 'softwareversions_id=' . $version['id']; |
|
145 |
$installations = $installations->find($filter); |
|
146 |
foreach ($installations as $installation) { |
|
147 |
if (-1 === $installation['computers_id']) { |
|
149 | 148 |
continue; |
150 | 149 |
} |
151 | 150 |
|
152 | 151 |
$computer = new Computer(); |
153 |
$computer->getFromDB($idComputer['computers_id']);
|
|
152 |
$computer->getFromDB($installation['computers_id']);
|
|
154 | 153 |
$this->update($computer); |
155 | 154 |
} |
156 | 155 |
} |
Also available in: Unified diff