Skip to content

Instantly share code, notes, and snippets.

@av-jok
Created March 26, 2016 11:57
Show Gist options
  • Save av-jok/4bd0af3f854155a95d5b to your computer and use it in GitHub Desktop.
Save av-jok/4bd0af3f854155a95d5b to your computer and use it in GitHub Desktop.
modx recreate TicketFile previews
<?php
define('MODX_API_MODE', true);
$modx->getService('error','error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_ERROR);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$modx->addPackage('Tickets', MODX_CORE_PATH . 'components/tickets/model/');
$files = $modx->getIterator('TicketFile');
foreach ($files as $file) {
$file->set('thumbs', null);
$file->save();
$file->generateThumbnail();
$file->save();
}
echo microtime(true) - $modx->startTime;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment