$db->addGlobalUpdateFields();
     if ($db->update()) {
         $info = $I18N->msg('pool_kat_updated', $cat_name);
         rex_deleteCacheMediaCategory($edit_id);
     } else {
         $warning = $db->getError();
     }
 } elseif ($media_method == 'delete_file_cat') {
     $gf = rex_sql::factory();
     $gf->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file WHERE category_id=' . $edit_id);
     $gd = rex_sql::factory();
     $gd->setQuery('SELECT * FROM ' . $REX['TABLE_PREFIX'] . 'file_category WHERE re_id=' . $edit_id);
     if ($gf->getRows() == 0 && $gd->getRows() == 0) {
         $gf->setQuery('DELETE FROM ' . $REX['TABLE_PREFIX'] . 'file_category WHERE id=' . $edit_id);
         rex_deleteCacheMediaCategory($edit_id);
         rex_deleteCacheMediaLists();
         $info = $I18N->msg('pool_kat_deleted');
     } else {
         $warning = $I18N->msg('pool_kat_not_deleted');
     }
 } elseif ($media_method == 'add_file_cat') {
     $db = rex_sql::factory();
     $db->setTable($REX['TABLE_PREFIX'] . 'file_category');
     $db->setValue('name', rex_request('catname', 'string'));
     $db->setValue('re_id', rex_request('cat_id', 'int'));
     $db->setValue('path', rex_request('catpath', 'string'));
     $db->addGlobalCreateFields();
     $db->addGlobalUpdateFields();
     if ($db->insert()) {
         $info = $I18N->msg('pool_kat_saved', stripslashes(rex_request('catname')));
         rex_deleteCacheMediaCategoryList(rex_request('cat_id', 'int'));
/**
 * Löscht die gecachte Medium-Datei.
 *
 * @param $filename Dateiname
 *
 * @return void
 */
function rex_deleteCacheMedia($filename)
{
    global $REX;
    $cachePath = $REX['GENERATED_PATH'] . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR;
    @unlink($cachePath . $filename . '.media');
    rex_deleteCacheMediaLists();
}