Files
crm.clientright.ru/modules/Workflow2/extends/provider/MySQL.inc.php
Fedor ac7467f0b4 Major CRM updates: AI Assistant, Court Status API, S3 integration improvements, and extensive file storage system
- Added comprehensive AI Assistant system (aiassist/ directory):
  * Vector search and embedding capabilities
  * Typebot proxy integration
  * Elastic search functionality
  * Message classification and chat history
  * MCP proxy for external integrations

- Implemented Court Status API (GetCourtStatus.php):
  * Real-time court document status checking
  * Integration with external court systems
  * Comprehensive error handling and logging

- Enhanced S3 integration:
  * Improved file backup system with metadata
  * Batch processing capabilities
  * Enhanced error logging and recovery
  * Copy operations with URL fixing

- Added Telegram contact creation API
- Improved error logging across all modules
- Enhanced callback system for AI responses
- Extensive backup file storage with timestamps
- Updated documentation and README files

- File storage improvements:
  * Thousands of backup files with proper metadata
  * Fix operations for broken file references
  * Project-specific backup and recovery systems
  * Comprehensive file integrity checking

Total: 26,461+ files added/modified including AWS SDK, vendor dependencies, and extensive backup system.
2025-10-16 11:17:21 +03:00

120 lines
3.3 KiB
PHP

<?php
/**
* Created by JetBrains PhpStorm.
* User: Stefan Warnat <support@stefanwarnat.de>
* Date: 20.09.14 23:15
* You must not use this file without permission.
*/
namespace Workflow\Plugins\ConnectionProvider;
class MySQL extends \Workflow\ConnectionProvider {
protected $_title = 'MySQL Connection';
private static $Cache = array();
protected $configFields = array(
'server' => array(
'label' => 'MySQL Server',
'type' => 'text',
'description' => 'Leave empty to use VtigerCRM Server'
),
'port' => array(
'label' => 'MySQL Serverport',
'type' => 'text',
'description' => 'Leave empty to use VtigerCRM Port',
),
'mysql_username' => array(
'label' => 'MySQL Login Username',
'type' => 'text',
'description' => 'Leave empty to use VtigerCRM Login'
),
'mysql_password' => array(
'label' => 'MySQL Login Password',
'type' => 'password',
),
'test_button' => array(
'label' => 'Test settings',
'type' => 'test_button',
),
);
protected $js4Editor = '';
/**
* @throws Exception
*/
public function renderExtraBackend($data) {
}
/**
* @return \PDO
*/
public function getMySQLConnection() {
$id = $this->get('_id');
if(!empty($id) && isset(self::$Cache[$id])) {
return self::$Cache[$id];
}
$server = $this->get('server');
$port = $this->get('port');
$mysql_username = $this->get('mysql_username');
$mysql_password = $this->get('mysql_password');
global $dbconfig;
if(empty($server)) {
$server = $dbconfig['db_server'];
}
if(empty($port)) {
$port = trim($dbconfig['db_port'],':');
}
if(empty($mysql_username)) {
$mysql_username = $dbconfig['db_username'];
$mysql_password = $dbconfig['db_password'];
}
$db = new \PDO('mysql:host='.$server.';port='.$port.';charset=utf8', $mysql_username, $mysql_password);
$db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
if($id == 'vtigerdb') {
$db->query("use `".$dbconfig['db_name'] . '`;');
}
if(!empty($id)) {
self::$Cache[$id] = $db;
}
return $db;
}
public function getColumns($tablenames) {
$condb = $this->getMySQLConnection();
// get column names
$query = $condb->prepare("DESCRIBE $tablenames");
$query->execute();
$table_names = $query->fetchAll(\PDO::FETCH_ASSOC);
$columns = array();
foreach($table_names as $col) {
$columns[$col['Field']] = $col;
}
return $columns;
}
public function test() {
try {
$connection = $this->getMySQLConnection();
} catch (\Exception $exp) {
throw new \Exception ($exp->getMessage());
}
return true;
}
public function database($newDatabase) {
$connection = $this->getMySQLConnection();
$connection->exec('USE `'.$newDatabase.'`;');
}
}
\Workflow\ConnectionProvider::register('mysql', '\Workflow\Plugins\ConnectionProvider\MySQL');