Go to the documentation of this file.
112 $this->sink =&
$sink;
117 $this->sink->writeOpenStream(
$output );
122 $this->sink->writeCloseStream(
$output );
144 $condition =
'rev_page >= ' . intval( $start );
146 $condition .=
' AND rev_page < ' . intval( $end );
149 $condition =
'page_id >= ' . intval( $start );
151 $condition .=
' AND page_id < ' . intval( $end );
154 $this->
dumpFrom( $condition, $orderRevs );
165 $condition =
'rev_id >= ' . intval( $start );
167 $condition .=
' AND rev_id < ' . intval( $end );
177 'page_namespace=' .
$title->getNamespace() .
178 ' AND page_title=' . $this->db->addQuotes(
$title->getDBkey() ) );
187 if ( is_null(
$title ) ) {
188 throw new MWException(
"Can't export invalid title" );
212 $condition =
'log_id >= ' . intval( $start );
214 $condition .=
' AND log_id < ' . intval( $end );
227 $this->author_list =
"<contributors>";
230 $res = $this->db->select(
231 [
'page',
'revision' ],
232 [
'DISTINCT rev_user_text',
'rev_user' ],
241 foreach (
$res as $row ) {
242 $this->author_list .=
"<contributor>" .
244 htmlentities( $row->rev_user_text ) .
251 $this->author_list .=
"</contributors>";
260 protected function dumpFrom( $cond =
'', $orderRevs =
false ) {
261 # For logging dumps...
262 if ( $this->
history & self::LOGS ) {
267 $where[] = $hideLogs;
269 # Add on any caller specified conditions
273 # Get logging table name for logging.* clause
274 $logging = $this->db->tableName(
'logging' );
276 if ( $this->buffer == self::STREAM ) {
277 $prev = $this->db->bufferResults(
false );
284 $result = $this->db->select( [
'logging',
'user' ] + $commentQuery[
'tables'],
285 [
"{$logging}.*",
'user_name' ] + $commentQuery[
'fields'],
288 [
'ORDER BY' =>
'log_id',
'USE INDEX' => [
'logging' =>
'PRIMARY' ] ],
289 [
'user' => [
'JOIN',
'user_id = log_user' ] ] + $commentQuery[
'joins']
292 if ( $this->buffer == self::STREAM ) {
293 $this->db->bufferResults( $prev );
295 }
catch ( Exception
$e ) {
304 }
catch ( Exception $e2 ) {
311 if ( $this->buffer == self::STREAM ) {
312 $this->db->bufferResults( $prev );
314 }
catch ( Exception $e2 ) {
324 $tables = [
'page',
'revision' ];
325 $opts = [
'ORDER BY' =>
'page_id ASC' ];
326 $opts[
'USE INDEX'] = [];
328 if ( is_array( $this->
history ) ) {
329 # Time offset/limit for all pages/history...
330 $revJoin =
'page_id=rev_page';
332 if ( $this->
history[
'dir'] ==
'asc' ) {
334 $opts[
'ORDER BY'] =
'rev_timestamp ASC';
337 $opts[
'ORDER BY'] =
'rev_timestamp DESC';
340 if ( !empty( $this->
history[
'offset'] ) ) {
341 $revJoin .=
" AND rev_timestamp $op " .
342 $this->db->addQuotes( $this->db->timestamp( $this->history[
'offset'] ) );
344 $join[
'revision'] = [
'INNER JOIN', $revJoin ];
346 if ( !empty( $this->
history[
'limit'] ) ) {
347 $opts[
'LIMIT'] = intval( $this->
history[
'limit'] );
349 } elseif ( $this->
history & self::FULL ) {
350 # Full history dumps...
351 # query optimization for history stub dumps
352 if ( $this->
text == self::STUB && $orderRevs ) {
353 $tables = [
'revision',
'page' ];
354 $opts[] =
'STRAIGHT_JOIN';
355 $opts[
'ORDER BY'] = [
'rev_page ASC',
'rev_id ASC' ];
356 $opts[
'USE INDEX'][
'revision'] =
'rev_page_id';
357 $join[
'page'] = [
'INNER JOIN',
'rev_page=page_id' ];
359 $join[
'revision'] = [
'INNER JOIN',
'page_id=rev_page' ];
361 } elseif ( $this->
history & self::CURRENT ) {
362 # Latest revision dumps...
363 if ( $this->list_authors && $cond !=
'' ) {
366 $join[
'revision'] = [
'INNER JOIN',
'page_id=rev_page AND page_latest=rev_id' ];
367 } elseif ( $this->
history & self::STABLE ) {
368 # "Stable" revision dumps...
369 # Default JOIN, to be overridden...
370 $join[
'revision'] = [
'INNER JOIN',
'page_id=rev_page AND page_latest=rev_id' ];
371 # One, and only one hook should set this, and return false
372 if (
Hooks::run(
'WikiExporter::dumpStableQuery', [ &
$tables, &$opts, &$join ] ) ) {
373 throw new MWException( __METHOD__ .
" given invalid history dump type." );
375 } elseif ( $this->
history & self::RANGE ) {
376 # Dump of revisions within a specified range
377 $join[
'revision'] = [
'INNER JOIN',
'page_id=rev_page' ];
378 $opts[
'ORDER BY'] = [
'rev_page ASC',
'rev_id ASC' ];
380 # Unknown history specification parameter?
381 throw new MWException( __METHOD__ .
" given invalid history dump type." );
383 # Query optimization hacks
385 $opts[] =
'STRAIGHT_JOIN';
386 $opts[
'USE INDEX'][
'page'] =
'PRIMARY';
388 # Build text join options
389 if ( $this->
text != self::STUB ) {
391 $join[
'text'] = [
'INNER JOIN',
'rev_text_id=old_id' ];
394 if ( $this->buffer == self::STREAM ) {
395 $prev = $this->db->bufferResults(
false );
400 [ $this->db, &
$tables, &$cond, &$opts, &$join ] );
406 $tables + $commentQuery[
'tables'],
407 [
'*' ] + $commentQuery[
'fields'],
411 $join + $commentQuery[
'joins']
413 # Output dump results
416 if ( $this->buffer == self::STREAM ) {
417 $this->db->bufferResults( $prev );
419 }
catch ( Exception
$e ) {
428 }
catch ( Exception $e2 ) {
435 if ( $this->buffer == self::STREAM ) {
436 $this->db->bufferResults( $prev );
438 }
catch ( Exception $e2 ) {
463 foreach ( $resultset
as $row ) {
464 if (
$last ===
null ||
465 $last->page_namespace != $row->page_namespace ||
466 $last->page_title != $row->page_title ) {
467 if (
$last !==
null ) {
469 if ( $this->dumpUploads ) {
473 $this->sink->writeClosePage(
$output );
476 $this->sink->writeOpenPage( $row,
$output );
480 $this->sink->writeRevision( $row,
$output );
482 if (
$last !==
null ) {
484 if ( $this->dumpUploads ) {
489 $this->sink->writeClosePage(
$output );
497 foreach ( $resultset
as $row ) {
499 $this->sink->writeLogItem( $row,
$output );
static schemaVersion()
Returns the export schema version.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
revsByRange( $start, $end)
Dumps a series of page and revision records for those pages in the database with revisions falling wi...
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
__construct( $db, $history=self::CURRENT, $buffer=self::BUFFER, $text=self::TEXT)
If using WikiExporter::STREAM to stream a large amount of data, provide a database connection which i...
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language & $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED! Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language & $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
bool $dumpUploadFileContents
Allows to change the fields on the form that will be generated $name
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output
dumpFrom( $cond='', $orderRevs=false)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
bool $list_authors
Return distinct author list (when not returning full history)
namespace and then decline to actually register it file or subcat img or subcat $title
outputLogStream( $resultset)
allPages()
Dumps a series of page and revision records for all pages in the database, either including complete ...
pagesByRange( $start, $end, $orderRevs)
Dumps a series of page and revision records for those pages in the database falling within the page_i...
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
static getExcludeClause( $db, $audience='public', User $user=null)
SQL clause to skip forbidden log types for this user.
do_list_authors( $cond)
Generates the distinct list of authors of an article Not called by default (depends on $this->list_au...
setOutputSink(&$sink)
Set the DumpOutput or DumpFilter object which will receive various row objects and XML output for fil...
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc next in line in page history
logsByRange( $start, $end)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
outputPageStream( $resultset)
Runs through a query result set dumping page and revision records.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.