diff --git a/en/building-sites/resources/custom-resources.md b/en/building-sites/resources/custom-resources.md index bb2683aee..1494e9cf2 100644 --- a/en/building-sites/resources/custom-resources.md +++ b/en/building-sites/resources/custom-resources.md @@ -4,7 +4,7 @@ _old_id: "79" _old_uri: "2.x/developing-in-modx/advanced-development/custom-resource-classes" --- -Custom Resource Classes are available in MODX 2.2 and later only. +Custom Resource Classes (CRC) shipped in MODX 2.2. They still work in 3.x. Create and update processors moved with the rest of the core processors. See [Processors on MODX 3](#processors-on-modx-3) below. ## What is a Custom Resource Class? @@ -31,6 +31,21 @@ CRCs look like normal Resources in the tree. The CRC class can also hook into th CRCs can have their Controllers, Processors and main rendering functionality extended and overridden. You can, for example, automatically append text to the output of any CRC's content by overriding the process() or getContent() method of the CRC in the PHP class. Any method in the modResource class is available to be overridden when using CRCs. +## Processors on MODX 3 + +When you create or update a CRC, `MODX\Revolution\Processors\Resource\Create::getInstance()` looks for `{class_key}CreateProcessor`. The update processor looks for `{class_key}UpdateProcessor`. Your subclass must extend the core Resource processor. + +In 2.x those core classes lived at `core/model/modx/processors/resource/create.class.php` (`modResourceCreateProcessor`) and `update.class.php` (`modResourceUpdateProcessor`). Those files are gone. A `require_once` of those paths fails. + +| Old class | New class | +| --- | --- | +| `modResourceCreateProcessor` | `\MODX\Revolution\Processors\Resource\Create` | +| `modResourceUpdateProcessor` | `\MODX\Revolution\Processors\Resource\Update` | + +`core/include/deprecated.php` aliases the old names until 3.3. For 3.0+ only, extend the namespaced classes. `runProcessor('resource/create')` still works. + +See [Step 4: Customizing the Processors](extending-modx/custom-resources/step-4-processors) and [Processors in the 3.0 upgrade notes](getting-started/upgrading-to-3.0/processors). + ## Creating a CRC Please follow the tutorial on [Creating a Resource Class](extending-modx/custom-resources "Creating a Resource Class"). diff --git a/en/extending-modx/custom-resources/index.md b/en/extending-modx/custom-resources/index.md index d55e9fe9d..c393b6eb8 100644 --- a/en/extending-modx/custom-resources/index.md +++ b/en/extending-modx/custom-resources/index.md @@ -11,6 +11,8 @@ _old_uri: "2.x/developing-in-modx/advanced-development/custom-resource-classes/c - [Part III: Customizing the Controllers](extending-modx/custom-resources/step-3-controllers "Creating a Resource Class - Step 3") - [Part IV: Customizing the Processors](extending-modx/custom-resources/step-4-processors "Creating a Resource Class - Step 4") +On MODX 3, skip the 2.x `require_once` paths under `core/model/modx/processors/resource/`. Extend `\MODX\Revolution\Processors\Resource\Create` and `Update`. Details are in [Step 4](extending-modx/custom-resources/step-4-processors) and on [Custom Resource Classes](building-sites/resources/custom-resources). + We're going to create a sample Custom Resource Class (CRC) that does a very simple task - it outputs a copyright on the bottom of a page with the current date. Yes, something this trivial should be done by placing a [Snippet](extending-modx/snippets "Snippets") in your [Template](building-sites/elements/templates "Templates"), but we want to illustrate the concept of CRCs using something very, very simple, so bear with us. :) This page deals with Part I - creating the actual Custom Resource Class itself. [Part II](extending-modx/custom-resources/step-2-overriding-methods "Creating a Resource Class - Step 2") will actually implement the behavior of appending the copyright. [Part III](extending-modx/custom-resources/step-3-controllers "Creating a Resource Class - Step 3") will deal with overriding the Controllers, and [Part IV](extending-modx/custom-resources/step-4-processors "Creating a Resource Class - Step 4") will deal with overriding the Processors. The files used in this tutorial can be found on GitHub for reference: diff --git a/en/extending-modx/custom-resources/step-4-processors.md b/en/extending-modx/custom-resources/step-4-processors.md index 3c4ad563d..ad00f1974 100644 --- a/en/extending-modx/custom-resources/step-4-processors.md +++ b/en/extending-modx/custom-resources/step-4-processors.md @@ -13,9 +13,37 @@ _old_uri: "2.x/developing-in-modx/advanced-development/custom-resource-classes/c This is a bit of bonus material to help identify some of the things you can do by extending the default processors. +## MODX 3.x class names + +When you create or update a CRC, `MODX\Revolution\Processors\Resource\Create::getInstance()` looks for `{class_key}CreateProcessor`. The update processor looks for `{class_key}UpdateProcessor`. Those classes must extend the core resource processors. + +The 2.x files `core/model/modx/processors/resource/create.class.php` and `update.class.php` are gone. Do not `require_once` those paths. + +| Old class | New class | +| --- | --- | +| `modResourceCreateProcessor` | `\MODX\Revolution\Processors\Resource\Create` | +| `modResourceUpdateProcessor` | `\MODX\Revolution\Processors\Resource\Update` | + +`core/include/deprecated.php` aliases the old names until 3.3. For 3.0+ only, extend the namespaced classes: + +``` php +use MODX\Revolution\Processors\Resource\Create; +use MODX\Revolution\Processors\Resource\Update; + +class CopyrightedResourceCreateProcessor extends Create +{ +} + +class CopyrightedResourceUpdateProcessor extends Update +{ +} +``` + +See [Processors in the 3.0 upgrade notes](getting-started/upgrading-to-3.0/processors). + ## Extending the Processors for our CRC - Extending the Processors for our CopyrightedResource is fairly simple. Load up your **copyrightedresource.class.php** file that contains your main class, and at the top, put this: + Extending the Processors for our CopyrightedResource is fairly simple. On MODX 2.x, load up your **copyrightedresource.class.php** file that contains your main class, and at the top, put this: ``` php require_once MODX_CORE_PATH.'model/modx/modprocessor.class.php'; @@ -23,7 +51,7 @@ require_once MODX_CORE_PATH.'model/modx/processors/resource/create.class.php'; require_once MODX_CORE_PATH.'model/modx/processors/resource/update.class.php'; ``` - This tells MODX to load some base classes that we'll need – yes, we're sort of double-dipping here. Because our main class file is on MODX's radar and will be included when MODX loads, we just can require more files from there. At the bottom of the same file, after your CopyrightedResource class, put this: + This tells MODX to load some base classes that we'll need. Because our main class file is on MODX's radar and will be included when MODX loads, we just can require more files from there. At the bottom of the same file, after your CopyrightedResource class, put this: ``` php class CopyrightedResourceCreateProcessor extends modResourceCreateProcessor { @@ -32,6 +60,8 @@ class CopyrightedResourceUpdateProcessor extends modResourceUpdateProcessor { } ``` + On 3.x skip those `require_once` lines and extend `\MODX\Revolution\Processors\Resource\Create` and `Update` instead, as shown above. + Now we've overridden the processors for our class; MODX will automatically use these classes as the processor class when creating or updating our CRC. We can then override methods to provide custom functionality for our CopyrightedResource class. For example, here is a stub for our CopyrightedResource class and the Update processor that shows some methods that you could override: ``` php diff --git a/en/getting-started/maintenance/upgrading.md b/en/getting-started/maintenance/upgrading.md index 066f4763a..0cbe0c10a 100644 --- a/en/getting-started/maintenance/upgrading.md +++ b/en/getting-started/maintenance/upgrading.md @@ -6,7 +6,7 @@ _old_uri: "2.x/administering-your-site/upgrading-modx" This document covers the standard process for upgrading an existing MODX Revolution installation (typically within the 3.x line, or from a recent 2.x site after you have planned for 3.0 changes). -- Upgrading **from 2.x to 3.0+**: read [Upgrading from 2.x to 3.0](getting-started/upgrading-to-3.0) first — namespaces, processors, the fixed core path, and PHP requirements all change. +- Upgrading **from 2.x to 3.0+**: Setup only accepts **2.6.0 or later**. Read [Upgrading from 2.x to 3.0](getting-started/upgrading-to-3.0) first. Namespaces, processors, the fixed core path, and PHP requirements all change. - Confirm your host meets current [Server Requirements](getting-started/server-requirements). **MODX 3.2+ requires PHP 8.1 or higher** (3.0 originally allowed PHP 7.2+). - Upgrading from Evolution (1.x) is not officially supported; historical notes are [here](getting-started/maintenance/upgrading/evolution). @@ -71,7 +71,7 @@ It's a good idea to clear your browser cache after upgrading. Browsers often cac For changes relating to specific versions, please see the following pages: -- [Upgrading from 2.x to 3.0](getting-started/upgrading-to-3.0) (required reading for any 2.x → 3.x move; includes the PHP 7.2 → **8.1 in 3.2** requirement notes) +- [Upgrading from 2.x to 3.0](getting-started/upgrading-to-3.0) (required reading for any 2.6+ to 3.x move; includes the PHP 7.2 to **8.1 in 3.2** requirement notes) - [Upgrading to 2.8.2 / 2.8.3](getting-started/maintenance/upgrading/2.8.2) (security-related behavioural changes still relevant before jumping to 3.x) - Historical 2.x notes: [2.3](getting-started/maintenance/upgrading/2.3), [2.2](getting-started/maintenance/upgrading/2.2), [2.1](getting-started/maintenance/upgrading/2.1), [pre-2.0.5](getting-started/maintenance/upgrading/2.0.5), [2.0.0-rc2](getting-started/maintenance/upgrading/2.0.0-rc2) diff --git a/en/getting-started/upgrading-to-3.0/index.md b/en/getting-started/upgrading-to-3.0/index.md index c8778ca7b..05500f59c 100644 --- a/en/getting-started/upgrading-to-3.0/index.md +++ b/en/getting-started/upgrading-to-3.0/index.md @@ -11,16 +11,21 @@ This document details the changes made between 2.x and 3.0 that may affect upgra ## Upgrade to 3.0 -In general, you can follow the [standard upgrading process](getting-started/maintenance/upgrading) when upgrading to 3.0. It's recommended to first upgrade to the latest 2.8 release for some time, which will log deprecated functionality your site may depend on to the MODX log. +Setup only upgrades from **MODX 2.6.0 or later**. On 2.5 or older, upgrade to 2.6 first. Setup stops with a failure if the current version is below 2.6.0. + +After you are on 2.6+, follow the [standard upgrading process](getting-started/maintenance/upgrading). Then spend time on the latest **2.8** release before 3.0. 2.8 writes deprecated API use to the MODX log. Fix extras and custom code there, then jump to 3.0. After upgrading the core and upgrading your extras, you may encounter some breaking changes that need to be addressed in extras or custom code. +- ⚠️ Important: upgrades from MODX older than **2.6.0** are not supported - ⚠️ Important: [the core folder must now always be located in the project root, and can no longer be renamed](getting-started/upgrading-to-3.0/core-folder) - ⚠️ Important: [MODX 3.0 required PHP 7.2; current 3.x (3.2+) requires PHP 8.1+](getting-started/upgrading-to-3.0/requirements) - ⚠️ Important: [sqlsrv support has been removed](getting-started/upgrading-to-3.0/sqlsrv) - [A list of breaking changes can be found here](getting-started/upgrading-to-3.0/breaking-changes), most notably [many core classes have been moved and renamed](getting-started/upgrading-to-3.0/class-names) - [The manager language is now dynamic](getting-started/upgrading-to-3.0/manager-language) - [Various system settings have been removed or changed](getting-started/upgrading-to-3.0/system-settings) +- [Notable manager UI changes in 3.0](getting-started/upgrading-to-3.0/manager-ui) +- Custom resource types that extend core Resource processors: [Processors](getting-started/upgrading-to-3.0/processors) and [Custom Resource Classes](building-sites/resources/custom-resources) ## Other notable changes and improvements diff --git a/en/getting-started/upgrading-to-3.0/manager-ui.md b/en/getting-started/upgrading-to-3.0/manager-ui.md new file mode 100644 index 000000000..945dec4a0 --- /dev/null +++ b/en/getting-started/upgrading-to-3.0/manager-ui.md @@ -0,0 +1,36 @@ +--- +title: Notable manager UI in 3.0 +--- + +The 3.0 manager is still ExtJS. The skin, spacing, and a set of forms changed. This page records those UI notes. Feature how-tos (login backgrounds, language switching, dashboards) live on their own pages. + +## Already documented elsewhere + +- Redesigned [manager login](building-sites/client-proofing/manager-login), including custom backgrounds. [#13773](https://github.com/modxcms/revolution/pull/13773) +- Redesigned installer. [#14507](https://github.com/modxcms/revolution/pull/14507) +- [On-the-fly manager language](getting-started/upgrading-to-3.0/manager-language). [#14046](https://github.com/modxcms/revolution/pull/14046) +- Media browser and manager layout on smaller screens. [#14700](https://github.com/modxcms/revolution/pull/14700), [#14735](https://github.com/modxcms/revolution/pull/14735) +- Chrome in-page translation is blocked in the manager. [#14414](https://github.com/modxcms/revolution/pull/14414) +- Gravatar is off on new installs. See [system settings in 3.0](getting-started/upgrading-to-3.0/system-settings). [#14215](https://github.com/modxcms/revolution/pull/14215) + +## Tooltips + +Form fields with a description show ExtJS QuickTips on the field and on its label. + +- `manager_tooltip_enable` (Yes/No, default Yes) turns those tooltips on or off. +- `manager_tooltip_delay` (number, default 2300) is milliseconds before a tooltip hides. The manager passes it to QuickTips as `dismissDelay`. + +Media Browser image previews use `modx_browser_tree_hide_tooltips`, not these two settings. [#14535](https://github.com/modxcms/revolution/pull/14535) + +## Profile and resource forms + +- User profile screens share one layout. [#14731](https://github.com/modxcms/revolution/pull/14731), [#14420](https://github.com/modxcms/revolution/pull/14420) +- Resource settings and the Quick Update Resource window use the same field layout. [#14726](https://github.com/modxcms/revolution/pull/14726) +- Template and TV forms put the TV tab before Settings. Resource editing does the same for TVs. [#14251](https://github.com/modxcms/revolution/pull/14251), [#14250](https://github.com/modxcms/revolution/pull/14250) +- Grid "New" buttons follow one pattern. [#14312](https://github.com/modxcms/revolution/pull/14312) + +## Other manager behaviour + +- System Info, Database tables: a success notice after a table operation. [#14525](https://github.com/modxcms/revolution/pull/14525) +- The top search bar (uberbar) trims spaces at both ends of the query. [#14523](https://github.com/modxcms/revolution/pull/14523) +- Manager CSS starts from normalize.css. [#14369](https://github.com/modxcms/revolution/pull/14369) diff --git a/en/getting-started/upgrading-to-3.0/processors.md b/en/getting-started/upgrading-to-3.0/processors.md index cd630ce26..0f412f102 100644 --- a/en/getting-started/upgrading-to-3.0/processors.md +++ b/en/getting-started/upgrading-to-3.0/processors.md @@ -37,6 +37,21 @@ To help ease with the transition to 3.0, the old class names are automatically m Any call to a core processor will need to be reviewed. The old action names in [modX::runProcessor](extending-modx/modx-class/reference/modx.runprocessor) (e.g. `resource/create`) are still supported, but it is possible that the internal logic of some processors has changed. +## Custom resource types (CRC) + +If a custom resource class defines `{ClassKey}CreateProcessor` or `{ClassKey}UpdateProcessor`, the core resource processors instantiate that class instead of themselves. Custom resource types that extend those processors must follow the 3.x class names. + +In 2.x the core classes lived at `core/model/modx/processors/resource/create.class.php` (`modResourceCreateProcessor`) and `update.class.php` (`modResourceUpdateProcessor`). Those files are gone. + +| Old class | New class | +| ------------------------------- | ----------------------------------------------- | +| `\modResourceCreateProcessor` | `\MODX\Revolution\Processors\Resource\Create` | +| `\modResourceUpdateProcessor` | `\MODX\Revolution\Processors\Resource\Update` | + +`core/include/deprecated.php` aliases the old names until 3.3. A `require_once` of the 2.x paths fails. + +See [Custom Resource Classes](building-sites/resources/custom-resources) and [Step 4: Customizing the Processors](extending-modx/custom-resources/step-4-processors). + ## Flat-file processors no longer supported Support for so-called flat-file processors (which end in `.php` rather than `.class.php` and don't use a processor class) has been removed. diff --git a/nl/aan-de-slag/upgraden-naar-3.0.md b/nl/aan-de-slag/upgraden-naar-3.0.md index ad8b4120d..95fbbc26e 100644 --- a/nl/aan-de-slag/upgraden-naar-3.0.md +++ b/nl/aan-de-slag/upgraden-naar-3.0.md @@ -10,16 +10,21 @@ Dit document beschrijft de belangrijkste wijzigingen tussen 2.x en 3.0 die upgra ## Upgraden naar 3.0 -In het algemeen volg je het [standaard upgradeproces](aan-de-slag/upgraden). Het is verstandig om eerst een tijd op de nieuwste 2.8-release te draaien: die logt deprecated functionaliteit waar je site van afhankelijk kan zijn naar het MODX-log. +Setup upgrade alleen vanaf **MODX 2.6.0 of nieuwer**. Zit je op 2.5 of ouder, ga dan eerst naar 2.6. Setup stopt met een fout als de huidige versie lager is dan 2.6.0. + +Ben je op 2.6+, volg dan het [standaard upgradeproces](aan-de-slag/upgraden). Draai zo mogelijk eerst de nieuwste **2.8**: die logt deprecated API-gebruik naar het MODX-log, zodat je extras en custom code kunt bijwerken vóór 3.0. Na het upgraden van de core en je extras kun je breaking changes tegenkomen in extras of custom code. +- Belangrijk: upgrades vanaf MODX ouder dan **2.6.0** worden niet ondersteund - Belangrijk: [de core-map moet in de projectroot staan en kan niet meer hernoemd worden](#core-map) - Belangrijk: [MODX 3.0 vroeg PHP 7.2; huidige 3.x (3.2+) vraagt PHP 8.1+](#serververeisten) - Belangrijk: [sqlsrv-ondersteuning is verwijderd](#sqlsrv) - [Breaking changes](#belangrijkste-breaking-changes), vooral [hernoemde en verplaatste core classes](/current/en/getting-started/upgrading-to-3.0/class-names) - [Manager-taal is dynamisch (EN)](/current/en/getting-started/upgrading-to-3.0/manager-language) - [Systeeminstellingen gewijzigd of verwijderd (EN)](/current/en/getting-started/upgrading-to-3.0/system-settings) +- [Opvallende manager-UI in 3.0 (EN)](/current/en/getting-started/upgrading-to-3.0/manager-ui) +- Custom resource types die core Resource-processors uitbreiden: [Processors (EN)](/current/en/getting-started/upgrading-to-3.0/processors) Uitgebreide details per onderwerp staan in de [Engelstalige upgrade-sectie](/current/en/getting-started/upgrading-to-3.0). @@ -101,7 +106,7 @@ Ondersteuning voor sqlsrv-databases is verwijderd. Migreer eerst naar MySQL: [sq ## Aanbevolen volgorde 1. Backup van bestanden en database -2. Upgrade naar nieuwste 2.8 en check de MODX-logs op deprecation-warnings +2. Zit je onder 2.6, upgrade eerst naar 2.6. Daarna naar de nieuwste 2.8 en check de MODX-logs op deprecation-warnings 3. Upgrade extras die 3.x ondersteunen; check [SiteDash](https://sitedash.app/extras) 4. Zorg voor PHP 8.1+ (voor huidige 3.x) en MySQL/MariaDB volgens de [server vereisten](aan-de-slag/server-vereisten) 5. Zet een custom core terug naar `/core/` indien van toepassing diff --git a/nl/aan-de-slag/upgraden.md b/nl/aan-de-slag/upgraden.md index 088967bea..869a5431e 100644 --- a/nl/aan-de-slag/upgraden.md +++ b/nl/aan-de-slag/upgraden.md @@ -6,7 +6,7 @@ translation: "getting-started/maintenance/upgrading" Dit beschrijft het standaardproces om een bestaande MODX Revolution-installatie te upgraden (meestal binnen de 3.x-lijn, of vanaf een recente 2.x-site nadat je de 3.0-wijzigingen hebt gepland). -- Upgraden **van 2.x naar 3.0+**: lees eerst [Upgraden van 2.x naar 3.0](aan-de-slag/upgraden-naar-3.0). Namespaces, processors, het vaste core-pad en PHP-eisen veranderen. +- Upgraden **van 2.x naar 3.0+**: setup accepteert alleen **2.6.0 of nieuwer**. Lees eerst [Upgraden van 2.x naar 3.0](aan-de-slag/upgraden-naar-3.0). Namespaces, processors, het vaste core-pad en PHP-eisen veranderen. - Controleer of je host voldoet aan de huidige [server vereisten](aan-de-slag/server-vereisten). **MODX 3.2+ vereist PHP 8.1 of hoger** (3.0 stond oorspronkelijk PHP 7.2+ toe). - Upgraden vanaf Evolution (1.x) wordt niet officieel ondersteund; historische notes: [Evolution (EN)](/current/en/getting-started/maintenance/upgrading/evolution). diff --git a/ru/building-sites/resources/custom-resources.md b/ru/building-sites/resources/custom-resources.md index 0c908f9b8..206d6a4c5 100644 --- a/ru/building-sites/resources/custom-resources.md +++ b/ru/building-sites/resources/custom-resources.md @@ -3,7 +3,7 @@ title: "Пользовательские классы ресурсов" translation: "building-sites/resources/custom-resources" --- -Пользовательские классы ресурсов доступны только в MODX 2.2 и более поздних версиях. +Пользовательские классы ресурсов (CRC) появились в MODX 2.2. В 3.x они работают. Процессоры создания и обновления переехали вместе с остальными процессорами ядра. См. [Процессоры в MODX 3](#процессоры-в-modx-3) ниже. ## Что такое пользовательский класс ресурсов? @@ -30,6 +30,21 @@ translation: "building-sites/resources/custom-resources" Контроллеры, процессоры и основные функции рендеринга могут быть расширены и переопределены. Например, вы можете автоматически добавлять текст к выводу любого содержимого пользовательских классов ресурсов, переопределяя метод `process()` или `getContent()` CRC в классе PHP. Любой метод в классе `modResource` доступен для переопределения при использовании пользовательских классов ресурсов. +## Процессоры в MODX 3 + +При создании или обновлении CRC метод `MODX\Revolution\Processors\Resource\Create::getInstance()` ищет класс `{class_key}CreateProcessor`. Процессор обновления ищет `{class_key}UpdateProcessor`. Ваш подкласс должен расширять основной процессор Resource. + +В 2.x эти классы лежали в `core/model/modx/processors/resource/create.class.php` (`modResourceCreateProcessor`) и `update.class.php` (`modResourceUpdateProcessor`). Этих файлов больше нет. `require_once` этих путей падает. + +| Старый класс | Новый класс | +| --- | --- | +| `modResourceCreateProcessor` | `\MODX\Revolution\Processors\Resource\Create` | +| `modResourceUpdateProcessor` | `\MODX\Revolution\Processors\Resource\Update` | + +`core/include/deprecated.php` даёт псевдонимы старых имён до 3.3. Для кода только под 3.0+ расширяйте классы с пространствами имён. `runProcessor('resource/create')` по-прежнему работает. + +См. [Шаг 4: Настройка процессоров](extending-modx/custom-resources/step-4-processors) и [процессоры в заметках об обновлении до 3.0](getting-started/upgrading-to-3.0/processors). + ## Создание Пользовательских классов ресурсов Пожалуйста, следуйте инструкциям на [Создание класса ресурса](extending-modx/custom-resources "Создание класса ресурса"). diff --git a/ru/extending-modx/custom-resources/index.md b/ru/extending-modx/custom-resources/index.md index b5bbcf499..10b853c00 100644 --- a/ru/extending-modx/custom-resources/index.md +++ b/ru/extending-modx/custom-resources/index.md @@ -10,6 +10,8 @@ translation: "extending-modx/custom-resources" - [Часть III: Настройка контроллеров](extending-modx/custom-resources/step-3-controllers "Creating a Resource Class - Step 3") - [Часть IV: Настройка процессоров](extending-modx/custom-resources/step-4-processors "Creating a Resource Class - Step 4") +В MODX 3 не подключайте пути 2.x из `core/model/modx/processors/resource/`. Расширяйте `\MODX\Revolution\Processors\Resource\Create` и `Update`. Подробности в [шаге 4](extending-modx/custom-resources/step-4-processors) и на странице [пользовательских классов ресурсов](building-sites/resources/custom-resources). + Мы собираемся создать пример пользовательского класса ресурсов (CRC), который выполняет очень простую задачу - он выводит информацию об авторском праве в нижней части страницы с текущей датой. Да, кое-что из этого должно быть сделано путем помещения [сниппета](extending-modx/snippets "Snippets") в ваш [шаблон](building-sites/elements/templates "Templates"), но мы хотим проиллюстрировать концепцию CRC, используя что-то очень, очень простое, так что оставайтесь с нами :) На этой странице рассматривается часть I - создание самого класса пользовательских ресурсов. [Часть II](extending-modx/custom-resources/step-2-overriding-methods "Creating a Resource Class - Step 2") фактически реализует поведение добавления авторского права. [Часть III](extending-modx/custom-resources/step-3-controllers "Creating a Resource Class - Step 3") будет иметь дело с переопределением контроллеров, а [часть IV](extending-modx/custom-resources/step-4-processors "Creating a Resource Class - Step 4") будет связана с переопределением процессоров. Файлы, используемые в этом руководстве, для справки можно найти на GitHub: [https://github.com/modxcms/CopyrightedResource](https://github.com/modxcms/CopyrightedResource) diff --git a/ru/extending-modx/custom-resources/step-4-processors.md b/ru/extending-modx/custom-resources/step-4-processors.md index e32ca656b..b6f0c1800 100644 --- a/ru/extending-modx/custom-resources/step-4-processors.md +++ b/ru/extending-modx/custom-resources/step-4-processors.md @@ -12,9 +12,37 @@ translation: "extending-modx/custom-resources/step-4-processors" Это небольшой бонусный материал, помогающий определить некоторые вещи, что можно сделать, расширяя стандартные процессоры. +## Имена классов в MODX 3.x + +При создании или обновлении CRC метод `MODX\Revolution\Processors\Resource\Create::getInstance()` ищет класс `{class_key}CreateProcessor`. Процессор обновления ищет `{class_key}UpdateProcessor`. Эти классы должны расширять основные процессоры ресурсов. + +Файлы 2.x `core/model/modx/processors/resource/create.class.php` и `update.class.php` удалены. Не подключайте их через `require_once`. + +| Старый класс | Новый класс | +| --- | --- | +| `modResourceCreateProcessor` | `\MODX\Revolution\Processors\Resource\Create` | +| `modResourceUpdateProcessor` | `\MODX\Revolution\Processors\Resource\Update` | + +`core/include/deprecated.php` даёт псевдонимы старых имён до 3.3. Для кода только под 3.0+ расширяйте классы с пространствами имён: + +```php +use MODX\Revolution\Processors\Resource\Create; +use MODX\Revolution\Processors\Resource\Update; + +class CopyrightedResourceCreateProcessor extends Create +{ +} + +class CopyrightedResourceUpdateProcessor extends Update +{ +} +``` + +См. [процессоры в заметках об обновлении до 3.0](getting-started/upgrading-to-3.0/processors). + ## Расширение процессоров для нашего CRC -Расширить процессоры для нашего CopyrightedResource довольно просто. Загрузите ваш файл **copyrightedresource.class.php**, содержащий ваш основной класс, и в верхней части поместите следующий код: +Расширить процессоры для нашего CopyrightedResource довольно просто. В MODX 2.x загрузите ваш файл **copyrightedresource.class.php**, содержащий ваш основной класс, и в верхней части поместите следующий код: ```php require_once MODX_CORE_PATH.'model/modx/modprocessor.class.php'; @@ -31,7 +59,9 @@ class CopyrightedResourceUpdateProcessor extends modResourceUpdateProcessor { } ``` -Теперь мы переопределили процессоры для нашего класса; MODX будет автоматически использовать эти классы в качестве класса процессора при создании или обновлении нашего CRC. Затем мы можем переопределить методы, чтобы обеспечить пользовательскую функциональность для нашего класса CopyrightedResource. Например, вот заглушка для нашего класса CopyrightedResource и процессора обновлений. Она показывает некоторые методы, которые вы можете переопределить: +В 3.x эти строки `require_once` не нужны. Расширяйте `\MODX\Revolution\Processors\Resource\Create` и `Update`, как показано выше. + +Теперь мы переопределили процессоры для нашего класса. MODX будет автоматически использовать эти классы в качестве класса процессора при создании или обновлении нашего CRC. Затем мы можем переопределить методы, чтобы обеспечить пользовательскую функциональность для нашего класса CopyrightedResource. Например, вот заглушка для нашего класса CopyrightedResource и процессора обновлений. Она показывает некоторые методы, которые вы можете переопределить: ```php class CopyrightedResourceUpdateProcessor extends modResourceUpdateProcessor { diff --git a/ru/getting-started/maintenance/upgrading.md b/ru/getting-started/maintenance/upgrading.md index c81fec91f..2a3dd79e5 100644 --- a/ru/getting-started/maintenance/upgrading.md +++ b/ru/getting-started/maintenance/upgrading.md @@ -5,7 +5,7 @@ translation: "getting-started/maintenance/upgrading" Этот документ описывает стандартный процесс обновления существующей установки MODX Revolution (обычно в линейке 3.x или с недавнего сайта 2.x после планирования изменений для 3.0). -- Обновление **с 2.x до 3.0+**: сначала прочитайте [Обновление с 2.x до 3.0](getting-started/upgrading-to-3.0). Меняются пространства имён, процессоры, фиксированный путь к core и требования к PHP. +- Обновление **с 2.x до 3.0+**: setup принимает только **2.6.0 и новее**. Сначала прочитайте [Обновление с 2.x до 3.0](getting-started/upgrading-to-3.0). Меняются пространства имён, процессоры, фиксированный путь к core и требования к PHP. - Убедитесь, что хостинг соответствует актуальным [требованиям к серверу](getting-started/server-requirements). **MODX 3.2+ требует PHP 8.1 или выше** (в 3.0 изначально допускался PHP 7.2+). - Обновление с Evolution (1.x) официально не поддерживается. Исторические заметки [здесь](getting-started/maintenance/upgrading/evolution). @@ -70,7 +70,7 @@ translation: "getting-started/maintenance/upgrading" Изменения для конкретных версий см. на следующих страницах: -- [Обновление с 2.x до 3.0](getting-started/upgrading-to-3.0) (обязательно при переходе 2.x → 3.x, включая заметки о PHP 7.2 → **8.1 в 3.2**) +- [Обновление с 2.x до 3.0](getting-started/upgrading-to-3.0) (обязательно при переходе с 2.6+ на 3.x, включая заметки о PHP 7.2 и **8.1 в 3.2**) - [Обновление до 2.8.2 / 2.8.3](getting-started/maintenance/upgrading/2.8.2) (изменения поведения, связанные с безопасностью, актуальны перед переходом на 3.x) - Исторические заметки по 2.x: [2.3](getting-started/maintenance/upgrading/2.3), [2.2](getting-started/maintenance/upgrading/2.2), [2.1](getting-started/maintenance/upgrading/2.1), [до 2.0.5](getting-started/maintenance/upgrading/2.0.5), [2.0.0-rc2](getting-started/maintenance/upgrading/2.0.0-rc2) diff --git a/ru/getting-started/upgrading-to-3.0/index.md b/ru/getting-started/upgrading-to-3.0/index.md index 31102d31d..f4f29b130 100644 --- a/ru/getting-started/upgrading-to-3.0/index.md +++ b/ru/getting-started/upgrading-to-3.0/index.md @@ -10,16 +10,21 @@ translation: "getting-started/upgrading-to-3.0" ## Обновление до 3.0 -В общем случае при обновлении до 3.0 можно следовать [стандартному процессу обновления](getting-started/maintenance/upgrading). Рекомендуется сначала обновиться до последнего релиза 2.8 и поработать на нём некоторое время. Он будет записывать в журнал MODX устаревший функционал, от которого зависит ваш сайт. +Установщик принимает обновление только с **MODX 2.6.0 и новее**. На 2.5 и старше сначала дойдите до 2.6. Если текущая версия ниже 2.6.0, setup останавливается с ошибкой. + +Когда вы уже на 2.6+, следуйте [стандартному процессу обновления](getting-started/maintenance/upgrading). Если можете, поработайте на последнем **2.8** перед 3.0. 2.8 пишет в журнал MODX вызовы устаревшего API, и вы успеете поправить дополнения и свой код. После обновления ядра и дополнений могут проявиться критические изменения, которые нужно исправить в дополнениях или своём коде. +- ⚠️ Важно: обновление с MODX старше **2.6.0** не поддерживается - ⚠️ Важно: [каталог core теперь всегда должен находиться в корне проекта и больше не может быть переименован](getting-started/upgrading-to-3.0/core-folder) - ⚠️ Важно: [MODX 3.0 требовал PHP 7.2, текущие 3.x (3.2+) требуют PHP 8.1+](getting-started/upgrading-to-3.0/requirements) - ⚠️ Важно: [поддержка sqlsrv удалена](getting-started/upgrading-to-3.0/sqlsrv) - [Список критических изменений](getting-started/upgrading-to-3.0/breaking-changes), в частности [многие классы ядра перенесены и переименованы](getting-started/upgrading-to-3.0/class-names) - [Язык менеджера теперь динамический](getting-started/upgrading-to-3.0/manager-language) - [Различные системные настройки удалены или изменены](getting-started/upgrading-to-3.0/system-settings) +- [Заметные изменения интерфейса менеджера в 3.0](getting-started/upgrading-to-3.0/manager-ui) +- Пользовательские типы ресурсов, которые расширяют процессоры Resource: [Процессоры](getting-started/upgrading-to-3.0/processors) и [пользовательские классы ресурсов](building-sites/resources/custom-resources) ## Другие заметные изменения и улучшения diff --git a/ru/getting-started/upgrading-to-3.0/manager-ui.md b/ru/getting-started/upgrading-to-3.0/manager-ui.md new file mode 100644 index 000000000..1b22b788c --- /dev/null +++ b/ru/getting-started/upgrading-to-3.0/manager-ui.md @@ -0,0 +1,37 @@ +--- +title: Заметные изменения интерфейса менеджера в 3.0 +translation: "getting-started/upgrading-to-3.0/manager-ui" +--- + +Менеджер 3.0 по-прежнему ExtJS. Сменились тема, отступы и часть форм. Здесь зафиксированы эти правки интерфейса. Инструкции по фичам (фон входа, язык, дашборды) живут на своих страницах. + +## Уже описано в других местах + +- Новый [вход в менеджер](building-sites/client-proofing/manager-login), включая свой фон. [#13773](https://github.com/modxcms/revolution/pull/13773) +- Новый установщик. [#14507](https://github.com/modxcms/revolution/pull/14507) +- [Язык менеджера на лету](getting-started/upgrading-to-3.0/manager-language). [#14046](https://github.com/modxcms/revolution/pull/14046) +- Медиабраузер и вёрстка менеджера на узких экранах. [#14700](https://github.com/modxcms/revolution/pull/14700), [#14735](https://github.com/modxcms/revolution/pull/14735) +- Встроенный перевод Chrome в менеджере отключён. [#14414](https://github.com/modxcms/revolution/pull/14414) +- Gravatar на новых установках выключен. См. [системные настройки в 3.0](getting-started/upgrading-to-3.0/system-settings). [#14215](https://github.com/modxcms/revolution/pull/14215) + +## Подсказки + +У полей с описанием ExtJS QuickTips показываются на поле и на подписи. + +- `manager_tooltip_enable` (Да/Нет, по умолчанию Да) включает или выключает эти подсказки. +- `manager_tooltip_delay` (число, по умолчанию 2300) задаёт миллисекунды до скрытия подсказки. Менеджер передаёт значение в QuickTips как `dismissDelay`. + +Превью картинок в Медиабраузере задаёт `modx_browser_tree_hide_tooltips`, не эти две настройки. [#14535](https://github.com/modxcms/revolution/pull/14535) + +## Профиль и формы ресурсов + +- Экраны профиля пользователя используют одну вёрстку. [#14731](https://github.com/modxcms/revolution/pull/14731), [#14420](https://github.com/modxcms/revolution/pull/14420) +- Настройки ресурса и окно быстрого обновления ресурса используют одну раскладку полей. [#14726](https://github.com/modxcms/revolution/pull/14726) +- В формах шаблона и TV вкладка TV стоит перед Настройками. В редактировании ресурса TV тоже стоят раньше. [#14251](https://github.com/modxcms/revolution/pull/14251), [#14250](https://github.com/modxcms/revolution/pull/14250) +- Кнопки «Создать» в таблицах приведены к одному шаблону. [#14312](https://github.com/modxcms/revolution/pull/14312) + +## Прочее поведение + +- Сведения о системе, таблицы базы данных: уведомление об успехе после операции с таблицей. [#14525](https://github.com/modxcms/revolution/pull/14525) +- Верхняя строка поиска (uberbar) обрезает пробелы с обоих концов запроса. [#14523](https://github.com/modxcms/revolution/pull/14523) +- CSS менеджера начинается с normalize.css. [#14369](https://github.com/modxcms/revolution/pull/14369) diff --git a/ru/getting-started/upgrading-to-3.0/processors.md b/ru/getting-started/upgrading-to-3.0/processors.md index 4e1b070fe..b1290418a 100644 --- a/ru/getting-started/upgrading-to-3.0/processors.md +++ b/ru/getting-started/upgrading-to-3.0/processors.md @@ -38,6 +38,21 @@ translation: "getting-started/upgrading-to-3.0/processors" Любой вызов к ядру процессора должен быть рассмотрен. Старые имена действий в [modX::runProcessor](extending-modx/modx-class/reference/modx.runprocessor) (например `resource/create`) все еще поддерживаются, но возможно, что внутренняя логика некоторых процессоров изменилась. +## Пользовательские типы ресурсов (CRC) + +Если класс пользовательского ресурса определяет `{ClassKey}CreateProcessor` или `{ClassKey}UpdateProcessor`, основные процессоры ресурсов создают этот класс вместо себя. Типы ресурсов, которые расширяют эти процессоры, должны использовать имена классов 3.x. + +В 2.x основные классы лежали в `core/model/modx/processors/resource/create.class.php` (`modResourceCreateProcessor`) и `update.class.php` (`modResourceUpdateProcessor`). Этих файлов больше нет. + +| Старый класс | Новый класс | +| ------------------------------- | ----------------------------------------------- | +| `\modResourceCreateProcessor` | `\MODX\Revolution\Processors\Resource\Create` | +| `\modResourceUpdateProcessor` | `\MODX\Revolution\Processors\Resource\Update` | + +`core/include/deprecated.php` даёт псевдонимы старых имён до 3.3. `require_once` путей 2.x падает. + +См. [пользовательские классы ресурсов](building-sites/resources/custom-resources) и [Шаг 4: Настройка процессоров](extending-modx/custom-resources/step-4-processors). + ## Процессоры с плоскими файлами больше не поддерживаются Поддержка так называемых процессоров с плоскими файлами (которые заканчиваются на `.php` вместо `.class.php` и не используют класс процессора) была удалена.