Added a few things to um and rr

This commit is contained in:
Arturo Gonzalez 2017-03-14 19:11:39 +01:00
parent a582cb9204
commit 1adb43bfb0
3 changed files with 41 additions and 2 deletions

View File

@ -356,7 +356,7 @@ if ($check_online_free_packages) {
}
if ($search_minor) {
$have_minor_releases = db_check_minor_relase_available();
$have_minor_releases = db_check_minor_relase_available_to_um();
$return['have_minor'] = false;
if ($have_minor_releases) {

View File

@ -1715,4 +1715,43 @@ function db_check_minor_relase_available () {
}
}
/**
* Search for minor release files.
*
* @return bool Return if minor release is available or not
*/
function db_check_minor_relase_available_to_um () {
global $config;
$dir = $config["homedir"]."/extras/mr";
$have_minor_release = false;
if (file_exists($dir) && is_dir($dir)) {
if (is_readable($dir)) {
$files = scandir($dir); // Get all the files from the directory ordered by asc
if ($files !== false) {
$pattern = "/^\d+\.sql$/";
$sqlfiles = preg_grep($pattern, $files); // Get the name of the correct files
$files = null;
$pattern = "/\.sql$/";
$replacement = "";
$sqlfiles_num = preg_replace($pattern, $replacement, $sqlfiles); // Get the number of the file
if ($sqlfiles_num) {
$have_minor_release = true;
}
}
}
}
if ($have_minor_release) {
return true;
}
else {
return false;
}
}
?>

View File

@ -343,7 +343,7 @@ function update_manager_check_online_free_packages ($is_ajax=true) {
echo "<p><b>There is a new version:</b> " . $result[0]['version'] . "</p>";
echo "<a href='javascript: update_last_package(\"" . base64_encode($result[0]["file_name"]) .
"\", \"" . $result[0]['version'] ."\");'>" .
__("Update to the next version") . "</a>";
__("Update to the last version") . "</a>";
}
else {
echo __("There is no update available.");