Merged in bugfix/HOR-3663 (pull request #5933)
HOR-3663 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
use Illuminate\Foundation\Console\Kernel;
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../bootstrap/autoload.php');
|
// Because laravel has a __ helper function, it's important we include the class.g file to ensure our __ is used.
|
||||||
|
require_once __DIR__ . '/../../bootstrap/autoload.php';
|
||||||
|
require_once __DIR__ . '/../../bootstrap/app.php';
|
||||||
|
$app->make(Kernel::class)->bootstrap();
|
||||||
|
|
||||||
|
error_reporting(error_reporting() & ~E_DEPRECATED & ~E_STRICT);
|
||||||
|
|
||||||
if (!PATH_THIRDPARTY) {
|
if (!PATH_THIRDPARTY) {
|
||||||
die("You must launch gulliver command line with the gulliver script\n");
|
die("You must launch gulliver command line with the gulliver script\n");
|
||||||
|
|||||||
@@ -491,52 +491,57 @@ function addTarFolder($tar, $pathBase, $pluginHome) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_pack_plugin($task, $args) {
|
function run_pack_plugin($task, $args)
|
||||||
ini_set('display_errors', 'on');
|
{
|
||||||
ini_set('error_reporting', E_ERROR);
|
ini_set('display_errors', 'on');
|
||||||
|
ini_set('error_reporting', E_ERROR);
|
||||||
|
|
||||||
// the environment for poedit always is Development
|
// the environment for poedit always is Development
|
||||||
define('G_ENVIRONMENT', G_DEV_ENV);
|
define('G_ENVIRONMENT', G_DEV_ENV);
|
||||||
|
|
||||||
//the plugin name in the first argument
|
//the plugin name in the first argument
|
||||||
if( ! isset($args[0]) ) {
|
if (!isset($args[0])) {
|
||||||
printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR'));
|
printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR'));
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
$pluginName = $args[0];
|
$pluginName = $args[0];
|
||||||
|
|
||||||
$pluginDirectory = PATH_PLUGINS . $pluginName;
|
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
||||||
$pluginOutDirectory = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
|
||||||
$pluginHome = PATH_OUTTRUNK . 'plugins' . PATH_SEP . $pluginName;
|
|
||||||
|
|
||||||
//verify if plugin exists,
|
//verify if plugin exists,
|
||||||
$pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php';
|
$pluginClassFilename = PATH_PLUGINS . $pluginName . PATH_SEP . 'class.' . $pluginName . '.php';
|
||||||
$pluginFilename = PATH_PLUGINS . $pluginName . '.php';
|
$pluginFilename = PATH_PLUGINS . $pluginName . '.php';
|
||||||
if( ! is_file($pluginClassFilename) ) {
|
if (!is_file($pluginClassFilename)) {
|
||||||
printf("The plugin %s does not exist in this file %s \n", pakeColor::colorize($pluginName, 'ERROR'), pakeColor::colorize($pluginClassFilename, 'INFO'));
|
printf("The plugin %s does not exist in this file %s \n", pakeColor::colorize($pluginName, 'ERROR'), pakeColor::colorize($pluginClassFilename, 'INFO'));
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once ($pluginFilename);
|
if (!file_exists($pluginFilename)) {
|
||||||
|
printf("Error: %s\n", pakeColor::colorize('you must specify a valid name for the plugin', 'ERROR'));
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
if (preg_match_all('/->iVersion(.*)=(.*);/i', file_get_contents($pluginFilename), $result)) {
|
||||||
$pluginDetail = $oPluginRegistry->getPluginDetails($pluginName . '.php');
|
$version = trim($result[2][0], ' "');
|
||||||
$fileTar = $pluginHome . PATH_SEP . $pluginName . '-' . $pluginDetail->iVersion . '.tar';
|
} else {
|
||||||
|
$version = 1;
|
||||||
|
}
|
||||||
|
$fileTar = $pluginHome . PATH_SEP . $pluginName . '-' . $version . '.tar';
|
||||||
|
|
||||||
$tar = new Archive_Tar($fileTar);
|
$tar = new Archive_Tar($fileTar);
|
||||||
$tar->_compress = false;
|
$tar->_compress = false;
|
||||||
|
|
||||||
$pathBase = $pluginHome . PATH_SEP . $pluginName . PATH_SEP;
|
$pathBase = $pluginHome . PATH_SEP . $pluginName . PATH_SEP;
|
||||||
$tar->createModify($pluginHome . PATH_SEP . $pluginName . '.php', '', $pluginHome);
|
$tar->createModify($pluginHome . PATH_SEP . $pluginName . '.php', '', $pluginHome);
|
||||||
addTarFolder($tar, $pathBase, $pluginHome);
|
addTarFolder($tar, $pathBase, $pluginHome);
|
||||||
$aFiles = $tar->listContent();
|
$aFiles = $tar->listContent();
|
||||||
|
|
||||||
foreach( $aFiles as $key => $val ) {
|
foreach ($aFiles as $key => $val) {
|
||||||
printf(" %6d %s \n", $val['size'], pakeColor::colorize($val['filename'], 'INFO'));
|
printf(" %6d %s \n", $val['size'], pakeColor::colorize($val['filename'], 'INFO'));
|
||||||
}
|
}
|
||||||
printf("File created in %s \n", pakeColor::colorize($fileTar, 'INFO'));
|
printf("File created in %s \n", pakeColor::colorize($fileTar, 'INFO'));
|
||||||
$filesize = sprintf("%5.2f", filesize($fileTar) / 1024);
|
$filesize = sprintf("%5.2f", filesize($fileTar) / 1024);
|
||||||
printf("Filesize %s Kb \n", pakeColor::colorize($filesize, 'INFO'));
|
printf("Filesize %s Kb \n", pakeColor::colorize($filesize, 'INFO'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_new_plugin($task, $args) {
|
function run_new_plugin($task, $args) {
|
||||||
@@ -2218,23 +2223,24 @@ function run_check_standard_code ( $task, $options) {
|
|||||||
function run_update_plugin_attributes($task, $args)
|
function run_update_plugin_attributes($task, $args)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
if (!isset($args[0])) {
|
if (!isset($args[0])) {
|
||||||
throw new Exception("Error: You must specify the name of a plugin");
|
throw new Exception("Error: You must specify the name of a plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set variables
|
//Set variables
|
||||||
$pluginName = $args[0];
|
$pluginName = $args[0];
|
||||||
|
// virtual SYS_SYS for cache
|
||||||
//Update plugin attributes
|
define('SYS_SYS', uniqid());
|
||||||
$pmPluginRegistry = PluginRegistry::loadSingleton();
|
foreach (PmSystem::listWorkspaces() as $value) {
|
||||||
|
\ProcessMaker\Util\Cnn::connect($value->name);
|
||||||
$pmPluginRegistry->updatePluginAttributesInAllWorkspaces($pluginName);
|
//Update plugin attributes
|
||||||
|
$pmPluginRegistry = PluginRegistry::newInstance();
|
||||||
|
$pmPluginRegistry->updatePluginAttributesInAllWorkspaces($value->name, $pluginName);
|
||||||
|
}
|
||||||
|
|
||||||
echo "Done!\n";
|
echo "Done!\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
error_log( $e->getMessage() . "\n" );
|
error_log($e->getMessage() . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2242,7 +2248,7 @@ function run_check_plugin_disabled_code($task, $args)
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Set variables
|
//Set variables
|
||||||
$option = (isset($args[0]))? trim($args[0]) : "";
|
$option = (isset($args[0])) ? trim($args[0]) : "";
|
||||||
$option2 = strtoupper($option);
|
$option2 = strtoupper($option);
|
||||||
|
|
||||||
switch ($option2) {
|
switch ($option2) {
|
||||||
@@ -2268,10 +2274,10 @@ function run_check_plugin_disabled_code($task, $args)
|
|||||||
|
|
||||||
if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) {
|
if (is_file(PATH_PLUGINS . $pluginName . ".php") && is_dir(PATH_PLUGINS . $pluginName)) {
|
||||||
if (preg_match(
|
if (preg_match(
|
||||||
'/^.*class\s+' . $pluginName . 'Plugin\s+extends\s+(\w*)\s*\{.*$/i',
|
'/^.*class\s+' . $pluginName . 'Plugin\s+extends\s+(\w*)\s*\{.*$/i',
|
||||||
str_replace(["\n", "\r", "\t"], ' ', file_get_contents(PATH_PLUGINS . $pluginName . '.php')),
|
str_replace(["\n", "\r", "\t"], ' ', file_get_contents(PATH_PLUGINS . $pluginName . '.php')),
|
||||||
$arrayMatch
|
$arrayMatch
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$pluginParentClassName = $arrayMatch[1];
|
$pluginParentClassName = $arrayMatch[1];
|
||||||
|
|
||||||
@@ -2320,13 +2326,13 @@ function run_check_plugin_disabled_code($task, $args)
|
|||||||
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName));
|
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName));
|
||||||
|
|
||||||
if (!empty($arrayFoundDisabledCode)) {
|
if (!empty($arrayFoundDisabledCode)) {
|
||||||
$strFoundDisabledCode .= (($strFoundDisabledCode != "")? "\n\n" : "") . "> " . $pluginName;
|
$strFoundDisabledCode .= (($strFoundDisabledCode != "") ? "\n\n" : "") . "> " . $pluginName;
|
||||||
|
|
||||||
foreach ($arrayFoundDisabledCode as $key2 => $value2) {
|
foreach ($arrayFoundDisabledCode as $key2 => $value2) {
|
||||||
$strCodeAndLine = "";
|
$strCodeAndLine = "";
|
||||||
|
|
||||||
foreach ($value2 as $key3 => $value3) {
|
foreach ($value2 as $key3 => $value3) {
|
||||||
$strCodeAndLine .= (($strCodeAndLine != "")? ", " : "") . $key3 . " (Lines " . implode(", ", $value3) . ")";
|
$strCodeAndLine .= (($strCodeAndLine != "") ? ", " : "") . $key3 . " (Lines " . implode(", ", $value3) . ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
$strFoundDisabledCode .= "\n- " . str_replace(PATH_PLUGINS, "", $key2) . ": " . $strCodeAndLine;
|
$strFoundDisabledCode .= "\n- " . str_replace(PATH_PLUGINS, "", $key2) . ": " . $strCodeAndLine;
|
||||||
@@ -2345,7 +2351,7 @@ function run_check_plugin_disabled_code($task, $args)
|
|||||||
|
|
||||||
echo "Done!\n";
|
echo "Done!\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
error_log( $e->getMessage() . "\n" );
|
error_log($e->getMessage() . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
thirdparty/pear/Archive/Tar.php
vendored
2
thirdparty/pear/Archive/Tar.php
vendored
@@ -39,8 +39,6 @@
|
|||||||
* @link http://pear.php.net/package/Archive_Tar
|
* @link http://pear.php.net/package/Archive_Tar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'PEAR.php';
|
|
||||||
|
|
||||||
define('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
|
define('ARCHIVE_TAR_ATT_SEPARATOR', 90001);
|
||||||
define('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
|
define('ARCHIVE_TAR_END_BLOCK', pack("a512", ''));
|
||||||
|
|
||||||
|
|||||||
@@ -129,6 +129,21 @@ class PluginRegistry
|
|||||||
$this->_aPluginDetails[$Namespace] = $detail;
|
$this->_aPluginDetails[$Namespace] = $detail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister the plugin in the class
|
||||||
|
* @param string $namespace Name Plugin
|
||||||
|
* @return PluginDetail
|
||||||
|
*/
|
||||||
|
public function unregisterPlugin($namespace)
|
||||||
|
{
|
||||||
|
$detail = null;
|
||||||
|
if (isset($this->_aPluginDetails[$namespace])) {
|
||||||
|
$detail = $this->_aPluginDetails[$namespace];
|
||||||
|
unset($this->_aPluginDetails[$namespace]);
|
||||||
|
}
|
||||||
|
return $detail;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get setup Plugins
|
* Get setup Plugins
|
||||||
* @return int
|
* @return int
|
||||||
@@ -1371,85 +1386,32 @@ class PluginRegistry
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the plugin attributes in all workspaces
|
* Update the plugin attributes in all workspaces
|
||||||
* @param string $Namespace Name of Plugin
|
* @param string $workspace Name workspace
|
||||||
|
* @param string $namespace Name of Plugin
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function updatePluginAttributesInAllWorkspaces($Namespace)
|
public function updatePluginAttributesInAllWorkspaces($workspace, $namespace)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
G::LoadClass("wsTools");
|
|
||||||
|
|
||||||
//Set variables
|
//Set variables
|
||||||
$pluginFileName = $Namespace . ".php";
|
$pluginFileName = $namespace . ".php";
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
if (!file_exists(PATH_PLUGINS . $pluginFileName)) {
|
if (!file_exists(PATH_PLUGINS . $pluginFileName)) {
|
||||||
throw new Exception("Error: The plugin not exists");
|
throw new Exception("Error: The plugin not exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Update plugin attributes
|
//remove old data plugin
|
||||||
|
$pmPluginRegistry = PluginRegistry::loadSingleton();
|
||||||
|
$pluginDetails = $pmPluginRegistry->unregisterPlugin($namespace);
|
||||||
|
|
||||||
|
//Load plugin attributes
|
||||||
require_once(PATH_PLUGINS . $pluginFileName);
|
require_once(PATH_PLUGINS . $pluginFileName);
|
||||||
|
|
||||||
$pmPluginRegistry = PluginRegistry::loadSingleton();
|
if (is_array($pluginDetails->getWorkspaces()) && !in_array($workspace, $pluginDetails->getWorkspaces())) {
|
||||||
|
$pmPluginRegistry->disablePlugin($namespace);
|
||||||
$pluginDetails = $pmPluginRegistry->getPluginDetails($pluginFileName);
|
|
||||||
|
|
||||||
if (is_array($pluginDetails->getWorkspaces()) &&
|
|
||||||
count($pluginDetails->getWorkspaces()) > 0
|
|
||||||
) {
|
|
||||||
$arrayWorkspace = array();
|
|
||||||
|
|
||||||
foreach (PmSystem::listWorkspaces() as $value) {
|
|
||||||
$workspaceTools = $value;
|
|
||||||
|
|
||||||
$arrayWorkspace[] = $workspaceTools->name;
|
|
||||||
}
|
|
||||||
//Workspaces to update
|
|
||||||
$arrayWorkspaceAux = array_diff($arrayWorkspace, $pluginDetails->getWorkspaces());
|
|
||||||
$strWorkspaceNoWritable = "";
|
|
||||||
|
|
||||||
$arrayWorkspace = array();
|
|
||||||
|
|
||||||
foreach ($arrayWorkspaceAux as $value) {
|
|
||||||
$workspace = $value;
|
|
||||||
|
|
||||||
$workspacePathDataSite = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP;
|
|
||||||
|
|
||||||
if (file_exists($workspacePathDataSite . "plugin.singleton")) {
|
|
||||||
$pmPluginRegistry = PluginRegistry::loadSingleton();
|
|
||||||
|
|
||||||
if (isset($pmPluginRegistry->_aPluginDetails[$Namespace])) {
|
|
||||||
if (!is_writable($workspacePathDataSite . "plugin.singleton")) {
|
|
||||||
$strWorkspaceNoWritable .= (($strWorkspaceNoWritable != "") ? ", " : "") . $workspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
$arrayWorkspace[] = $workspace;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Verify data
|
|
||||||
if ($strWorkspaceNoWritable != "") {
|
|
||||||
throw new Exception(
|
|
||||||
'Error: The workspaces ' .
|
|
||||||
$strWorkspaceNoWritable .
|
|
||||||
' has problems of permissions of write in file "plugin.singleton", solve this problem'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update plugin attributes
|
|
||||||
foreach ($arrayWorkspace as $value) {
|
|
||||||
$workspace = $value;
|
|
||||||
|
|
||||||
$workspacePathDataSite = PATH_DATA . "sites" . PATH_SEP . $workspace . PATH_SEP;
|
|
||||||
|
|
||||||
$pmPluginRegistry = PluginRegistry::loadSingleton();
|
|
||||||
|
|
||||||
$pmPluginRegistry->disablePlugin($Namespace);
|
|
||||||
|
|
||||||
$pmPluginRegistry->savePlugin($Namespace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$pmPluginRegistry->savePlugin($namespace);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|||||||
122
workflow/engine/src/ProcessMaker/Util/Cnn.php
Normal file
122
workflow/engine/src/ProcessMaker/Util/Cnn.php
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Util;
|
||||||
|
|
||||||
|
use Propel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Cnn
|
||||||
|
* @package ProcessMaker\Util
|
||||||
|
*/
|
||||||
|
class Cnn
|
||||||
|
{
|
||||||
|
private $dbFile;
|
||||||
|
private $workspace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Establishes connection for the workspace
|
||||||
|
* @param string $workspace Name workspace
|
||||||
|
*/
|
||||||
|
public static function connect($workspace)
|
||||||
|
{
|
||||||
|
$cnn = new static();
|
||||||
|
$cnn->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(['<?php', '<?', '?>'], '', $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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user