HOR-3670-RG-2 Files review:
workflow/engine/classes/LdapAdvanced.php workflow/engine/classes/License_Application.php workflow/engine/classes/MultipleFilesBackup.php workflow/engine/classes/NET.php workflow/engine/classes/ObjectCellection.php
This commit is contained in:
@@ -1500,7 +1500,7 @@ function get_infoOnPM($workspace) {
|
|||||||
|
|
||||||
if( defined("DB_HOST") ) {
|
if( defined("DB_HOST") ) {
|
||||||
|
|
||||||
$dbNetView = new NET(DB_HOST);
|
$dbNetView = new Net(DB_HOST);
|
||||||
$dbNetView->loginDbServer(DB_USER, DB_PASS);
|
$dbNetView->loginDbServer(DB_USER, DB_PASS);
|
||||||
|
|
||||||
$dbConns = new DbConnections('');
|
$dbConns = new DbConnections('');
|
||||||
|
|||||||
@@ -1,29 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* cliWorkspaces.php
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2011 Colosa Inc.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*
|
|
||||||
* @author Alexandre Rosenfeld <alexandre@colosa.com>
|
|
||||||
* @package workflow-engine-bin-tasks
|
|
||||||
*/
|
|
||||||
|
|
||||||
CLI::taskName('info');
|
CLI::taskName('info');
|
||||||
CLI::taskDescription(<<<EOT
|
CLI::taskDescription(<<<EOT
|
||||||
@@ -51,7 +26,7 @@ EOT
|
|||||||
);
|
);
|
||||||
CLI::taskArg('workspace', false);
|
CLI::taskArg('workspace', false);
|
||||||
CLI::taskArg('backup-file', true);
|
CLI::taskArg('backup-file', true);
|
||||||
CLI::taskOpt("filesize", "Split the backup file in multiple files which are compressed. The maximum size of these files is set to MAX-SIZE in megabytes. If MAX-SIZE is not set, then it is 1000 megabytes by default. It may be necessary to use this option if using a 32 bit Linux/UNIX system which limits its maximum file size to 2GB. This option does not work on Windows systems.", "s:","filesize=");
|
CLI::taskOpt("filesize", "Split the backup file in multiple files which are compressed. The maximum size of these files is set to MAX-SIZE in megabytes. If MAX-SIZE is not set, then it is 1000 megabytes by default. It may be necessary to use this option if using a 32 bit Linux/UNIX system which limits its maximum file size to 2GB. This option does not work on Windows systems.", "s:", "filesize=");
|
||||||
CLI::taskRun("run_workspace_backup");
|
CLI::taskRun("run_workspace_backup");
|
||||||
|
|
||||||
CLI::taskName('workspace-restore');
|
CLI::taskName('workspace-restore');
|
||||||
@@ -72,9 +47,8 @@ CLI::taskOpt("overwrite", "If a workspace already exists, overwrite it.", "o", "
|
|||||||
CLI::taskOpt("info", "Show information about backup file, but do not restore any workspaces.", "i");
|
CLI::taskOpt("info", "Show information about backup file, but do not restore any workspaces.", "i");
|
||||||
CLI::taskOpt("multiple", "Restore from multiple compressed backup files which are numbered.", "m");
|
CLI::taskOpt("multiple", "Restore from multiple compressed backup files which are numbered.", "m");
|
||||||
CLI::taskOpt("workspace", "Specify which workspace to restore if multiple workspaces are present in the backup file.
|
CLI::taskOpt("workspace", "Specify which workspace to restore if multiple workspaces are present in the backup file.
|
||||||
Ex: -wworkflow.",
|
Ex: -wworkflow.", "w:", "workspace=");
|
||||||
"w:", "workspace=");
|
CLI::taskOpt("lang", "Specify the language which will be used to rebuild the case cache list. If this option isn't included, then 'en' (English) will be used by default.", "l:", "lang=");
|
||||||
CLI::taskOpt("lang", "Specify the language which will be used to rebuild the case cache list. If this option isn't included, then 'en' (English) will be used by default.", "l:","lang=");
|
|
||||||
CLI::taskOpt("port", "Specify the port number used by MySQL. If not specified, then the port 3306 will be used by default.", "p:");
|
CLI::taskOpt("port", "Specify the port number used by MySQL. If not specified, then the port 3306 will be used by default.", "p:");
|
||||||
CLI::taskRun("run_workspace_restore");
|
CLI::taskRun("run_workspace_restore");
|
||||||
|
|
||||||
@@ -93,7 +67,7 @@ CLI::taskDescription(<<<EOT
|
|||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
CLI::taskArg('workspace', true, true);
|
CLI::taskArg('workspace', true, true);
|
||||||
CLI::taskOpt("lang", "Specify the language to rebuild the case cache list. If not specified, then 'en' (English) will be used by default.\n Ex: -lfr (French) Ex: --lang=zh-CN (Mainland Chinese)", "l:","lang=");
|
CLI::taskOpt("lang", "Specify the language to rebuild the case cache list. If not specified, then 'en' (English) will be used by default.\n Ex: -lfr (French) Ex: --lang=zh-CN (Mainland Chinese)", "l:", "lang=");
|
||||||
CLI::taskRun("run_cacheview_upgrade");
|
CLI::taskRun("run_cacheview_upgrade");
|
||||||
|
|
||||||
CLI::taskName('database-upgrade');
|
CLI::taskName('database-upgrade');
|
||||||
@@ -174,8 +148,7 @@ CLI::taskDescription(<<<EOT
|
|||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
//CLI::taskArg('workspace', true);
|
//CLI::taskArg('workspace', true);
|
||||||
CLI::taskOpt("workspace", "Select the workspace whose case folders will be migrated, if multiple workspaces are present in the server.\n Ex: -wworkflow. Ex: --workspace=workflow",
|
CLI::taskOpt("workspace", "Select the workspace whose case folders will be migrated, if multiple workspaces are present in the server.\n Ex: -wworkflow. Ex: --workspace=workflow", "w:", "workspace=");
|
||||||
"w:", "workspace=");
|
|
||||||
CLI::taskRun("runStructureDirectories");
|
CLI::taskRun("runStructureDirectories");
|
||||||
|
|
||||||
CLI::taskName("database-generate-self-service-by-value");
|
CLI::taskName("database-generate-self-service-by-value");
|
||||||
@@ -236,7 +209,7 @@ EOT
|
|||||||
CLI::taskArg('workspace', true, true);
|
CLI::taskArg('workspace', true, true);
|
||||||
CLI::taskRun("run_migrate_itee_to_dummytask");
|
CLI::taskRun("run_migrate_itee_to_dummytask");
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/* ----------------------------------********--------------------------------- */
|
||||||
CLI::taskName("check-workspace-disabled-code");
|
CLI::taskName("check-workspace-disabled-code");
|
||||||
CLI::taskDescription(<<<EOT
|
CLI::taskDescription(<<<EOT
|
||||||
Check disabled code for the specified workspace(s).
|
Check disabled code for the specified workspace(s).
|
||||||
@@ -275,7 +248,7 @@ EOT
|
|||||||
);
|
);
|
||||||
CLI::taskArg('workspace', true, true);
|
CLI::taskArg('workspace', true, true);
|
||||||
CLI::taskRun("run_migrate_list_unassigned");
|
CLI::taskRun("run_migrate_list_unassigned");
|
||||||
/*----------------------------------********---------------------------------*/
|
/* ----------------------------------********--------------------------------- */
|
||||||
|
|
||||||
CLI::taskName('migrate-indexing-acv');
|
CLI::taskName('migrate-indexing-acv');
|
||||||
CLI::taskDescription(<<<EOT
|
CLI::taskDescription(<<<EOT
|
||||||
@@ -300,7 +273,7 @@ CLI::taskDescription(<<<EOT
|
|||||||
EOT
|
EOT
|
||||||
);
|
);
|
||||||
CLI::taskArg('workspace', true, true);
|
CLI::taskArg('workspace', true, true);
|
||||||
CLI::taskOpt("lang", "Specify the language to migrate the content data. If not specified, then 'en' (English) will be used by default.\n Ex: -lfr (French) Ex: --lang=zh-CN (Mainland Chinese)", "l:","lang=");
|
CLI::taskOpt("lang", "Specify the language to migrate the content data. If not specified, then 'en' (English) will be used by default.\n Ex: -lfr (French) Ex: --lang=zh-CN (Mainland Chinese)", "l:", "lang=");
|
||||||
CLI::taskRun("run_migrate_content");
|
CLI::taskRun("run_migrate_content");
|
||||||
|
|
||||||
CLI::taskName('migrate-plugins-singleton-information');
|
CLI::taskName('migrate-plugins-singleton-information');
|
||||||
@@ -342,7 +315,7 @@ CLI::taskOpt("lang", "", "lLANG", "lang=LANG");
|
|||||||
CLI::taskArg('workspace');
|
CLI::taskArg('workspace');
|
||||||
CLI::taskRun("cliListIds");
|
CLI::taskRun("cliListIds");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
CLI::taskName('regenerate-pmtable-classes');
|
CLI::taskName('regenerate-pmtable-classes');
|
||||||
@@ -358,11 +331,12 @@ EOT
|
|||||||
CLI::taskArg('workspace');
|
CLI::taskArg('workspace');
|
||||||
CLI::taskRun("regenerate_pmtable_classes");
|
CLI::taskRun("regenerate_pmtable_classes");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function run_info
|
* Function run_info
|
||||||
* access public
|
* access public
|
||||||
*/
|
*/
|
||||||
function run_info($args, $opts) {
|
function run_info($args, $opts)
|
||||||
|
{
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
WorkspaceTools::printSysInfo();
|
WorkspaceTools::printSysInfo();
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
@@ -371,8 +345,8 @@ function run_info($args, $opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_workspace_upgrade($args, $opts) {
|
function run_workspace_upgrade($args, $opts)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$opts = $filter->xssFilterHard($opts);
|
$opts = $filter->xssFilterHard($opts);
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
@@ -396,7 +370,7 @@ function run_workspace_upgrade($args, $opts) {
|
|||||||
$first = false;
|
$first = false;
|
||||||
$flagUpdateXml = false;
|
$flagUpdateXml = false;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
G::outRes("Errors upgrading workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,7 +384,8 @@ function run_workspace_upgrade($args, $opts) {
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function run_translation_upgrade($args, $opts) {
|
function run_translation_upgrade($args, $opts)
|
||||||
|
{
|
||||||
$noXml = array_key_exists('noxml', $opts) ? '--no-xml' : '';
|
$noXml = array_key_exists('noxml', $opts) ? '--no-xml' : '';
|
||||||
$noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : '';
|
$noMafe = array_key_exists('nomafe', $opts) ? '--no-mafe' : '';
|
||||||
if (!empty($noXml)) {
|
if (!empty($noXml)) {
|
||||||
@@ -459,8 +434,8 @@ function translation_upgrade($args, $opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_cacheview_upgrade($args, $opts) {
|
function run_cacheview_upgrade($args, $opts)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$opts = $filter->xssFilterHard($opts);
|
$opts = $filter->xssFilterHard($opts);
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
@@ -468,14 +443,16 @@ function run_cacheview_upgrade($args, $opts) {
|
|||||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
try {
|
try {
|
||||||
G::outRes( "Upgrading cache view for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
G::outRes("Upgrading cache view for " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
||||||
$workspace->upgradeCacheView(true, false, $lang);
|
$workspace->upgradeCacheView(true, false, $lang);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "Errors upgrading cache view of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
G::outRes("Errors upgrading cache view of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function run_plugins_database_upgrade($args, $opts) {
|
|
||||||
|
function run_plugins_database_upgrade($args, $opts)
|
||||||
|
{
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
try {
|
try {
|
||||||
@@ -487,14 +464,17 @@ function run_plugins_database_upgrade($args, $opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_database_export($args, $opts) {
|
function run_database_export($args, $opts)
|
||||||
if (count($args) < 2)
|
{
|
||||||
throw new Exception ("Please provide a workspace name and a directory for export");
|
if (count($args) < 2) {
|
||||||
|
throw new Exception("Please provide a workspace name and a directory for export");
|
||||||
|
}
|
||||||
$workspace = new WorkspaceTools($args[0]);
|
$workspace = new WorkspaceTools($args[0]);
|
||||||
$workspace->exportDatabase($args[1]);
|
$workspace->exportDatabase($args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_database_import($args, $opts) {
|
function run_database_import($args, $opts)
|
||||||
|
{
|
||||||
throw new Exception("Not implemented");
|
throw new Exception("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,32 +485,37 @@ function run_database_import($args, $opts) {
|
|||||||
* @param string $opts
|
* @param string $opts
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function run_database_upgrade($args, $opts) {
|
function run_database_upgrade($args, $opts)
|
||||||
|
{
|
||||||
//Check if the command is executed by a specific workspace
|
//Check if the command is executed by a specific workspace
|
||||||
if (count($args) === 1) {
|
if (count($args) === 1) {
|
||||||
database_upgrade('upgrade', $args);
|
database_upgrade('upgrade', $args);
|
||||||
} else {
|
} else {
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
passthru('./processmaker database-upgrade '.$workspace->name);
|
passthru('./processmaker database-upgrade ' . $workspace->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_database_check($args, $opts) {
|
function run_database_check($args, $opts)
|
||||||
|
{
|
||||||
database_upgrade("check", $args);
|
database_upgrade("check", $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_new_cases_lists($args, $opts) {
|
function run_migrate_new_cases_lists($args, $opts)
|
||||||
|
{
|
||||||
migrate_new_cases_lists("migrate", $args, $opts);
|
migrate_new_cases_lists("migrate", $args, $opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_counters($args, $opts) {
|
function run_migrate_counters($args, $opts)
|
||||||
|
{
|
||||||
migrate_counters("migrate", $args);
|
migrate_counters("migrate", $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_list_unassigned($args, $opts) {
|
function run_migrate_list_unassigned($args, $opts)
|
||||||
|
{
|
||||||
migrate_list_unassigned("migrate", $args, $opts);
|
migrate_list_unassigned("migrate", $args, $opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,9 +525,9 @@ function run_migrate_list_unassigned($args, $opts) {
|
|||||||
* @param array $args, workspaceName for to apply the database-upgrade
|
* @param array $args, workspaceName for to apply the database-upgrade
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function database_upgrade($command, $args) {
|
function database_upgrade($command, $args)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$command = $filter->xssFilterHard($command);
|
$command = $filter->xssFilterHard($command);
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
@@ -553,9 +538,9 @@ function database_upgrade($command, $args) {
|
|||||||
$wsName = $workspaces[key($workspaces)]->name;
|
$wsName = $workspaces[key($workspaces)]->name;
|
||||||
Bootstrap::setConstantsRelatedWs($wsName);
|
Bootstrap::setConstantsRelatedWs($wsName);
|
||||||
if ($checkOnly) {
|
if ($checkOnly) {
|
||||||
print_r("Checking database in ".pakeColor::colorize($wsName, "INFO")."\n");
|
print_r("Checking database in " . pakeColor::colorize($wsName, "INFO") . "\n");
|
||||||
} else {
|
} else {
|
||||||
print_r("Upgrading database in ".pakeColor::colorize($wsName, "INFO")."\n");
|
print_r("Upgrading database in " . pakeColor::colorize($wsName, "INFO") . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
@@ -563,11 +548,11 @@ function database_upgrade($command, $args) {
|
|||||||
$changes = $workspace->upgradeDatabase($checkOnly);
|
$changes = $workspace->upgradeDatabase($checkOnly);
|
||||||
if ($changes != false) {
|
if ($changes != false) {
|
||||||
if ($checkOnly) {
|
if ($checkOnly) {
|
||||||
echo "> ".pakeColor::colorize("Run upgrade", "INFO")."\n";
|
echo "> " . pakeColor::colorize("Run upgrade", "INFO") . "\n";
|
||||||
echo " Tables (add = " . count($changes['tablesToAdd']);
|
echo " Tables (add = " . count($changes['tablesToAdd']);
|
||||||
echo ", alter = " . count($changes['tablesToAlter']) . ") ";
|
echo ", alter = " . count($changes['tablesToAlter']) . ") ";
|
||||||
echo "- Indexes (add = " . count($changes['tablesWithNewIndex'])."";
|
echo "- Indexes (add = " . count($changes['tablesWithNewIndex']) . "";
|
||||||
echo ", alter = " . count($changes['tablesToAlterIndex']).")\n";
|
echo ", alter = " . count($changes['tablesToAlterIndex']) . ")\n";
|
||||||
} else {
|
} else {
|
||||||
echo "-> Schema fixed\n";
|
echo "-> Schema fixed\n";
|
||||||
}
|
}
|
||||||
@@ -575,22 +560,25 @@ function database_upgrade($command, $args) {
|
|||||||
echo "> OK\n";
|
echo "> OK\n";
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_app_from_table($con, $tableName, $appUid, $col="APP_UID") {
|
function delete_app_from_table($con, $tableName, $appUid, $col = "APP_UID")
|
||||||
|
{
|
||||||
$stmt = $con->createStatement();
|
$stmt = $con->createStatement();
|
||||||
$sql = "DELETE FROM " . $tableName . " WHERE " . $col . "='" . $appUid . "'";
|
$sql = "DELETE FROM " . $tableName . " WHERE " . $col . "='" . $appUid . "'";
|
||||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
|
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_drafts_clean($args, $opts) {
|
function run_drafts_clean($args, $opts)
|
||||||
|
{
|
||||||
echo "Cleaning drafts\n";
|
echo "Cleaning drafts\n";
|
||||||
|
|
||||||
if (count($args) < 1)
|
if (count($args) < 1) {
|
||||||
throw new Exception ("Please specify a workspace name");
|
throw new Exception("Please specify a workspace name");
|
||||||
|
}
|
||||||
$workspace = $args[0];
|
$workspace = $args[0];
|
||||||
|
|
||||||
if (!file_exists(PATH_DB . $workspace . '/db.php')) {
|
if (!file_exists(PATH_DB . $workspace . '/db.php')) {
|
||||||
@@ -600,7 +588,7 @@ function run_drafts_clean($args, $opts) {
|
|||||||
$allDrafts = false;
|
$allDrafts = false;
|
||||||
if (count($args) < 2) {
|
if (count($args) < 2) {
|
||||||
echo "Cases older them this much days will be deleted (ENTER for all): ";
|
echo "Cases older them this much days will be deleted (ENTER for all): ";
|
||||||
$days = rtrim( fgets( STDIN ), "\n" );
|
$days = rtrim(fgets(STDIN), "\n");
|
||||||
if ($days == "") {
|
if ($days == "") {
|
||||||
$allDrafts = true;
|
$allDrafts = true;
|
||||||
}
|
}
|
||||||
@@ -615,24 +603,26 @@ function run_drafts_clean($args, $opts) {
|
|||||||
throw new Exception("Days value is not valid: " . $days);
|
throw new Exception("Days value is not valid: " . $days);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($allDrafts)
|
if ($allDrafts) {
|
||||||
echo "Removing all drafts\n";
|
echo "Removing all drafts\n";
|
||||||
else
|
} else {
|
||||||
echo "Removing drafts older than " . $days . " days\n";
|
echo "Removing drafts older than " . $days . " days\n";
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the configuration from the workspace */
|
/* Load the configuration from the workspace */
|
||||||
require_once( PATH_DB . $workspace . '/db.php' );
|
require_once(PATH_DB . $workspace . '/db.php');
|
||||||
require_once( PATH_THIRDPARTY . 'propel/Propel.php');
|
require_once(PATH_THIRDPARTY . 'propel/Propel.php');
|
||||||
|
|
||||||
PROPEL::Init ( PATH_METHODS.'dbConnections/rootDbConnections.php' );
|
PROPEL::Init(PATH_METHODS . 'dbConnections/rootDbConnections.php');
|
||||||
$con = Propel::getConnection("root");
|
$con = Propel::getConnection("root");
|
||||||
|
|
||||||
$stmt = $con->createStatement();
|
$stmt = $con->createStatement();
|
||||||
|
|
||||||
if (!$allDrafts)
|
if (!$allDrafts) {
|
||||||
$dateSql = "AND DATE_SUB(CURDATE(),INTERVAL " . $days . " DAY) >= APP_CREATE_DATE";
|
$dateSql = "AND DATE_SUB(CURDATE(),INTERVAL " . $days . " DAY) >= APP_CREATE_DATE";
|
||||||
else
|
} else {
|
||||||
$dateSql = "";
|
$dateSql = "";
|
||||||
|
}
|
||||||
/* Search for all the draft cases */
|
/* Search for all the draft cases */
|
||||||
$sql = "SELECT APP_UID FROM APPLICATION WHERE APP_STATUS='DRAFT'" . $dateSql;
|
$sql = "SELECT APP_UID FROM APPLICATION WHERE APP_STATUS='DRAFT'" . $dateSql;
|
||||||
$appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
$appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||||
@@ -657,22 +647,23 @@ function run_drafts_clean($args, $opts) {
|
|||||||
delete_app_from_table($con, $table, $appUid);
|
delete_app_from_table($con, $table, $appUid);
|
||||||
}
|
}
|
||||||
delete_app_from_table($con, "CONTENT", $appUid, "CON_ID");
|
delete_app_from_table($con, "CONTENT", $appUid, "CON_ID");
|
||||||
if (file_exists(PATH_DB . $workspace . '/files/'. $appUid)) {
|
if (file_exists(PATH_DB . $workspace . '/files/' . $appUid)) {
|
||||||
echo "\nRemoving files from " . $appUid . "\n";
|
echo "\nRemoving files from " . $appUid . "\n";
|
||||||
G::rm_dir(PATH_DB . $workspace . '/files/'. $appUid);
|
G::rm_dir(PATH_DB . $workspace . '/files/' . $appUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_workspace_backup($args, $opts) {
|
function run_workspace_backup($args, $opts)
|
||||||
|
{
|
||||||
$workspaces = array();
|
$workspaces = array();
|
||||||
if (sizeof($args) > 2) {
|
if (sizeof($args) > 2) {
|
||||||
$filename = array_pop($args);
|
$filename = array_pop($args);
|
||||||
foreach ($args as $arg) {
|
foreach ($args as $arg) {
|
||||||
$workspaces[] = new WorkspaceTools($arg);
|
$workspaces[] = new WorkspaceTools($arg);
|
||||||
}
|
}
|
||||||
} else if (sizeof($args) > 0) {
|
} elseif (sizeof($args) > 0) {
|
||||||
$workspace = new WorkspaceTools($args[0]);
|
$workspace = new WorkspaceTools($args[0]);
|
||||||
$workspaces[] = $workspace;
|
$workspaces[] = $workspace;
|
||||||
if (sizeof($args) == 2) {
|
if (sizeof($args) == 2) {
|
||||||
@@ -692,7 +683,7 @@ function run_workspace_backup($args, $opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//If this is a relative path, put the file in the backups directory
|
//If this is a relative path, put the file in the backups directory
|
||||||
if (strpos($filename, "/") === false && strpos($filename, '\\') === false){
|
if (strpos($filename, "/") === false && strpos($filename, '\\') === false) {
|
||||||
$filename = PATH_DATA . "backups/$filename";
|
$filename = PATH_DATA . "backups/$filename";
|
||||||
}
|
}
|
||||||
CLI::logging("Backing up to $filename\n");
|
CLI::logging("Backing up to $filename\n");
|
||||||
@@ -704,7 +695,7 @@ function run_workspace_backup($args, $opts) {
|
|||||||
CLI::error("This is not a Linux enviroment, cannot use this filesize [-s] feature.\n");
|
CLI::error("This is not a Linux enviroment, cannot use this filesize [-s] feature.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$multipleBackup = new multipleFilesBackup ($filename,$filesize);//if filesize is 0 the default size will be took
|
$multipleBackup = new MultipleFilesBackup($filename, $filesize); //if filesize is 0 the default size will be took
|
||||||
//using new method
|
//using new method
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
$multipleBackup->addToBackup($workspace);
|
$multipleBackup->addToBackup($workspace);
|
||||||
@@ -726,23 +717,24 @@ function run_workspace_backup($args, $opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_workspace_restore($args, $opts) {
|
function run_workspace_restore($args, $opts)
|
||||||
|
{
|
||||||
if (sizeof($args) > 0) {
|
if (sizeof($args) > 0) {
|
||||||
|
|
||||||
$filename = $args[0];
|
$filename = $args[0];
|
||||||
|
|
||||||
G::verifyPath(PATH_DATA . 'upgrade', true);
|
G::verifyPath(PATH_DATA . 'upgrade', true);
|
||||||
|
|
||||||
if(isset($args[1]) && strlen($args[1])>=30){
|
if (isset($args[1]) && strlen($args[1]) >= 30) {
|
||||||
eprintln("Invalid workspace name, insert a maximum of 30 characters.", 'red');
|
eprintln("Invalid workspace name, insert a maximum of 30 characters.", 'red');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($filename, "/") === false && strpos($filename, '\\') === false) {
|
if (strpos($filename, "/") === false && strpos($filename, '\\') === false) {
|
||||||
$filename = PATH_DATA . "backups/$filename";
|
$filename = PATH_DATA . "backups/$filename";
|
||||||
if (!file_exists($filename) && substr_compare($filename, ".tar", -4, 4, true) != 0)
|
if (!file_exists($filename) && substr_compare($filename, ".tar", -4, 4, true) != 0) {
|
||||||
$filename .= ".tar";
|
$filename .= ".tar";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$info = array_key_exists("info", $opts);
|
$info = array_key_exists("info", $opts);
|
||||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||||
$port = array_key_exists("port", $opts) ? $opts['port'] : '';
|
$port = array_key_exists("port", $opts) ? $opts['port'] : '';
|
||||||
@@ -750,30 +742,28 @@ function run_workspace_restore($args, $opts) {
|
|||||||
WorkspaceTools::getBackupInfo($filename);
|
WorkspaceTools::getBackupInfo($filename);
|
||||||
} else {
|
} else {
|
||||||
CLI::logging("Restoring from $filename\n");
|
CLI::logging("Restoring from $filename\n");
|
||||||
$workspace = array_key_exists("workspace", $opts) ? $opts['workspace'] : NULL;
|
$workspace = array_key_exists("workspace", $opts) ? $opts['workspace'] : null;
|
||||||
$overwrite = array_key_exists("overwrite", $opts);
|
$overwrite = array_key_exists("overwrite", $opts);
|
||||||
$multiple = array_key_exists("multiple", $opts);
|
$multiple = array_key_exists("multiple", $opts);
|
||||||
$dstWorkspace = isset($args[1]) ? $args[1] : null;
|
$dstWorkspace = isset($args[1]) ? $args[1] : null;
|
||||||
if(!empty($multiple)){
|
if (!empty($multiple)) {
|
||||||
if(!Bootstrap::isLinuxOs()){
|
if (!Bootstrap::isLinuxOs()) {
|
||||||
CLI::error("This is not a Linux enviroment, cannot use this multiple [-m] feature.\n");
|
CLI::error("This is not a Linux enviroment, cannot use this multiple [-m] feature.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
multipleFilesBackup::letsRestore ($filename,$workspace,$dstWorkspace,$overwrite);
|
MultipleFilesBackup::letsRestore($filename, $workspace, $dstWorkspace, $overwrite);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$anotherExtention = ".*"; //if there are files with and extra extention: e.g. <file>.tar.number
|
$anotherExtention = ".*"; //if there are files with and extra extention: e.g. <file>.tar.number
|
||||||
$multiplefiles = glob($filename . $anotherExtention);// example: //shared/workflow_data/backups/myWorkspace.tar.*
|
$multiplefiles = glob($filename . $anotherExtention); // example: //shared/workflow_data/backups/myWorkspace.tar.*
|
||||||
if(count($multiplefiles) > 0)
|
if (count($multiplefiles) > 0) {
|
||||||
{
|
|
||||||
CLI::error("Processmaker found these files: .\n");
|
CLI::error("Processmaker found these files: .\n");
|
||||||
foreach($multiplefiles as $index => $value){
|
foreach ($multiplefiles as $index => $value) {
|
||||||
CLI::logging($value . "\n");
|
CLI::logging($value . "\n");
|
||||||
}
|
}
|
||||||
CLI::error("Please, you should use -m parameter to restore them.\n");
|
CLI::error("Please, you should use -m parameter to restore them.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
WorkspaceTools::restore($filename, $workspace, $dstWorkspace, $overwrite, $lang, $port );
|
WorkspaceTools::restore($filename, $workspace, $dstWorkspace, $overwrite, $lang, $port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -781,7 +771,8 @@ function run_workspace_restore($args, $opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function runStructureDirectories($command, $args) {
|
function runStructureDirectories($command, $args)
|
||||||
|
{
|
||||||
$workspaces = get_workspaces_from_args($command);
|
$workspaces = get_workspaces_from_args($command);
|
||||||
$count = count($workspaces);
|
$count = count($workspaces);
|
||||||
$errors = false;
|
$errors = false;
|
||||||
@@ -801,7 +792,6 @@ function runStructureDirectories($command, $args) {
|
|||||||
|
|
||||||
function run_database_generate_self_service_by_value($args, $opts)
|
function run_database_generate_self_service_by_value($args, $opts)
|
||||||
{
|
{
|
||||||
|
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$opts = $filter->xssFilterHard($opts);
|
$opts = $filter->xssFilterHard($opts);
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
@@ -812,10 +802,10 @@ function run_database_generate_self_service_by_value($args, $opts)
|
|||||||
$workspace = $value;
|
$workspace = $value;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
G::outRes( "Generating the table \"self-service by value\" for " . pakeColor::colorize($workspace->name, "INFO") . "\n" );
|
G::outRes("Generating the table \"self-service by value\" for " . pakeColor::colorize($workspace->name, "INFO") . "\n");
|
||||||
$workspace->appAssignSelfServiceValueTableGenerateData();
|
$workspace->appAssignSelfServiceValueTableGenerateData();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "Errors generating the table \"self-service by value\" of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n" );
|
G::outRes("Errors generating the table \"self-service by value\" of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
@@ -823,7 +813,7 @@ function run_database_generate_self_service_by_value($args, $opts)
|
|||||||
|
|
||||||
echo "Done!\n";
|
echo "Done!\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( CLI::error($e->getMessage()) . "\n" );
|
G::outRes(CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -882,8 +872,8 @@ function verifyMigratedDataConsistency($args)
|
|||||||
return $inconsistentRecords;
|
return $inconsistentRecords;
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_itee_to_dummytask($args, $opts){
|
function run_migrate_itee_to_dummytask($args, $opts)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$opts = $filter->xssFilterHard($opts);
|
$opts = $filter->xssFilterHard($opts);
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
@@ -893,12 +883,12 @@ function run_migrate_itee_to_dummytask($args, $opts){
|
|||||||
$ws = new WorkspaceTools($workspace->name);
|
$ws = new WorkspaceTools($workspace->name);
|
||||||
$res = $ws->migrateIteeToDummytask($workspace->name);
|
$res = $ws->migrateIteeToDummytask($workspace->name);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* ----------------------------------********--------------------------------- */
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
|
||||||
/**
|
/**
|
||||||
* Check if we need to execute an external program for each workspace
|
* Check if we need to execute an external program for each workspace
|
||||||
* If we apply the command for all workspaces we will need to execute one by one by redefining the constants
|
* If we apply the command for all workspaces we will need to execute one by one by redefining the constants
|
||||||
@@ -906,8 +896,9 @@ function run_migrate_itee_to_dummytask($args, $opts){
|
|||||||
* @param string $opts
|
* @param string $opts
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function run_check_workspace_disabled_code($args, $opts) {
|
function run_check_workspace_disabled_code($args, $opts)
|
||||||
|
{
|
||||||
//Check if the command is executed by a specific workspace
|
//Check if the command is executed by a specific workspace
|
||||||
if (count($args) === 1) {
|
if (count($args) === 1) {
|
||||||
check_workspace_disabled_code($args, $opts);
|
check_workspace_disabled_code($args, $opts);
|
||||||
@@ -918,6 +909,7 @@ function run_check_workspace_disabled_code($args, $opts) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is executed only by one workspace
|
* This function is executed only by one workspace
|
||||||
* Code Security Scanner related to the custom blacklist
|
* Code Security Scanner related to the custom blacklist
|
||||||
@@ -925,7 +917,7 @@ function run_check_workspace_disabled_code($args, $opts) {
|
|||||||
* @param array $opts, workspaceName for to apply the database-upgrade
|
* @param array $opts, workspaceName for to apply the database-upgrade
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function check_workspace_disabled_code($args, $opts)
|
function check_workspace_disabled_code($args, $opts)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -951,7 +943,7 @@ function check_workspace_disabled_code($args, $opts)
|
|||||||
|
|
||||||
foreach ($arrayFoundDisabledCode as $value2) {
|
foreach ($arrayFoundDisabledCode as $value2) {
|
||||||
$arrayProcessData = $value2;
|
$arrayProcessData = $value2;
|
||||||
$strFoundDisabledCode .= ($strFoundDisabledCode != "")? "\n" : "";
|
$strFoundDisabledCode .= ($strFoundDisabledCode != "") ? "\n" : "";
|
||||||
$strFoundDisabledCode .= " Process: " . $arrayProcessData["processTitle"] . "\n";
|
$strFoundDisabledCode .= " Process: " . $arrayProcessData["processTitle"] . "\n";
|
||||||
$strFoundDisabledCode .= " Triggers:\n";
|
$strFoundDisabledCode .= " Triggers:\n";
|
||||||
|
|
||||||
@@ -960,7 +952,7 @@ function check_workspace_disabled_code($args, $opts)
|
|||||||
$strCodeAndLine = "";
|
$strCodeAndLine = "";
|
||||||
|
|
||||||
foreach ($arrayTriggerData["disabledCode"] as $key4 => $value4) {
|
foreach ($arrayTriggerData["disabledCode"] as $key4 => $value4) {
|
||||||
$strCodeAndLine .= (($strCodeAndLine != "")? ", " : "") . $key4 . " (Lines " . implode(", ", $value4) . ")";
|
$strCodeAndLine .= (($strCodeAndLine != "") ? ", " : "") . $key4 . " (Lines " . implode(", ", $value4) . ")";
|
||||||
}
|
}
|
||||||
$strFoundDisabledCode .= " - " . $arrayTriggerData["triggerTitle"] . ": " . $strCodeAndLine . "\n";
|
$strFoundDisabledCode .= " - " . $arrayTriggerData["triggerTitle"] . ": " . $strCodeAndLine . "\n";
|
||||||
}
|
}
|
||||||
@@ -970,17 +962,18 @@ function check_workspace_disabled_code($args, $opts)
|
|||||||
echo "The workspace it's OK\n\n";
|
echo "The workspace it's OK\n\n";
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "Errors to check disabled code: " . CLI::error($e->getMessage()) . "\n\n" );
|
G::outRes("Errors to check disabled code: " . CLI::error($e->getMessage()) . "\n\n");
|
||||||
}
|
}
|
||||||
$workspace->close();
|
$workspace->close();
|
||||||
}
|
}
|
||||||
echo "Done!\n\n";
|
echo "Done!\n\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( CLI::error($e->getMessage()) . "\n" );
|
G::outRes(CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrate_new_cases_lists($command, $args, $opts) {
|
function migrate_new_cases_lists($command, $args, $opts)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$opts = $filter->xssFilterHard($opts);
|
$opts = $filter->xssFilterHard($opts);
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
@@ -992,12 +985,13 @@ function migrate_new_cases_lists($command, $args, $opts) {
|
|||||||
$workspace->migrateList($workspace->name, true, $lang);
|
$workspace->migrateList($workspace->name, true, $lang);
|
||||||
echo "> List tables are done\n";
|
echo "> List tables are done\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrate_counters($command, $args) {
|
function migrate_counters($command, $args)
|
||||||
|
{
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
|
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
@@ -1008,13 +1002,13 @@ function migrate_counters($command, $args) {
|
|||||||
|
|
||||||
echo "> Counters are done\n";
|
echo "> Counters are done\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrate_list_unassigned($command, $args, $opts) {
|
function migrate_list_unassigned($command, $args, $opts)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$opts = $filter->xssFilterHard($opts);
|
$opts = $filter->xssFilterHard($opts);
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
@@ -1026,11 +1020,11 @@ function migrate_list_unassigned($command, $args, $opts) {
|
|||||||
$workspace->regenerateListUnassigned();
|
$workspace->regenerateListUnassigned();
|
||||||
echo "> Unassigned List is done\n";
|
echo "> Unassigned List is done\n";
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
G::outRes( "> Error: ".CLI::error($e->getMessage()) . "\n" );
|
G::outRes("> Error: " . CLI::error($e->getMessage()) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/* ----------------------------------********--------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we need to execute an external program for each workspace
|
* Check if we need to execute an external program for each workspace
|
||||||
@@ -1039,8 +1033,9 @@ function migrate_list_unassigned($command, $args, $opts) {
|
|||||||
* @param string $opts, specify the language
|
* @param string $opts, specify the language
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function run_migrate_content($args, $opts) {
|
function run_migrate_content($args, $opts)
|
||||||
|
{
|
||||||
//Check the additional parameters
|
//Check the additional parameters
|
||||||
$lang = array_key_exists("lang", $opts) ? '--lang=' . $opts['lang'] : '--lang=' . SYS_LANG;
|
$lang = array_key_exists("lang", $opts) ? '--lang=' . $opts['lang'] : '--lang=' . SYS_LANG;
|
||||||
//Check if the command is executed by a specific workspace
|
//Check if the command is executed by a specific workspace
|
||||||
@@ -1049,17 +1044,18 @@ function run_migrate_content($args, $opts) {
|
|||||||
} else {
|
} else {
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
passthru('./processmaker migrate-content ' . $lang . ' '.$workspace->name);
|
passthru('./processmaker migrate-content ' . $lang . ' ' . $workspace->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is executed only by one workspace
|
* This function is executed only by one workspace
|
||||||
* @param array $args, workspaceName for to apply the migrate-content
|
* @param array $args, workspaceName for to apply the migrate-content
|
||||||
* @param array $opts, specify the language
|
* @param array $opts, specify the language
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function migrate_content($args, $opts)
|
function migrate_content($args, $opts)
|
||||||
{
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
@@ -1081,8 +1077,8 @@ function migrate_content($args, $opts)
|
|||||||
CLI::logging("<*> Optimizing content data Process took " . ($stop - $start) . " seconds.\n");
|
CLI::logging("<*> Optimizing content data Process took " . ($stop - $start) . " seconds.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_self_service_value($args, $opts) {
|
function run_migrate_self_service_value($args, $opts)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
@@ -1097,7 +1093,8 @@ function run_migrate_self_service_value($args, $opts) {
|
|||||||
CLI::logging("<*> Migrating Self-Service records Process took " . ($stop - $start) . " seconds.\n");
|
CLI::logging("<*> Migrating Self-Service records Process took " . ($stop - $start) . " seconds.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_indexing_acv($args, $opts) {
|
function run_migrate_indexing_acv($args, $opts)
|
||||||
|
{
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$args = $filter->xssFilterHard($args);
|
$args = $filter->xssFilterHard($args);
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
@@ -1111,7 +1108,8 @@ function run_migrate_indexing_acv($args, $opts) {
|
|||||||
CLI::logging("<*> Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n");
|
CLI::logging("<*> Migrating and populating indexing for avoiding the use of table APP_CACHE_VIEW process took " . ($stop - $start) . " seconds.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_migrate_plugin($args, $opts) {
|
function run_migrate_plugin($args, $opts)
|
||||||
|
{
|
||||||
$workspaces = get_workspaces_from_args($args);
|
$workspaces = get_workspaces_from_args($args);
|
||||||
//Check if the command is executed by a specific workspace
|
//Check if the command is executed by a specific workspace
|
||||||
/** @var WorkspaceTools $workspace */
|
/** @var WorkspaceTools $workspace */
|
||||||
@@ -1124,12 +1122,13 @@ function run_migrate_plugin($args, $opts) {
|
|||||||
CLI::logging("> Migrating and populating data...\n");
|
CLI::logging("> Migrating and populating data...\n");
|
||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
foreach ($workspaces as $workspace) {
|
foreach ($workspaces as $workspace) {
|
||||||
passthru('./processmaker migrate-plugins-singleton-information '.$workspace->name);
|
passthru('./processmaker migrate-plugins-singleton-information ' . $workspace->name);
|
||||||
}
|
}
|
||||||
$stop = microtime(true);
|
$stop = microtime(true);
|
||||||
CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n");
|
CLI::logging("<*> Migrating and populating data Singleton took " . ($stop - $start) . " seconds.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method recursively finds all PHP files that reference the path PATH_DATA
|
* This method recursively finds all PHP files that reference the path PATH_DATA
|
||||||
* incorrectly, which is caused by importing processes where the data directory
|
* incorrectly, which is caused by importing processes where the data directory
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class.ldapAdvanced.php
|
* class.ldapAdvanced.php
|
||||||
* LDAP plugin for the RBAC class. This
|
* LDAP plugin for the RBAC class. This
|
||||||
class ldapAdvanced
|
*/
|
||||||
|
class LdapAdvanced
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The authsource id
|
* The authsource id
|
||||||
@@ -38,7 +40,7 @@ class ldapAdvanced
|
|||||||
* Object where an rbac instance is set
|
* Object where an rbac instance is set
|
||||||
* @var Object
|
* @var Object
|
||||||
*/
|
*/
|
||||||
static private $instance = null;
|
private static $instance = null;
|
||||||
|
|
||||||
private $arrayObjectClassFilter = array(
|
private $arrayObjectClassFilter = array(
|
||||||
"user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)",
|
"user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)",
|
||||||
@@ -457,14 +459,14 @@ class ldapAdvanced
|
|||||||
$logFile = PATH_DATA . "log/ldapAdvanced.log";
|
$logFile = PATH_DATA . "log/ldapAdvanced.log";
|
||||||
|
|
||||||
if (!file_exists($logFile) || is_writable($logFile)) {
|
if (!file_exists($logFile) || is_writable($logFile)) {
|
||||||
$fpt= fopen ($logFile, "a");
|
$fpt= fopen($logFile, "a");
|
||||||
$ldapErrorMsg = "";
|
$ldapErrorMsg = "";
|
||||||
$ldapErrorNr = 0;
|
$ldapErrorNr = 0;
|
||||||
|
|
||||||
if ($link != null) {
|
if ($link != null) {
|
||||||
$ldapErrorNr = ldap_errno($link);
|
$ldapErrorNr = ldap_errno($link);
|
||||||
|
|
||||||
if ( $ldapErrorNr != 0 ) {
|
if ($ldapErrorNr != 0) {
|
||||||
$ldapErrorMsg = ldap_error($link);
|
$ldapErrorMsg = ldap_error($link);
|
||||||
$text = $ldapErrorMsg . " : " . $text;
|
$text = $ldapErrorMsg . " : " . $text;
|
||||||
}
|
}
|
||||||
@@ -474,7 +476,7 @@ class ldapAdvanced
|
|||||||
fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), SYS_SYS, $ldapErrorNr, $text));
|
fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), SYS_SYS, $ldapErrorNr, $text));
|
||||||
fclose($fpt);
|
fclose($fpt);
|
||||||
} else {
|
} else {
|
||||||
error_log ("file $logFile is not writable ");
|
error_log("file $logFile is not writable ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,11 +507,11 @@ class ldapAdvanced
|
|||||||
*/
|
*/
|
||||||
public function ldapConnection($aAuthSource)
|
public function ldapConnection($aAuthSource)
|
||||||
{
|
{
|
||||||
$pass = explode("_",$aAuthSource["AUTH_SOURCE_PASSWORD"]);
|
$pass = explode("_", $aAuthSource["AUTH_SOURCE_PASSWORD"]);
|
||||||
|
|
||||||
foreach ($pass as $index => $value) {
|
foreach ($pass as $index => $value) {
|
||||||
if ($value == "2NnV3ujj3w") {
|
if ($value == "2NnV3ujj3w") {
|
||||||
$aAuthSource["AUTH_SOURCE_PASSWORD"] = G::decrypt($pass[0],$aAuthSource["AUTH_SOURCE_SERVER_NAME"]);
|
$aAuthSource["AUTH_SOURCE_PASSWORD"] = G::decrypt($pass[0], $aAuthSource["AUTH_SOURCE_SERVER_NAME"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1045,11 +1047,11 @@ class ldapAdvanced
|
|||||||
$strUser = trim($strUser);
|
$strUser = trim($strUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $strUser == "" ) {
|
if ($strUser == "") {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strlen( $strPass ) == 0) {
|
if (strlen($strPass) == 0) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1140,7 +1142,7 @@ class ldapAdvanced
|
|||||||
|
|
||||||
$ldapcnn = $this->ldapConnection($arrayAuthSource);
|
$ldapcnn = $this->ldapConnection($arrayAuthSource);
|
||||||
$flagUpdate = false;
|
$flagUpdate = false;
|
||||||
switch(ldap_errno($ldapcnn)) {
|
switch (ldap_errno($ldapcnn)) {
|
||||||
case '0x00':
|
case '0x00':
|
||||||
$flagUpdate = true;
|
$flagUpdate = true;
|
||||||
$statusRbac = 1;
|
$statusRbac = 1;
|
||||||
@@ -1195,7 +1197,7 @@ class ldapAdvanced
|
|||||||
$validUserPass = -5;
|
$validUserPass = -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $validUserPass == 1 ) {
|
if ($validUserPass == 1) {
|
||||||
$this->log($ldapcnn, "sucessful login user " . $verifiedUser["sDN"]);
|
$this->log($ldapcnn, "sucessful login user " . $verifiedUser["sDN"]);
|
||||||
} else {
|
} else {
|
||||||
$this->log($ldapcnn, "failure authentication for user $strUser");
|
$this->log($ldapcnn, "failure authentication for user $strUser");
|
||||||
@@ -1295,7 +1297,7 @@ class ldapAdvanced
|
|||||||
$entries = ldap_count_entries($ldapcnn, $oSearch);
|
$entries = ldap_count_entries($ldapcnn, $oSearch);
|
||||||
$totalUser = $entries;
|
$totalUser = $entries;
|
||||||
|
|
||||||
if ( $entries > 0) {
|
if ($entries > 0) {
|
||||||
$oEntry = ldap_first_entry($ldapcnn, $oSearch);
|
$oEntry = ldap_first_entry($ldapcnn, $oSearch);
|
||||||
|
|
||||||
$countEntries=0;
|
$countEntries=0;
|
||||||
@@ -1546,11 +1548,11 @@ class ldapAdvanced
|
|||||||
$res = 0;
|
$res = 0;
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
if ($this->VerifyLogin( $user['sUsername'], $strPass) === true) {
|
if ($this->VerifyLogin($user['sUsername'], $strPass) === true) {
|
||||||
$res = 1;
|
$res = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($res == 0 && $this->VerifyLogin( $user['sDN'], $strPass) === true) {
|
if ($res == 0 && $this->VerifyLogin($user['sDN'], $strPass) === true) {
|
||||||
$res = 1;
|
$res = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1583,8 +1585,8 @@ class ldapAdvanced
|
|||||||
|
|
||||||
if (!empty($aAttributes)) {
|
if (!empty($aAttributes)) {
|
||||||
foreach ($aAttributes as $value) {
|
foreach ($aAttributes as $value) {
|
||||||
if (isset( $user[$value['attributeUser']] )) {
|
if (isset($user[$value['attributeUser']])) {
|
||||||
$aData[$value['attributeUser']] = str_replace( "*", "'", $user[$value['attributeUser']] );
|
$aData[$value['attributeUser']] = str_replace("*", "'", $user[$value['attributeUser']]);
|
||||||
if ($value['attributeUser'] == 'USR_STATUS') {
|
if ($value['attributeUser'] == 'USR_STATUS') {
|
||||||
$evalValue = $aData[$value['attributeUser']];
|
$evalValue = $aData[$value['attributeUser']];
|
||||||
$statusValue = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] :'ACTIVE';
|
$statusValue = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] :'ACTIVE';
|
||||||
@@ -1595,7 +1597,7 @@ class ldapAdvanced
|
|||||||
}
|
}
|
||||||
|
|
||||||
//req - accountexpires
|
//req - accountexpires
|
||||||
if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"]!='' ) {
|
if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"]!='') {
|
||||||
$aData["USR_DUE_DATE"] = $this->convertDateADtoPM($user["USR_DUE_DATE"]);
|
$aData["USR_DUE_DATE"] = $this->convertDateADtoPM($user["USR_DUE_DATE"]);
|
||||||
}
|
}
|
||||||
//end
|
//end
|
||||||
@@ -1768,12 +1770,12 @@ class ldapAdvanced
|
|||||||
* @param <type> $currentDN
|
* @param <type> $currentDN
|
||||||
* @return <type>
|
* @return <type>
|
||||||
*/
|
*/
|
||||||
public function getDepUidIfExistsDN ($currentDN)
|
public function getDepUidIfExistsDN($currentDN)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->add(DepartmentPeer::DEP_STATUS , 'ACTIVE' );
|
$oCriteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE');
|
||||||
$oCriteria->add(DepartmentPeer::DEP_LDAP_DN, $currentDN );
|
$oCriteria->add(DepartmentPeer::DEP_LDAP_DN, $currentDN);
|
||||||
|
|
||||||
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
|
$oDataset = DepartmentPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
@@ -1888,7 +1890,7 @@ class ldapAdvanced
|
|||||||
BasePeer::doUpdate($c1, $c2, $con);
|
BasePeer::doUpdate($c1, $c2, $con);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deactivateUser ($userUid)
|
public function deactivateUser($userUid)
|
||||||
{
|
{
|
||||||
if (!class_exists('RbacUsers')) {
|
if (!class_exists('RbacUsers')) {
|
||||||
require_once(PATH_RBAC.'model/RbacUsers.php');
|
require_once(PATH_RBAC.'model/RbacUsers.php');
|
||||||
@@ -2045,7 +2047,7 @@ class ldapAdvanced
|
|||||||
|
|
||||||
$criteriaCount = new Criteria('workflow');
|
$criteriaCount = new Criteria('workflow');
|
||||||
$criteriaCount->clearSelectColumns();
|
$criteriaCount->clearSelectColumns();
|
||||||
$criteriaCount->addSelectColumn( 'COUNT(*)' );
|
$criteriaCount->addSelectColumn('COUNT(*)');
|
||||||
$criteriaCount->add(DepartmentPeer::DEP_PARENT, $oDepartment->getDepUid(), Criteria::EQUAL);
|
$criteriaCount->add(DepartmentPeer::DEP_PARENT, $oDepartment->getDepUid(), Criteria::EQUAL);
|
||||||
$rs = DepartmentPeer::doSelectRS($criteriaCount);
|
$rs = DepartmentPeer::doSelectRS($criteriaCount);
|
||||||
$rs->next();
|
$rs->next();
|
||||||
@@ -2054,7 +2056,7 @@ class ldapAdvanced
|
|||||||
$result[] = $node;
|
$result[] = $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( count($result) >= 1 ) {
|
if (count($result) >= 1) {
|
||||||
$result[ count($result) -1 ]['DEP_LAST'] = 1;
|
$result[ count($result) -1 ]['DEP_LAST'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2108,11 +2110,11 @@ class ldapAdvanced
|
|||||||
$attributes = $aAuthSource["AUTH_SOURCE_DATA"];
|
$attributes = $aAuthSource["AUTH_SOURCE_DATA"];
|
||||||
$this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU'])? trim($attributes['AUTH_SOURCE_RETIRED_OU']) : '';
|
$this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU'])? trim($attributes['AUTH_SOURCE_RETIRED_OU']) : '';
|
||||||
|
|
||||||
if ($this->sTerminatedOu == '' ) {
|
if ($this->sTerminatedOu == '') {
|
||||||
return $aUsers;
|
return $aUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getUsersFromDepartmentByName( $this->sTerminatedOu );
|
return $this->getUsersFromDepartmentByName($this->sTerminatedOu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2142,8 +2144,8 @@ class ldapAdvanced
|
|||||||
$con = Propel::getConnection('rbac');
|
$con = Propel::getConnection('rbac');
|
||||||
// select set
|
// select set
|
||||||
$c1 = new Criteria('rbac');
|
$c1 = new Criteria('rbac');
|
||||||
$c1->add(RbacUsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN );
|
$c1->add(RbacUsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN);
|
||||||
$c1->add(RbacUsersPeer::USR_STATUS, 1 );
|
$c1->add(RbacUsersPeer::USR_STATUS, 1);
|
||||||
// update set
|
// update set
|
||||||
$c2 = new Criteria('rbac');
|
$c2 = new Criteria('rbac');
|
||||||
$c2->add(RbacUsersPeer::USR_STATUS, '0');
|
$c2->add(RbacUsersPeer::USR_STATUS, '0');
|
||||||
@@ -2152,7 +2154,7 @@ class ldapAdvanced
|
|||||||
$con = Propel::getConnection('workflow');
|
$con = Propel::getConnection('workflow');
|
||||||
// select set
|
// select set
|
||||||
$c1 = new Criteria('workflow');
|
$c1 = new Criteria('workflow');
|
||||||
$c1->add(UsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN );
|
$c1->add(UsersPeer::USR_USERNAME, $aUsrUid, Criteria::IN);
|
||||||
// update set
|
// update set
|
||||||
$c2 = new Criteria('workflow');
|
$c2 = new Criteria('workflow');
|
||||||
$c2->add(UsersPeer::USR_STATUS, 'INACTIVE');
|
$c2->add(UsersPeer::USR_STATUS, 'INACTIVE');
|
||||||
@@ -2360,7 +2362,7 @@ class ldapAdvanced
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$criteria->add(GroupwfPeer::GRP_STATUS , 'ACTIVE');
|
$criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
|
||||||
$criteria->add(GroupwfPeer::GRP_LDAP_DN, $currentDN);
|
$criteria->add(GroupwfPeer::GRP_LDAP_DN, $currentDN);
|
||||||
$dataset = GroupwfPeer::doSelectRS($criteria);
|
$dataset = GroupwfPeer::doSelectRS($criteria);
|
||||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|||||||
@@ -1,57 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Project: Distrubution License Class
|
|
||||||
* File: class.license.app.php
|
|
||||||
*
|
|
||||||
* Copyright (C) 2005 Oliver Lillie
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2 of the License, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* @link http://www.buggedcom.co.uk/
|
|
||||||
* @link http://www.phpclasses.org/browse/package/2298.html
|
|
||||||
* @author Oliver Lillie, buggedcom <publicmail at buggedcom dot co dot uk>
|
|
||||||
* @history---------------------------------------------
|
|
||||||
* see CHANGELOG
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
class license_application extends padl
|
||||||
* Project: Distrubution License Class
|
|
||||||
* File: class.license.app.php
|
|
||||||
*
|
|
||||||
* Copyright (C) 2005 Oliver Lillie
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2 of the License, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* @link http://www.buggedcom.co.uk/
|
|
||||||
* @link http://www.phpclasses.org/browse/package/2298.html
|
|
||||||
* @author Oliver Lillie, buggedcom <publicmail at buggedcom dot co dot uk>
|
|
||||||
* @history---------------------------------------------
|
|
||||||
* see CHANGELOG
|
|
||||||
*/class license_application extends padl
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The number of allowed differences between the $_SERVER vars and the vars
|
* The number of allowed differences between the $_SERVER vars and the vars
|
||||||
|
|||||||
@@ -6,13 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
|
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
|
||||||
*/
|
*/
|
||||||
|
class MultipleFilesBackup
|
||||||
/**
|
|
||||||
* Class MultipleFilesBackup
|
|
||||||
* create a backup of this workspace
|
|
||||||
*
|
|
||||||
* Exports the database and copies the files to an tar archive o several if the max filesize is reached.
|
|
||||||
*/class multipleFilesBackup
|
|
||||||
{
|
{
|
||||||
private $dir_to_compress = "";
|
private $dir_to_compress = "";
|
||||||
private $filename = "backUpProcessMaker.tar";
|
private $filename = "backUpProcessMaker.tar";
|
||||||
@@ -20,18 +14,18 @@
|
|||||||
// 1 GB by default.
|
// 1 GB by default.
|
||||||
private $sizeDescriptor = "m";
|
private $sizeDescriptor = "m";
|
||||||
//megabytes
|
//megabytes
|
||||||
private $tempDirectories = array ();
|
private $tempDirectories = array();
|
||||||
|
|
||||||
/* Constructor
|
/* Constructor
|
||||||
* @filename contains the path and filename of the comppress file(s).
|
* @filename contains the path and filename of the comppress file(s).
|
||||||
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
|
* @size got the Max size of the compressed files, by default if the $size less to zero will mantains 1000 Mb as Max size.
|
||||||
*/
|
*/
|
||||||
public function multipleFilesBackup ($filename, $size)
|
public function MultipleFilesBackup($filename, $size)
|
||||||
{
|
{
|
||||||
if (! empty( $filename )) {
|
if (!empty($filename)) {
|
||||||
$this->filename = $filename;
|
$this->filename = $filename;
|
||||||
}
|
}
|
||||||
if (! empty( $size ) && (int) $size > 0) {
|
if (!empty($size) && (int) $size > 0) {
|
||||||
$this->fileSize = $size;
|
$this->fileSize = $size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,48 +33,48 @@
|
|||||||
/* Gets workspace information enough to make its backup.
|
/* Gets workspace information enough to make its backup.
|
||||||
* @workspace contains the workspace to be add to the commpression process.
|
* @workspace contains the workspace to be add to the commpression process.
|
||||||
*/
|
*/
|
||||||
public function addToBackup ($workspace)
|
public function addToBackup($workspace)
|
||||||
{
|
{
|
||||||
//verifing if workspace exists.
|
//verifing if workspace exists.
|
||||||
if (! $workspace->workspaceExists()) {
|
if (!$workspace->workspaceExists()) {
|
||||||
echo "Workspace {$workspace->name} not found\n";
|
echo "Workspace {$workspace->name} not found\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//create destination path
|
//create destination path
|
||||||
if (! file_exists( PATH_DATA . "upgrade/" )) {
|
if (!file_exists(PATH_DATA . "upgrade/")) {
|
||||||
mkdir( PATH_DATA . "upgrade/" );
|
mkdir(PATH_DATA . "upgrade/");
|
||||||
}
|
}
|
||||||
$tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
|
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
||||||
mkdir( $tempDirectory );
|
mkdir($tempDirectory);
|
||||||
$metadata = $workspace->getMetadata();
|
$metadata = $workspace->getMetadata();
|
||||||
CLI::logging( "Creating temporary files on database...\n" );
|
CLI::logging("Creating temporary files on database...\n");
|
||||||
$metadata["databases"] = $workspace->exportDatabase( $tempDirectory );
|
$metadata["databases"] = $workspace->exportDatabase($tempDirectory);
|
||||||
$metadata["directories"] = array ("{$workspace->name}");
|
$metadata["directories"] = array("{$workspace->name}");
|
||||||
$metadata["version"] = 1;
|
$metadata["version"] = 1;
|
||||||
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
|
$metaFilename = "$tempDirectory/{$workspace->name}.meta";
|
||||||
if (! file_put_contents( $metaFilename, str_replace( array (",","{","}"), array (",\n ","{\n ","\n}\n"), G::json_encode( $metadata ) ) )) {
|
if (!file_put_contents($metaFilename, str_replace(array(",", "{", "}"), array(",\n ", "{\n ", "\n}\n"), G::json_encode($metadata)))) {
|
||||||
CLI::logging( "Could not create backup metadata" );
|
CLI::logging("Could not create backup metadata");
|
||||||
}
|
}
|
||||||
CLI::logging( "Adding database to backup...\n" );
|
CLI::logging("Adding database to backup...\n");
|
||||||
$this->addDirToBackup( $tempDirectory );
|
$this->addDirToBackup($tempDirectory);
|
||||||
CLI::logging( "Adding files to backup...\n" );
|
CLI::logging("Adding files to backup...\n");
|
||||||
$this->addDirToBackup( $workspace->path );
|
$this->addDirToBackup($workspace->path);
|
||||||
$this->tempDirectories[] = $tempDirectory;
|
$this->tempDirectories[] = $tempDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a directory containing Db files or info files to be commpressed
|
/* Add a directory containing Db files or info files to be commpressed
|
||||||
* @directory the name and path of the directory to be add to the commpression process.
|
* @directory the name and path of the directory to be add to the commpression process.
|
||||||
*/
|
*/
|
||||||
private function addDirToBackup ($directory)
|
private function addDirToBackup($directory)
|
||||||
{
|
{
|
||||||
if (! empty( $directory )) {
|
if (!empty($directory)) {
|
||||||
$this->dir_to_compress .= $directory . " ";
|
$this->dir_to_compress .= $directory . " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commpress the DB and files into a single or several files with numerical series extentions
|
// Commpress the DB and files into a single or several files with numerical series extentions
|
||||||
|
|
||||||
public function letsBackup ()
|
public function letsBackup()
|
||||||
{
|
{
|
||||||
// creating command
|
// creating command
|
||||||
$CommpressCommand = "tar czv ";
|
$CommpressCommand = "tar czv ";
|
||||||
@@ -90,11 +84,11 @@
|
|||||||
$CommpressCommand .= "m -d - ";
|
$CommpressCommand .= "m -d - ";
|
||||||
$CommpressCommand .= $this->filename . ".";
|
$CommpressCommand .= $this->filename . ".";
|
||||||
//executing command to create the files
|
//executing command to create the files
|
||||||
echo exec( $CommpressCommand );
|
echo exec($CommpressCommand);
|
||||||
//Remove leftovers dirs.
|
//Remove leftovers dirs.
|
||||||
foreach ($this->tempDirectories as $tempDirectory) {
|
foreach ($this->tempDirectories as $tempDirectory) {
|
||||||
CLI::logging( "Deleting: " . $tempDirectory . "\n" );
|
CLI::logging("Deleting: " . $tempDirectory . "\n");
|
||||||
G::rm_dir( $tempDirectory );
|
G::rm_dir($tempDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Restore from file(s) commpressed by letsBackup function, into a temporary directory
|
/* Restore from file(s) commpressed by letsBackup function, into a temporary directory
|
||||||
@@ -103,7 +97,7 @@
|
|||||||
* @ dstWorkspace contains the workspace to be overwriting.
|
* @ dstWorkspace contains the workspace to be overwriting.
|
||||||
* @ overwrite got the option true if the workspace will be overwrite.
|
* @ overwrite got the option true if the workspace will be overwrite.
|
||||||
*/
|
*/
|
||||||
static public function letsRestore ($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
|
public static function letsRestore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
|
||||||
{
|
{
|
||||||
// Needed info:
|
// Needed info:
|
||||||
// TEMPDIR /shared/workflow_data/upgrade/
|
// TEMPDIR /shared/workflow_data/upgrade/
|
||||||
@@ -112,101 +106,101 @@
|
|||||||
$DecommpressCommand = "cat " . $filename . ".* ";
|
$DecommpressCommand = "cat " . $filename . ".* ";
|
||||||
$DecommpressCommand .= " | tar xzv";
|
$DecommpressCommand .= " | tar xzv";
|
||||||
|
|
||||||
$tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
|
$tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
|
||||||
$tempDirectoryHelp = $tempDirectory;
|
$tempDirectoryHelp = $tempDirectory;
|
||||||
|
|
||||||
$parentDirectory = PATH_DATA . "upgrade";
|
$parentDirectory = PATH_DATA . "upgrade";
|
||||||
if (is_writable( $parentDirectory )) {
|
if (is_writable($parentDirectory)) {
|
||||||
mkdir( $tempDirectory );
|
mkdir($tempDirectory);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( "Could not create directory:" . $parentDirectory );
|
throw new Exception("Could not create directory:" . $parentDirectory);
|
||||||
}
|
}
|
||||||
//Extract all backup files, including database scripts and workspace files
|
//Extract all backup files, including database scripts and workspace files
|
||||||
CLI::logging( "Restoring into " . $tempDirectory . "\n" );
|
CLI::logging("Restoring into " . $tempDirectory . "\n");
|
||||||
chdir( $tempDirectory );
|
chdir($tempDirectory);
|
||||||
echo exec( $DecommpressCommand );
|
echo exec($DecommpressCommand);
|
||||||
CLI::logging( "\nUncompressed into: " . $tempDirectory . "\n" );
|
CLI::logging("\nUncompressed into: " . $tempDirectory . "\n");
|
||||||
|
|
||||||
//Search for metafiles in the new standard (the old standard would contain meta files.
|
//Search for metafiles in the new standard (the old standard would contain meta files.
|
||||||
$decommpressedfile = scandir($tempDirectoryHelp.dirname($tempDirectoryHelp), 1);
|
$decommpressedfile = scandir($tempDirectoryHelp . dirname($tempDirectoryHelp), 1);
|
||||||
$tempDirectory = $tempDirectoryHelp.dirname($tempDirectoryHelp)."/".$decommpressedfile[0];
|
$tempDirectory = $tempDirectoryHelp . dirname($tempDirectoryHelp) . "/" . $decommpressedfile[0];
|
||||||
|
|
||||||
$metaFiles = glob( $tempDirectory . "/*.meta" );
|
$metaFiles = glob($tempDirectory . "/*.meta");
|
||||||
if (empty( $metaFiles )) {
|
if (empty($metaFiles)) {
|
||||||
$metaFiles = glob( $tempDirectory . "/*.txt" );
|
$metaFiles = glob($tempDirectory . "/*.txt");
|
||||||
if (! empty( $metaFiles )) {
|
if (!empty($metaFiles)) {
|
||||||
return WorkspaceTools::restoreLegacy( $tempDirectory );
|
return WorkspaceTools::restoreLegacy($tempDirectory);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( "No metadata found in backup" );
|
throw new Exception("No metadata found in backup");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CLI::logging( "Found " . count( $metaFiles ) . " workspaces in backup:\n" );
|
CLI::logging("Found " . count($metaFiles) . " workspaces in backup:\n");
|
||||||
foreach ($metaFiles as $metafile) {
|
foreach ($metaFiles as $metafile) {
|
||||||
CLI::logging( "-> " . basename( $metafile ) . "\n" );
|
CLI::logging("-> " . basename($metafile) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count( $metaFiles ) > 1 && (! isset( $srcWorkspace ))) {
|
if (count($metaFiles) > 1 && (!isset($srcWorkspace))) {
|
||||||
throw new Exception( "Multiple workspaces in backup but no workspace specified to restore" );
|
throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
|
||||||
}
|
}
|
||||||
if (isset( $srcWorkspace ) && ! in_array( "$srcWorkspace.meta", array_map( basename, $metaFiles ) )) {
|
if (isset($srcWorkspace) && !in_array("$srcWorkspace.meta", array_map(basename, $metaFiles))) {
|
||||||
throw new Exception( "Workspace $srcWorkspace not found in backup" );
|
throw new Exception("Workspace $srcWorkspace not found in backup");
|
||||||
}
|
}
|
||||||
foreach ($metaFiles as $metaFile) {
|
foreach ($metaFiles as $metaFile) {
|
||||||
$metadata = G::json_decode( file_get_contents( $metaFile ) );
|
$metadata = G::json_decode(file_get_contents($metaFile));
|
||||||
if ($metadata->version != 1) {
|
if ($metadata->version != 1) {
|
||||||
throw new Exception( "Backup version {$metadata->version} not supported" );
|
throw new Exception("Backup version {$metadata->version} not supported");
|
||||||
}
|
}
|
||||||
$backupWorkspace = $metadata->WORKSPACE_NAME;
|
$backupWorkspace = $metadata->WORKSPACE_NAME;
|
||||||
if (isset( $dstWorkspace )) {
|
if (isset($dstWorkspace)) {
|
||||||
$workspaceName = $dstWorkspace;
|
$workspaceName = $dstWorkspace;
|
||||||
$createWorkspace = true;
|
$createWorkspace = true;
|
||||||
} else {
|
} else {
|
||||||
$workspaceName = $metadata->WORKSPACE_NAME;
|
$workspaceName = $metadata->WORKSPACE_NAME;
|
||||||
$createWorkspace = false;
|
$createWorkspace = false;
|
||||||
}
|
}
|
||||||
if (isset( $srcWorkspace ) && strcmp( $metadata->WORKSPACE_NAME, $srcWorkspace ) != 0) {
|
if (isset($srcWorkspace) && strcmp($metadata->WORKSPACE_NAME, $srcWorkspace) != 0) {
|
||||||
CLI::logging( CLI::warning( "> Workspace $backupWorkspace found, but not restoring." ) . "\n" );
|
CLI::logging(CLI::warning("> Workspace $backupWorkspace found, but not restoring.") . "\n");
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
CLI::logging( "> Restoring " . CLI::info( $backupWorkspace ) . " to " . CLI::info( $workspaceName ) . "\n" );
|
CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
|
||||||
}
|
}
|
||||||
$workspace = new WorkspaceTools( $workspaceName );
|
$workspace = new WorkspaceTools($workspaceName);
|
||||||
if ($workspace->workspaceExists()) {
|
if ($workspace->workspaceExists()) {
|
||||||
if ($overwrite) {
|
if ($overwrite) {
|
||||||
CLI::logging( CLI::warning( "> Workspace $workspaceName already exist, overwriting!" ) . "\n" );
|
CLI::logging(CLI::warning("> Workspace $workspaceName already exist, overwriting!") . "\n");
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( "Destination workspace already exist (use -o to overwrite)" );
|
throw new Exception("Destination workspace already exist (use -o to overwrite)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (file_exists( $workspace->path )) {
|
if (file_exists($workspace->path)) {
|
||||||
G::rm_dir( $workspace->path );
|
G::rm_dir($workspace->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tempDirectorySite = $tempDirectoryHelp.dirname($workspace->path);
|
$tempDirectorySite = $tempDirectoryHelp . dirname($workspace->path);
|
||||||
|
|
||||||
foreach ($metadata->directories as $dir) {
|
foreach ($metadata->directories as $dir) {
|
||||||
CLI::logging( "+> Restoring directory '$dir'\n" );
|
CLI::logging("+> Restoring directory '$dir'\n");
|
||||||
if (! rename( "$tempDirectorySite/$dir", $workspace->path )) {
|
if (!rename("$tempDirectorySite/$dir", $workspace->path)) {
|
||||||
throw new Exception( "There was an error copying the backup files ($tempDirectory/$dir) to the workspace directory {$workspace->path}." );
|
throw new Exception("There was an error copying the backup files ($tempDirectory/$dir) to the workspace directory {$workspace->path}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CLI::logging( "> Changing file permissions\n" );
|
CLI::logging("> Changing file permissions\n");
|
||||||
$shared_stat = stat( PATH_DATA );
|
$shared_stat = stat(PATH_DATA);
|
||||||
if ($shared_stat !== false) {
|
if ($shared_stat !== false) {
|
||||||
WorkspaceTools::dirPerms( $workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode'] );
|
WorkspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
|
||||||
} else {
|
} else {
|
||||||
CLI::logging( CLI::error( "Could not get the shared folder permissions, not changing workspace permissions" ) . "\n" );
|
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
list ($dbHost, $dbUser, $dbPass) = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );
|
list($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||||
|
|
||||||
CLI::logging( "> Connecting to system database in '$dbHost'\n" );
|
CLI::logging("> Connecting to system database in '$dbHost'\n");
|
||||||
$link = mysql_connect( $dbHost, $dbUser, $dbPass );
|
$link = mysql_connect($dbHost, $dbUser, $dbPass);
|
||||||
@mysql_query( "SET NAMES 'utf8';" );
|
@mysql_query("SET NAMES 'utf8';");
|
||||||
@mysql_query( "SET FOREIGN_KEY_CHECKS=0;" );
|
@mysql_query("SET FOREIGN_KEY_CHECKS=0;");
|
||||||
if (! $link) {
|
if (!$link) {
|
||||||
throw new Exception( 'Could not connect to system database: ' . mysql_error() );
|
throw new Exception('Could not connect to system database: ' . mysql_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($metadata->DB_RBAC_NAME, 'rb_') === false) {
|
if (strpos($metadata->DB_RBAC_NAME, 'rb_') === false) {
|
||||||
@@ -215,22 +209,21 @@
|
|||||||
$onedb = false;
|
$onedb = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newDBNames = $workspace->resetDBInfo( $dbHost, $createWorkspace, $onedb );
|
$newDBNames = $workspace->resetDBInfo($dbHost, $createWorkspace, $onedb);
|
||||||
$aParameters = array('dbHost'=>$dbHost,'dbUser'=>$dbUser,'dbPass'=>$dbPass);
|
$aParameters = array('dbHost' => $dbHost, 'dbUser' => $dbUser, 'dbPass' => $dbPass);
|
||||||
|
|
||||||
foreach ($metadata->databases as $db) {
|
foreach ($metadata->databases as $db) {
|
||||||
$dbName = $newDBNames[$db->name];
|
$dbName = $newDBNames[$db->name];
|
||||||
CLI::logging( "+> Restoring database {$db->name} to $dbName\n" );
|
CLI::logging("+> Restoring database {$db->name} to $dbName\n");
|
||||||
$workspace->executeSQLScript( $dbName, "$tempDirectory/{$db->name}.sql", $aParameters );
|
$workspace->executeSQLScript($dbName, "$tempDirectory/{$db->name}.sql", $aParameters);
|
||||||
$workspace->createDBUser( $dbName, $db->pass, "localhost", $dbName );
|
$workspace->createDBUser($dbName, $db->pass, "localhost", $dbName);
|
||||||
$workspace->createDBUser( $dbName, $db->pass, "%", $dbName );
|
$workspace->createDBUser($dbName, $db->pass, "%", $dbName);
|
||||||
}
|
}
|
||||||
$workspace->upgradeCacheView( false );
|
$workspace->upgradeCacheView(false);
|
||||||
mysql_close( $link );
|
mysql_close($link);
|
||||||
|
|
||||||
}
|
}
|
||||||
CLI::logging( "Removing temporary files\n" );
|
CLI::logging("Removing temporary files\n");
|
||||||
G::rm_dir( $tempDirectory );
|
G::rm_dir($tempDirectory);
|
||||||
CLI::logging( CLI::info( "Done restoring" ) . "\n" );
|
CLI::logging(CLI::info("Done restoring") . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
class Net
|
||||||
* LastModification 30/05/2008
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package workflow.engine.classes
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @package workflow.engine.classes
|
|
||||||
*/class NET
|
|
||||||
{
|
{
|
||||||
public $hostname;
|
public $hostname;
|
||||||
public $ip;
|
public $ip;
|
||||||
@@ -62,9 +49,9 @@
|
|||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
$this->db_instance = "";
|
$this->db_instance = "";
|
||||||
|
|
||||||
unset( $this->db_user );
|
unset($this->db_user);
|
||||||
unset( $this->db_passwd );
|
unset($this->db_passwd);
|
||||||
unset( $this->db_sourcename );
|
unset($this->db_sourcename);
|
||||||
|
|
||||||
#verifing valid param
|
#verifing valid param
|
||||||
if ($pHost == "") {
|
if ($pHost == "") {
|
||||||
@@ -72,7 +59,7 @@
|
|||||||
$this->errstr = "NET::You must specify a host";
|
$this->errstr = "NET::You must specify a host";
|
||||||
//$this->showMsg();
|
//$this->showMsg();
|
||||||
}
|
}
|
||||||
$this->resolv( $pHost );
|
$this->resolv($pHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,31 +68,31 @@
|
|||||||
* @param string $pHost
|
* @param string $pHost
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function resolv ($pHost)
|
public function resolv($pHost)
|
||||||
{
|
{
|
||||||
$aHost = explode( "\\", $pHost );
|
$aHost = explode("\\", $pHost);
|
||||||
if (count( $aHost ) > 1) {
|
if (count($aHost) > 1) {
|
||||||
$ipHost = $aHost[0];
|
$ipHost = $aHost[0];
|
||||||
$this->db_instance = $aHost[1];
|
$this->db_instance = $aHost[1];
|
||||||
} else {
|
} else {
|
||||||
$ipHost = $pHost;
|
$ipHost = $pHost;
|
||||||
}
|
}
|
||||||
if ($this->is_ipaddress( $ipHost )) {
|
if ($this->is_ipaddress($ipHost)) {
|
||||||
$this->ip = $ipHost;
|
$this->ip = $ipHost;
|
||||||
if (! $this->hostname = @gethostbyaddr( $ipHost )) {
|
if (! $this->hostname = @gethostbyaddr($ipHost)) {
|
||||||
$this->errno = 2000;
|
$this->errno = 2000;
|
||||||
$this->errstr = "NET::Host down";
|
$this->errstr = "NET::Host down";
|
||||||
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ip = @gethostbyname( $ipHost );
|
$ip = @gethostbyname($ipHost);
|
||||||
$long = ip2long( $ip );
|
$long = ip2long($ip);
|
||||||
if ($long == - 1 || $long === false) {
|
if ($long == - 1 || $long === false) {
|
||||||
$this->errno = 2000;
|
$this->errno = 2000;
|
||||||
$this->errstr = "NET::Host down";
|
$this->errstr = "NET::Host down";
|
||||||
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
$this->error = G::loadTranslation('ID_HOST_UNREACHABLE');
|
||||||
} else {
|
} else {
|
||||||
$this->ip = @gethostbyname( $ipHost );
|
$this->ip = @gethostbyname($ipHost);
|
||||||
$this->hostname = $pHost;
|
$this->hostname = $pHost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,14 +104,14 @@
|
|||||||
* @param string $pPort
|
* @param string $pPort
|
||||||
* @return true
|
* @return true
|
||||||
*/
|
*/
|
||||||
public function scannPort ($pPort)
|
public function scannPort($pPort)
|
||||||
{
|
{
|
||||||
define( 'TIMEOUT', 5 );
|
define('TIMEOUT', 5);
|
||||||
$hostip = @gethostbyname( $host ); // resloves IP from Hostname returns hostname on failure
|
$hostip = @gethostbyname($host); // resloves IP from Hostname returns hostname on failure
|
||||||
// attempt to connect
|
// attempt to connect
|
||||||
if (@fsockopen( $this->ip, $pPort, $this->errno, $this->errstr, TIMEOUT )) {
|
if (@fsockopen($this->ip, $pPort, $this->errno, $this->errstr, TIMEOUT)) {
|
||||||
return true;
|
return true;
|
||||||
@fclose( $x ); //close connection (i dont know if this is needed or not).
|
@fclose($x); //close connection (i dont know if this is needed or not).
|
||||||
} else {
|
} else {
|
||||||
$this->errno = 9999;
|
$this->errno = 9999;
|
||||||
$this->errstr = "NET::Port Host Unreachable";
|
$this->errstr = "NET::Port Host Unreachable";
|
||||||
@@ -139,16 +126,16 @@
|
|||||||
* @param string $pHost
|
* @param string $pHost
|
||||||
* @return true
|
* @return true
|
||||||
*/
|
*/
|
||||||
public function is_ipaddress ($pHost)
|
public function is_ipaddress($pHost)
|
||||||
{
|
{
|
||||||
$key = true;
|
$key = true;
|
||||||
#verifing if is a ip address
|
#verifing if is a ip address
|
||||||
$tmp = explode( ".", $pHost );
|
$tmp = explode(".", $pHost);
|
||||||
#if have a ip address format
|
#if have a ip address format
|
||||||
if (count( $tmp ) == 4) {
|
if (count($tmp) == 4) {
|
||||||
#if a correct ip address
|
#if a correct ip address
|
||||||
for ($i = 0; $i < count( $tmp ); $i ++) {
|
for ($i = 0; $i < count($tmp); $i ++) {
|
||||||
if (! is_int( $tmp[$i] )) {
|
if (! is_int($tmp[$i])) {
|
||||||
$key = false;
|
$key = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -165,12 +152,12 @@
|
|||||||
* @param string $pHost
|
* @param string $pHost
|
||||||
* @return true
|
* @return true
|
||||||
*/
|
*/
|
||||||
public function ping ($pTTL = 3000)
|
public function ping($pTTL = 3000)
|
||||||
{
|
{
|
||||||
$cmd = "ping -w $pTTL $this->ip";
|
$cmd = "ping -w $pTTL $this->ip";
|
||||||
$output = exec( $cmd, $a, $a1 );
|
$output = exec($cmd, $a, $a1);
|
||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
for ($i = 0; $i < count( $a ); $i ++) {
|
for ($i = 0; $i < count($a); $i ++) {
|
||||||
$this->errstr += $a[$i];
|
$this->errstr += $a[$i];
|
||||||
}
|
}
|
||||||
$this->errno = $a1;
|
$this->errno = $a1;
|
||||||
@@ -183,7 +170,7 @@
|
|||||||
* @param string $pPasswd
|
* @param string $pPasswd
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function loginDbServer ($pUser, $pPasswd)
|
public function loginDbServer($pUser, $pPasswd)
|
||||||
{
|
{
|
||||||
$this->db_user = $pUser;
|
$this->db_user = $pUser;
|
||||||
$this->db_passwd = $pPasswd;
|
$this->db_passwd = $pPasswd;
|
||||||
@@ -196,7 +183,7 @@
|
|||||||
* @param string $pPort
|
* @param string $pPort
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setDataBase ($pDb, $pPort = '')
|
public function setDataBase($pDb, $pPort = '')
|
||||||
{
|
{
|
||||||
$this->db_sourcename = $pDb;
|
$this->db_sourcename = $pDb;
|
||||||
$this->db_port = $pPort;
|
$this->db_port = $pPort;
|
||||||
@@ -212,10 +199,9 @@
|
|||||||
*/
|
*/
|
||||||
public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
|
public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
|
||||||
{
|
{
|
||||||
|
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$this->ip = $filter->validateInput($this->ip);
|
$this->ip = $filter->validateInput($this->ip);
|
||||||
$this->db_port = $filter->validateInput($this->db_port,'int');
|
$this->db_port = $filter->validateInput($this->db_port, 'int');
|
||||||
$this->db_user = $filter->validateInput($this->db_user);
|
$this->db_user = $filter->validateInput($this->db_user);
|
||||||
$this->db_passwd = $filter->validateInput($this->db_passwd);
|
$this->db_passwd = $filter->validateInput($this->db_passwd);
|
||||||
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
|
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
|
||||||
@@ -227,10 +213,10 @@
|
|||||||
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
||||||
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
||||||
$flagTns=1;
|
$flagTns=1;
|
||||||
}else{
|
} else {
|
||||||
$flagTns=0;
|
$flagTns=0;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$flagTns=0;
|
$flagTns=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,12 +224,12 @@
|
|||||||
switch ($pDbDriver) {
|
switch ($pDbDriver) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
if ($this->db_passwd == '') {
|
if ($this->db_passwd == '') {
|
||||||
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user );
|
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user);
|
||||||
} else {
|
} else {
|
||||||
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd );
|
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
|
||||||
}
|
}
|
||||||
if ($link) {
|
if ($link) {
|
||||||
if (@mysql_ping( $link )) {
|
if (@mysql_ping($link)) {
|
||||||
$stat->status = 'SUCCESS';
|
$stat->status = 'SUCCESS';
|
||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
$this->errno = 0;
|
$this->errno = 0;
|
||||||
@@ -260,7 +246,7 @@
|
|||||||
break;
|
break;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
$this->db_port = ($this->db_port == "") ? "5432" : $this->db_port;
|
$this->db_port = ($this->db_port == "") ? "5432" : $this->db_port;
|
||||||
$link = @pg_connect( "host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'" );
|
$link = @pg_connect("host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'");
|
||||||
if ($link) {
|
if ($link) {
|
||||||
$stat->status = 'SUCCESS';
|
$stat->status = 'SUCCESS';
|
||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
@@ -274,10 +260,10 @@
|
|||||||
case 'mssql':
|
case 'mssql':
|
||||||
if ($this->db_instance != "") {
|
if ($this->db_instance != "") {
|
||||||
$str_port = "";
|
$str_port = "";
|
||||||
$link = @mssql_connect( $this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd );
|
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
|
||||||
} else {
|
} else {
|
||||||
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
||||||
$link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd );
|
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($link) {
|
if ($link) {
|
||||||
@@ -310,7 +296,7 @@
|
|||||||
$this->errno = 30001;
|
$this->errno = 30001;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new Exception( "[erik] Couldn't connect to Oracle Server! - " . $e->getMessage() );
|
throw new Exception("[erik] Couldn't connect to Oracle Server! - " . $e->getMessage());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'informix':
|
case 'informix':
|
||||||
@@ -319,7 +305,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( "CLASS::NET::ERROR: No connections param." );
|
throw new Exception("CLASS::NET::ERROR: No connections param.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $stat;
|
return $stat;
|
||||||
@@ -335,10 +321,9 @@
|
|||||||
*/
|
*/
|
||||||
public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
|
public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
|
||||||
{
|
{
|
||||||
|
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
$this->ip = $filter->validateInput($this->ip);
|
$this->ip = $filter->validateInput($this->ip);
|
||||||
$this->db_port = $filter->validateInput($this->db_port,'int');
|
$this->db_port = $filter->validateInput($this->db_port, 'int');
|
||||||
$this->db_user = $filter->validateInput($this->db_user);
|
$this->db_user = $filter->validateInput($this->db_user);
|
||||||
$this->db_passwd = $filter->validateInput($this->db_passwd);
|
$this->db_passwd = $filter->validateInput($this->db_passwd);
|
||||||
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
|
$this->db_sourcename = $filter->validateInput($this->db_sourcename);
|
||||||
@@ -346,32 +331,32 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_time_limit( 0 );
|
set_time_limit(0);
|
||||||
$stat = new Stat();
|
$stat = new Stat();
|
||||||
|
|
||||||
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
|
||||||
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
|
||||||
$flagTns=1;
|
$flagTns=1;
|
||||||
}else{
|
} else {
|
||||||
$flagTns=0;
|
$flagTns=0;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$flagTns=0;
|
$flagTns=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) {
|
if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) {
|
||||||
switch ($pDbDriver) {
|
switch ($pDbDriver) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd );
|
$link = @mysql_connect($this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd);
|
||||||
$db = @mysql_select_db( $this->db_sourcename );
|
$db = @mysql_select_db($this->db_sourcename);
|
||||||
if ($link) {
|
if ($link) {
|
||||||
if ($db) {
|
if ($db) {
|
||||||
$result = @mysql_query( "show tables;" );
|
$result = @mysql_query("show tables;");
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$stat->status = 'SUCCESS';
|
$stat->status = 'SUCCESS';
|
||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
$this->errno = 0;
|
$this->errno = 0;
|
||||||
@mysql_free_result( $result );
|
@mysql_free_result($result);
|
||||||
} else {
|
} else {
|
||||||
$this->error = "the user $this->db_user doesn't have privileges to run queries!";
|
$this->error = "the user $this->db_user doesn't have privileges to run queries!";
|
||||||
$this->errstr = "NET::MYSQL->Test query failed";
|
$this->errstr = "NET::MYSQL->Test query failed";
|
||||||
@@ -390,9 +375,9 @@
|
|||||||
break;
|
break;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
$this->db_port = (($this->db_port == "") || ($this->db_port == 0)) ? "5432" : $this->db_port;
|
$this->db_port = (($this->db_port == "") || ($this->db_port == 0)) ? "5432" : $this->db_port;
|
||||||
$link = @pg_connect( "host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'" );
|
$link = @pg_connect("host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'");
|
||||||
if ($link) {
|
if ($link) {
|
||||||
if (@pg_ping( $link )) {
|
if (@pg_ping($link)) {
|
||||||
$stat->status = 'SUCCESS';
|
$stat->status = 'SUCCESS';
|
||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
$this->errno = 0;
|
$this->errno = 0;
|
||||||
@@ -412,13 +397,13 @@
|
|||||||
// $link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
// $link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
||||||
if ($this->db_instance != "") {
|
if ($this->db_instance != "") {
|
||||||
$str_port = "";
|
$str_port = "";
|
||||||
$link = @mssql_connect( $this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd );
|
$link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd);
|
||||||
} else {
|
} else {
|
||||||
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
$str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
|
||||||
$link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd );
|
$link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
|
||||||
}
|
}
|
||||||
if ($link) {
|
if ($link) {
|
||||||
$db = @mssql_select_db( $this->db_sourcename, $link );
|
$db = @mssql_select_db($this->db_sourcename, $link);
|
||||||
if ($db) {
|
if ($db) {
|
||||||
$stat->status = 'SUCCESS';
|
$stat->status = 'SUCCESS';
|
||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
@@ -445,7 +430,7 @@
|
|||||||
|
|
||||||
if ($cnn) {
|
if ($cnn) {
|
||||||
$stid = @oci_parse($cnn, 'select AUTHENTICATION_TYPE from v$session_connect_info');
|
$stid = @oci_parse($cnn, 'select AUTHENTICATION_TYPE from v$session_connect_info');
|
||||||
$result = @oci_execute( $stid, OCI_DEFAULT );
|
$result = @oci_execute($stid, OCI_DEFAULT);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$stat->status = 'SUCCESS';
|
$stat->status = 'SUCCESS';
|
||||||
$this->errstr = "";
|
$this->errstr = "";
|
||||||
@@ -468,7 +453,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( "CLASS::NET::ERROR: No connections param." );
|
throw new Exception("CLASS::NET::ERROR: No connections param.");
|
||||||
}
|
}
|
||||||
return $stat;
|
return $stat;
|
||||||
}
|
}
|
||||||
@@ -479,30 +464,29 @@
|
|||||||
* @param string $driver
|
* @param string $driver
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function getDbServerVersion ($driver)
|
public function getDbServerVersion($driver)
|
||||||
{
|
{
|
||||||
if (! isset( $this->ip )) {
|
if (! isset($this->ip)) {
|
||||||
$this->ip = getenv( 'HTTP_CLIENT_IP' );
|
$this->ip = getenv('HTTP_CLIENT_IP');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset( $this->ip ) && isset( $this->db_user ) && isset( $this->db_passwd )) {
|
if (isset($this->ip) && isset($this->db_user) && isset($this->db_passwd)) {
|
||||||
try {
|
try {
|
||||||
if (! isset( $this->db_sourcename )) {
|
if (! isset($this->db_sourcename)) {
|
||||||
$this->db_sourcename = DB_NAME;
|
$this->db_sourcename = DB_NAME;
|
||||||
}
|
}
|
||||||
$value = 'none';
|
$value = 'none';
|
||||||
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
|
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
|
||||||
if (G::LoadSystemExist( $sDataBase )) {
|
if (G::LoadSystemExist($sDataBase)) {
|
||||||
|
|
||||||
$oDataBase = new database();
|
$oDataBase = new database();
|
||||||
$value = $oDataBase->getServerVersion( $driver, $this->ip, $this->db_port, $this->db_user, $this->db_passwd, $this->db_sourcename );
|
$value = $oDataBase->getServerVersion($driver, $this->ip, $this->db_port, $this->db_user, $this->db_passwd, $this->db_sourcename);
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new Exception( $e->getMessage() );
|
throw new Exception($e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( 'NET::Error->No params for Data Base Server!' );
|
throw new Exception('NET::Error->No params for Data Base Server!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +496,7 @@
|
|||||||
* @param string $pAdapter
|
* @param string $pAdapter
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function dbName ($pAdapter)
|
public function dbName($pAdapter)
|
||||||
{
|
{
|
||||||
switch ($pAdapter) {
|
switch ($pAdapter) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
@@ -542,7 +526,7 @@
|
|||||||
* @param string $pAdapter
|
* @param string $pAdapter
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function showMsg ()
|
public function showMsg()
|
||||||
{
|
{
|
||||||
if ($this->errno != 0) {
|
if ($this->errno != 0) {
|
||||||
$msg = "
|
$msg = "
|
||||||
@@ -556,7 +540,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<center>";
|
<center>";
|
||||||
print ($msg) ;
|
print($msg) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,7 +550,7 @@
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getErrno ()
|
public function getErrno()
|
||||||
{
|
{
|
||||||
return $this->errno;
|
return $this->errno;
|
||||||
}
|
}
|
||||||
@@ -577,7 +561,7 @@
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getErrmsg ()
|
public function getErrmsg()
|
||||||
{
|
{
|
||||||
return $this->errstr;
|
return $this->errstr;
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* class.processes.php
|
|
||||||
*
|
|
||||||
* @package workflow.engine.ProcessMaker
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ObjectDocument Collection
|
* ObjectDocument Collection
|
||||||
*
|
*
|
||||||
* @package workflow.engine.ProcessMaker
|
* @package workflow.engine.ProcessMaker
|
||||||
*/class ObjectCellection
|
*/
|
||||||
|
class ObjectCollection
|
||||||
{
|
{
|
||||||
public $num;
|
public $num;
|
||||||
public $swapc;
|
public $swapc;
|
||||||
@@ -40,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->objects = Array();
|
$this->objects = array();
|
||||||
$this->num = 0;
|
$this->num = 0;
|
||||||
$this->swapc = $this->num;
|
$this->swapc = $this->num;
|
||||||
array_push($this->objects, 'void');
|
array_push($this->objects, 'void');
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
{
|
{
|
||||||
$sMySQLVersion = '?????';
|
$sMySQLVersion = '?????';
|
||||||
if (defined("DB_HOST")) {
|
if (defined("DB_HOST")) {
|
||||||
$dbNetView = new NET(DB_HOST);
|
$dbNetView = new Net(DB_HOST);
|
||||||
$dbNetView->loginDbServer(DB_USER, DB_PASS);
|
$dbNetView->loginDbServer(DB_USER, DB_PASS);
|
||||||
|
|
||||||
$dbConns = new DbConnections('');
|
$dbConns = new DbConnections('');
|
||||||
|
|||||||
@@ -1145,7 +1145,7 @@ class WorkspaceTools
|
|||||||
$Fields['WORKSPACE_NAME'] = $this->name;
|
$Fields['WORKSPACE_NAME'] = $this->name;
|
||||||
|
|
||||||
if (isset($this->dbHost)) {
|
if (isset($this->dbHost)) {
|
||||||
$dbNetView = new NET($this->dbHost);
|
$dbNetView = new Net($this->dbHost);
|
||||||
$dbNetView->loginDbServer($this->dbUser, $this->dbPass);
|
$dbNetView->loginDbServer($this->dbUser, $this->dbPass);
|
||||||
try {
|
try {
|
||||||
if (!defined('DB_ADAPTER')) {
|
if (!defined('DB_ADAPTER')) {
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class Admin extends Controller
|
|||||||
|
|
||||||
$redhat .= " (" . PHP_OS . ")";
|
$redhat .= " (" . PHP_OS . ")";
|
||||||
if (defined( "DB_HOST" )) {
|
if (defined( "DB_HOST" )) {
|
||||||
$dbNetView = new NET( DB_HOST );
|
$dbNetView = new Net( DB_HOST );
|
||||||
$dbNetView->loginDbServer( DB_USER, DB_PASS );
|
$dbNetView->loginDbServer( DB_USER, DB_PASS );
|
||||||
|
|
||||||
$dbConns = new DbConnections( '' );
|
$dbConns = new DbConnections( '' );
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ class adminProxy extends HttpProxyController
|
|||||||
$Mailto = $_POST['eMailto'];
|
$Mailto = $_POST['eMailto'];
|
||||||
$SMTPSecure = $_POST['UseSecureCon'];
|
$SMTPSecure = $_POST['UseSecureCon'];
|
||||||
|
|
||||||
$Server = new NET($server);
|
$Server = new Net($server);
|
||||||
$smtp = new SMTP;
|
$smtp = new SMTP;
|
||||||
|
|
||||||
$timeout = 10;
|
$timeout = 10;
|
||||||
|
|||||||
@@ -695,7 +695,7 @@ class Main extends Controller
|
|||||||
|
|
||||||
$redhat .= " (" . PHP_OS . ")";
|
$redhat .= " (" . PHP_OS . ")";
|
||||||
if (defined( "DB_HOST" )) {
|
if (defined( "DB_HOST" )) {
|
||||||
$dbNetView = new NET( DB_HOST );
|
$dbNetView = new Net( DB_HOST );
|
||||||
$dbNetView->loginDbServer( DB_USER, DB_PASS );
|
$dbNetView->loginDbServer( DB_USER, DB_PASS );
|
||||||
|
|
||||||
$dbConns = new DbConnections( '' );
|
$dbConns = new DbConnections( '' );
|
||||||
|
|||||||
@@ -918,7 +918,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = new stdClass();
|
$result = new stdClass();
|
||||||
$net = new NET( G::getIpAddress() );
|
$net = new Net( G::getIpAddress() );
|
||||||
|
|
||||||
$META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . PmSystem::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . SYS_SYS . "\n" . " @Export trace back:\n\n";
|
$META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . PmSystem::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . SYS_SYS . "\n" . " @Export trace back:\n\n";
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ try {
|
|||||||
function getLDAPAdvanceInstance($authUid)
|
function getLDAPAdvanceInstance($authUid)
|
||||||
{
|
{
|
||||||
$RBAC = &RBAC::getSingleton();
|
$RBAC = &RBAC::getSingleton();
|
||||||
$ldapAdvanced = new ldapAdvanced();
|
$ldapAdvanced = new LdapAdvanced();
|
||||||
$ldapAdvanced->sAuthSource = $authUid;
|
$ldapAdvanced->sAuthSource = $authUid;
|
||||||
$ldapAdvanced->sSystem = $RBAC->sSystem;
|
$ldapAdvanced->sSystem = $RBAC->sSystem;
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ switch ($function) {
|
|||||||
$aFields['AUTH_SOURCE_DATA'] = $aData;
|
$aFields['AUTH_SOURCE_DATA'] = $aData;
|
||||||
|
|
||||||
//LDAP_PAGE_SIZE_LIMIT
|
//LDAP_PAGE_SIZE_LIMIT
|
||||||
$ldapAdvanced = new ldapAdvanced();
|
$ldapAdvanced = new LdapAdvanced();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$arrayAuthenticationSourceData = $aFields;
|
$arrayAuthenticationSourceData = $aFields;
|
||||||
@@ -205,7 +205,7 @@ switch ($function) {
|
|||||||
//Get data
|
//Get data
|
||||||
$arrayData = array();
|
$arrayData = array();
|
||||||
|
|
||||||
$ldapAdvanced = new ldapAdvanced();
|
$ldapAdvanced = new LdapAdvanced();
|
||||||
$ldapAdvanced->sAuthSource = $authenticationSourceUid;
|
$ldapAdvanced->sAuthSource = $authenticationSourceUid;
|
||||||
|
|
||||||
$result = $ldapAdvanced->searchUsers($keyword, $start, $limit);
|
$result = $ldapAdvanced->searchUsers($keyword, $start, $limit);
|
||||||
@@ -345,7 +345,7 @@ switch ($function) {
|
|||||||
$arrayAuthenticationSourceData['AUTH_SOURCE_VERSION'] = 3;
|
$arrayAuthenticationSourceData['AUTH_SOURCE_VERSION'] = 3;
|
||||||
|
|
||||||
//Test connection
|
//Test connection
|
||||||
$ldapAdvanced = new ldapAdvanced();
|
$ldapAdvanced = new LdapAdvanced();
|
||||||
|
|
||||||
$ldapcnn = $ldapAdvanced->ldapConnection($arrayAuthenticationSourceData);
|
$ldapcnn = $ldapAdvanced->ldapConnection($arrayAuthenticationSourceData);
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Server = new NET($server);
|
$Server = new Net($server);
|
||||||
|
|
||||||
switch ($step) {
|
switch ($step) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -305,7 +305,7 @@ switch ($action) {
|
|||||||
$connectionType = $_POST["connectionType"];
|
$connectionType = $_POST["connectionType"];
|
||||||
$tns = $_POST["tns"];
|
$tns = $_POST["tns"];
|
||||||
|
|
||||||
$net = new NET();
|
$net = new Net();
|
||||||
|
|
||||||
switch ($step) {
|
switch ($step) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class ldapadvancedClassCron
|
|||||||
$rbac->authSourcesObj = new AuthenticationSource();
|
$rbac->authSourcesObj = new AuthenticationSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugin = new ldapAdvanced();
|
$plugin = new LdapAdvanced();
|
||||||
$plugin->sSystem = $rbac->sSystem;
|
$plugin->sSystem = $rbac->sSystem;
|
||||||
|
|
||||||
$plugin->setFrontEnd(true);
|
$plugin->setFrontEnd(true);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function testConnection($type, $server, $user, $passwd, $port = 'none', $dbName
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Server = new NET($server);
|
$Server = new Net($server);
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
|
|
||||||
if ($Server->getErrno() == 0) {
|
if ($Server->getErrno() == 0) {
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ switch ($request) {
|
|||||||
$SMTPSecure = $_POST['SMTPSecure'];
|
$SMTPSecure = $_POST['SMTPSecure'];
|
||||||
$timeout = 10;
|
$timeout = 10;
|
||||||
|
|
||||||
$Server = new NET( $srv );
|
$Server = new Net( $srv );
|
||||||
$smtp = new SMTP();
|
$smtp = new SMTP();
|
||||||
|
|
||||||
switch ($step) {
|
switch ($step) {
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ class DataBaseConnection
|
|||||||
$flagTns = ($dataCon["DBS_TYPE"] == "oracle" && $dataCon["DBS_CONNECTION_TYPE"] == "TNS")? 1 : 0;
|
$flagTns = ($dataCon["DBS_TYPE"] == "oracle" && $dataCon["DBS_CONNECTION_TYPE"] == "TNS")? 1 : 0;
|
||||||
|
|
||||||
if ($flagTns == 0) {
|
if ($flagTns == 0) {
|
||||||
$Server = new \NET($dataCon['DBS_SERVER']);
|
$Server = new \Net($dataCon['DBS_SERVER']);
|
||||||
|
|
||||||
// STEP 1 : Resolving Host Name
|
// STEP 1 : Resolving Host Name
|
||||||
$respTest['0'] = array();
|
$respTest['0'] = array();
|
||||||
@@ -356,7 +356,7 @@ class DataBaseConnection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$net = new \NET();
|
$net = new \Net();
|
||||||
|
|
||||||
//STEP 0: Trying to open database type TNS
|
//STEP 0: Trying to open database type TNS
|
||||||
$respTest["0"] = array();
|
$respTest["0"] = array();
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ class EmailServer
|
|||||||
$mailTo = $arrayData["MAIL_TO"];
|
$mailTo = $arrayData["MAIL_TO"];
|
||||||
$smtpSecure = $arrayData["SMTPSECURE"];
|
$smtpSecure = $arrayData["SMTPSECURE"];
|
||||||
|
|
||||||
$serverNet = new \NET($server);
|
$serverNet = new \Net($server);
|
||||||
$smtp = new \SMTP();
|
$smtp = new \SMTP();
|
||||||
|
|
||||||
$timeout = 10;
|
$timeout = 10;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ $html = '
|
|||||||
$flagTns = ($_POST["type"] == "oracle" && $_POST["connectionType"] == "TNS")? 1 : 0;
|
$flagTns = ($_POST["type"] == "oracle" && $_POST["connectionType"] == "TNS")? 1 : 0;
|
||||||
|
|
||||||
if ($flagTns == 0) {
|
if ($flagTns == 0) {
|
||||||
$host = new NET($_POST["server"]);
|
$host = new Net($_POST["server"]);
|
||||||
|
|
||||||
$port = $_POST["port"];
|
$port = $_POST["port"];
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
* @Updated Nov 6th, 2009 bye Eriknyk
|
* @Updated Nov 6th, 2009 bye Eriknyk
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$host = new net($_POST['srv']);
|
$host = new Net($_POST['srv']);
|
||||||
$host = $filter->xssFilterHard($host);
|
$host = $filter->xssFilterHard($host);
|
||||||
$width_content = '550px';
|
$width_content = '550px';
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
|
|||||||
Reference in New Issue
Block a user