🔨 N°5633 update-xml.php : add new XML dir (/application and /core)

This commit is contained in:
Pierre Goiffon
2022-12-07 17:36:28 +01:00
parent 025f8b9dc3
commit 4a22361f39
3 changed files with 39 additions and 17 deletions

View File

@@ -6,6 +6,8 @@
* Will update version in the following files :
*
* datamodels/2.x/.../datamodel.*.xml
* application/*.xml
* core/*.xml
*
* Usage :
* `php .make\release\update-xml.php "1.7"`
@@ -16,6 +18,7 @@
* @since 2.7.0 simple version change using regexp (not doing conversion)
* @since 3.1.0 N°5405 now does a real conversion
* @since 3.1.0 N°5633 allow to use without parameter
* @since 3.1.0 N°5633 add /application and /core XML files
******************************************************************************/

View File

@@ -125,16 +125,31 @@ class iTopVersionFileUpdater extends AbstractSingleFileVersionUpdater
abstract class AbstractGlobFileVersionUpdater extends FileVersionUpdater
{
protected $sGlobPattern;
/** @var array|string glob patterns to seek for files to modify */
protected $globPattern;
public function __construct($sGlobPattern)
public function __construct($globPattern)
{
$this->sGlobPattern = $sGlobPattern;
$this->globPattern = $globPattern;
}
public function GetFiles()
{
return glob($this->sGlobPattern);
$aGlobPatterns = (is_array($this->globPattern))
? $this->globPattern
: [$this->globPattern];
$aFiles = [];
foreach ($aGlobPatterns as $sGlobPattern) {
$result = glob($sGlobPattern);
if (false === $result) {
continue;
}
/** @noinspection SlowArrayOperationsInLoopInspection */
$aFiles = array_merge($aFiles, $result);
}
return $aFiles;
}
}
@@ -166,7 +181,11 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
{
public function __construct()
{
parent::__construct(APPROOT.'datamodels/2.x/*/datamodel.*.xml');
parent::__construct([
APPROOT.'datamodels/2.x/*/datamodel.*.xml',
APPROOT.'application/*.xml',
APPROOT.'core/*.xml',
]);
}
/**