Leave the image data out of the story lists.
A page of 50 stories read 50 images from the database only to see which stories had one.
This commit is contained in:
@@ -22,7 +22,13 @@ class SiteData {
|
||||
self::$lastInsertId = 0;
|
||||
|
||||
$stories = '(xxx|queue)';
|
||||
FakeDb::on("/^SELECT \\* FROM $stories\\b/", array(self::class, 'selectStories'));
|
||||
FakeDb::on("/^SELECT id, title, author, email, date, story, hidden, mime, comments, editor, IF\\(LENGTH\\(img\\) > 0, 1, NULL\\) AS img FROM $stories\\b/",
|
||||
function ($sql, $params) {
|
||||
return array_map(function ($row) {
|
||||
$row['img'] = strlen((string)$row['img']) > 0 ? 1 : NULL;
|
||||
return $row;
|
||||
}, self::selectStories($sql, $params));
|
||||
});
|
||||
FakeDb::on("/^SELECT COUNT\\(\\*\\) FROM $stories\\b/", function ($sql, $params) {
|
||||
return array(array('COUNT(*)' => (string)count(self::filterStories($sql, $params))));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user