Files
crm.clientright.ru/modules/Workflow2/MailScannerCron.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

83 lines
2.5 KiB
PHP

<?php
if (file_exists(vglobal('root_directory').'/workflow2_ms_lock') && filemtime(vglobal('root_directory').'/workflow2_ms_lock') > (time() - 3600) && !defined('DEBUG_MODE')) {
echo "Cronjob already running (".vglobal('root_directory').'/workflow2_ms_lock'.")\n";
return;
}
function wfd_ms_cron_shutdown_handler() {
@unlink(vglobal('root_directory').'/workflow2_ms_lock');
if(defined('WRITTEN_OUTPUT_LOG')) return;
$content = ob_get_contents();
if(defined('WRITE_OUTPUT_LOG') && !empty(WRITE_OUTPUT_LOG)) {
file_put_contents(WRITE_OUTPUT_LOG, $content);
}
ob_end_flush();
}
$path = vglobal('root_directory') . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'Workflow2' . DIRECTORY_SEPARATOR . 'Mailscanner-Log';
@mkdir($path, 0775, true);
ob_start();
define('WRITE_OUTPUT_LOG', $path . DIRECTORY_SEPARATOR . date('Y-m-d-H-i-s').'.log');
$files = glob(vglobal('root_directory') . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'Workflow2' . DIRECTORY_SEPARATOR . 'Mailscanner-Log' . DIRECTORY_SEPARATOR . '*.log');
foreach($files as $file) {
if(filemtime($file) < time() - 86400 * 2) {
unlink($file);
}
}
register_shutdown_function('wfd_ms_cron_shutdown_handler');
$cronjobStartTime = time();
$maxRuntimeMinutes = 10; # Max Runtime
echo "Workflow2 Mailscanner Started\n";
file_put_contents(vglobal('root_directory').'/workflow2_ms_lock', 'locked');
/**
This File was developed by Stefan Warnat <vtiger@stefanwarnat.de>
It belongs to the Workflow Designer and must not be distributed without complete extension
**/
require_once('autoload_wf.php');
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
#$wfManager = new WfManager();
#$tasks = $wfManager->GetQueue();
global $current_language, $default_language, $current_user, $app_strings;
if(empty($current_language)) {
$current_language = $default_language;
}
$app_strings = return_application_language($current_language);
Workflow2::$enableError = true;
$adb = \PearDatabase::getInstance();
$sql = 'SELECT * FROM vtiger_wf_mailscanner WHERE active = 1';
$result = $adb->query($sql);
while($row = $adb->fetchByAssoc($result)) {
$obj = new \Workflow\Mailscanner($row['id']);
echo 'Start Mailscanner '.$row['id'].PHP_EOL;
$obj->execute();
}
$content = ob_get_contents();
if(defined('WRITE_OUTPUT_LOG') && !empty(WRITE_OUTPUT_LOG)) {
file_put_contents(WRITE_OUTPUT_LOG, $content);
define('WRITTEN_OUTPUT_LOG', true);
}
ob_end_flush();