[dev] [commit] r1054 - wwwbase/admin
automailer at dexonline.ro
automailer at dexonline.ro
Mon Jan 13 12:39:09 EET 2014
Author: cata
Date: Mon Jan 13 12:39:09 2014
New Revision: 1054
Log:
Use a different technique for selecting a random row from MySQL.
Modified:
wwwbase/admin/randomAbbrevReview.php
Modified: wwwbase/admin/randomAbbrevReview.php
==============================================================================
--- wwwbase/admin/randomAbbrevReview.php Mon Jan 13 04:18:05 2014 (r1053)
+++ wwwbase/admin/randomAbbrevReview.php Mon Jan 13 12:39:09 2014 (r1054)
@@ -36,11 +36,12 @@
}
$MARKER = 'DEADBEEF'; // any string that won't occur naturally in a definition
+$def = null;
+$ids = db_getArray(sprintf('select id from Definition where status != %d and abbrevReview = %d', ST_DELETED, ABBREV_AMBIGUOUS));
+if (count($ids)) {
+ $defId = $ids[array_rand($ids, 1)];
+ $def = Definition::get_by_id($defId);
-$def = Model::factory('Definition')->raw_query('select * from Definition where status != ' . ST_DELETED .
- ' and abbrevReview = ' . ABBREV_AMBIGUOUS . ' order by rand() limit 1', null)->find_one();
-
-if ($def) {
// Collect the positions of ambiguous abbreviations
$matches = array();
AdminStringUtil::markAbbreviations($def->internalRep, $def->sourceId, $matches);
More information about the Dev
mailing list