r15885 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r15884‎ | r15885 | r15886 >
Date:06:18, 30 July 2006
Author:yurik
Status:old
Tags:
Comment:
*FIX: spaces are not treated correctly for the ??from= parameters.
Modified paths:
  • /trunk/extensions/BotQuery/query.php (modified) (history)

Diff [purge]

Index: trunk/extensions/BotQuery/query.php
@@ -928,7 +928,7 @@
929929 }
930930
931931 $where = array( 'page_namespace' => intval($apnamespace) );
932 - if( $apfrom !== '' ) $where[] = 'page_title>=' . $this->db->addQuotes($apfrom);
 932+ if( $apfrom !== '' ) $where[] = 'page_title>=' . $this->db->addQuotes(titleToKey($apfrom));
933933
934934 if ($apfilterredir === 'redirects')
935935 $where['page_is_redirect'] = 1;
@@ -949,7 +949,7 @@
950950 while ( $row = $this->db->fetchObject( $res ) ) {
951951 if( ++$count > $aplimit ) {
952952 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
953 - $this->addStatusMessage( $prop, array('next' => $row->page_title) );
 953+ $this->addStatusMessage( $prop, array('next' => keyToTitle($row->page_title)) );
954954 break;
955955 }
956956 $this->storePageInfo( $row );
@@ -983,7 +983,7 @@
984984 . " FROM $page LEFT JOIN $langlinks ON page_id = ll_from"
985985 . ' WHERE'
986986 . ' ll_from IS NULL AND page_is_redirect = 0 AND page_namespace=' . intval($nlnamespace)
987 - . ( $nlfrom === '' ? '' : ' AND page_title>=' . $this->db->addQuotes($nlfrom) )
 987+ . ( $nlfrom === '' ? '' : ' AND page_title>=' . $this->db->addQuotes(titleToKey($nlfrom)) )
988988 . ' ORDER BY page_namespace, page_title'
989989 . ' LIMIT ' . intval($nllimit+1);
990990
@@ -996,7 +996,7 @@
997997 while ( $row = $this->db->fetchObject( $res ) ) {
998998 if( ++$count > $nllimit ) {
999999 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
1000 - $this->addStatusMessage( $prop, array('next' => $row->page_title) );
 1000+ $this->addStatusMessage( $prop, array('next' => keyToTitle($row->page_title)));
10011001 break;
10021002 }
10031003 $this->storePageInfo( $row );
@@ -1028,7 +1028,7 @@
10291029 $tables = array( 'categorylinks' );
10301030 $conds = array( 'cl_to' => $categoryObj->getDBkey() );
10311031 if ($cpfrom != '')
1032 - $conds[] = 'cl_sortkey >= ' . $this->db->addQuotes($cpfrom);
 1032+ $conds[] = 'cl_sortkey >= ' . $this->db->addQuotes(titleToKey($cpfrom));
10331033
10341034 if( $cpnamespace !== NS_ALL_NAMESPACES )
10351035 {
@@ -1060,7 +1060,7 @@
10611061 while ( $row = $this->db->fetchObject( $res ) ) {
10621062 if( ++$count > $cplimit ) {
10631063 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
1064 - $this->addStatusMessage( 'category', array('next' => $row->cl_sortkey) );
 1064+ $this->addStatusMessage( 'category', array('next' => keyToTitle($row->cl_sortkey)));
10651065 break;
10661066 }
10671067 $this->addRaw( 'pageids', $row->cl_from );
@@ -2563,6 +2563,15 @@
25642564 return round( $timeDelta * 1000.0, 1 );
25652565 }
25662566
 2567+function titleToKey($title)
 2568+{
 2569+ return str_replace(' ', '_', $title);
 2570+}
 2571+function keyToTitle($key)
 2572+{
 2573+ return str_replace('_', ' ', $key);
 2574+}
 2575+
25672576 /**
25682577 *@desc Get a parameter from the request, and validate that it contains only '-' or lower case letters
25692578 */