r20145 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20144‎ | r20145 | r20146 >
Date:17:36, 5 March 2007
Author:tstarling
Status:old
Tags:
Comment:
Revert of r20085, breaks retrieval with GET and subpage syntax, which breaks transwiki and probably various other things.
Modified paths:
  • /trunk/phase3/includes/SpecialExport.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialExport.php
@@ -21,34 +21,6 @@
2222 * @addtogroup SpecialPage
2323 */
2424
25 -function wfExportGetPagesFromCategory( $title ) {
26 - global $wgContLang;
27 -
28 - $name = $title->getDBKey();
29 -
30 - $dbr = wfGetDB( DB_SLAVE );
31 -
32 - list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
33 - $sql = "SELECT page_namespace, page_title FROM $page " .
34 - "JOIN $categorylinks ON cl_from = page_id " .
35 - "WHERE cl_to = " . $dbr->addQuotes( $name );
36 -
37 - $pages = array();
38 - $res = $dbr->query( $sql, 'wfExportGetPagesFromCategory' );
39 - while ( $row = $dbr->fetchObject( $res ) ) {
40 - $n = $row->page_title;
41 - if ($row->page_namespace) {
42 - $ns = $wgContLang->getNsText( $row->page_namespace );
43 - $n = $ns . ':' . $n;
44 - }
45 -
46 - $pages[] = $n;
47 - }
48 - $dbr->freeResult($res);
49 -
50 - return $pages;
51 -}
52 -
5325 /**
5426 *
5527 */
@@ -57,23 +29,8 @@
5830 global $wgExportAllowHistory, $wgExportMaxHistory;
5931
6032 $curonly = true;
61 - $doexport = false;
62 - $page = NULL;
63 -
64 - if ( $wgRequest->getCheck( 'addcat' ) ) {
 33+ if( $wgRequest->wasPosted() ) {
6534 $page = $wgRequest->getText( 'pages' );
66 - $catname = $wgRequest->getText( 'catname' );
67 -
68 - if ( $catname !== '' && $catname !== NULL && $catname !== false ) {
69 - $t = Title::makeTitleSafe( NS_CATEGORY, $catname );
70 - if ( $t ) {
71 - $catpages = wfExportGetPagesFromCategory( $t );
72 - if ( $catpages ) $page .= "\n" . implode( "\n", $catpages );
73 - }
74 - }
75 - }
76 - else if( $wgRequest->wasPosted() ) {
77 - $page = $wgRequest->getText( 'pages' );
7835 $curonly = $wgRequest->getCheck( 'curonly' );
7936 $rawOffset = $wgRequest->getVal( 'offset' );
8037 if( $rawOffset ) {
@@ -102,8 +59,6 @@
10360 $history['dir'] = 'desc';
10461 }
10562 }
106 -
107 - if( $page != '' ) $doexport = true;
10863 } else {
10964 // Default to current-only for GET requests
11065 $page = $wgRequest->getText( 'pages', $page );
@@ -113,10 +68,7 @@
11469 } else {
11570 $history = WikiExporter::CURRENT;
11671 }
117 -
118 - if( $page != '' ) $doexport = true;
11972 }
120 -
12173 if( !$wgExportAllowHistory ) {
12274 // Override
12375 $history = WikiExporter::CURRENT;
@@ -125,7 +77,7 @@
12678 $list_authors = $wgRequest->getCheck( 'listauthors' );
12779 if ( !$curonly || !$wgExportAllowListContributors ) $list_authors = false ;
12880
129 - if ( $doexport ) {
 81+ if( $page != '' ) {
13082 $wgOut->disable();
13183
13284 // Cancel output buffering and gzipping if set
@@ -169,12 +121,7 @@
170122 $titleObj = SpecialPage::getTitleFor( "Export" );
171123
172124 $form = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalUrl() ) );
173 -
174 - $form .= wfInputLabel( wfMsg( 'export-addcattext' ), 'catname', 'catname', 40 ) . ' ';
175 - $form .= wfSubmitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />';
176 -
177 - $form .= wfOpenElement( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ) ) . htmlspecialchars($page). '</textarea><br />';
178 -
 125+ $form .= wfOpenElement( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ) ) . '</textarea><br />';
179126 if( $wgExportAllowHistory ) {
180127 $form .= wfCheck( 'curonly', true, array( 'value' => 'true', 'id' => 'curonly' ) );
181128 $form .= wfLabel( wfMsg( 'exportcuronly' ), 'curonly' ) . '<br />';

Follow-up revisions

RevisionCommit summaryAuthorDate
r20570Reverting SpecialRevisiondelete.php back to r17880, to fix bug 9336 ( "Specia...nickj07:41, 21 March 2007

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r20085pages-from-category function for Special:Exportdaniel17:27, 28 February 2007