[TYPO3-dev] sys_history in Frontend Extension

Steffen Müller typo3 at t3node.com
Sun Aug 25 16:18:05 CEST 2013


Hi.

On 25.08.2013 09:29 Benjamin Klatt wrote:
> Now, I have to create sys_history entries as it is done during backend
> editin, to allow the editors to rollback the website users changes if
> necessary.
> 
> However, I am not able to find any documentation or posts about how to
> do this in frontend extensions. Only the backend TCEMAIN stuff.
> 

I have no clue about any doc/article, but have a look at the
t3lib_TCEmain->updateDB()

It does basically does:
1. DB update using $GLOBALS['TYPO3_DB']->exec_UPDATEquery(),
2. update the reference index, using tceman->updateRefIndex(),
3. add a log entry to sys_log table using tceman->log(),
4. add a history entry to sys_history using ->setHistory(),

The sys_log record is mandatory to be able to find the sys_history
change in the BE log module or the web->info module.

To options:
1. You could create your own class which provides your own API for that.
But be aware that you switching back and force in the sys_history will
probably fail, if the history records don't fulfill the (undocumented)
requirements. Also in the FE, you won't have access to API calls of the
BE context like t3lib_BEfunc $GLOBALS['BE_USER'] etc.
The sys_log record structur is partl explained here:
http://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/SystemLog/Index.html
There's another reference which explains some more details, but I can't
find it unfortunately.

2. Alternatively, look at the sysext feedit, which uses a full instance
of t3lib_TCEmain for updating records.



-- 
cheers,
Steffen

Active Contributor TYPO3 CMS

TYPO3 Blog: http://www.t3node.com/
Twitter: @t3node - http://twitter.com/t3node



More information about the TYPO3-dev mailing list