diff --git a/ExcludeRandom.php b/ExcludeRandom.php index b83f083..e924770 100644 --- a/ExcludeRandom.php +++ b/ExcludeRandom.php @@ -35,15 +35,17 @@ function wfExcludeRandomInit( &$rand, &$isRedir, &$namespaces, &$extra, &$title ) { global $wgExcludeRandomPages; - $DB = wfGetDB(DB_MASTER); if (!$wgExcludeRandomPages) { return true; } - + + $DB = wfGetDB(DB_MASTER); foreach ($wgExcludeRandomPages AS $cond) { - $extra[] = "`page_title` NOT LIKE '".$DB->strencode($cond)."'"; + $pattern = $DB->strencode($cond); + $pattern = str_replace( array(' ', '*', '%'), + array('_', '%', '\%'), $pattern); + $extra[] = "`page_title` NOT LIKE '$pattern'"; } return true; } -?> \ No newline at end of file