Physikerwelt has submitted this change and it was merged.

Change subject: Update ExtractFeatures script
......................................................................


Update ExtractFeatures script

* use more generic methoid to discover formulae

Change-Id: I6d3f0f396a38fc6015f8a8a8922595dad3ebee8e
---
M maintenance/ExtractFeatures.php
1 file changed, 6 insertions(+), 6 deletions(-)

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



diff --git a/maintenance/ExtractFeatures.php b/maintenance/ExtractFeatures.php
index b16a8bb..fef7613 100644
--- a/maintenance/ExtractFeatures.php
+++ b/maintenance/ExtractFeatures.php
@@ -21,7 +21,7 @@
 
 require_once( dirname( __FILE__ ) . '/../../../maintenance/Maintenance.php' );
 
-class UpdateMath extends Maintenance {
+class ExtractFeatures extends Maintenance {
        const RTI_CHUNK_SIZE = 100;
        var $purge = false;
        var $dbw = null;
@@ -110,12 +110,12 @@
                // TODO: fix link id problem
                $anchorID = 0;
                $res = "";
-               $pText = Sanitizer::removeHTMLcomments( $pText );
-               $matches = preg_match_all( "#<math>(.*?)</math>#s", $pText, 
$math );
+               $math = MathObject::extractMathTagsFromWikiText( $pText );
+               $matches = sizeof( $math );
                if ( $matches ) {
                        echo( "\t processing $matches math fields for {$pTitle} 
page\n" );
-                       foreach ( $math[1] as $formula ) {
-                               $mo = new MathObject( $formula );
+                       foreach ( $math as $formula ) {
+                               $mo = new MathObject( $formula[1] );
                                $mo->updateObservations( $dbw );
                                // Enable indexing of math formula
                                $anchorID++;
@@ -136,5 +136,5 @@
        }
 }
 
-$maintClass = "UpdateMath";
+$maintClass = "ExtractFeatures";
 require_once( RUN_MAINTENANCE_IF_MAIN );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6d3f0f396a38fc6015f8a8a8922595dad3ebee8e
Gerrit-PatchSet: 1
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