private $curonly, $doExport, $pageLinkDepth, $templates;
private $images;
private $curonly, $doExport, $pageLinkDepth, $templates;
private $images;
public function execute( $par ) {
global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors;
global $wgExportAllowHistory, $wgExportMaxHistory;
public function execute( $par ) {
global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors;
global $wgExportAllowHistory, $wgExportMaxHistory;
if ( $wgRequest->getCheck( 'addcat' ) ) {
$page = $wgRequest->getText( 'pages' );
$catname = $wgRequest->getText( 'catname' );
if ( $wgRequest->getCheck( 'addcat' ) ) {
$page = $wgRequest->getText( 'pages' );
$catname = $wgRequest->getText( 'catname' );
if ( $catname !== '' && $catname !== NULL && $catname !== false ) {
$t = Title::makeTitleSafe( NS_MAIN, $catname );
if ( $t ) {
if ( $catname !== '' && $catname !== NULL && $catname !== false ) {
$t = Title::makeTitleSafe( NS_MAIN, $catname );
if ( $t ) {
$historyCheck = $wgRequest->getCheck( 'history' );
if( $historyCheck ) {
$history = WikiExporter::FULL;
} else {
$history = WikiExporter::CURRENT;
}
$historyCheck = $wgRequest->getCheck( 'history' );
if( $historyCheck ) {
$history = WikiExporter::FULL;
} else {
$history = WikiExporter::CURRENT;
}
$list_authors = $wgRequest->getCheck( 'listauthors' );
if ( !$this->curonly || !$wgExportAllowListContributors ) $list_authors = false ;
$list_authors = $wgRequest->getCheck( 'listauthors' );
if ( !$this->curonly || !$wgExportAllowListContributors ) $list_authors = false ;
$form = Xml::openElement( 'form', array( 'method' => 'post',
'action' => $this->getTitle()->getLocalUrl( 'action=submit' ) ) );
$form .= Xml::inputLabel( wfMsg( 'export-addcattext' ) , 'catname', 'catname', 40 ) . ' ';
$form .= Xml::submitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />';
$form .= Xml::element( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ), $page, false );
$form .= '<br />';
$form = Xml::openElement( 'form', array( 'method' => 'post',
'action' => $this->getTitle()->getLocalUrl( 'action=submit' ) ) );
$form .= Xml::inputLabel( wfMsg( 'export-addcattext' ) , 'catname', 'catname', 40 ) . ' ';
$form .= Xml::submitButton( wfMsg( 'export-addcat' ), array( 'name' => 'addcat' ) ) . '<br />';
$form .= Xml::element( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ), $page, false );
$form .= '<br />';
if( $wgExportAllowHistory ) {
$form .= Xml::checkLabel( wfMsg( 'exportcuronly' ), 'curonly', 'curonly', true ) . '<br />';
} else {
if( $wgExportAllowHistory ) {
$form .= Xml::checkLabel( wfMsg( 'exportcuronly' ), 'curonly', 'curonly', true ) . '<br />';
} else {
// Enable this when we can do something useful exporting/importing image information. :)
//$form .= Xml::checkLabel( wfMsg( 'export-images' ), 'images', 'wpExportImages', false ) . '<br />';
$form .= Xml::checkLabel( wfMsg( 'export-download' ), 'wpDownload', 'wpDownload', true ) . '<br />';
// Enable this when we can do something useful exporting/importing image information. :)
//$form .= Xml::checkLabel( wfMsg( 'export-images' ), 'images', 'wpExportImages', false ) . '<br />';
$form .= Xml::checkLabel( wfMsg( 'export-download' ), 'wpDownload', 'wpDownload', true ) . '<br />';
$form .= Xml::submitButton( wfMsg( 'export-submit' ), array( 'accesskey' => 's' ) );
$form .= Xml::closeElement( 'form' );
$wgOut->addHTML( $form );
}
$form .= Xml::submitButton( wfMsg( 'export-submit' ), array( 'accesskey' => 's' ) );
$form .= Xml::closeElement( 'form' );
$wgOut->addHTML( $form );
}
*/
private function doExport( $page, $history ) {
global $wgExportMaxHistory;
*/
private function doExport( $page, $history ) {
global $wgExportMaxHistory;
/* Split up the input and look up linked pages */
$inputPages = array_filter( explode( "\n", $page ), array( $this, 'filterPage' ) );
$pageSet = array_flip( $inputPages );
/* Split up the input and look up linked pages */
$inputPages = array_filter( explode( "\n", $page ), array( $this, 'filterPage' ) );
$pageSet = array_flip( $inputPages );
if( $linkDepth = $this->pageLinkDepth ) {
$pageSet = $this->getPageLinks( $inputPages, $pageSet, $linkDepth );
}
if( $linkDepth = $this->pageLinkDepth ) {
$pageSet = $this->getPageLinks( $inputPages, $pageSet, $linkDepth );
}
/*
// Enable this when we can do something useful exporting/importing image information. :)
if( $this->images ) ) {
$pageSet = $this->getImages( $inputPages, $pageSet );
}
*/
/*
// Enable this when we can do something useful exporting/importing image information. :)
if( $this->images ) ) {
$pageSet = $this->getImages( $inputPages, $pageSet );
}
*/
/* Ok, let's get to it... */
if( $history == WikiExporter::CURRENT ) {
$lb = false;
/* Ok, let's get to it... */
if( $history == WikiExporter::CURRENT ) {
$lb = false;
$lb = wfGetLBFactory()->newMainLB();
$db = $lb->getConnection( DB_SLAVE );
$buffer = WikiExporter::STREAM;
$lb = wfGetLBFactory()->newMainLB();
$db = $lb->getConnection( DB_SLAVE );
$buffer = WikiExporter::STREAM;
$title = Title::newFromText( $page );
if( is_null( $title ) ) continue; #TODO: perhaps output an <error> tag or something.
if( !$title->userCanRead() ) continue; #TODO: perhaps output an <error> tag or something.
$title = Title::newFromText( $page );
if( is_null( $title ) ) continue; #TODO: perhaps output an <error> tag or something.
if( !$title->userCanRead() ) continue; #TODO: perhaps output an <error> tag or something.
list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
$sql = "SELECT page_namespace, page_title FROM $page " .
"JOIN $categorylinks ON cl_from = page_id " .
"WHERE cl_to = " . $dbr->addQuotes( $name );
list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
$sql = "SELECT page_namespace, page_title FROM $page " .
"JOIN $categorylinks ON cl_from = page_id " .
"WHERE cl_to = " . $dbr->addQuotes( $name );
$pages = array();
$res = $dbr->query( $sql, __METHOD__ );
while ( $row = $dbr->fetchObject( $res ) ) {
$pages = array();
$res = $dbr->query( $sql, __METHOD__ );
while ( $row = $dbr->fetchObject( $res ) ) {
/**
* Expand a list of pages to include images used in those pages.
* @param $inputPages array, list of titles to look up
/**
* Expand a list of pages to include images used in those pages.
* @param $inputPages array, list of titles to look up
array( NS_FILE . ' AS namespace', 'il_to AS title' ),
array( 'page_id=il_from' ) );
}
array( NS_FILE . ' AS namespace', 'il_to AS title' ),
array( 'page_id=il_from' ) );
}