Skip to content

Commit e998c47

Browse files
committed
feat: Added a Script to Update Version
1 parent 84facc3 commit e998c47

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

update-version.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Script to update WebFiori Framework version constants
4+
* Usage: php update-version.php --version=3.0.0 --type=Stable
5+
*/
6+
7+
$options = getopt('', ['version:', 'type:']);
8+
9+
if (!isset($options['version']) || !isset($options['type'])) {
10+
echo "Usage: php update-version.php --version=VERSION --type=TYPE\n";
11+
echo "Example: php update-version.php --version=3.0.0 --type=Stable\n";
12+
exit(1);
13+
}
14+
15+
$version = $options['version'];
16+
$type = $options['type'];
17+
$date = date('Y-m-d');
18+
19+
$appFile = __DIR__ . '/WebFiori/Framework/App.php';
20+
$content = file_get_contents($appFile);
21+
22+
$content = preg_replace(
23+
"/define\('WF_VERSION', '[^']*'\);/",
24+
"define('WF_VERSION', '$version');",
25+
$content
26+
);
27+
28+
$content = preg_replace(
29+
"/define\('WF_VERSION_TYPE', '[^']*'\);/",
30+
"define('WF_VERSION_TYPE', '$type');",
31+
$content
32+
);
33+
34+
$content = preg_replace(
35+
"/define\('WF_RELEASE_DATE', '[^']*'\);/",
36+
"define('WF_RELEASE_DATE', '$date');",
37+
$content
38+
);
39+
40+
file_put_contents($appFile, $content);
41+
42+
echo "Updated version constants:\n";
43+
echo "WF_VERSION: $version\n";
44+
echo "WF_VERSION_TYPE: $type\n";
45+
echo "WF_RELEASE_DATE: $date\n";

0 commit comments

Comments
 (0)