Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179070

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(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MathSearch 
refs/changes/70/179070/1

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..d79ac40 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,13 +66,15 @@
                $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(
@@ -82,8 +86,9 @@
                                }
                        }
                } 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: newchange
Gerrit-Change-Id: I8effa098ff099195a85526f5b38d0a5f258cadbb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>

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

Reply via email to