There is a _postSave() method you could use in your DataWriter.
More information:
There are certain methods for certain events. The _postSave() method in a DataWriter gets called after the saving process.
When you are extending a DataWriter, you can copy this method to your DataWriter to handle the stuff that needs to be done after the saving (updating counters etc.).
Take a look at library/XenForo/DataWriter/Attachment.php (line 82) - there is even a method to handle the stuff that needs to be done before the saving (_preSave()).
PHP:
// Example from library/XenForo/DataWriter/Attachment.php
/**
* Post-save handling.
*/
protected function _postSave()
{
$this->_db->query('
UPDATE xf_attachment_data
SET attach_count = attach_count + 1
WHERE data_id = ?
', $this->get('data_id'));
}
// todo move to own class instead of creating new methods here
class Ragtek_DeveloperTools_AddOn extends XFCP_Ragtek_DeveloperTools_AddOn
{
private $addOnId = '';
private $path = '';
protected function _postSave()
{
if ($this->isInsert())
{
$this->_createFolders();
$this->_createFiles();
}
parent::_postSave();
// create folder
}