Incremental enabling changes to allow searching of LiquidThreads by page and by thread:
authorAndrew Garrett <werdna@users.mediawiki.org>
Mon, 27 Jul 2009 17:57:51 +0000 (17:57 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Mon, 27 Jul 2009 17:57:51 +0000 (17:57 +0000)
* Add three new hooks, XmlDumpWriterOpenPage, ModifyExportQuery and XmlDumpWriterWriteRevision, to WikiExporter class.
* Hook two of these events to add a DiscussionThreading section to XML dumps, containing the parent, ancestor and discussion page to which a post belongs, if it is indeed a LiquidThreads post (as determined by joining on the thread table).
* Deprecate old calling style for Thread constructor, the $children parameter has been unused for yonks.

docs/hooks.txt
includes/Export.php

index ece9e28..65048b5 100644 (file)
@@ -1017,6 +1017,13 @@ Useful for updating caches.
 $title: name of the page changed.
 $text: new contents of the page.
 
+'ModifyExportQuery': Modify the query used by the exporter.
+$db: The database object to be queried.
+&$tables: Tables in the query.
+&$conds: Conditions in the query.
+&$opts: Options for the query.
+&$join_conds: Join conditions for the query.
+
 'MonoBookTemplateToolboxEnd': Called by Monobook skin after toolbox links have
 been rendered (useful for adding more)
 Note: this is only run for the Monobook skin.  To add items to the toolbox
@@ -1634,5 +1641,19 @@ One, and only one hook should set this, and return false.
 query pages to be updated with maintenance/updateSpecialPages.php
 $query: $wgQueryPages itself
 
+'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow extra
+ metadata to be added.
+$obj: The XmlDumpWriter object.
+&$out: The output string.
+$row: The database row for the page.
+$title: The title of the page.
+
+'XmlDumpWriterWriteRevision': Called at the end of a revision in an XML dump, to add extra
+ metadata.
+$obj: The XmlDumpWriter object.
+&$out: The text being output.
+$row: The database row for the revision.
+$text: The revision text.
+
 More hooks might be available but undocumented, you can execute
 ./maintenance/findhooks.php to find hidden one.
index 3372cec..f05b660 100644 (file)
@@ -266,6 +266,9 @@ class WikiExporter {
                        if( $this->buffer == WikiExporter::STREAM ) {
                                $prev = $this->db->bufferResults( false );
                        }
+                       
+                       wfRunHooks( 'ModifyExportQuery',
+                                               array( $this->db, &$tables, &$cond, &$opts, &$join ) );
 
                        # Do the query!
                        $result = $this->db->select( $tables, '*', $cond, __METHOD__, $opts, $join );
@@ -445,6 +448,9 @@ class XmlDumpWriter {
                        $out .= '    ' . Xml::element( 'restrictions', array(),
                                strval( $row->page_restrictions ) ) . "\n";
                }
+               
+               wfRunHooks( 'XmlDumpWriterOpenPage', array( $this, &$out, $row, $title ) );
+               
                return $out;
        }
 
@@ -503,6 +509,8 @@ class XmlDumpWriter {
                                array( 'id' => $row->rev_text_id ),
                                "" ) . "\n";
                }
+               
+               wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) );
 
                $out .= "    </revision>\n";