public static function delete_article($articleid)
 {
     $db = cmsms()->GetDb();
     //Now remove the article
     $query = "DELETE FROM " . cms_db_prefix() . "module_news WHERE news_id = ?";
     $db->Execute($query, array($articleid));
     // Delete it from the custom fields
     $query = 'DELETE FROM ' . cms_db_prefix() . 'module_news_fieldvals WHERE news_id = ?';
     $db->Execute($query, array($articleid));
     // delete any files...
     $config = cmsms()->GetConfig;
     $p = cms_join_path($config['uploads_path'], 'news', 'id', $articleid);
     if (is_dir($p)) {
         recursive_delete($p);
     }
     news_admin_ops::delete_static_route($articleid);
     //Update search index
     $mod = cms_utils::get_module('News');
     $module = cms_utils::get_module('Search');
     if ($module != FALSE) {
         $module->DeleteWords($mod->GetName(), $articleid, 'article');
     }
     @$mod->SendEvent('NewsArticleDeleted', array('news_id' => $articleid));
     // put mention into the admin log
     audit($articleid, 'News: ' . $articleid, 'Article deleted');
 }
     foreach ($params['customfield'] as $fldid => $value) {
         if ($value == '') {
             continue;
         }
         $query = "INSERT INTO " . cms_db_prefix() . "module_news_fieldvals (news_id,fielddef_id,value,create_date,modified_date) VALUES (?,?,?,?,?)";
         $dbr = $db->Execute($query, array($articleid, $fldid, $value, $now, $now));
         if (!$dbr) {
             die('FATAL SQL ERROR: ' . $db->ErrorMsg() . '<br/>QUERY: ' . $db->sql);
         }
     }
 }
 // if
 if (!$error && $status == 'published' && $news_url != '') {
     // todo: if not expired
     // register the route.
     news_admin_ops::delete_static_route($articleid);
     news_admin_ops::register_static_route($news_url, $articleid);
 }
 if (!$error && $status == 'published') {
     //Update search index
     $module = cms_utils::get_search_module();
     if (is_object($module)) {
         $text = '';
         if (isset($params['customfield'])) {
             foreach ($params['customfield'] as $fldid => $value) {
                 if (strlen($value) > 1) {
                     $text .= $value . ' ';
                 }
             }
         }
         $text .= $content . ' ' . $summary . ' ' . $title . ' ' . $title;