BUG 12213 "Adicionar soporte para hotfixes" SOLVED
- Nuevo feature
- Funcionalidad para la instalacion de parches
- Nuevo feature implementado, se ha adicionado una nueva opcion al comando ./processmaker
Esta nueva opcion trabaja de la siguiente manera:
Caso 1 - ./processmaker patch-install MyPatch.tar
Caso 2 - ./processmaker patch-install path_to_patch/MyPatch.tar
Para el caso 1, el archivo tar debe estar fisicamente en la ruta:
path_to_processmaker/shared/patchs (si no existe el directorio "patchs", crearlo y darle todos los permisos)
Para el caso 2, el archivo debe existir en la ruta que se especifica
* Available from version ProcessMaker-2.5.1-testing.3
This commit is contained in:
48
workflow/engine/bin/tasks/cliPatch.php
Normal file
48
workflow/engine/bin/tasks/cliPatch.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
CLI::taskName("patch-install");
|
||||
|
||||
CLI::taskDescription(<<<EOT
|
||||
Install patch to system
|
||||
|
||||
This command is executed when you want to update certain files, which have improvements or solution to bugs.
|
||||
EOT
|
||||
);
|
||||
|
||||
CLI::taskRun(runPatchInstall);
|
||||
|
||||
function runPatchInstall($command, $args)
|
||||
{
|
||||
CLI::logging("PATCH", PATH_DATA . "log" . PATH_SEP . "upgrades.log");
|
||||
CLI::logging("Install patch to system\n");
|
||||
|
||||
$arrayFile = $command;
|
||||
|
||||
if (count($arrayFile) > 0) {
|
||||
//Install patch
|
||||
foreach ($arrayFile as $value) {
|
||||
$f = $value;
|
||||
|
||||
$result = workspaceTools::patchInstall($f);
|
||||
|
||||
CLI::logging($result["message"] . "\n");
|
||||
}
|
||||
|
||||
//Clear server's cache
|
||||
CLI::logging("\nClearing cache...\n");
|
||||
|
||||
if (defined("PATH_C")) {
|
||||
G::rm_dir(PATH_C);
|
||||
G::mk_dir(PATH_C, 0777);
|
||||
}
|
||||
|
||||
//Safe upgrade for JavaScript files
|
||||
CLI::logging("\nSafe upgrade for files cached by the browser\n\n");
|
||||
|
||||
G::browserCacheFilesSetUid();
|
||||
|
||||
CLI::logging("PATCH done\n");
|
||||
} else {
|
||||
CLI::logging("Not exist patchs to install in the command\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ class workspaceTools
|
||||
rmdir($UIdDir);//remove the diretory itself, G::rm_dir cannot do it
|
||||
} else {
|
||||
CLI::logging(CLI::error("Error: Failure at coping from $UIdDir...\n"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CLI::logging("$UIdDir is empty, removing it\n");
|
||||
rmdir($UIdDir);//remove the diretory itself
|
||||
@@ -582,7 +582,7 @@ class workspaceTools
|
||||
unlink($file[$index]);
|
||||
} else {
|
||||
CLI::logging(CLI::error("Error: Failure at copy $file[$index] files...\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ class workspaceTools
|
||||
$this->upgradeData();
|
||||
p11835::execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade this workspace database from a schema
|
||||
@@ -1191,12 +1191,12 @@ class workspaceTools
|
||||
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(BASENAME, $metaFiles))) {
|
||||
throw new Exception("Workspace $srcWorkspace not found in backup");
|
||||
}
|
||||
|
||||
|
||||
$version = System::getVersion();
|
||||
$version = explode('-', $version);
|
||||
$versionPresent = ( isset($version[0])) ? $version[0] : '';
|
||||
CLI::logging(CLI::warning("
|
||||
Note.- If you try to execute a restore from a generated backup on a recent version of Processmaker
|
||||
Note.- If you try to execute a restore from a generated backup on a recent version of Processmaker
|
||||
than version you are using currently to restore it, it may be occur errors on the restore process,
|
||||
it shouldn't be restaured generated backups on later versions than version when the restore is executed") . "\n");
|
||||
|
||||
@@ -1296,7 +1296,7 @@ class workspaceTools
|
||||
$stop = microtime(true);
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Updating cache view Process took $final seconds.\n");
|
||||
|
||||
|
||||
|
||||
mysql_close($link);
|
||||
}
|
||||
@@ -1307,5 +1307,55 @@ class workspaceTools
|
||||
|
||||
CLI::logging(CLI::info("Done restoring") . "\n");
|
||||
}
|
||||
|
||||
public static function patchInstall($file)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
$dirPatch = PATH_DATA . "patchs";
|
||||
|
||||
$arrayPathInfo = pathinfo($file);
|
||||
|
||||
$f = ($arrayPathInfo["dirname"] == ".")? $dirPatch . PATH_SEP . $file : $file;
|
||||
|
||||
$swv = 1;
|
||||
$msgv = "";
|
||||
|
||||
if (!file_exists($dirPatch)) {
|
||||
G::mk_dir($dirPatch, 0777);
|
||||
}
|
||||
|
||||
if (!file_exists($f)) {
|
||||
$swv = 0;
|
||||
$msgv = $msgv . (($msgv != "")? "\n": null) . "- The file \"$f\" does not exist";
|
||||
}
|
||||
|
||||
if ($arrayPathInfo["extension"] != "tar") {
|
||||
$swv = 0;
|
||||
$msgv = $msgv . (($msgv != "")? "\n": null) . "- The file's extension \"$file\" no is \"tar\"";
|
||||
}
|
||||
|
||||
if ($swv == 1) {
|
||||
G::LoadThirdParty("pear/Archive", "Tar");
|
||||
|
||||
//Extract
|
||||
$tar = new Archive_Tar($f);
|
||||
|
||||
$swTar = $tar->extract(PATH_OUTTRUNK); //true on success, false on error
|
||||
|
||||
if ($swTar) {
|
||||
$result["status"] = 1;
|
||||
$result["message"] = "- Successfully to install patch \"$f\"";
|
||||
} else {
|
||||
$result["status"] = 0;
|
||||
$result["message"] = "- Could not extract file \"$f\"";
|
||||
}
|
||||
} else {
|
||||
$result["status"] = 0;
|
||||
$result["message"] = $msgv;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user