merged master
[lhc/web/wiklou.git] / includes / api / ApiQueryRevisions.php
index 44cb46e..4ac7a44 100644 (file)
@@ -114,7 +114,7 @@ class ApiQueryRevisions extends ApiQueryBase {
                }
 
                if ( !is_null( $params['difftotext'] ) ) {
-                       $this->difftotext = $params['difftotext'];
+                       $this->difftotext = $params['difftotext']; #FIXME: handle non-text content!
                } elseif ( !is_null( $params['diffto'] ) ) {
                        if ( $params['diffto'] == 'cur' ) {
                                $params['diffto'] = 0;
@@ -513,11 +513,13 @@ class ApiQueryRevisions extends ApiQueryBase {
                                $vals['diff'] = array();
                                $context = new DerivativeContext( $this->getContext() );
                                $context->setTitle( $title );
+                $handler = ContentHandler::getForTitle( $title );
+
                                if ( !is_null( $this->difftotext ) ) {
-                                       $engine = new DifferenceEngine( $context );
-                                       $engine->setText( $text, $this->difftotext );
+                                       $engine = $handler->createDifferenceEngine( $context );
+                                       $engine->setText( $text, $this->difftotext ); #FIXME: use content objects!...
                                } else {
-                                       $engine = new DifferenceEngine( $context, $revision->getID(), $this->diffto );
+                                       $engine = $handler->createDifferenceEngine( $context, $revision->getID(), $this->diffto );
                                        $vals['diff']['from'] = $engine->getOldid();
                                        $vals['diff']['to'] = $engine->getNewid();
                                }