Quote from: claytonk at May 24, 2016, 09:39 AMBy default, migxdb is probably using the processor at core/components/migx/processors/mgr/default/. You can copy the code for that processor, modify the code so that it takes the additional step of deleting your file, and then save it to your package folder at core/components/yourpackage/processors/mgr/default/.
What processor I haven't decided to use. I have tried this emptytrash (from core/components/migx/processors/mgr/default/) and I have created the file (emptytrash.php) to your package folder at core\components\mybooks\processors\mgr\default\emptytrash.php
And when empty the trash I delete files from the server.
<?php
$modx->addPackage('mybooks', MODX_BASE_PATH . 'core/components/mybooks/model/', 'modx_'); // correctly???
$resources = $modx->getCollection('mybooks', array('deleted'=>1));
foreach ($resources as $k => $res) {
//at me image isn't simple, Image+
$json = $res->get('image');
$data = json_decode($json, true);
$src = $data['sourceImg']['src'] ;
$sourceid = $data['sourceImg']['source'] ;
// Load up the mediaSource
$source = $modx->getObject('sources.modMediaSource', $sourceid);
$properties = $source->getProperties();
$pathimage = $properties['basePath']['value'].$src;
$assets_path = str_replace('assets/', "", $pathimage);
$directory = $modx->getOption('assets_path',null,MODX_CORE_PATH).$assets_path;
// delete files
if(is_file($directory)) {
unlink($directory);
}
}
include $modx->getOption('core_path') . 'components/migx/processors/mgr/default/emptytrash.php';
So everything works, but whether such decision is right?