Jeroen De Dauw has uploaded a new change for review.

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


Change subject: Improve SQLite compat
......................................................................

Improve SQLite compat

Fix error that can be seen here 
https://integration.mediawiki.org/ci/job/mwext-EducationProgram-testextensions-master/169/console

Change-Id: I8dc631869fcf6a68767676b42d4fe9aa0a2cb4ac
---
M includes/DYKBox.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram 
refs/changes/14/50914/1

diff --git a/includes/DYKBox.php b/includes/DYKBox.php
index 158e5b6..e7b3253 100644
--- a/includes/DYKBox.php
+++ b/includes/DYKBox.php
@@ -159,6 +159,9 @@
                global $wgContLang;
 
                $dbr = wfGetDB( DB_SLAVE );
+
+               $randomFunction = $dbr->getType() === 'sqlite' ? 'RANDOM()' : 
'RAND()';
+
                $res = $dbr->selectRow(
                        array( 'page', 'categorylinks' ),
                        array( 'page_namespace', 'page_title' ),
@@ -167,7 +170,7 @@
                                'cl_to' => Title::newFromText( $categoryName, 
NS_CATEGORY )->getDBkey()
                        ),
                        __METHOD__,
-                       array( 'ORDER BY' => 'RAND()' )
+                       array( 'ORDER BY' => $randomFunction )
                );
 
                if ( $res !== false ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dc631869fcf6a68767676b42d4fe9aa0a2cb4ac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>

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

Reply via email to