From 3504b921877a9cd1682ad361a36408feaec79a2a Mon Sep 17 00:00:00 2001 From: seek3r Date: Sat, 6 Jan 2001 10:03:03 +0000 Subject: [PATCH] added code for getting apps status in terms of the version --- phpgwapi/version.inc.php | 18 ++++++++++++++++ setup/inc/phpgw_setup.inc.php | 39 ++++++++++++++++++++++++++++------- setup/index.php | 1 + 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 phpgwapi/version.inc.php diff --git a/phpgwapi/version.inc.php b/phpgwapi/version.inc.php new file mode 100644 index 0000000000..11237e22b5 --- /dev/null +++ b/phpgwapi/version.inc.php @@ -0,0 +1,18 @@ +close(); } + + function app_status($appname = ""){ + global $phpgw_info; + $this->execute_script("version"); + reset ($phpgw_info["server"]["versions"]); + + $this->db->query("select * from applications"); + while ($this->db->next_record()){ + $phpgw_info["server"]["current_versions"][$this->db->f("app_name")] = $this->db->f("app_version"); + } + while (list($key, $value) = each ($phpgw_info["server"]["versions"])){ + if ($key != "header" && $key != "current_header" && $key != "" && $key != "mcrypt"){ + if (!isset($phpgw_info["server"]["current_versions"][$key])){ + $phpgw_info["server"]["current_versions"][$key] = "new"; + $phpgw_info["setup"][$key]["status"] = "new"; + }elseif ($value != $phpgw_info["server"]["current_versions"][$key]){ + $phpgw_info["setup"][$key]["status"] = "upgrade"; + }else{ + $phpgw_info["setup"][$key]["status"] = "current"; + } +echo "phpgw_info[setup][$key][status]: ".$phpgw_info["setup"][$key]["status"]."
"; + } + } + + } function execute_script($script, $appname = ""){ global $phpgw_info, $phpgw_domain; if ($appname == ""){ $d = dir($phpgw_info["server"]["server_root"]); while($entry=$d->read()) { - $f = $phpgw_info["server"]["server_root"]."/".$entry."/setup/version.inc.php"; - if (file_exists ($f)){ - include($f); + if ($script == "version"){ + $f = $phpgw_info["server"]["server_root"]."/".$entry."/version.inc.php"; + if (file_exists ($f)){include($f); } }else{ - $phpgw_info["server"]["versions"][$entry] = $phpgw_info["setup"]["currentver"]["phpgwapi"]; + $f = $phpgw_info["server"]["server_root"]."/".$entry."/setup/".$script.".inc.php"; + if (file_exists ($f)){include($f);} } - - $f = $phpgw_info["server"]["server_root"]."/".$entry."/setup/".$script.".inc.php"; - if (file_exists ($f)){include($f);} } $d->close(); }else{ @@ -337,7 +360,7 @@ $this->db->query("update applications set app_version='".$phpgw_info["setup"]["currentver"]["phpgwapi"]."' where app_name='".$appname."'"); } - function manage_tables(){ + function manage_tables($appname=""){ global $phpgw_domain, $phpgw_info; if ($phpgw_info["setup"]["currentver"]["phpgwapi"] == "drop"){ $this->execute_script("droptables"); diff --git a/setup/index.php b/setup/index.php index 15fcc5e4c3..a95e88e7ef 100644 --- a/setup/index.php +++ b/setup/index.php @@ -65,6 +65,7 @@ exit; } +//$phpgw_setup->app_status(); $phpgw_info["server"]["app_images"] = "templates/default/images"; echo "";