Views: 5892
Last Modified: 14.02.2023

  Folder for custom development

To make developer's life more convenient, main user project files were moved from the folder /bitrix into the folder /local starting starting from the code D7 main module version 14.0.1. Essentially, a single folder /bitrix is enough to be added into exceptions.

Which folders are processed in /local?
  • activities - workflow activities;
  • components - components;
  • modules - modules;
  • php_interface - init.php, folder user_lang;
  • templates - site templates, component templates, page templates;
  • blocks - Sites24 blocks.
  • routes - file with configuration for routing paths

When processing folders, priority is always given to the /local folder before /bitrix. It means that if /local/templates/ and /bitrix/templates/ contain site templates with the same name, the system connects the template from /local.

Note: It's not recommended to copy entities with the same name into both folders. The more correct solution - is to move entities from one folder to another. When copying, the system will still operate correctly; however there is a significant likelihood to create confusion in developer's work.

  Moving a project

How to move an old project into the /local folder.

You have an old and already running project. Who modified and updated it - is unknown, where adjustments were made - is unknown as well. Your task is to clean it up.

  1. First, use Project Quality Control that has check for kernel files modification. This test helps to determine, which files were updated.
  2. Next, create the /local folder, and do not create the file /local/php_interface/init.php, but only create /local/php_interface/constants.php, /local/php_inteface/events.php, autoloader for your classes and etc., and connect these files in /bitrix/php_interface/init.php.
  3. Start gradually moving your modified templates into /local/templates/.default, with the following actions: copy into local with another name, work with test page (if there are no test server available). Next, replace name and delete (or rename) old template from your template folder. This way, new template (cleaned up and ready for use) will gradually be assembled in local. As soon as all templates and components are moved into /local; init.php also can be moved.
  4. Component handling is different: if these components are your native components, they can be moved as is (nothing will change from it). Modified standard components must be copied first from main core and then modifications compared and updates introduced.
  5. Direct links in templates and components must be replaced to /bitrix/templates/**, /bitrix/components/** and /local/**. Also, attentively check modules as well and, if required, move them as well.

It's impossible to state, how much time is required for this process. It all depends on how the project is "undermaintained". However, existing developer experience stipulates that these actions can take up to several weeks.

Courses developed by Bitrix24