isFile() ) { updateVersionNumbers($file->getPathname(), $oldVersion, $newVersion); } } } //Update version numbers in certain files that are not in the above subdirectories. $standaloneFiles = [ 'plugin-update-checker.php', 'README.md', 'languages/plugin-update-checker.pot', ]; foreach ($standaloneFiles as $standaloneFile) { updateVersionNumbers($repositoryRoot . '/' . $standaloneFile, $oldVersion, $newVersion); } //Rename the loader file and update the version numbers. $oldLoaderFileName = "load-$oldVersionInfix.php"; $newLoaderFileName = "load-$newVersionInfix.php"; exec("git mv \"$oldLoaderFileName\" \"$newLoaderFileName\""); updateVersionNumbers($repositoryRoot . '/' . $newLoaderFileName, $oldVersion, $newVersion); //Replace the old loader file name with new one in files that use it. //plugin-update-checker.php was already updated by the previous step, but we'll //include it here anyway in case the code order or loader naming scheme changes. $filesUsingLoader = ['plugin-update-checker.php', 'composer.json']; foreach ($filesUsingLoader as $fileName) { $fullFileName = $repositoryRoot . '/' . $fileName; $content = file_get_contents($fullFileName); $content = str_replace($oldLoaderFileName, $newLoaderFileName, $content); file_put_contents($fullFileName, $content); } //Commit the changes. exec('git add .'); exec("git commit -m \"Bump version number to $newVersion\""); echo "Version number bumped to $newVersion.\n"; //Switch back to the original directory. chdir($oldDir);