diff --git a/cli/version_bump.php b/cli/version_bump.php index b6a24db..ece23de 100644 --- a/cli/version_bump.php +++ b/cli/version_bump.php @@ -125,7 +125,9 @@ if (file_exists($mokoManifest) && !empty($mokoContent)) { $mokoContent, 1 ); - file_put_contents($mokoManifest, $updated); + if ($updated !== null) { + file_put_contents($mokoManifest, $updated); + } } // -- Update README.md -- @@ -136,7 +138,9 @@ if (file_exists($readme) && !empty($readmeContent)) { $readmeContent, 1 ); - file_put_contents($readme, $updated); + if ($updated !== null) { + file_put_contents($readme, $updated); + } } // -- Cascade to ALL Joomla extension XML manifests -- @@ -160,7 +164,7 @@ foreach ($xmlPatterns as $pattern) { "{$newFull}", $content ); - if ($newContent !== $content) { + if ($newContent !== null && $newContent !== $content) { file_put_contents($xmlFile, $newContent); $updatedFiles[] = substr($xmlFile, strlen($root) + 1); } diff --git a/cli/version_check.php b/cli/version_check.php index e5e2379..ff4d538 100644 --- a/cli/version_check.php +++ b/cli/version_check.php @@ -99,13 +99,15 @@ if (count($uniqueVersions) === 1) { // Fix README.md if (isset($versions['README.md']) && $versions['README.md'] !== $highestVersion) { $content = file_get_contents($readme); - $content = preg_replace( + $updated = preg_replace( '/(VERSION:\s*)\d{2}\.\d{2}\.\d{2}/m', '${1}' . $highestVersion, $content, 1 ); - file_put_contents($readme, $content); + if ($updated !== null) { + file_put_contents($readme, $updated); + } echo " Fixed: README.md -> {$highestVersion}\n"; } @@ -118,12 +120,14 @@ if (count($uniqueVersions) === 1) { if (!file_exists($file)) continue; $content = file_get_contents($file); - $content = preg_replace( + $updated = preg_replace( '|[^<]*|', "{$highestVersion}", $content ); - file_put_contents($file, $content); + if ($updated !== null) { + file_put_contents($file, $updated); + } echo " Fixed: {$source} -> {$highestVersion}\n"; } diff --git a/cli/version_set_platform.php b/cli/version_set_platform.php index d661ad6..c5d0297 100644 --- a/cli/version_set_platform.php +++ b/cli/version_set_platform.php @@ -152,7 +152,7 @@ if (in_array($platform, ['waas-component', 'joomla'], true)) { "{$version}", $content ); - if ($updated !== $content) { + if ($updated !== null && $updated !== $content) { file_put_contents($file, $updated); $relPath = str_replace($root . '/', '', $file); echo "Joomla: {$relPath} → {$version}\n";