mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°5405 UpdateXML update tool now do a full file conversion
This commit is contained in:
@@ -7,12 +7,11 @@
|
|||||||
*
|
*
|
||||||
* datamodels/2.x/.../datamodel.*.xml
|
* datamodels/2.x/.../datamodel.*.xml
|
||||||
*
|
*
|
||||||
* Warning : this will NOT update the XML structure (iTopDesignFormat convert methods)
|
|
||||||
*
|
|
||||||
* Usage :
|
* Usage :
|
||||||
* `php .make\release\update-xml.php "1.7"`
|
* `php .make\release\update-xml.php "1.7"`
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0 simple version change using regexp (not doing conversion)
|
||||||
|
* @since 3.1.0 N°5405 now does a real conversion
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -174,11 +174,21 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
|
|||||||
*/
|
*/
|
||||||
public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath)
|
public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath)
|
||||||
{
|
{
|
||||||
//TODO should also CONVERT files !
|
require_once APPROOT.'setup/itopdesignformat.class.inc.php';
|
||||||
return preg_replace(
|
$oFileXml = new DOMDocument();
|
||||||
'/(<itop_design .* version=")[^"]+(">)/',
|
/** @noinspection PhpComposerExtensionStubsInspection */
|
||||||
'${1}'.$sVersionLabel.'${2}',
|
libxml_clear_errors();
|
||||||
$sFileContent
|
$oFileXml->formatOutput = true;
|
||||||
);
|
$oFileXml->preserveWhiteSpace = false;
|
||||||
|
$oFileXml->loadXML($sFileContent);
|
||||||
|
|
||||||
|
$oFileItopFormat = new iTopDesignFormat($oFileXml);
|
||||||
|
$bConversionResult = $oFileItopFormat->Convert($sVersionLabel);
|
||||||
|
|
||||||
|
if (false === $bConversionResult) {
|
||||||
|
throw new Exception("Error when converting $sFileFullPath");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $oFileItopFormat->GetXmlAsString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user