Added more code to um and rr

This commit is contained in:
Arturo Gonzalez 2017-03-16 16:00:57 +01:00
parent 2b9e75237a
commit 54959257c0
3 changed files with 8 additions and 5 deletions

View File

@ -21,10 +21,11 @@ if (is_ajax ()) {
if ($updare_rr) { if ($updare_rr) {
$number = get_parameter('number'); $number = get_parameter('number');
$package = ger_parameter('package'); $package = get_parameter('package');
$dir = sys_get_temp_dir() . "/pandora_oum/" . $package . "/extras/mr"; $dir = sys_get_temp_dir() . "/pandora_oum/" . $package . "/extras/mr";
$file = "$dir/$number.sql"; $file = "$dir/$number.sql";
html_debug($file, true);
$dangerous_query = false; $dangerous_query = false;
$mr_file = fopen($file, "r"); $mr_file = fopen($file, "r");
while (!feof($mr_file)) { while (!feof($mr_file)) {
@ -49,6 +50,8 @@ if (is_ajax ()) {
else { else {
if (file_exists($dir) && is_dir($dir)) { if (file_exists($dir) && is_dir($dir)) {
if (is_readable($dir)) { if (is_readable($dir)) {
html_debug($number, true);
html_debug($config['MR'], true);
if (($number > $config['MR'] + 1) || ($number == $config['MR'])) { if (($number > $config['MR'] + 1) || ($number == $config['MR'])) {
$message = "bad_mr_filename"; $message = "bad_mr_filename";
} }
@ -77,7 +80,7 @@ if (is_ajax ()) {
$file_dest = $config["homedir"] . "/extras/mr/updated/$number.sql"; $file_dest = $config["homedir"] . "/extras/mr/updated/$number.sql";
html_debug("FILE EXISTS: " . (int)file_exists($file_dest), true); html_debug("FILE EXISTS: " . (int)file_exists($file_dest), true);
if (file_exists($file_dest)) { if (file_exists($file_dest) !== 0) {
unlink($file); unlink($file);
} }
else if (copy($file, $file_dest)) { else if (copy($file, $file_dest)) {

View File

@ -362,7 +362,7 @@ if ($search_minor) {
$return['have_minor'] = false; $return['have_minor'] = false;
if ($have_minor_releases) { if ($have_minor_releases) {
$return['have_minor'] = true; $return['have_minor'] = true;
$size_mr = get_number_of_mr(); $size_mr = get_number_of_mr($package);
$return['mr'] = $size_mr; $return['mr'] = $size_mr;
} }

View File

@ -2683,10 +2683,10 @@ function update_config_token ($cfgtoken, $cfgvalue) {
} }
} }
function get_number_of_mr() { function get_number_of_mr($package) {
global $config; global $config;
$dir = $config["homedir"]."/extras/mr"; $dir = sys_get_temp_dir() . "/pandora_oum/" . $package . "/extras/mr";
$mr_size = array(); $mr_size = array();
if (file_exists($dir) && is_dir($dir)) { if (file_exists($dir) && is_dir($dir)) {