Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions en/getting-started/upgrading-to-3.0/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Manager URLs like `/manager/?a=15` (where `15` is an action ID) no longer work i
For some extras, this means rewriting controllers; for others, changing the menu definition (in Admin > Menus) is enough.


`modAction` and `modAccessAction` are gone (see [Removed objects](#removed-objects) below). `modActionDom`, `modAccessActionDom`, `modActionField` and the `actiondom` / `access_actiondom` / `actions_fields` tables remain and still serve Form Customization rules. The cleanup also touched the `modManagerResponse` and `modManagerController` classes.
`modAction` and `modAccessAction` are gone (see [Removed objects](#removed-objects) below). `modActionDom`, `modAccessActionDom`, and `modActionField` remain, along with the `actiondom`, `access_actiondom`, and `actions_fields` tables; they still serve Form Customization rules. The cleanup also touched `modManagerResponse` and `modManagerController`.

## Removed: `MODX.action` (JavaScript)

Expand Down Expand Up @@ -47,7 +47,7 @@ A falsey return value from `modManagerController::checkPermissions` is also hand

Controller loading in `modManagerResponse` was refactored; both methods are gone.

Controllers may now live in the autoloaded `\MODX\Revolution\Controllers\` namespace: `getControllerClassName()` looks for `\MODX\Revolution\Controllers\{action}` first, then falls back to the filesystem lookup in `{namespace_path}/controllers/`. If your controller class is autoloadable there, no other wiring is needed.
Controllers may now live in the autoloaded `\MODX\Revolution\Controllers\` namespace. `getControllerClassName()` looks for `\MODX\Revolution\Controllers\{action}` first, then falls back to the filesystem lookup in `{namespace_path}/controllers/`. If your controller class is autoloadable there, no other wiring is needed.

Some signatures changed:

Expand Down
12 changes: 6 additions & 6 deletions en/getting-started/upgrading-to-3.0/class-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ To implement namespaces, 3.0 renamed and moved many files and classes. You may s

## Model & Service Classes

Most model and service classes loaded through `$modx->loadClass` (including the xPDO Query builder) or `$modx->getService` still work: `loadClass` translates the old names internally. `$modx->getIterator('modResource')` still resolves — and logs a deprecation. Prefer `$modx->getIterator(\MODX\Revolution\modResource::class)`.
Most model and service classes loaded through `$modx->loadClass` (including the xPDO Query builder) or `$modx->getService` still work: `loadClass` translates the old names internally. `$modx->getIterator('modResource')` still resolves and logs a deprecation. Prefer `$modx->getIterator(\MODX\Revolution\modResource::class)`.

`$modx->getService()` itself is **deprecated** in 3.x but was **not** removed in 3.1; the core still uses it. For new code, register and fetch objects on `$modx->services`. See [modX.getService](extending-modx/modx-class/reference/modx.getservice) and the [DI container](extending-modx/di-container).
`$modx->getService()` itself is **deprecated** in 3.x but was **not** removed in 3.1. The core still uses it. For new code, register and fetch objects on `$modx->services`. See [modX.getService](extending-modx/modx-class/reference/modx.getservice) and the [DI container](extending-modx/di-container).

### Type checks against old names

Expand All @@ -35,7 +35,7 @@ This works whether or not the aliases are loaded.
These commonly used classes are aliased to their new names. The aliases load in `modX::loadConfig` when `load_deprecated_global_class_aliases` is `true` (the default). To disable them, add the key with a value of `false` to `$config_options` in `core/config/config.inc.php`.


**Automatic loading of these aliases will stop in a future 3.x release — the source comment in `core/include/deprecated.php` says "likely 3.3 or 3.4".** If you still need the aliases after that, you can manually require `core/include/deprecated.php` as a stopgap, but update your code to the new classes anyway. The backwards-compatibility layer itself (including manual loading) will likely be removed in MODX 4.0.
**Automatic loading of these aliases will stop in a future 3.x release.** The source comment in `core/include/deprecated.php` says "likely 3.3 or 3.4". If you still need the aliases after that, manually require `core/include/deprecated.php` as a stopgap, but update your code to the new classes anyway. The backwards-compatibility layer itself, including manual loading, will likely be removed in MODX 4.0.

### xPDO

Expand Down Expand Up @@ -83,11 +83,11 @@ How Composer, PSR-4, `metadata.mysql.php`, and Extra `addPackage` calls fit toge

### Processors

All processors, including the base classes (`\modProcessor`, `\modObjectProcessor`, `\modObject*Processor`, `\modProcessorResponse`, `\modProcessorResponseError`), have been renamed and moved. Old names have aliases for now; flat-file processors are gone. See the [processors page](getting-started/upgrading-to-3.0/processors).
All processors, including the base classes (`\modProcessor`, `\modObjectProcessor`, `\modObject*Processor`, `\modProcessorResponse`, `\modProcessorResponseError`), have been renamed and moved. Old names have aliases for now. Flat-file processors are gone. See the [processors page](getting-started/upgrading-to-3.0/processors).

## Changed classes, without upgrade path

Every other model and service class has no alias. This includes the everyday objects from `getObject`/`getCollection`, such as `\MODX\Revolution\modContext`, `\MODX\Revolution\modUser`, `\MODX\Revolution\modChunk`, `\MODX\Revolution\modSnippet`, `\MODX\Revolution\modPlugin` and `\MODX\Revolution\modTemplate`.
Every other model and service class has no alias. This includes the everyday objects from `getObject`/`getCollection`: `\MODX\Revolution\modContext`, `\MODX\Revolution\modUser`, `\MODX\Revolution\modChunk`, `\MODX\Revolution\modSnippet`, `\MODX\Revolution\modPlugin`, and `\MODX\Revolution\modTemplate`.

## Removed classes

Expand All @@ -105,5 +105,5 @@ Flash clipboard helpers used by ExtJS for copy-to-clipboard are gone; use the br

## Signature changes

- `modResponse::_construct` (and inherited `modManagerResponse`/`modConnectorResponse`) is now `public` and no longer uses the ampersand: objects are always passed by reference.
- `modResponse::_construct` (and inherited `modManagerResponse`/`modConnectorResponse`) is now `public`. It no longer uses the ampersand: objects are always passed by reference.
- `Processor::getInstance` and `modManagerController::getInstance` no longer pass modX by reference with the ampersand.
10 changes: 5 additions & 5 deletions en/getting-started/upgrading-to-3.0/core-folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ If you have a custom core directory, or the core sits outside the webroot, rever
1. Move the core directory back to /core/ in the root of the installation.
2. Edit `config.core.php`, `/manager/config.core.php`, and `/connectors/config.core.php` to use the updated core path.

The `MODX_CORE_PATH` definition in `core/config/config.inc.php` is only a fallback that never runs once `config.core.php` already defines the constant, so it does not need changing — keep the two in sync if you edit it anyway.
The `MODX_CORE_PATH` definition in `core/config/config.inc.php` is only a fallback. It never runs once `config.core.php` already defines the constant, so it does not need changing. Keep the two in sync if you edit it anyway.

After those steps, run the MODX installer to verify the path was updated correctly.


## But what about security?

From a security point of view, there is zero difference between physically moving the core out of the webroot to prevent direct access, and blocking access to it in a different way.
From a security point of view, physically moving the core out of the webroot and blocking access to it another way are equivalent.

Here's how you could block access to the core (and various other common sensitive directories or files, including any dotfiles except the .well-known directory) on Apache:
Block access to the core on Apache, along with other sensitive directories and files, including dotfiles except `.well-known`:

````
RewriteRule ^(\.(?!well-known)|_build|_gitify|_backup|core|config.core.php) /index.php?q=doesnotexist [L,R=404]
Expand All @@ -34,9 +34,9 @@ location ~ ^/(\.(?!well-known)|_build|_gitify|_backup|core|config.core.php) {
}
````

These examples pass the request on to MODX with a non-existent alias, which has the benefit of ensuring it looks like the rest of your site.
These examples pass the request to MODX with a non-existent alias. The result matches the rest of your site.

On high-traffic sites you can prevent such requests from hitting MODX by immediately returning a 404. That response then differs from a regular error, which lets an attacker conclude the requested files probably do exist.
On high-traffic sites, return 404 immediately instead of letting the request reach MODX. That response differs from a regular error, so an attacker can infer the requested files probably exist.

For nginx, that would look like this:

Expand Down
2 changes: 1 addition & 1 deletion en/getting-started/upgrading-to-3.0/extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Site owners use [Upgrading from 2.x to 3.0](getting-started/upgrading-to-3.0). T
| MODX 3 only | Namespaced classes, PSR-4 models, `bootstrap.php`. Drop `require_once` of old core paths. |
| One package for 2.x and 3.x | Branch on version (`$modx->version['version'] >= 3`), class-name prefixes or dynamic parent classes. More work. Overview: [Modernizing Extras cheat sheet](https://modx.com/blog/modernizing-extras-conversion-cheat-sheet). |

Global aliases (`modResource`, `modObjectCreateProcessor`, and similar) still load by default in 3.0-3.2 through `load_deprecated_global_class_aliases`. Automatic loading is scheduled to stop in a future 3.x release — the source comment in `core/include/deprecated.php` says "likely 3.3 or 3.4" — so move to namespaced code before then. See [Changed class names](getting-started/upgrading-to-3.0/class-names).
Global aliases (`modResource`, `modObjectCreateProcessor`, and similar) still load by default in 3.0-3.2 through `load_deprecated_global_class_aliases`. Automatic loading is scheduled to stop in a future 3.x release. The source comment in `core/include/deprecated.php` says "likely 3.3 or 3.4". Move to namespaced code before then. See [Changed class names](getting-started/upgrading-to-3.0/class-names).

## Checklist

Expand Down
2 changes: 0 additions & 2 deletions en/getting-started/upgrading-to-3.0/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Setup only upgrades from **MODX 2.6.0 or later**. On 2.5 or older, upgrade to 2.

From 2.6+, follow the [standard upgrading process](getting-started/maintenance/upgrading). Upgrade to 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 move to 3.0.


- ⚠️ 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.5; current 3.x (3.2+) requires PHP 8.1+](getting-started/upgrading-to-3.0/requirements)
Expand Down Expand Up @@ -49,7 +48,6 @@ From 2.6+, follow the [standard upgrading process](getting-started/maintenance/u

### Resources & Templates


- Resources can now get an icon based on their content type [#14383](https://github.com/modxcms/revolution/pull/14383). See [Content Types](building-sites/resources/content-types).
- New output modifiers related to files: `dirname`, `basename`, `filename`, `extension` [#14198](https://github.com/modxcms/revolution/pull/14198). See [Output Filter/Modifiers](building-sites/tag-syntax/output-filters).

Expand Down
2 changes: 1 addition & 1 deletion en/getting-started/upgrading-to-3.0/manager-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ In MODX 2.x the manager language came from the `manager_language` system setting

The current language is available as `cultureKey` in the MODX config array: `$modx->config['cultureKey']`. Manager JavaScript must use `MODx.config.cultureKey` instead of `MODx.config.manager_language`.

The manager picks a language from the browser language on first visit; a different one can be chosen at the bottom of the login screen. While logged in, use Admin > Toggle language in the manager menu (in 3.0 this item was under User; it moved to Admin in 3.1 — the screenshot below shows the 3.0 menu).
The manager picks a language from the browser language on first visit; a different one can be chosen at the bottom of the login screen. While logged in, use Admin > Toggle language in the manager menu. In 3.0 this item was under User; it moved to Admin in 3.1. The screenshot below shows the 3.0 menu.

![Toggling the manager language while you're logged in to the manager](manager-language.jpg)
2 changes: 1 addition & 1 deletion en/getting-started/upgrading-to-3.0/manager-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Media Browser image previews use [modx_browser_tree_hide_tooltips](building-site
- Grid "New" buttons follow one pattern. [#14312](https://github.com/modxcms/revolution/pull/14312)


## Other manager behaviour
## Other manager behavior

- System Info → Database tables shows a success notice after a table operation. [#14525](https://github.com/modxcms/revolution/pull/14525)
- The top search bar (uberbar) trims leading and trailing spaces before it searches. [#14523](https://github.com/modxcms/revolution/pull/14523)
Expand Down
4 changes: 2 additions & 2 deletions en/getting-started/upgrading-to-3.0/processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For third-party extras, this means:

Any processor that previously inherited from a base processor (`modProcessor`, `modObjectProcessor`, `modDriverSpecificProcessor`, any `modObject*Processor`) must be updated. Practically, that means every processor.

The old class names are available as aliases for now, but **automatic loading of those aliases will stop in a future 3.x release (the source comment in `core/include/deprecated.php` says "likely 3.3 or 3.4")**.
The old class names are available as aliases for now. Automatic loading of those aliases will stop in a future 3.x release. The source comment in `core/include/deprecated.php` says "likely 3.3 or 3.4".

- To support both 2.x and 3.x, you can keep using the `modObject...Processor` classes for now, but plan for MODX 3.3+. Tell your users which versions you support and until when.
- To support 3.0+ without another round of changes when the aliases stop loading, change the class name you extend.
Expand All @@ -38,7 +38,7 @@ The old class names are available as aliases for now, but **automatic loading of

## Calling core processors with runProcessor

Review every call to a core processor. The old action names in [modX::runProcessor](extending-modx/modx-class/reference/modx.runprocessor) (e.g. `resource/create`) are still supported, but the internal logic of some processors has changed. `runProcessor` also accepts a full processor class name as `$action`, e.g. `$modx->runProcessor(\MODX\Revolution\Processors\Resource\Create::class, $props)`.
Review every call to a core processor. The old action names in [modX::runProcessor](extending-modx/modx-class/reference/modx.runprocessor) (e.g. `resource/create`) are still supported, but the internal logic of some processors has changed. `runProcessor` also accepts a full processor class name as `$action`: `$modx->runProcessor(\MODX\Revolution\Processors\Resource\Create::class, $props)`.

## Custom resource types (CRC)

Expand Down
5 changes: 2 additions & 3 deletions en/getting-started/upgrading-to-3.0/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ That floor was raised again later:

If you are upgrading from 2.x all the way to a current 3.x release, plan for PHP 8.1+ — not only the original 3.0 requirement of 7.2.5.

> Note: the installer's own PHP check still expects PHP 7.4.0 (recommended 8.0.0), while `composer.json` requires 8.1. On PHP 7.4 the Setup passes but `composer install` fails during the upgrade — run Setup on PHP 8.1+.

> Note: the installer's own PHP check still expects PHP 7.4.0 (recommended 8.0.0), while `composer.json` requires 8.1. On PHP 7.4 Setup passes, but `composer install` fails during the upgrade. Run Setup on PHP 8.1+.

Web server and database version requirements are covered on the main [Server Requirements](getting-started/server-requirements) page.

Support for sqlsrv databases has been removed, and will [need to be migrated to MySQL](getting-started/upgrading-to-3.0/sqlsrv).
Support for sqlsrv databases has been removed; [migrate to MySQL](getting-started/upgrading-to-3.0/sqlsrv).
2 changes: 1 addition & 1 deletion en/getting-started/upgrading-to-3.0/system-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ MODX 3.0 cleaned up a significant number of old system settings and changed the
## Renamed

- `mail_smtp_prefix` → `mail_smtp_secure`. Setup migrates the value on upgrade ([3.0.0 upgrade script](https://github.com/modxcms/revolution/blob/3.x/setup/includes/upgrades/common/3.0.0-update-smtp-system-settings.php)).
- `upload_check_exists` → `upload_file_exists`. There is **no automatic migration** for this one: check your site settings for the old key after upgrading.
- `upload_check_exists` → `upload_file_exists`. There is **no automatic migration** for this one. Check your site settings for the old key after upgrading. The new setting defaults to `Yes` (overwrite allowed) (`modMediaSource::getOption(..., true)`).

## Changed default values

Expand Down
6 changes: 3 additions & 3 deletions en/getting-started/upgrading-to-3.0/xpdo.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ Generate classes with your build script or the xPDO CLI (`core/vendor/bin/xpdo p
- `src/Model/metadata.mysql.php` (`version` ≥ `3.0`, `namespace`, `namespacePrefix`, `class_map`)
- `src/Model/mysql/Task.php` (platform map)

For MODX 3, regenerate `metadata.mysql.php` from a `version="3.0"` schema so it includes the namespace fields and `class_map`. A 2.x metadata file will not register PSR-4 the same way and can log a package metadata warning.
For MODX 3, regenerate `metadata.mysql.php` from a `version="3.0"` schema. It must include the namespace fields and `class_map`. A 2.x metadata file will not register PSR-4 the same way and can log a package metadata warning.

## Migrating a 2.x Extra model

Work through this checklist for each custom package:


1. **Move classes** into a `src/` tree that mirrors the PHP namespace (`MyExtra\Model\...`).
2. **Rewrite the schema**: set `package` to the PHP namespace, `version="3.0"`, and namespaced `extends` / relation `class` values (`xPDO\Om\...`, `MODX\Revolution\...` when you relate to core objects).
2. **Rewrite the schema**: set `package` to the PHP namespace and `version="3.0"`. Use namespaced `extends` and relation `class` values (`xPDO\Om\...`, `MODX\Revolution\...` when you relate to core objects).
3. **Regenerate** maps and classes. Commit `metadata.mysql.php` and the `mysql/` maps your generator writes.
4. **Update `addPackage`** to the four-argument (or namespaced) form and load it from [`bootstrap.php`](extending-modx/namespaces) when the Extra boots.
5. **Replace string class keys** in PHP with `::class` or FQCNs in `getObject`, `newObject`, `newQuery`, processors, and vehicle attributes.
Expand All @@ -124,7 +124,7 @@ $resource = $modx->getObject(modResource::class, $id);
if ($resource instanceof modResource) { /* ... */ }
```

`$modx->getObject('modResource', $id)` may still resolve through `loadClass` translation and log a deprecation. Prefer the namespaced form. `instanceof modResource` only works while the deprecated global aliases are loaded (the default; see [Changed Class Names](getting-started/upgrading-to-3.0/class-names)) — with them disabled, the old name is not a class and the check silently returns `false`.
`$modx->getObject('modResource', $id)` may still resolve through `loadClass` translation and log a deprecation. Prefer the namespaced form. `instanceof modResource` only works while the deprecated global aliases are loaded (the default; see [Changed Class Names](getting-started/upgrading-to-3.0/class-names)). With them disabled, the old name is not a class and the check silently returns `false`. To disable global aliases, set `'load_deprecated_global_class_aliases' => false` in `core/config/config.inc.php` (default: `true`).

### Before / after (custom package)

Expand Down
Loading
Loading