[MediaWiki-commits] [Gerrit] Stable IDs for NTCIR wmc1.02 - change (mediawiki...MathSearch)

2014-08-29 Thread Physikerwelt (Code Review)
Physikerwelt has submitted this change and it was merged.

Change subject: Stable IDs for NTCIR wmc1.02
..


Stable IDs for NTCIR wmc1.02

Use stable IDs for the second round of NTCIR-11
Math 2 Wikipedia Subtask round 2.

Change-Id: Ic1cfa6c35515f7acfc4c03c88710e531de77cd7f
---
M MathSearch.hooks.php
M SpecialMathSearch.php
2 files changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Physikerwelt: Verified; Looks good to me, approved



diff --git a/MathSearch.hooks.php b/MathSearch.hooks.php
index 65a492f..d5053eb 100644
--- a/MathSearch.hooks.php
+++ b/MathSearch.hooks.php
@@ -54,6 +54,9 @@
}
}
 
+   private static function curId2OldId( $curId ){
+   return Title::newFromID( $curId )-getLatestRevID();
+   }
/**
 * Updates the formula index in the database
 *
@@ -64,7 +67,7 @@
 */
private static function updateIndex($pid, $eid, $inputHash, $tex){
try {
-   $oldID = Title::newFromID( $pid )-getLatestRevID();
+   $oldID = self::curId2OldId( $pid );
$dbr = wfGetDB( DB_SLAVE );
$exists = $dbr-selectRow( 'mathindex',
array( 'mathindex_page_id', 'mathindex_anchor', 
'mathindex_inputhash' ),
@@ -192,9 +195,10 @@
self::updateIndex( $pid, $eid, 
$Renderer-getInputHash(), $Renderer-getTex() );
}
if ( preg_match( '#math(.*)?\sid=(?Pid[\w\.]+)#', $Result, 
$matches ) ) {
-   $oldId = $matches['id'];
-   $newID = math.$pid.$eid;
-   $Result = str_replace( $oldId, $newID, $Result );
+   $rendererId = $matches['id'];
+   $oldId = self::curId2OldId( $pid );
+   $newID = math.${oldId}.${eid};
+   $Result = str_replace( $rendererId, $newID, $Result );
}
return true;
}
diff --git a/SpecialMathSearch.php b/SpecialMathSearch.php
index a28eaa6..0ab2514 100644
--- a/SpecialMathSearch.php
+++ b/SpecialMathSearch.php
@@ -164,7 +164,6 @@
}
 
if ( $this-mathBackend  $this-textpattern ==  ) {
-   wfDebugLog( MathSearch, Starting output 
(notext mode) );
$results = $this-mathBackend-getResultSet();
if ( $results ) {
foreach ( $results as $pageID = $page 
) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1cfa6c35515f7acfc4c03c88710e531de77cd7f
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt w...@physikerwelt.de
Gerrit-Reviewer: Hashar has...@free.fr
Gerrit-Reviewer: Physikerwelt w...@physikerwelt.de

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


[MediaWiki-commits] [Gerrit] Stable IDs for NTCIR wmc1.02 - change (mediawiki...MathSearch)

2014-08-28 Thread Physikerwelt (Code Review)
Physikerwelt has uploaded a new change for review.

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

Change subject: Stable IDs for NTCIR wmc1.02
..

Stable IDs for NTCIR wmc1.02

Use stable IDs for the second round of NTCIR-11
Math 2 Wikipedia Subtask round 2.

Change-Id: Ic1cfa6c35515f7acfc4c03c88710e531de77cd7f
---
M SpecialMathSearch.php
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/SpecialMathSearch.php b/SpecialMathSearch.php
index a28eaa6..0ab2514 100644
--- a/SpecialMathSearch.php
+++ b/SpecialMathSearch.php
@@ -164,7 +164,6 @@
}
 
if ( $this-mathBackend  $this-textpattern ==  ) {
-   wfDebugLog( MathSearch, Starting output 
(notext mode) );
$results = $this-mathBackend-getResultSet();
if ( $results ) {
foreach ( $results as $pageID = $page 
) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1cfa6c35515f7acfc4c03c88710e531de77cd7f
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