Index: trunk/phase3/maintenance/storage/compressOld.inc |
— | — | @@ -105,8 +105,8 @@ |
106 | 106 | # overwriting bulk storage concat rows. Don't compress external references, because |
107 | 107 | # the script doesn't yet delete rows from external storage. |
108 | 108 | $conds = array( |
109 | | - 'old_flags NOT ' . $dbr->buildLike( MATCH_STRING, 'object', MATCH_STRING ) . ' AND old_flags NOT ' |
110 | | - . $dbr->buildLike( MATCH_STRING, 'external', MATCH_STRING ) ); |
| 109 | + 'old_flags NOT ' . $dbr->buildLike( $dbr->anyString(), 'object', $dbr->anyString() ) . ' AND old_flags NOT ' |
| 110 | + . $dbr->buildLike( $dbr->anyString(), 'external', $dbr->anyString() ) ); |
111 | 111 | |
112 | 112 | if ( $beginDate ) { |
113 | 113 | if ( !preg_match( '/^\d{14}$/', $beginDate ) ) { |
Index: trunk/phase3/includes/LinkFilter.php |
— | — | @@ -53,63 +53,18 @@ |
54 | 54 | */ |
55 | 55 | public static function makeLike( $filterEntry , $prot = 'http://' ) { |
56 | 56 | wfDeprecated( __METHOD__ ); |
57 | | - $db = wfGetDB( DB_MASTER ); |
58 | | - if ( substr( $filterEntry, 0, 2 ) == '*.' ) { |
59 | | - $subdomains = true; |
60 | | - $filterEntry = substr( $filterEntry, 2 ); |
61 | | - if ( $filterEntry == '' ) { |
62 | | - // We don't want to make a clause that will match everything, |
63 | | - // that could be dangerous |
64 | | - return false; |
65 | | - } |
66 | | - } else { |
67 | | - $subdomains = false; |
68 | | - } |
69 | | - // No stray asterisks, that could cause confusion |
70 | | - // It's not simple or efficient to handle it properly so we don't |
71 | | - // handle it at all. |
72 | | - if ( strpos( $filterEntry, '*' ) !== false ) { |
| 57 | + |
| 58 | + $like = self::makeLikeArray( $filterEntry , $prot ); |
| 59 | + if ( !$like ) { |
73 | 60 | return false; |
74 | 61 | } |
75 | | - $slash = strpos( $filterEntry, '/' ); |
76 | | - if ( $slash !== false ) { |
77 | | - $path = substr( $filterEntry, $slash ); |
78 | | - $host = substr( $filterEntry, 0, $slash ); |
79 | | - } else { |
80 | | - $path = '/'; |
81 | | - $host = $filterEntry; |
82 | | - } |
83 | | - // Reverse the labels in the hostname, convert to lower case |
84 | | - // For emails reverse domainpart only |
85 | | - if ( $prot == 'mailto:' && strpos($host, '@') ) { |
86 | | - // complete email adress |
87 | | - $mailparts = explode( '@', $host ); |
88 | | - $domainpart = strtolower( implode( '.', array_reverse( explode( '.', $mailparts[1] ) ) ) ); |
89 | | - $host = $domainpart . '@' . $mailparts[0]; |
90 | | - $like = $db->escapeLike( "$prot$host" ) . "%"; |
91 | | - } elseif ( $prot == 'mailto:' ) { |
92 | | - // domainpart of email adress only. do not add '.' |
93 | | - $host = strtolower( implode( '.', array_reverse( explode( '.', $host ) ) ) ); |
94 | | - $like = $db->escapeLike( "$prot$host" ) . "%"; |
95 | | - } else { |
96 | | - $host = strtolower( implode( '.', array_reverse( explode( '.', $host ) ) ) ); |
97 | | - if ( substr( $host, -1, 1 ) !== '.' ) { |
98 | | - $host .= '.'; |
99 | | - } |
100 | | - $like = $db->escapeLike( "$prot$host" ); |
| 62 | + $dbw = wfGetDB( DB_MASTER ); |
101 | 63 | |
102 | | - if ( $subdomains ) { |
103 | | - $like .= '%'; |
104 | | - } |
105 | | - if ( !$subdomains || $path !== '/' ) { |
106 | | - $like .= $db->escapeLike( $path ) . '%'; |
107 | | - } |
108 | | - } |
109 | | - return $like; |
| 64 | + return $dbw->buildLike( $like ); |
110 | 65 | } |
111 | 66 | |
112 | 67 | /** |
113 | | - * Make an array to be used for calls to Database::like(), which will match the specified |
| 68 | + * Make an array to be used for calls to Database::buildLike(), which will match the specified |
114 | 69 | * string. There are several kinds of filter entry: |
115 | 70 | * *.domain.com - Produces http://com.domain.%, matches domain.com |
116 | 71 | * and www.domain.com |