Skip to content

Commit 00f250f

Browse files
committed
Команды.
1 parent 53d3e95 commit 00f250f

File tree

3 files changed

+74
-275
lines changed

3 files changed

+74
-275
lines changed

bin/rabbit.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

install/bin/rabbit

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use Bitrix\Main\DB\ConnectionException;
5+
use Bitrix\Main\Loader;
6+
use Proklung\RabbitMq\Integration\CLI\CommandsSetup;
7+
use Proklung\RabbitMq\Integration\CLI\ConsoleCommandConfigurator;
8+
use Proklung\RabbitMq\Integration\DI\Services;
9+
use Symfony\Component\Console\Application;
10+
11+
@set_time_limit(0);
12+
13+
$_SERVER['DOCUMENT_ROOT'] = __DIR__. DIRECTORY_SEPARATOR . '..';
14+
$documentRoot = $GLOBALS['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'];
15+
16+
$autoloadPath = $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
17+
18+
define('BITRIX_CLI', true);
19+
define('NO_KEEP_STATISTIC', true);
20+
define('NOT_CHECK_PERMISSIONS', true);
21+
define('LANGUAGE_ID', 'pa');
22+
define('LOG_FILENAME', 'php://stderr');
23+
define('BX_NO_ACCELERATOR_RESET', true);
24+
define('STOP_STATISTICS', true);
25+
define('NO_AGENT_STATISTIC', 'Y');
26+
define('NO_AGENT_CHECK', true);
27+
defined('PUBLIC_AJAX_MODE') || define('PUBLIC_AJAX_MODE', true);
28+
29+
30+
/** @noinspection PhpIncludeInspection */
31+
require_once $autoloadPath;
32+
33+
try {
34+
35+
global
36+
$DB, $DBType, $DBHost, $DBLogin, $DBPassword,
37+
$DBName, $DBDebug, $DBDebugToFile, $APPLICATION, $USER, $DBSQLServerType;
38+
39+
require_once $documentRoot . '/bitrix/modules/main/include/prolog_before.php';
40+
41+
if (defined('B_PROLOG_INCLUDED') && B_PROLOG_INCLUDED === true) {
42+
$bitrixStatus = 200;
43+
}
44+
45+
// Альтернативный способ вывода ошибок типа "DB query error.":
46+
$GLOBALS['DB']->debug = true;
47+
48+
$app = \Bitrix\Main\Application::getInstance();
49+
$con = $app->getConnection();
50+
$DB->db_Conn = $con->getResource();
51+
52+
if (in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) {
53+
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '
54+
. \PHP_SAPI . ' SAPI' . \PHP_EOL;
55+
}
56+
} catch (ConnectionException $e) {
57+
$bitrixStatus = 404;
58+
}
59+
60+
if ($bitrixStatus !== 200) {
61+
exit('Bitrix not loaded.');
62+
}
63+
64+
Loader::includeModule('proklung.rabbitmq');
65+
66+
$commands = CommandsSetup::load(Services::getInstance());
67+
68+
$application = new ConsoleCommandConfigurator(
69+
new Application(),
70+
...$commands
71+
);
72+
73+
$application->init();
74+
$application->run();

lib/Integration/CLI/LoaderBitrix.php

Lines changed: 0 additions & 236 deletions
This file was deleted.

0 commit comments

Comments
 (0)