Index: trunk/phase3/includes/SpecialExport.php |
— | — | @@ -21,34 +21,6 @@ |
22 | 22 | * @addtogroup SpecialPage |
23 | 23 | */ |
24 | 24 | |
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 | | - |
53 | 25 | /** |
54 | 26 | * |
55 | 27 | */ |
— | — | @@ -57,23 +29,8 @@ |
58 | 30 | global $wgExportAllowHistory, $wgExportMaxHistory; |
59 | 31 | |
60 | 32 | $curonly = true; |
61 | | - $doexport = false; |
62 | | - $page = NULL; |
63 | | - |
64 | | - if ( $wgRequest->getCheck( 'addcat' ) ) { |
| 33 | + if( $wgRequest->wasPosted() ) { |
65 | 34 | $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' ); |
78 | 35 | $curonly = $wgRequest->getCheck( 'curonly' ); |
79 | 36 | $rawOffset = $wgRequest->getVal( 'offset' ); |
80 | 37 | if( $rawOffset ) { |
— | — | @@ -102,8 +59,6 @@ |
103 | 60 | $history['dir'] = 'desc'; |
104 | 61 | } |
105 | 62 | } |
106 | | - |
107 | | - if( $page != '' ) $doexport = true; |
108 | 63 | } else { |
109 | 64 | // Default to current-only for GET requests |
110 | 65 | $page = $wgRequest->getText( 'pages', $page ); |
— | — | @@ -113,10 +68,7 @@ |
114 | 69 | } else { |
115 | 70 | $history = WikiExporter::CURRENT; |
116 | 71 | } |
117 | | - |
118 | | - if( $page != '' ) $doexport = true; |
119 | 72 | } |
120 | | - |
121 | 73 | if( !$wgExportAllowHistory ) { |
122 | 74 | // Override |
123 | 75 | $history = WikiExporter::CURRENT; |
— | — | @@ -125,7 +77,7 @@ |
126 | 78 | $list_authors = $wgRequest->getCheck( 'listauthors' ); |
127 | 79 | if ( !$curonly || !$wgExportAllowListContributors ) $list_authors = false ; |
128 | 80 | |
129 | | - if ( $doexport ) { |
| 81 | + if( $page != '' ) { |
130 | 82 | $wgOut->disable(); |
131 | 83 | |
132 | 84 | // Cancel output buffering and gzipping if set |
— | — | @@ -169,12 +121,7 @@ |
170 | 122 | $titleObj = SpecialPage::getTitleFor( "Export" ); |
171 | 123 | |
172 | 124 | $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 />'; |
179 | 126 | if( $wgExportAllowHistory ) { |
180 | 127 | $form .= wfCheck( 'curonly', true, array( 'value' => 'true', 'id' => 'curonly' ) ); |
181 | 128 | $form .= wfLabel( wfMsg( 'exportcuronly' ), 'curonly' ) . '<br />'; |