Physikerwelt has uploaded a new change for review.

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

Change subject: Adjust title suggestion logic
......................................................................

Adjust title suggestion logic

Change-Id: I8cc732b2ae6fcf8a60fb82fe28838871b7ed2d88
---
M MathSearch.hooks.php
M includes/special/SpecialMlpEval.php
2 files changed, 18 insertions(+), 1 deletion(-)


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

diff --git a/MathSearch.hooks.php b/MathSearch.hooks.php
index 179b3b5..94dbf19 100644
--- a/MathSearch.hooks.php
+++ b/MathSearch.hooks.php
@@ -33,6 +33,7 @@
                        $updater->addExtensionTable( 'mathidentifier', $dir . 
'mathidentifier.sql' );
                        $updater->addExtensionTable( 'mathlog', $dir . 
'mathlog.sql' );
                        $updater->addExtensionTable( 'math_mlp', $dir . 
'math_mlp.sql' );
+                       $updater->addExtensionTable( 'math_review_list', 
"${dir}math_review_list.sql" );
                        if ( $wgMathWmcServer ) {
                                $wmcDir = $dir . 'wmc/persistent/';
                                $updater->addExtensionTable( 'math_wmc_ref', 
$wmcDir . "math_wmc_ref.sql" );
@@ -42,7 +43,7 @@
                                        $wmcDir . 
"math_wmc_assessed_formula.sql" );
                                $updater->addExtensionTable( 
'math_wmc_assessed_revision',
                                        $wmcDir . 
"math_wmc_assessed_revision.sql" );
-                               $updater->addExtensionTable( 
'math_review_list', "${wmcDir}math_review_list.sql" );
+
                        }
                        if ( $updater->tableExists( 'mathlatexml' ) ) {
                                // temporary workaround for T117659
diff --git a/includes/special/SpecialMlpEval.php 
b/includes/special/SpecialMlpEval.php
index e4aa6e7..adc965b 100644
--- a/includes/special/SpecialMlpEval.php
+++ b/includes/special/SpecialMlpEval.php
@@ -162,6 +162,22 @@
 
 
        public function getRandomPage() {
+               try {
+                       $uid = $this->getUser()->getId();
+                       $dbr = wfGetDB( DB_READ );
+                       $results = $dbr->selectFieldValues( 'math_review_list', 
'revision_id',
+                                       "revision_id not in (SELECT revision_id 
from math_mlp where user_id = $uid )",
+                                       __METHOD__, array(
+                                               'LIMIT'    => 1,
+                                               'ORDER BY' => 'priority desc'
+                                       ) );
+                       if ( $results ) {
+                               $this->setRevision( $results[0] );
+                               return $this->revision->getTitle();
+                       }
+               } catch ( Exception $e ){
+                       // empty
+               }
                $rp = new RandomPage();
                for ( $i = 0; $i < self::MAX_ATTEMPTS; $i ++ ) {
                        $title = $rp->getRandomTitle();

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

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