pixelant / recall
一个TYPO3扩展,使用哈希来记住不同请求中的设置。例如,在eID请求中回忆主请求中使用的设置或数据。
1.0.0
2021-06-09 14:33 UTC
Requires
- php: ~7.2.0 || ~7.3.0 || ~7.4.0
- typo3/cms-core: ^9.5 || ^10.4
Requires (Dev)
- codeception/codeception: ^4.1.5
- helhum/typo3-composer-setup: ^0.5.7
- nimut/testing-framework: ^5.0.3
- phpunit/phpunit: ^7.5.20
- seld/jsonlint: ^1.8
- typo3/cms-fluid-styled-content: ^9.5 || ^10.4
This package is auto-updated.
Last update: 2024-09-08 15:23:53 UTC
README
一个TYPO3扩展,可以使用哈希来记住不同请求中的设置。例如,在eID请求中回忆主请求中使用的设置或数据。
安装
- 使用Composer安装扩展:
composer req pixelant/recall
- 通过使用TYPO3中的管理工具 > 扩展模块或在命令行中运行
vendor/bin/typo3 extension:activate recall; vendor/bin/typo3cms database:updateschema
来激活扩展。
使用方法
在正常控制器类中初始化可回忆的数据
// use Pixelant\Recall\Service\RecallService // use TYPO3\CMS\Core\Page\PageRenderer $recallService = GeneralUtility::makeInstance(RecallService::class); $recallHash = $recallService->set(['settings' => $this->settings]); $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addInlineSettingArray( 'tx_myextension', ['recallHash' => $recallHash] );
使用eID进行Ajax调用以获取数据
$.ajax( '/?eID=tx_myextension_getmore&recall=' + TYPO3.settings.tx_myextension.recallHash );
在控制器中处理eID。 (注意:eID控制器不会初始化设置数组。)
$recallHash = $request->getQueryParams()['recall']; $settings = $this->recallService->get($recallHash)['settings'];
现在您可以直接访问原始请求中的设置,而无需初始化配置或考虑页面ID。
提示:当然,您也可以提供比整个设置数组更少的信息。
清理
回忆数据存储在数据库中,且每个数据的哈希是唯一的。如果您更改数据很多,数据库会很快被填满。
频繁运行清理命令(或设置调度任务)
vendor/bin/typo3 recall:cleanup
帮助屏幕
Description:
Removes old recall data.
Usage:
recall:cleanup [<age>]
Arguments:
age The minimum age of records to remove. Default is sessionTimeout or 86400 seconds. [default: 6000]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Removes recall data older than [age] seconds. The default age is the same as $GLOBALS['TYPO3_CONF_VARS']['FE']['sessionTimeout'] or (if that's not set) 86400 seconds.
请注意:每次请求回忆数据记录时,都会更新其时间戳,因此频繁使用的记录不会被删除。
错误报告、贡献和功能请求
非常欢迎错误报告、拉取请求和功能请求。 创建错误报告或功能请求