. * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. * * @author Alexandre Rosenfeld * @package workflow-engine-bin-tasks */ G::LoadClass("system"); G::LoadClass("wsTools"); CLI::taskName('upgrade'); CLI::taskDescription(<< $workspace) { try { $countWorkspace++; CLI::logging("Upgrading workspaces ($countWorkspace/$count): " . CLI::info($workspace->name) . "\n"); $workspace->upgrade($first, $buildCacheView, $workspace->name); $workspace->close(); $first = false; } catch (Exception $e) { CLI::logging("Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"); $errors = true; } } if ($errors) { CLI::logging("Upgrade finished but there were errors upgrading workspaces.\n"); CLI::logging(CLI::error("Please check the log above to correct any issues.")."\n"); } else { CLI::logging("Upgrade successful\n"); } // SAVE Upgrades/Patches $arrayPatch = glob(PATH_TRUNK . 'patch-*'); if ($arrayPatch) { foreach ($arrayPatch as $value) { if (file_exists($value)) { // copy content the patch $names = pathinfo($value); $nameFile = $names['basename']; $contentFile = file_get_contents($value); $contentFile = preg_replace("[\n|\r|\n\r]", '', $contentFile); CLI::logging($contentFile . ' installed (' . $nameFile . ')', PATH_DATA . 'log/upgrades.log'); // move file of patch $newFile = PATH_DATA . $nameFile; G::rm_dir($newFile); copy($value, $newFile); G::rm_dir($value); } } } else { CLI::logging('ProcessMaker ' . System::getVersion(). ' installed', PATH_DATA . 'log/upgrades.log'); } //setting flag to false $flag = G::isPMUnderUpdating(0); }