From: <jhe...@us...> - 2002-11-28 14:34:47
|
Update of /cvsroot/upcase-project/UpCase/admin In directory sc8-pr-cvs1:/tmp/cvs-serv11486 Modified Files: installer.php Log Message: splitted installation in pre, configure and install setps, with configure allowing user to input data if the package request it. Index: installer.php =================================================================== RCS file: /cvsroot/upcase-project/UpCase/admin/installer.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** installer.php 21 Nov 2002 15:20:14 -0000 1.8 --- installer.php 28 Nov 2002 14:34:44 -0000 1.9 *************** *** 33,84 **** die("Invalid package2"); ! if (checkVar("install", false)) ! $operation = "install"; ! else if (checkVar("upgrade", false)) ! { ! $operation = "upgrade"; ! die("Not yet implemented"); ! } ! else if (checkVar("cancel", false)) ! { ! $operation = "cancel"; ! die("Not yet implemented"); ! } ! else if (checkVar("uninstall", false)) ! { ! $operation = "uninstall"; ! } ! else ! $operation = "view"; // don't use the include_once directive unless you want // to always display this page in the default language include("config/uc_templates.inc"); ! ! if ($operation == "view") { ! $tmpl = new ModeliXe($uc_tmpl["INSTALLER"]); $tmpl->SetModeliXe(); ! $tmpl->MxAttribut("installer", $ucConfig->upcaseUrl . "/admin/installer.php"); $tmpl->MxText("pkgname", $package->name); - $tmpl->MxText("siteroot", $ucConfig->siteUrl . "/"); - $tmpl->MxText("catname", $category->name); $tmpl->MxWrite(); } ! else if ($operation == "install") { ! $cfg = $GLOBALS["ucConfig"]; ! if (checkVar("pkgurl", false)) ! $pkgRelUrl = checkVar("pkgurl"); ! else ! die("Please give a url that is under your site root"); ! if (checkVar("tblprefix", false)) ! $tblPrefix = checkVar("tblprefix"); else ! die("You MUST specify a tables prefix"); ! $inst->saveMetaData($package); ! $redirect = $inst->install($package, $pkgRelUrl, $tblPrefix); header("Location: " . $redirect); } else if ($operation == "uninstall") { --- 33,153 ---- die("Invalid package2"); ! $operation = "configure"; ! if (checkVar("op", false)) ! $operation = checkVar("op"); ! // don't use the include_once directive unless you want // to always display this page in the default language include("config/uc_templates.inc"); ! if ($operation == "preinstall") { ! $tmpl = new ModeliXe($uc_tmpl["PREINSTALL"]); $tmpl->SetModeliXe(); ! ! $tmpl->MxAttribut("installer", ! $ucConfig->upcaseUrl . "/admin/installer.php"); ! $tmpl->MxHidden("params", "op=configure&cat=$catname&pkg=$pkgname"); ! $tmpl->MxText("siteurl", $ucConfig->siteUrl); $tmpl->MxText("pkgname", $package->name); $tmpl->MxWrite(); } ! ! else if ($operation == "configure") { ! $pkgPath = checkVar("pkgpath", false) ! or die("No destination path defined"); ! $tblPrefix = checkVar("tblprefix", false) ! or die("No tables prefix defined"); ! $inst->preinstall($package, $pkgPath, $tblPrefix); ! ! if ($package->supported == 0) ! { ! header("Location: " . $ucConfig->upcaseUrl . "/admin/installer.php" ! . "?op=install&cat=$catname&pkg=$pkgname" ! . "&tblprefix=$tblPrefix&pkgpath=$pkgPath"); ! exit(); ! } ! ! $inputs = $inst->getConfigInputs($package, $pkgPath); ! ! if ($inputs) ! { ! $tmpl = new ModeliXe($uc_tmpl["CONFIGURE"]); ! $tmpl->SetModeliXe(); ! $tmpl->MxAttribut("installer", ! $ucConfig->upcaseUrl . "/admin/installer.php"); ! $tmpl->MxHidden("params", ! "op=install&pkgpath=$pkgPath&cat=$catname&pkg=$pkgname&tblprefix=$tblPrefix"); ! $tmpl->MxText("pkgname", $package->name); ! $tmpl->MxFormField("pkgprefix", "text", "tblprefix", $package->name); ! foreach ($inputs as $inputVar => $inputInfo) ! { ! $tmpl->MxText("inputs.label", $inputInfo[2]); ! if ($inputInfo[0] == "text") ! { ! $tmpl->MxBloc("inputs.enums", "delete"); ! $tmpl->MxBloc("inputs.booleans", "delete"); ! $tmpl->MxFormField("inputs.fields.field", "text", ! $inputVar, $inputInfo[1]); ! } ! else if ($inputInfo[0] == "password") ! { ! $tmpl->MxBloc("inputs.enums", "delete"); ! $tmpl->MxBloc("inputs.booleans", "delete"); ! $tmpl->MxFormField("inputs.fields.field", "password", ! $inputVar, ""); ! } ! else if ($inputInfo[0] == "boolean") ! { ! $tmpl->MxBloc("inputs.fields", "delete"); ! $tmpl->MxBloc("inputs.enums", "delete"); ! $tmpl->MxCheckerField("inputs.booleans.boolean", "checkbox", ! $inputVar, $inputInfo[1]); ! } ! else if ($inputInfo[0] == "enum") ! { ! $tmpl->MxBloc("inputs.fields", "delete"); ! $tmpl->MxBloc("inputs.booleans", "delete"); ! $tmpl->MxSelect("inputs.enums.enum", $inputVar, $inputInfo[1], ! $inputInfo[3]); ! } ! $tmpl->MxBloc("inputs", "loop"); ! } ! $tmpl->MxWrite(); ! } else ! { ! header("Location: " . $ucConfig->upcaseUrl . "/admin/installer.php" ! . "?op=install&cat=$catname&pkg=$pkgname" ! . "&tblprefix=$tblPrefix&pkgpath=$pkgPath"); ! } ! } ! ! else if ($operation == "install") ! { ! $configData = array(); ! $configData["TABLES_PREFIX"] = checkVar("tblprefix", false) ! or die("No tables prefix defined"); ! $configData["PACKAGE_PATH"] = checkVar("pkgpath", false) ! or die("No package path defined"); ! ! if ($package->supported == 1) ! { ! $configInputs = $inst->getConfigInputs($package, ! $configData["PACKAGE_PATH"]); ! if ($configInputs) ! { ! foreach (array_keys($configInputs) as $key) ! { ! if (checkVar($key, false)) ! $configData[$key] = checkVar($key); ! } ! } ! } ! $redirect = $inst->install($package, $configData); header("Location: " . $redirect); } + else if ($operation == "uninstall") { *************** *** 87,94 **** --- 156,167 ---- . "/admin/category.php?catname=" . $catname); } + else if ($operation == "upgrade") { die("Not yet implemented upgrade feature"); } + + else + die("Invalid installer operation"); ?> |