OnBeforeSaveWebPageCache
Последнее обновление Jan 28th, 2020 | История страницы | Улучшить эту страницу | Сообщить о проблеме
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moreСобытие: OnBeforeSaveWebPageCache¶
Событие запускается после того, как ресурс загружен, но ещё не закэширован. Оно срабатывает только при успешной генерации страницы, а также требует системной настройки cache_resource (по умолчанию 1) и cacheable = 1 у ресурса. Иначе в кэш ничего не записывается и событие не запускается.
- Служба: 4 - Cache Service Events
- Group: System
Параметры события¶
Нет. На ресурс можно ссылаться через $modx->resource.
Пример¶
Такой плагин запишет в "Журнал ошибок" id загруженного ресурса:
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnBeforeSaveWebPageCache':
$res = $modx->resource->get('id');
$modx->log(modX::LOG_LEVEL_ERROR, 'Ресурс с id '.$res.' успешно загрузился');
break;
}
Смотри также¶
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










