mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Update _release.php
This commit is contained in:
parent
2257878da0
commit
aa1f0153fb
1 changed files with 39 additions and 0 deletions
39
_release.php
39
_release.php
|
@ -20,3 +20,42 @@ require_once BB_ROOT . 'library/defines.php';
|
|||
|
||||
// Include CLI functions
|
||||
require INC_DIR . '/functions_cli.php';
|
||||
|
||||
$configFile = BB_PATH . '/library/config.php';
|
||||
|
||||
if (!is_file($configFile)) {
|
||||
out("- Config file " . basename($configFile) . " not found", 'error');
|
||||
}
|
||||
if (!is_readable($configFile)) {
|
||||
out("Config file " . basename($configFile) . " is not readable", 'error');
|
||||
}
|
||||
if (!is_writable($configFile)) {
|
||||
out("Config file " . basename($configFile) . " is not writable", 'error');
|
||||
}
|
||||
|
||||
// Welcoming message
|
||||
out("--- Release creation tool ---\n", 'info');
|
||||
|
||||
fwrite(STDOUT, "Enter version number (e.g, v2.4.0): ");
|
||||
$version = trim(fgets(STDIN));
|
||||
|
||||
fwrite(STDOUT, "Enter release date (e.g, 25-05-2025): ");
|
||||
$date = trim(fgets(STDIN));
|
||||
|
||||
if (empty($date)) {
|
||||
$date = date('d-m-Y');
|
||||
out("- !\n", 'success');
|
||||
}
|
||||
|
||||
$content = file_get_contents($configFile);
|
||||
$content = preg_replace(
|
||||
"/\\\$bb_cfg\['tp_version'\]\s*=\s*'[^']*';/",
|
||||
"\$bb_cfg['tp_version'] = '$version';",
|
||||
$content
|
||||
);
|
||||
$content = preg_replace(
|
||||
"/\\\$bb_cfg\['tp_release_date'\]\s*=\s*'[^']*';/",
|
||||
"\$bb_cfg['tp_release_date'] = '$date';",
|
||||
$content
|
||||
);
|
||||
file_put_contents($configFile, $content);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue