Talk:Regexp wgWhitelistRead

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

I have confirmed that this still works in 1.14. The relevant code that needs to be replaced, however, is different. Here is the content:

                         */
                        if( !is_array($wgWhitelistRead) ) {
                                return false;
                        }

                        /**
                         * Check for explicit whitelisting
                         */
                        $name = $this->getPrefixedText();
                        $dbName = $this->getPrefixedDBKey();
                        // Check with and without underscores
                        //REPLACE THE NEXT TWO LINES WITH THE FOLLOWING 7 LINES:
                        //if( in_array($name,$wgWhitelistRead,true) || in_array($dbName,$wgWhitelistRead,true) )
                        //      return true;
                        if ( is_array($wgWhitelistRead) ) {
                                for ($i=0; $i<count($wgWhitelistRead); $i++) {
                                        if (preg_match($wgWhitelistRead[$i],$name)) {
                                                return true;
                                        }
                                }
                        }


                        /**
                         * Old settings might have the title prefixed with
                         * a colon for main-namespace pages
                         */
                        if( $this->getNamespace() == NS_MAIN ) {
                                if( in_array( ':' . $name, $wgWhitelistRead ) )
                                        return true;
                        }
  • This doesn't work- when someone isn't logged in, I get:
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /var/www/mediawiki-1.13./includes/Title.php on line 1480
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /var/www/mediawiki-1.13.2/includes/Title.php on line 1480
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /var/www/mediawiki-1.13.2/includes/Title.php on line 1480