From 9ae42fc7e41c69008b9f59c852106664970817ff Mon Sep 17 00:00:00 2001 From: IsaiDiaz Date: Fri, 27 Jun 2025 12:06:00 -0400 Subject: [PATCH] remove cnn.php --- gulliver/bin/tasks/pakeGulliver.php | 49 +++---- workflow/engine/src/ProcessMaker/Util/Cnn.php | 122 ------------------ 2 files changed, 25 insertions(+), 146 deletions(-) delete mode 100644 workflow/engine/src/ProcessMaker/Util/Cnn.php diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php index 976dea9ef..7c0ec957e 100644 --- a/gulliver/bin/tasks/pakeGulliver.php +++ b/gulliver/bin/tasks/pakeGulliver.php @@ -2301,31 +2301,32 @@ function run_check_standard_code($task, $options) } } -function run_update_plugin_attributes($task, $args) -{ - try { - //Verify data - if (!isset($args[0])) { - throw new Exception("Error: You must specify the name of a plugin"); - } - //Set variables - $pluginName = $args[0]; - // virtual SYS_SYS for cache - $sys_sys = uniqid(); - define('SYS_SYS', $sys_sys); - config(["system.workspace" => $sys_sys]); - foreach (PmSystem::listWorkspaces() as $value) { - \ProcessMaker\Util\Cnn::connect($value->name); - //Update plugin attributes - $pmPluginRegistry = PluginRegistry::newInstance(); - $pmPluginRegistry->updatePluginAttributesInAllWorkspaces($value->name, $pluginName); - } +// Commented out due to cnn.php deletion +// function run_update_plugin_attributes($task, $args) +// { +// try { +// //Verify data +// if (!isset($args[0])) { +// throw new Exception("Error: You must specify the name of a plugin"); +// } +// //Set variables +// $pluginName = $args[0]; +// // virtual SYS_SYS for cache +// $sys_sys = uniqid(); +// define('SYS_SYS', $sys_sys); +// config(["system.workspace" => $sys_sys]); +// foreach (PmSystem::listWorkspaces() as $value) { +// \ProcessMaker\Util\Cnn::connect($value->name); +// //Update plugin attributes +// $pmPluginRegistry = PluginRegistry::newInstance(); +// $pmPluginRegistry->updatePluginAttributesInAllWorkspaces($value->name, $pluginName); +// } - echo "Done!\n"; - } catch (Exception $e) { - error_log($e->getMessage() . "\n"); - } -} +// echo "Done!\n"; +// } catch (Exception $e) { +// error_log($e->getMessage() . "\n"); +// } +// } function run_check_plugin_disabled_code($task, $args) { diff --git a/workflow/engine/src/ProcessMaker/Util/Cnn.php b/workflow/engine/src/ProcessMaker/Util/Cnn.php deleted file mode 100644 index ca08710b9..000000000 --- a/workflow/engine/src/ProcessMaker/Util/Cnn.php +++ /dev/null @@ -1,122 +0,0 @@ -workspace = $workspace; - Propel::initConfiguration($cnn->buildParams()); - } - - /** - * Loads the parameters required to connect to each workspace database - * @return array - */ - public function buildParams() - { - if ($this->readFileDBWorkspace()) { - return $this->prepareDataSources(); - } - return []; - } - - /** - * Reads the workspace db.php file - * @return bool - */ - private function readFileDBWorkspace() - { - if (file_exists(PATH_DB . $this->workspace . PATH_SEP . 'db.php')) { - $this->dbFile = file_get_contents(PATH_DB . $this->workspace . PATH_SEP . 'db.php'); - return true; - } - return false; - } - - /** - * Prepares data resources - * @return array - */ - private function prepareDataSources() - { - $phpCode = preg_replace( - '/define\s*\(\s*[\x22\x27](.*)[\x22\x27]\s*,\s*(\x22.*\x22|\x27.*\x27)\s*\)\s*;/i', - '$$1 = $2;', - $this->dbFile - ); - $phpCode = str_replace([''], '', $phpCode); - - eval($phpCode); - - $dataSources = []; - $dataSources['datasources'] = array( - 'workflow' => array( - 'connection' => $this->buildDsnString( - $DB_ADAPTER, - $DB_HOST, - $DB_NAME, - $DB_USER, - urlencode($DB_PASS) - ), - 'adapter' => "mysql" - ), - 'rbac' => array( - 'connection' => $this->buildDsnString( - $DB_ADAPTER, - $DB_RBAC_HOST, - $DB_RBAC_NAME, - $DB_RBAC_USER, - urlencode($DB_RBAC_PASS) - ), - 'adapter' => "mysql" - ), - 'report' => array( - 'connection' => $this->buildDsnString( - $DB_ADAPTER, - $DB_REPORT_HOST, - $DB_REPORT_NAME, - $DB_REPORT_USER, - urlencode($DB_REPORT_PASS) - ), - 'adapter' => "mysql" - ) - ); - return $dataSources; - } - - /** - * Builds the DSN string to be used by PROPEL - * @param string $adapter - * @param string $host - * @param string $name - * @param string $user - * @param string $pass - * @return string - */ - private function buildDsnString($adapter, $host, $name, $user, $pass) - { - $dns = $adapter . "://" . $user . ":" . $pass . "@" . $host . "/" . $name; - switch ($adapter) { - case 'mysql': - $dns .= '?encoding=utf8'; - break; - } - return $dns; - } -}