jenkins-bot has submitted this change and it was merged.

Change subject: Fix Specialpage Formulainfo
......................................................................


Fix Specialpage Formulainfo

$pid was used but was never calculated.

Change-Id: I8effa098ff099195a85526f5b38d0a5f258cadbb
---
M FormulaInfo.php
M MathEngineBaseX.php
2 files changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Physikerwelt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/FormulaInfo.php b/FormulaInfo.php
index fffe20e..b75c1c9 100644
--- a/FormulaInfo.php
+++ b/FormulaInfo.php
@@ -68,7 +68,7 @@
                $pageName = (string)$revision->getTitle();
                $out->addWikiText( "* Page found: [[$pageName#$eid|$pageName]] 
(eq $eid)  ", false );
                $out->addHtml( '<a href="/index.php?title=' . $pageName . 
'&action=purge&mathpurge=true">(force rerendering)</a>' );
-
+               $pid = Revision::newFromId($oldID)->getTitle()->getArticleID();
                /* @var $mo MathObject  */
                $mo = MathObject::constructformpage( $pid, $eid );
                if ( !$mo ) {
diff --git a/MathEngineBaseX.php b/MathEngineBaseX.php
index 592ef4e..b02d1d1 100644
--- a/MathEngineBaseX.php
+++ b/MathEngineBaseX.php
@@ -52,6 +52,8 @@
 
        /**
         * Posts the query to BaseX and evaluates the results
+        * @throws BaseXError
+        * @throws MWException
         * @return boolean
         */
        function postQuery() {
@@ -64,26 +66,27 @@
                $res = $session->execute( "xquery ".$this->query->getXQuery() );
                $this->relevanceMap = array();
                $this->resultSet = array();
+               $size = 0;
                if( $res ){
                        //TODO: ReEvaluate the regexp.
-                       $baseXRegExp = "/<a .*? 
href=\"http.*?curid=(\d+)#math(\d?)\"/";
+                       $baseXRegExp = "/<a .*? 
href=\"http.*?curid=math.(\d+).math(\d+)\"/";
                        preg_match_all( $baseXRegExp , $res, 
$matches,PREG_SET_ORDER);
                        foreach($matches as $match){
                                $mo = 
MathObject::constructformpage($match[1],$match[2]);
                                if ( $mo ) {
+                                       $size++;
                                        
$this->relevanceMap[(string)$mo->getPageID()] = true;
                                        
$this->resultSet[(string)$mo->getPageID()][(string)$mo->getAnchorID()][] =
                                                array(
                                                        "xpath" => '/',
                                                        "mappings" => array()
-                                               ); // 
,"original"=>$page->asXML()
+                                               );
                                } else {
                                        wfDebugLog( 'MathSearch', "Warning: 
Entry ${match[1]}, ${match[2]} not fund in database. Index might be out of 
date." );
                                }
                        }
-               } else {
-                       $this->size = 0;
                }
+               $this->size = $size;
                return true;
        }
 }
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/179070
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8effa098ff099195a85526f5b38d0a5f258cadbb
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to