Merged in marcoAntonioNina/processmaker/BUG-15561 (pull request #811)
BUG-15561 Cambiar el algoritmo o metodo de cifrado... IMPROVEMENT
This commit is contained in:
@@ -19,6 +19,15 @@ EOT
|
||||
}
|
||||
*/
|
||||
|
||||
CLI::taskName('change-password-hash-method');
|
||||
CLI::taskDescription(<<<EOT
|
||||
Create .po file for the plugin
|
||||
EOT
|
||||
);
|
||||
CLI::taskArg('workspace', false);
|
||||
CLI::taskArg('hash', false);
|
||||
CLI::taskRun("change_hash");
|
||||
|
||||
//function run_addon_install($args, $opts) {
|
||||
function run_addon_install($args)
|
||||
{
|
||||
@@ -92,3 +101,46 @@ function run_addon_install($args)
|
||||
//echo "** Installation finished\n";
|
||||
}
|
||||
|
||||
function change_hash($command, $opts)
|
||||
{
|
||||
if (count($command) < 2) {
|
||||
$hash = 'md5';
|
||||
} else {
|
||||
$hash = array_pop($command);
|
||||
}
|
||||
$workspaces = get_workspaces_from_args($command);
|
||||
|
||||
require_once (PATH_GULLIVER . PATH_SEP . 'class.bootstrap.php');
|
||||
Bootstrap::LoadClass("plugin");
|
||||
foreach ($workspaces as $workspace) {
|
||||
CLI::logging("Checking workspace: ".pakeColor::colorize($workspace->name, "INFO")."\n");
|
||||
$path = PATH_DATA . 'sites' . PATH_SEP . $workspace->name . PATH_SEP;
|
||||
try {
|
||||
if (file_exists($path . 'plugin.singleton')) {
|
||||
define('SYS_SYS', $workspace->name);
|
||||
define('PATH_DATA_SITE', $path);
|
||||
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->setupPlugins();
|
||||
$oPluginRegistry->unSerializeInstance(file_get_contents($path . 'plugin.singleton'));
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->unSerializeInstance(file_get_contents($path . 'plugin.singleton'));
|
||||
|
||||
if ($oPluginRegistry->existsTrigger ( PM_HASH_PASSWORD )) {
|
||||
$response = new stdclass();
|
||||
$response->workspace = $workspace;
|
||||
$response->hash = $hash;
|
||||
$workspace->changeHashPassword($workspace->name, $response);
|
||||
$workspace->close();
|
||||
CLI::logging(pakeColor::colorize("Changed...", "ERROR") . "\n");
|
||||
} else {
|
||||
CLI::logging(pakeColor::colorize("You can't use the \"change-password-hash-method\" option because the license has expired or your workspace doesn't have the Enteprise plugin enabled.", "ERROR") . "\n");
|
||||
}
|
||||
} else {
|
||||
CLI::logging(pakeColor::colorize("You can't use the \"change-password-hash-method\" option because the license has expired or your workspace doesn't have the Enteprise plugin enabled.", "INFO") . "\n");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user