|
| 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