1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
include.php
См. документацию.
1<?php
2
3/*.require_module 'standard';.*/
4/*.require_module 'bitrix_main';.*/
5if (!defined('CACHED_b_clouds_file_bucket'))
6{
7 define('CACHED_b_clouds_file_bucket', 360000);
8}
9if (!defined('CACHED_clouds_file_resize'))
10{
11 define('CACHED_clouds_file_resize', 360000);
12}
13if (!defined('BX_S3_MIN_UPLOAD_PART_SIZE'))
14{
15 define('BX_S3_MIN_UPLOAD_PART_SIZE', 5242880); //5MB
16}
17//if (defined("BX24_IS_STAGE") && BX24_IS_STAGE === true) define("BX_CLOUDS_COUNTERS_DEBUG", "#^/([^/]+/)?(tmp/BXTEMP-|export/|BXTEMP-[0-9-]+/)#");
18
20 'clouds',
21 [
22 'clouds' => 'install/index.php',
23 'CCloudUtil' => 'classes/general/util.php',
24 'CCloudStorage' => 'classes/general/storage.php',
25 'CCloudStorageBucket' => 'classes/general/storage_bucket.php',
26 'CCloudStorageUpload' => 'classes/general/storage_upload.php',
27 'CCloudTempFile' => 'classes/general/temp_file.php',
28 'CCloudFailover' => 'classes/general/failover.php',
29 'CCloudFileHash' => 'classes/general/filehash.php',
30 'CCloudStorageService' => 'classes/general/storage_service.php',
31 'CCloudStorageService_S3' => 'classes/general/storage_service_s3.php',
32 'CCloudStorageService_AmazonS3' => 'classes/general/storage_service_amazon.php',
33 'CCloudStorageService_Yandex' => 'classes/general/storage_service_yandex.php',
34 'CCloudStorageService_HotBox' => 'classes/general/storage_service_hotbox.php',
35 'CCloudStorageService_OpenStackStorage' => 'classes/general/storage_service_openstack.php',
36 'CCloudStorageService_RackSpaceCloudFiles' => 'classes/general/storage_service_rackspace.php',
37 'CCloudStorageService_ClodoRU' => 'classes/general/storage_service_clodo.php',
38 'CCloudStorageService_Selectel' => 'classes/general/storage_service_selectel.php',
39 'CCloudStorageService_Selectel_S3' => 'classes/general/storage_service_selectel_s3.php',
40 'CCloudStorageService_GoogleStorage' => 'classes/general/storage_service_google.php',
41 'CCloudSecurityService_AmazonS3' => 'classes/general/security_service_s3.php',
42 'CCloudSecurityService_HotBox' => 'classes/general/security_service_hotbox.php',
43 'CCloudSecurityService_STS' => 'classes/general/security_service_sts.php',
44 'CCloudSecurityService_Amazon' => 'classes/general/security_service_amazon.php',
45 'CCloudSecurityService_Yandex' => 'classes/general/security_service_yandex.php',
46 ]
47);
48
50{
51 protected static $instances = [];
52
53 public static function getInstance($action = 'counters')
54 {
55 if (!isset(static::$instances[$action]))
56 {
57 static::$instances[$action] = new static($action);
58 }
59 return static::$instances[$action];
60 }
61
62 protected $head = '';
63 protected $id = '';
64
65 public function __construct($action)
66 {
67 $this->head = BX24_HOST_NAME . '|' . $action;
68 $this->id = 0;
69 $now = time();
70 $expired = $now - 600;
71 while (!apcu_add($this->head . '|' . $this->id, $now))
72 {
73 $prev = apcu_fetch($this->head . '|' . $this->id);
74 if ($prev > 0 && $prev < $expired)
75 {
76 $cloudsKey = $this->head . '|' . $this->id . '|mess';
77 $prevTrace = apcu_fetch($cloudsKey);
78 if ($prevTrace)
79 {
80 AddMessage2Log($prevTrace, 'clouds', 0);
81 }
82 apcu_delete($cloudsKey);
83 apcu_delete($this->head . '|' . $this->id);
84 }
85 $this->id++;
86 }
87 }
88
89 public function __destruct()
90 {
91 $cloudsKey = $this->head . '|' . $this->id . '|mess';
92 $prevTrace = apcu_fetch($cloudsKey);
93 if ($prevTrace)
94 {
95 AddMessage2Log($prevTrace, 'clouds', 0);
96 }
97 apcu_delete($cloudsKey);
98 apcu_delete($this->head . '|' . $this->id);
99 }
100
101 public static function getBackTrace($skip = 0)
102 {
103 $functionStack = '';
104 $fileStack = '';
105 foreach (Bitrix\Main\Diag\Helper::getBackTrace(0, DEBUG_BACKTRACE_IGNORE_ARGS, $skip) as $backTraceFrame)
106 {
107 if ($functionStack)
108 {
109 $functionStack .= ' < ';
110 }
111
112 if (isset($backTraceFrame['class']))
113 {
114 $functionStack .= $backTraceFrame['class'] . '::';
115 }
116
117 $functionStack .= $backTraceFrame['function'];
118
119 if (isset($backTraceFrame['file']))
120 {
121 $fileStack .= "\t" . $backTraceFrame['file'] . ':' . $backTraceFrame['line'] . "\n";
122 }
123 }
124 return ' ' . $functionStack . "\n" . $fileStack;
125 }
126
127 public function startAction($filePath = '')
128 {
129 $newTrace = $this->head . ':v2:' . $filePath . "\n" . $_SERVER['REQUEST_URI'] . "\n" . static::getBackTrace(2);
130 $cloudsKey = $this->head . '|' . $this->id . '|mess';
131 if (!apcu_add($cloudsKey, $newTrace))
132 {
133 $prevTrace = apcu_fetch($cloudsKey);
134 if ($prevTrace)
135 {
136 AddMessage2Log($prevTrace, 'clouds', 0);
137 }
138 }
139 apcu_store($cloudsKey, $newTrace);
140 }
141
142 public function endAction()
143 {
144 $cloudsKey = $this->head . '|' . $this->id . '|mess';
145 apcu_delete($cloudsKey);
146 }
147}
Определения include.php:50
static $instances
Определения include.php:51
static getInstance($action='counters')
Определения include.php:53
__destruct()
Определения include.php:89
startAction($filePath='')
Определения include.php:127
endAction()
Определения include.php:142
$head
Определения include.php:62
$id
Определения include.php:63
__construct($action)
Определения include.php:65
static getBackTrace($skip=0)
Определения include.php:101
static AddAutoloadClasses($module, $arParams=[])
Определения module.php:27
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
AddMessage2Log($text, $module='', $traceDepth=6, $showArgs=false)
Определения tools.php:3941
$action
Определения file_dialog.php:21