Hello,
I am wondering if it is possible to retrieve the Metabase version from the .jar file. I would like to develop a utility to automatically update Metabase.
Hello,
I am wondering if it is possible to retrieve the Metabase version from the .jar file. I would like to develop a utility to automatically update Metabase.
a JAR file is a compressed file, open it with a compression tool and you'll find a version file in there
Please post what's your current approach so we can help you
Thanks for the tip! I came up with this PHP function:
function extractMetabaseVersion($path){
if (file_exists($path)) {
$zip = new ZipArchive();
if ($zip->open($path) === true) {
for ($i = 0; $i < $zip->numFiles; $i++) {
$fileName = $zip->getNameIndex($i);
if($fileName == 'version.properties'){
$fileContents = $zip->getFromIndex($i);
$keyValues = explode("\n", $fileContents);
$parts = explode("=", $keyValues[0]);
$result = preg_replace("/[^0-9.]/", "", $parts[1]);
return $result ;
}
}
$zip->close();
} else {
echo "Failed to open the JAR file as a zip archive.";
}
} else {
echo "The JAR file does not exist.";
}
}
Why don’t you simply hit the properties endpoint where the version is located?