public function actionRedact($pattern = null)
{
$criteria = new CDbCriteria();
if ($pattern != null) {
$criteria->condition = 'name like :name';
$criteria->params = array(':name' => $pattern);
} else {
echo 'You MUST specify a file pattern to match.';
}
$files = ProtectedFile::model()->findAll($criteria);
// we can't really filter images, except on size - for now just
// assume the count is half the amount when taking thumbnails into
// consideration
echo count($files) / 2 . ' files found for modification.';
if ($files) {
foreach ($files as $file) {
if (file_exists($file->getPath())) {
$this->anonymiseTif($file->getPath());
} else {
echo 'Could not transform file; ' . $file->getPathName() . ' does not exist.' . PHP_EOL;
}
}
}
}