Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1017,6 +1017,13 @@ |
1018 | 1018 | $title: name of the page changed. |
1019 | 1019 | $text: new contents of the page. |
1020 | 1020 | |
| 1021 | +'ModifyExportQuery': Modify the query used by the exporter. |
| 1022 | +$db: The database object to be queried. |
| 1023 | +&$tables: Tables in the query. |
| 1024 | +&$conds: Conditions in the query. |
| 1025 | +&$opts: Options for the query. |
| 1026 | +&$join_conds: Join conditions for the query. |
| 1027 | + |
1021 | 1028 | 'MonoBookTemplateToolboxEnd': Called by Monobook skin after toolbox links have |
1022 | 1029 | been rendered (useful for adding more) |
1023 | 1030 | Note: this is only run for the Monobook skin. To add items to the toolbox |
— | — | @@ -1634,5 +1641,19 @@ |
1635 | 1642 | query pages to be updated with maintenance/updateSpecialPages.php |
1636 | 1643 | $query: $wgQueryPages itself |
1637 | 1644 | |
| 1645 | +'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow extra |
| 1646 | + metadata to be added. |
| 1647 | +$obj: The XmlDumpWriter object. |
| 1648 | +&$out: The output string. |
| 1649 | +$row: The database row for the page. |
| 1650 | +$title: The title of the page. |
| 1651 | + |
| 1652 | +'XmlDumpWriterWriteRevision': Called at the end of a revision in an XML dump, to add extra |
| 1653 | + metadata. |
| 1654 | +$obj: The XmlDumpWriter object. |
| 1655 | +&$out: The text being output. |
| 1656 | +$row: The database row for the revision. |
| 1657 | +$text: The revision text. |
| 1658 | + |
1638 | 1659 | More hooks might be available but undocumented, you can execute |
1639 | 1660 | ./maintenance/findhooks.php to find hidden one. |
Index: trunk/phase3/includes/Export.php |
— | — | @@ -266,6 +266,9 @@ |
267 | 267 | if( $this->buffer == WikiExporter::STREAM ) { |
268 | 268 | $prev = $this->db->bufferResults( false ); |
269 | 269 | } |
| 270 | + |
| 271 | + wfRunHooks( 'ModifyExportQuery', |
| 272 | + array( $this->db, &$tables, &$cond, &$opts, &$join ) ); |
270 | 273 | |
271 | 274 | # Do the query! |
272 | 275 | $result = $this->db->select( $tables, '*', $cond, __METHOD__, $opts, $join ); |
— | — | @@ -445,6 +448,9 @@ |
446 | 449 | $out .= ' ' . Xml::element( 'restrictions', array(), |
447 | 450 | strval( $row->page_restrictions ) ) . "\n"; |
448 | 451 | } |
| 452 | + |
| 453 | + wfRunHooks( 'XmlDumpWriterOpenPage', array( $this, &$out, $row, $title ) ); |
| 454 | + |
449 | 455 | return $out; |
450 | 456 | } |
451 | 457 | |
— | — | @@ -503,6 +509,8 @@ |
504 | 510 | array( 'id' => $row->rev_text_id ), |
505 | 511 | "" ) . "\n"; |
506 | 512 | } |
| 513 | + |
| 514 | + wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) ); |
507 | 515 | |
508 | 516 | $out .= " </revision>\n"; |
509 | 517 | |
Index: trunk/extensions/LiquidThreads/LqtFunctions.php |
— | — | @@ -138,3 +138,28 @@ |
139 | 139 | return true; |
140 | 140 | } |
141 | 141 | |
| 142 | +function lqtDumpThreadData( $writer, &$out, $row, $title ) { |
| 143 | + // Is it a thread |
| 144 | + if ( $row->thread_id ) { |
| 145 | + $thread = new Thread( $row ); |
| 146 | + $threadInfo = "\n"; |
| 147 | + $threadInfo .= Xml::element( 'ThreadSubject', null, $thread->subject() ) . "\n"; |
| 148 | + if ($thread->hasSuperThread()) { |
| 149 | + $threadInfo .= Xml::element( 'ThreadParent', null, $thread->superThread()->id() ) . "\n"; |
| 150 | + } |
| 151 | + $threadInfo .= Xml::element( 'ThreadAncestor', null, $thread->topmostThread()->id() ) . "\n"; |
| 152 | + $threadInfo .= Xml::element( 'ThreadPage', null, $thread->article()->getId() ) . "\n"; |
| 153 | + |
| 154 | + $out .= Xml::tags( 'DiscussionThreading', null, $threadInfo ) . "\n"; |
| 155 | + } |
| 156 | + |
| 157 | + return true; |
| 158 | +} |
| 159 | + |
| 160 | +function lqtModifyExportQuery( $db, &$tables, &$cond, &$opts, &$join ) { |
| 161 | + $tables[] = 'thread'; |
| 162 | + |
| 163 | + $join['thread'] = array( 'left join', array( 'thread_root=page_id' ) ); |
| 164 | + |
| 165 | + return true; |
| 166 | +} |
Index: trunk/extensions/LiquidThreads/LiquidThreads.php |
— | — | @@ -59,6 +59,8 @@ |
60 | 60 | $wgHooks['GetPreferences'][] = 'lqtGetPreferences'; |
61 | 61 | $wgHooks['ArticleEditUpdateNewTalk'][] = 'lqtUpdateNewtalkOnEdit'; |
62 | 62 | $wgHooks['LanguageGetMagic'][] = 'LiquidThreadsMagicWords::getMagicWords'; |
| 63 | +$wgHooks['XmlDumpWriterOpenPage'][] = 'lqtDumpThreadData'; |
| 64 | +$wgHooks['ModifyExportQuery'][] = 'lqtModifyExportQuery'; |
63 | 65 | |
64 | 66 | // Deletion |
65 | 67 | $wgHooks['ArticleDeleteComplete'][] = 'LqtDeletionController::onArticleDeleteComplete'; |
Index: trunk/extensions/LiquidThreads/classes/Thread.php |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | |
299 | 299 | |
300 | 300 | |
301 | | - function __construct( $line, $children ) { |
| 301 | + function __construct( $line, $unused = null ) { |
302 | 302 | /* SCHEMA changes must be reflected here. */ |
303 | 303 | |
304 | 304 | $dataLoads = array( |