Commit ddd144fd authored by Kevin Duret's avatar Kevin Duret
Browse files

fix(mediawiki): manage properly mediawiki url of host templates (#9367)

Refs: MON-6321
parent 99147870
...@@ -157,6 +157,11 @@ class ProceduresProxy ...@@ -157,6 +157,11 @@ class ProceduresProxy
public function getHostUrl($hostName): ?string public function getHostUrl($hostName): ?string
{ {
$hostId = $this->getHostId($hostName); $hostId = $this->getHostId($hostName);
if ($hostId === null) {
return null;
}
$hostProperties = $this->hostObj->getInheritedValues( $hostProperties = $this->hostObj->getInheritedValues(
$hostId, $hostId,
[], [],
...@@ -168,15 +173,18 @@ class ProceduresProxy ...@@ -168,15 +173,18 @@ class ProceduresProxy
return $this->wikiUrl . "/index.php?title=Host_:_" . $hostProperties['host_name']; return $this->wikiUrl . "/index.php?title=Host_:_" . $hostProperties['host_name'];
} }
$inheritedHostProperties = $this->hostObj->getInheritedValues( $templates = $this->hostObj->getTemplateChain($hostId);
$hostId, foreach ($templates as $template) {
[], $inheritedHostProperties = $this->hostObj->getInheritedValues(
-1, $template['id'],
['host_name', 'ehi_notes_url'] [],
); 1,
['host_name', 'ehi_notes_url']
if (isset($inheritedHostProperties['ehi_notes_url'])) { );
return $this->wikiUrl . "/index.php?title=Host-Template_:_" . $inheritedHostProperties['host_name'];
if (isset($inheritedHostProperties['ehi_notes_url'])) {
return $this->wikiUrl . "/index.php?title=Host-Template_:_" . $inheritedHostProperties['host_name'];
}
} }
return null; return null;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment