Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ProklUng/bitrix-symfony-base
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.7.0
Choose a base ref
...
head repository: ProklUng/bitrix-symfony-base
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on May 31, 2021

  1. Разгрузка

    ProklUng committed May 31, 2021
    Copy the full SHA
    400e94e View commit details
  2. composer.json

    ProklUng committed May 31, 2021
    Copy the full SHA
    81d7c08 View commit details
  3. composer.json

    ProklUng committed May 31, 2021
    Copy the full SHA
    c263bac View commit details
  4. composer.json

    ProklUng committed May 31, 2021
    Copy the full SHA
    f4de60a View commit details
  5. composer.json

    ProklUng committed May 31, 2021
    Copy the full SHA
    5e7d560 View commit details
  6. small frontend update

    ProklUng committed May 31, 2021
    Copy the full SHA
    215ded8 View commit details

Commits on Jun 1, 2021

  1. Разгрузка

    ProklUng committed Jun 1, 2021
    Copy the full SHA
    426ff71 View commit details
  2. Разгрузка

    ProklUng committed Jun 1, 2021
    Copy the full SHA
    c195f28 View commit details

Commits on Jul 22, 2021

  1. Copy the full SHA
    c46699a View commit details
  2. fix README.md

    ProklUng committed Jul 22, 2021
    Copy the full SHA
    735a3df View commit details
  3. Fix bug in jedi-light runner

    ProklUng committed Jul 22, 2021
    Copy the full SHA
    a776c08 View commit details
  4. Fix .settings.php

    ProklUng committed Jul 22, 2021
    Copy the full SHA
    02f2325 View commit details
  5. Fix dbconn.php

    ProklUng committed Jul 22, 2021
    Copy the full SHA
    52b232b View commit details
  6. README.md

    ProklUng committed Jul 22, 2021
    Copy the full SHA
    6362b8d View commit details
  7. Copy the full SHA
    c4cd19f View commit details
  8. Copy the full SHA
    01a608a View commit details
  9. Copy the full SHA
    0d7e600 View commit details

Commits on Jul 23, 2021

  1. Copy the full SHA
    1ddf1d2 View commit details

Commits on Jul 26, 2021

  1. Разгрузка

    ProklUng committed Jul 26, 2021
    Copy the full SHA
    61f4375 View commit details
  2. Разгрузка

    ProklUng committed Jul 26, 2021
    Copy the full SHA
    5544b94 View commit details
  3. Разгрузка

    ProklUng committed Jul 26, 2021
    Copy the full SHA
    3ea473a View commit details
  4. Разгрузка

    ProklUng committed Jul 26, 2021
    Copy the full SHA
    e026f25 View commit details
  5. Разгрузка

    ProklUng committed Jul 26, 2021
    Copy the full SHA
    e41c7d2 View commit details
  6. Причесывание

    ProklUng committed Jul 26, 2021
    Copy the full SHA
    9341429 View commit details

Commits on Jul 27, 2021

  1. Copy the full SHA
    40c69fe View commit details

Commits on Aug 4, 2021

  1. Copy the full SHA
    2dd7a51 View commit details

Commits on Aug 8, 2021

  1. Bump composer.json

    ProklUng committed Aug 8, 2021
    Copy the full SHA
    97c76b3 View commit details

Commits on Aug 9, 2021

  1. Copy the full SHA
    6601523 View commit details
  2. Оптимизации

    ProklUng committed Aug 9, 2021
    Copy the full SHA
    3bca3e2 View commit details

Commits on Aug 12, 2021

  1. Copy the full SHA
    52f9dad View commit details
  2. Copy the full SHA
    366691b View commit details

Commits on Aug 15, 2021

  1. Copy the full SHA
    71a1408 View commit details

Commits on Aug 16, 2021

  1. Copy the full SHA
    77b066e View commit details
  2. Copy the full SHA
    d902c82 View commit details

Commits on Jan 11, 2022

  1. Copy the full SHA
    785f127 View commit details

Commits on Jan 13, 2022

  1. Copy the full SHA
    d9973a2 View commit details

Commits on Jan 27, 2022

  1. Copy the full SHA
    577072a View commit details
Showing with 506 additions and 3,633 deletions.
  1. +12 −0 .env.example
  2. +0 −7 .gitignore
  3. +19 −0 LICENSE
  4. +53 −2 README.md
  5. +39 −5 bin/console
  6. +24 −6 bin/db
  7. +23 −7 bin/jedi
  8. +37 −4 bin/module
  9. +39 −74 composer.json
  10. +10 −8 environments/default/bitrix/.settings.php
  11. +14 −27 environments/default/bitrix/.settings_extra.php
  12. +4 −2 environments/default/bitrix/php_interface/dbconn.php
  13. +36 −8 environments/dev/bitrix/.settings.php
  14. +17 −30 environments/dev/bitrix/.settings_extra.php
  15. +4 −2 environments/dev/bitrix/php_interface/dbconn.php
  16. +36 −8 environments/prod/bitrix/.settings.php
  17. +17 −30 environments/prod/bitrix/.settings_extra.php
  18. +4 −2 environments/prod/bitrix/php_interface/dbconn.php
  19. +0 −138 local/classes/Bitrix/Orm/AbstractBaseModel.php
  20. +0 −76 local/classes/Bitrix/Orm/ExampleModelOrmTable.php
  21. +0 −69 local/classes/Bundles/DtoMapperBundle/DependencyInjection/DtoMapperExtension.php
  22. +0 −27 local/classes/Bundles/DtoMapperBundle/DtoMapperBundle.php
  23. +0 −43 local/classes/Bundles/DtoMapperBundle/Resources/config/property_extractor.yaml
  24. +0 −12 local/classes/Bundles/DtoMapperBundle/Resources/config/services.yaml
  25. +0 −114 local/classes/Bundles/DtoMapperBundle/Services/Mapper.php
  26. +0 −31 local/classes/Bundles/DtoMapperBundle/Services/MapperInterface.php
  27. +0 −53 local/classes/Bundles/SymfonyMailerBundle/DependencyInjection/Configuration.php
  28. +0 −100 local/classes/Bundles/SymfonyMailerBundle/DependencyInjection/SymfonyMailerExtension.php
  29. +0 −64 local/classes/Bundles/SymfonyMailerBundle/Events/SetFromListener.php
  30. +0 −143 local/classes/Bundles/SymfonyMailerBundle/Resources/config/services.yaml
  31. +0 −41 local/classes/Bundles/SymfonyMailerBundle/Resources/config/transport.yaml
  32. +0 −42 local/classes/Bundles/SymfonyMailerBundle/Services/Contracts/MailerMessageFactoryInterface.php
  33. +0 −159 local/classes/Bundles/SymfonyMailerBundle/Services/EmailService.php
  34. +0 −175 local/classes/Bundles/SymfonyMailerBundle/Services/Factory/MailerMessageFactory.php
  35. +0 −76 local/classes/Bundles/SymfonyMailerBundle/Services/Factory/TransportFactory.php
  36. +0 −129 local/classes/Bundles/SymfonyMailerBundle/Services/Transport/FileTransport.php
  37. +0 −27 local/classes/Bundles/SymfonyMailerBundle/SymfonyMailerBundle.php
  38. +0 −66 local/classes/Bundles/TaskSchedulerBundle/Command/ListCommand.php
  39. +0 −55 local/classes/Bundles/TaskSchedulerBundle/Command/RunCommand.php
  40. +0 −30 local/classes/Bundles/TaskSchedulerBundle/DependencyInjection/Compiler/EventDispatcherPass.php
  41. +0 −30 local/classes/Bundles/TaskSchedulerBundle/DependencyInjection/Compiler/TaskPass.php
  42. +0 −31 local/classes/Bundles/TaskSchedulerBundle/DependencyInjection/Configuration.php
  43. +0 −28 local/classes/Bundles/TaskSchedulerBundle/DependencyInjection/RewieerTaskSchedulerExtension.php
  44. +0 −47 local/classes/Bundles/TaskSchedulerBundle/Event/EventDispatcher.php
  45. +0 −23 local/classes/Bundles/TaskSchedulerBundle/Event/EventSubscriberInterface.php
  46. +0 −29 local/classes/Bundles/TaskSchedulerBundle/Examples/ExampleTask.php
  47. +0 −30 local/classes/Bundles/TaskSchedulerBundle/Resources/config/services.xml
  48. +0 −21 local/classes/Bundles/TaskSchedulerBundle/RewieerTaskSchedulerBundle.php
  49. +0 −74 local/classes/Bundles/TaskSchedulerBundle/Services/SchedulerLogger.php
  50. +0 −52 local/classes/Bundles/TaskSchedulerBundle/Task/AbstractScheduledTask.php
  51. +0 −146 local/classes/Bundles/TaskSchedulerBundle/Task/Schedule.php
  52. +0 −72 local/classes/Bundles/TaskSchedulerBundle/Task/Scheduler.php
  53. +0 −17 local/classes/Bundles/TaskSchedulerBundle/Task/SchedulerEvents.php
  54. +0 −30 local/classes/Bundles/TaskSchedulerBundle/Task/TaskInterface.php
  55. +0 −65 local/classes/Bundles/TaskSchedulerBundle/Tests/Command/ListCommandTest.php
  56. +0 −67 local/classes/Bundles/TaskSchedulerBundle/Tests/Command/RunCommandTest.php
  57. +0 −35 ...lasses/Bundles/TaskSchedulerBundle/Tests/DependencyInjection/Compiler/EventDispatcherPassTest.php
  58. +0 −51 local/classes/Bundles/TaskSchedulerBundle/Tests/DependencyInjection/Compiler/TaskPassTest.php
  59. +0 −25 local/classes/Bundles/TaskSchedulerBundle/Tests/DependencyInjection/ContainerAwareTest.php
  60. +0 −22 local/classes/Bundles/TaskSchedulerBundle/Tests/Event/DummySubscriber.php
  61. +0 −22 local/classes/Bundles/TaskSchedulerBundle/Tests/Event/EventDispatcherTest.php
  62. +0 −46 local/classes/Bundles/TaskSchedulerBundle/Tests/EventSubscriberMock.php
  63. +0 −133 local/classes/Bundles/TaskSchedulerBundle/Tests/Task/ScheduleTest.php
  64. +0 −24 local/classes/Bundles/TaskSchedulerBundle/Tests/Task/ScheduledTask.php
  65. +0 −75 local/classes/Bundles/TaskSchedulerBundle/Tests/Task/SchedulerTest.php
  66. +0 −26 local/classes/Bundles/TaskSchedulerBundle/Tests/Task/Task.php
  67. +0 −29 local/classes/Bundles/TaskSchedulerBundle/Tests/TaskMock.php
  68. +30 −0 local/classes/ComposerScript/CacheWarmerHandler.php
  69. +25 −0 local/classes/ComposerScript/RunMigrationsHandler.php
  70. +0 −150 local/classes/Services/Bitrix/AddElement.php
  71. +0 −16 local/classes/Services/Bitrix/Exceptions/IblockModelDuplicateException.php
  72. +0 −16 local/classes/Services/Bitrix/Exceptions/IblockModelException.php
  73. +0 −19 local/classes/Services/Filesystem/Interfaces/LeagueFilesystemAdapterInterface.php
  74. +0 −50 local/classes/Services/Filesystem/LocalLeagueFilesystemAdapter.php
  75. +0 −3 local/configs/packages.unused/bitrix_utils.yaml
  76. +0 −5 local/configs/packages/argument_resolvers.yaml
  77. +0 −8 local/configs/packages/automapper_plus.yaml
  78. +0 −13 local/configs/packages/bitrix-fixture-generator.yaml
  79. +0 −6 local/configs/packages/bitrix_og_graph.yaml
  80. +0 −30 local/configs/packages/csa_guzzle.yaml
  81. +9 −1 local/configs/packages/framework.yaml
  82. +0 −10 local/configs/packages/request_log.yaml
  83. +0 −4 local/configs/packages/symfony_blade.yaml
  84. +0 −21 local/configs/packages/symfony_mailer.yaml
  85. +0 −6 local/configs/packages/url_signer.yaml
  86. +0 −1 local/configs/services.yaml
  87. +0 −5 local/configs/services/bitrix.yaml
  88. +0 −20 local/configs/services/filesystem.yaml
  89. +1 −1 local/configs/services/tasks.yaml
  90. +5 −28 local/configs/standalone_bundles.php
  91. +4 −3 local/php_interface/events.php
  92. +3 −7 local/php_interface/init.php
  93. +0 −8 local/php_interface/symfony_events.php
  94. +37 −37 package.json
  95. +3 −15 webpack.config.js
  96. +1 −8 webpack.parts.js
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -14,3 +14,15 @@ DATABASE_URL=mysql://root:@localhost/sitemanager1

# Путь до лог-файла
LOG_FILE_PATH=/home/bitrix/logs/app.log

# При использовании Symfony Messanger
#MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages

# Насильное переопределение переменных в $_SERVER (для CLI)
#HTTPS=off
#HTTP_HOST=bitrix-example.loc
#SERVER_NAME=bitrix-example.loc

# Путь к DOCUMENT_ROOT относительно корня сайта (для CLI)
# Если не задано, то будет считать путем '/bin/..'
RELATIVE_DOCUMENT_ROOT_PATH="/sites/s1"
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -21,14 +21,7 @@ hosts.yml
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/
/local/classes/ServiceProvider/cache/
/bitrix/

/composer.lock
composer.lock

/local/components/bbc
/local/modules/bex.bbc
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020-2021 Fedor Gavrilov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -55,6 +55,13 @@ git submodule update

Или настроить его иным способом (через git submodule ad).

#### ВАЖНО

Перед этой процедурой обновить `include.php` в `environments/*/bitrix/modules/main`, на актуальный из сабмодуля
или устанавливаемого иным способом Битрикса.

После этого рекомендуется сделать еще разок `composer update` дабы подтянулись битриксовые модули.

### Символьные ссылки

В директорию `sites/s1` перенести публичные файлы сайта.
@@ -88,8 +95,7 @@ php bin/jedi env:init default

Эта команда скопирует в директорию `bitrix` системные файлы настроек сконфигурированные для работы с
[переменными окружения](https://github.com/vlucas/phpdotenv), а также настройки
[шаблонизатора Twig](https://github.com/maximaster/tools.twig)
и [логгера Monolog](https://github.com/bitrix-expert/monolog-adapter)
[шаблонизатора Twig](https://github.com/maximaster/tools.twig).

### Миграции

@@ -216,3 +222,48 @@ mklink "upload" "../../upload" /j
```

Далее необходимо настроить веб-сервер для работы с новым сайтом.

## Composer scripts

Приложено пару примеров скриптов для composer, запускающимся по событиям `post-update` и `post-install`.

- `Local\ComposerScript\RunMigrationsHandler` - запускает миграции.

- `Local\ComposerScript\CacheWarmerHandler` - убивает и прогревает кэш.

Добавить в секцию `scripts` файла `composer.json`:

```json
"scripts": {
"post-update-cmd": [
"Local\\ComposerScript\\RunMigrationsHandler::doInstall",
"Local\\ComposerScript\\CacheWarmerHandler::doInstall"
],
"post-install-cmd": [
"Local\\ComposerScript\\RunMigrationsHandler::doInstall",
"Local\\ComposerScript\\CacheWarmerHandler::doInstall"
],
"cache:warm": "Local\\ComposerScript\\CacheWarmerHandler::doInstall",
"migrations:run": "Local\\ComposerScript\\RunMigrationsHandler::doInstall"
},
```

Появятся команды:

```sh
composer cache:warm
```

и

```sh
composer migrations:run
```

## Прочее

- Пришлось залочить пакет `psr/container` на версию 1.0. Без этого ставился 1.1.1 (по запросу Symfony DI)
и конструкция падала из-за несоответствия интерфейсов.

Последствия: DI компонент пока версии 5.2, а не актуальной 5.3.

44 changes: 39 additions & 5 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,18 +1,52 @@
#!/usr/bin/env php
<?php

use Prokl\FrameworkExtensionBundle\Services\Bitrix\LoaderBitrix;
use Prokl\CustomFrameworkExtensionsBundle\Services\Console\ConsoleCommandConfigurator;
use Symfony\Component\Dotenv\Dotenv;

@set_time_limit(0);

$_SERVER['DOCUMENT_ROOT'] = __DIR__. DIRECTORY_SEPARATOR . '..';
$GLOBALS['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'];
/** @var array $autoloadPaths Пути, где искать autoload.php композера. */
$autoloadPaths = ['/../vendor/autoload.php', '/../../current/vendor/autoload.php'];
$autoloadPath = '';

$autoloadPath = $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
foreach ($autoloadPaths as $path) {
if (file_exists($autoloadPath = realpath(__DIR__) . $path)) {
$autoloadPath = realpath(__DIR__) . $path;
break;
}
}

if (!$autoloadPath) {
die('Cannot find composer autoload.php file.' . PHP_EOL);
}

/** @noinspection PhpIncludeInspection */
require_once $autoloadPath;

$dotenv = new Dotenv();

$envFile = realpath(__DIR__.'/../') . '/.env';

if (!file_exists($envFile)) {
die('Cannot find .env file by path: ' . realpath(__DIR__.'/../' . PHP_EOL));
}
$dotenv->load($envFile);

// Попытка определить DOCUMENT_ROOT.
$documentRoot = __DIR__. '/..';
if (array_key_exists('RELATIVE_DOCUMENT_ROOT_PATH', $_ENV)) {
$documentRoot = realpath(__DIR__.'/..') . $_ENV['RELATIVE_DOCUMENT_ROOT_PATH'];
if (!file_exists($documentRoot)) {
die(
'Path to root ' . $_ENV['RELATIVE_DOCUMENT_ROOT_PATH'] . ' from RELATIVE_DOCUMENT_ROOT_PATH variable not exists' . PHP_EOL
);
}
}

$_SERVER['DOCUMENT_ROOT'] = $documentRoot;
$GLOBALS['DOCUMENT_ROOT'] = $documentRoot;

/**
* Загрузить Битрикс.
*/
@@ -21,7 +55,7 @@ $loaderBitrix->setDocumentRoot($_SERVER['DOCUMENT_ROOT']);
$loaderBitrix->initializeBitrix();

if (!$loaderBitrix->isBitrixLoaded()) {
exit('Bitrix not initialized.');
exit('Bitrix not initialized.' . PHP_EOL);
}

if (!container()->has('console.command.manager')) {
30 changes: 24 additions & 6 deletions bin/db
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
#!/usr/bin/env php
<?php

use Symfony\Component\Console\Application;
use Prokl\DbCommands\Commands\DbDrop;
use Prokl\DbCommands\Commands\DbExport;
use Prokl\DbCommands\Commands\DbImport;
use Prokl\DbCommands\Configurator\ConsoleCommandConfiguratorSimple;
use Symfony\Component\Console\Application;

@set_time_limit(0);

$_SERVER['DOCUMENT_ROOT'] = __DIR__. DIRECTORY_SEPARATOR . '..';
$GLOBALS['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'];
/** @var array $autoloadPaths Пути, где искать autoload.php композера. */
$autoloadPaths = ['/../vendor/autoload.php',
'/../../current/vendor/autoload.php',
'/../../../vendor/autoload.php',
'/../../../../vendor/autoload.php',

];
$autoloadPath = '';

$autoloadPath = $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
foreach ($autoloadPaths as $path) {
if (file_exists($autoloadPath = realpath(__DIR__) . $path)) {
$autoloadPath = realpath(__DIR__) . $path;
break;
}
}

if (!$autoloadPath) {
die('Cannot find composer autoload.php file.' . PHP_EOL);
}

/** @noinspection PhpIncludeInspection */
require_once $autoloadPath;

// Считаю, что в данном случае DOCUMENT_ROOT находится на одном уровне с папкой vendor
$_SERVER['DOCUMENT_ROOT'] = $GLOBALS['DOCUMENT_ROOT'] = dirname($autoloadPath) . '/..';

$application = new ConsoleCommandConfiguratorSimple(
new Application(),
new DbImport(),
@@ -24,4 +42,4 @@ $application = new ConsoleCommandConfiguratorSimple(
);

$application->init();
$application->run();
$application->run();
30 changes: 23 additions & 7 deletions bin/jedi
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
#!/usr/bin/env php
<?php

use Local\ConsoleJedi\Application\Application;
use Prokl\JediLight\Application\Application;

@set_time_limit(0);

$_SERVER['DOCUMENT_ROOT'] = __DIR__. DIRECTORY_SEPARATOR . '..';
$GLOBALS['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'];
/** @var array $autoloadPaths Пути, где искать autoload.php композера. */
$autoloadPaths = ['/../vendor/autoload.php',
'/../../current/vendor/autoload.php',
'/../../../vendor/autoload.php'

$autoloadPath = $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
];
$autoloadPath = '';

foreach ($autoloadPaths as $path) {
if (file_exists($autoloadPath = realpath(__DIR__) . $path)) {
$autoloadPath = realpath(__DIR__) . $path;
break;
}
}

if (!$autoloadPath) {
die('Cannot find composer autoload.php file.' . PHP_EOL);
}

/** @noinspection PhpIncludeInspection */
require_once $autoloadPath;

// Считаю, что в данном случае DOCUMENT_ROOT находится на одном уровне с папкой vendor
$_SERVER['DOCUMENT_ROOT'] = $GLOBALS['DOCUMENT_ROOT'] = dirname($autoloadPath) . '/..';

$jediApplication = new Application();
$jediApplication->setDocumentRoot($_SERVER['DOCUMENT_ROOT']);

$jediApplication->run();

$jediApplication->run();
41 changes: 37 additions & 4 deletions bin/module
Original file line number Diff line number Diff line change
@@ -6,17 +6,50 @@ use ProklUng\ModuleGenerator\Utils\ConsoleCommandConfigurator;
use ProklUng\ModuleGenerator\Utils\LoaderBitrix;
use Symfony\Component\Console\Application;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Dotenv\Dotenv;

@set_time_limit(0);

$_SERVER['DOCUMENT_ROOT'] = __DIR__ . DIRECTORY_SEPARATOR . '..';
$GLOBALS['DOCUMENT_ROOT'] = $_SERVER['DOCUMENT_ROOT'];
/** @var array $autoloadPaths Пути, где искать autoload.php композера. */
$autoloadPaths = ['/../vendor/autoload.php', '/../../current/vendor/autoload.php'];
$autoloadPath = '';

$autoloadPath = $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
foreach ($autoloadPaths as $path) {
if (file_exists($autoloadPath = realpath(__DIR__) . $path)) {
$autoloadPath = realpath(__DIR__) . $path;
break;
}
}

if (!$autoloadPath) {
die('Cannot find composer autoload.php file.' . PHP_EOL);
}

/** @noinspection PhpIncludeInspection */
require_once $autoloadPath;

$dotenv = new Dotenv();

$envFile = realpath(__DIR__.'/../') . '/.env';

if (!file_exists($envFile)) {
die('Cannot find .env file by path: ' . realpath(__DIR__.'/../' . PHP_EOL));
}
$dotenv->load($envFile);

// Попытка определить DOCUMENT_ROOT.
$documentRoot = __DIR__. '/..';
if (array_key_exists('RELATIVE_DOCUMENT_ROOT_PATH', $_ENV)) {
$documentRoot = realpath(__DIR__.'/..') . $_ENV['RELATIVE_DOCUMENT_ROOT_PATH'];
if (!file_exists($documentRoot)) {
die(
'Path to root ' . $_ENV['RELATIVE_DOCUMENT_ROOT_PATH'] . ' from RELATIVE_DOCUMENT_ROOT_PATH variable not exists' . PHP_EOL
);
}
}

$_SERVER['DOCUMENT_ROOT'] = $documentRoot;
$GLOBALS['DOCUMENT_ROOT'] = $documentRoot;

/**
* Загрузить Битрикс.
*/
Loading