[MediaWiki-commits] [Gerrit] Update ExtractFeatures script - change (mediawiki...MathSearch)

2014-04-03 Thread Physikerwelt (Code Review)
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( "#(.*?)#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 
Gerrit-Reviewer: Physikerwelt 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] Update ExtractFeatures script - change (mediawiki...MathSearch)

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

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

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(-)


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

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( "#(.*?)#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: newchange
Gerrit-Change-Id: I6d3f0f396a38fc6015f8a8a8922595dad3ebee8e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MathSearch
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt 

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