Skip to content

Commit 2ad9ef0

Browse files
committed
fixes to work when the statisticclient is not there
1 parent c9abf8f commit 2ad9ef0

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/directadmin.inc.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ function directadmin_get_best_type($module, $packageId, $order = false, $extra =
131131
*/
132132
function directadmin_req($page, $post = '', $options = false)
133133
{
134-
require_once __DIR__.'/../../../workerman/statistics/Applications/Statistics/Clients/StatisticClient.php';
134+
if (is_file(__DIR__.'/../../../workerman/statistics/Applications/Statistics/Clients/StatisticClient.php')) {
135+
require_once __DIR__.'/../../../workerman/statistics/Applications/Statistics/Clients/StatisticClient.php';
136+
}
135137

136138
if ($options === false) {
137139
$options = [];
@@ -164,12 +166,18 @@ function directadmin_req($page, $post = '', $options = false)
164166
}
165167
}
166168
$call = basename(parse_url($page)['path'], '.php');
167-
\StatisticClient::tick('DirectAdmin', $call);
169+
if (class_exists(\StatisticClient::class, false)) {
170+
\StatisticClient::tick('DirectAdmin', $call);
171+
}
168172
$response = getcurlpage($page, $post, $options);
169173
if ($response === false) {
170-
\StatisticClient::report('DirectAdmin', $call, false, 1, 'Curl Error', STATISTICS_SERVER);
174+
if (class_exists(\StatisticClient::class, false)) {
175+
\StatisticClient::report('DirectAdmin', $call, false, 1, 'Curl Error', STATISTICS_SERVER);
176+
}
171177
} else {
172-
\StatisticClient::report('DirectAdmin', $call, true, 0, '', STATISTICS_SERVER);
178+
if (class_exists(\StatisticClient::class, false)) {
179+
\StatisticClient::report('DirectAdmin', $call, true, 0, '', STATISTICS_SERVER);
180+
}
173181
}
174182
return trim($response);
175183
}

0 commit comments

Comments
 (0)