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
affb488587
commit
3c56179881
1 changed files with 14 additions and 6 deletions
20
_release.php
20
_release.php
|
@ -24,20 +24,20 @@ require INC_DIR . '/functions_cli.php';
|
|||
$configFile = BB_PATH . '/library/config.php';
|
||||
|
||||
if (!is_file($configFile)) {
|
||||
out("- Config file " . basename($configFile) . " not found", 'error');
|
||||
out('- Config file ' . basename($configFile) . ' not found', 'error');
|
||||
}
|
||||
if (!is_readable($configFile)) {
|
||||
out("- Config file " . basename($configFile) . " is not readable", 'error');
|
||||
out('- Config file ' . basename($configFile) . ' is not readable', 'error');
|
||||
}
|
||||
if (!is_writable($configFile)) {
|
||||
out("- Config file " . basename($configFile) . " is not writable", 'error');
|
||||
out('- Config file ' . basename($configFile) . ' is not writable', 'error');
|
||||
}
|
||||
|
||||
// Welcoming message
|
||||
out("--- Release creation tool ---\n", 'info');
|
||||
|
||||
// Ask for version
|
||||
fwrite(STDOUT, "Enter version number (e.g, v2.4.0): ");
|
||||
fwrite(STDOUT, 'Enter version number (e.g, v2.4.0): ');
|
||||
$version = trim(fgets(STDIN));
|
||||
|
||||
// Ask for release date or use today's date
|
||||
|
@ -51,7 +51,7 @@ if (empty($date)) {
|
|||
// Validate date format (dd-mm-yyyy)
|
||||
$dateObj = DateTime::createFromFormat('d-m-Y', $date);
|
||||
if (!$dateObj || $dateObj->format('d-m-Y') !== $date) {
|
||||
out("Invalid date format. Expected format: DD-MM-YYYY", 'error');
|
||||
out('Invalid date format. Expected format: DD-MM-YYYY', 'error');
|
||||
}
|
||||
|
||||
out("- Using date: $date", 'info');
|
||||
|
@ -75,4 +75,12 @@ $content = preg_replace(
|
|||
);
|
||||
|
||||
// Save updated config
|
||||
file_put_contents($configFile, $content);
|
||||
$bytesWritten = file_put_contents($configFile, $content);
|
||||
|
||||
if ($bytesWritten === false) {
|
||||
out('Failed to write to config file', 'error');
|
||||
}
|
||||
|
||||
if ($bytesWritten === 0) {
|
||||
out('Config file was not updated (0 bytes written)', 'error');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue