Use SQL RANDOM() instead of RAND() for db type, except mysql

see http://board.s9y.org/viewtopic.php?f=3&t=19184
This commit is contained in:
Ian 2013-03-06 12:22:19 +01:00
parent e3dfd69ce4
commit 5bfd0fd858
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,6 @@
2.13:
- Use SQL RANDOM() instead of RAND() for db type, except mysql
latest: Smarty3 forward compatibility
2.0:

View file

@ -38,7 +38,7 @@ class serendipity_event_includeentry extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_INCLUDEENTRY_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '2.12');
$propbag->add('version', '2.13');
$propbag->add('scrambles_true_content', true);
$propbag->add('requirements', array(
'serendipity' => '0.8',
@ -681,7 +681,11 @@ class serendipity_event_includeentry extends serendipity_event
/* Show randomized blocks */
if ($cache['show'] && $show_multi && $cache['loops'] >= $cache['first_show']) {
if ($cache['last_skip'] == 0) {
$this->staticblock = $this->fetchStaticBlocks('block', 'RAND()', 1);
if (stristr($serendipity['dbType'], 'mysql') === FALSE) {
$this->staticblock = $this->fetchStaticBlocks('block', 'RANDOM()', 1);
} else {
$this->staticblock = $this->fetchStaticBlocks('block', 'RAND()', 1);
}
$eventData['display_dat'] .= $this->smartyParse();
}