This commit is contained in:
Julio Cesar Laura Avendaño
2018-11-19 16:16:40 -04:00
parent 9b3d936e65
commit 5d6ed65a97

View File

@@ -1,20 +1,5 @@
<?php
/*
//Support ProcessMaker 1.8 which doesn't have the CLI class.
define("CLI2", class_exists("CLI"));
if (CLI2) {
CLI::taskName("addon-install");
CLI::taskDescription(<<<EOT
Download and install an addon
EOT
);
CLI::taskRun(run_addon_core_install);
} else {
pake_desc("install addon");
pake_task("addon-install");
}
*/
/*----------------------------------********---------------------------------*/
CLI::taskName('change-password-hash-method');
CLI::taskDescription(<<<EOT
@@ -25,23 +10,10 @@ CLI::taskArg('workspace', false);
CLI::taskArg('hash', false);
CLI::taskRun("change_hash");
/*----------------------------------********---------------------------------*/
//function run_addon_core_install($args, $opts) {
function run_addon_core_install($args)
{
try {
if (!extension_loaded("mysql")) {
if (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") {
dl("mysql.dll");
} else {
dl("mysql.so");
}
}
///////
/*
if (!CLI2) {
$args = $opts;
}
*/
$workspace = $args[0];
$storeId = $args[1];
$addonName = $args[2];
@@ -57,20 +29,17 @@ function run_addon_core_install($args)
define("DB_ADAPTER", $args[3]);
}
///////
$ws = new WorkspaceTools($workspace);
$ws->initPropel(false);
require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php';
require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AddonsManagerPeer.php';
$addon = AddonsManagerPeer::retrieveByPK($addonName, $storeId);
if ($addon == null) {
throw new Exception("Id $addonName not found in store $storeId");
}
//echo "Downloading...\n";
$download = $addon->download();
//echo "Installing...\n";
$addon->download();
$addon->install();
if ($addon->isCore()) {
@@ -82,10 +51,7 @@ function run_addon_core_install($args)
}
} catch (Exception $e) {
$addon->setState("error");
//fwrite(STDERR, "\n[ERROR: {$e->getMessage()}]\n");
//fwrite(STDOUT, "\n[ERROR: {$e->getMessage()}]\n");
}
//echo "** Installation finished\n";
}
/*----------------------------------********---------------------------------*/
function change_hash($command, $opts)