$rows = System::database()->Select('news_topics');
 foreach ($rows as $r) {
     if ($r['image'] != '') {
         $image = SafeEnv(System::config('news/icons_dirs') . $r['image'], 255, str);
         $id = SafeEnv($r['id'], 11, int);
         System::database()->Update('news_topics', "`image`='{$image}'", "`id`='{$id}'");
     }
 }
 // Добавляем новые настройки миниатюр и удаляем старые
 $tmb_width = System::config('news/thumb_max_width');
 $tmb_height = System::config('news/thumb_max_height');
 System::database()->Insert('config', "'','3','tmb_size','{$tmb_width}:{$tmb_height}','1','Размеры миниатюр изображений новостей','Ширина и высота через двоеточие, 0:0 - оставить как есть.','edit:w100','','','23,string,false','1'");
 System::database()->Insert('config', "'','3','topics_tmb_size','160:160','1','Размеры миниатюр изображений разделов','Ширина и высота через двоеточие, 0:0 - оставить как есть.','edit:w100','','','23,string,false','1'");
 RemoveConfig('news', 'icons_dirs');
 RemoveConfig('news', 'thumb_max_width');
 RemoveConfig('news', 'thumb_max_height');
 // Обновление таблицы forms (добавление текстовой ссылки)
 System::database()->InsertColl('forms', Unserialize('a:5:{s:4:"name";s:4:"link";s:4:"type";s:7:"varchar";s:6:"length";i:255;s:7:"notnull";b:1;s:5:"index";b:1;}'), 2);
 $rows = System::database()->Select('forms');
 foreach ($rows as $r) {
     $link = SafeEnv(UfuLink($r['hname']), 255, str);
     $id = SafeEnv($r['id'], 11, int);
     System::database()->Update('forms', "`link`='{$link}'", "`id`='{$id}'");
 }
 // Обновление таблицы rewrite_rules
 System::database()->Truncate('rewrite_rules');
 System::database()->InsertColl('rewrite_rules', Unserialize('a:4:{s:4:"name";s:4:"name";s:4:"type";s:7:"varchar";s:6:"length";i:255;s:7:"notnull";b:1;}'), 0);
 System::database()->InsertColl('rewrite_rules', Unserialize('a:4:{s:4:"name";s:6:"module";s:4:"type";s:7:"varchar";s:6:"length";i:255;s:7:"notnull";b:1;}'), 1);
 System::database()->InsertColl('rewrite_rules', Unserialize('a:4:{s:4:"name";s:11:"description";s:4:"type";s:7:"varchar";s:6:"length";i:255;s:7:"notnull";b:1;}'), 2);
 System::database()->InsertColl('rewrite_rules', Unserialize('a:4:{s:4:"name";s:5:"order";s:4:"type";s:3:"int";s:6:"length";i:11;s:7:"notnull";b:1;}'), 6);
 // Системные правила
/**
 * Удаляет настройку плагина.
 * @param int|string $Group Если строка, то имя группы, если число то идентификатор.
 * @param string     $Name  Имя настройки.
 */
function RemovePluginConfig($Group, $Name)
{
    RemoveConfig($Group, $Name, 'plugins_config', 'plugins_config_groups');
}