mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 01:34:31 +02:00
Fix issue processwire/processwire-issues#1389
This commit is contained in:
@@ -732,8 +732,13 @@ class PagesRawFinder extends Wire {
|
||||
$idsCSV = &$this->ids;
|
||||
$colSQL = $getAllCols ? '*' : '`' . implode('`,`', $getCols) . '`';
|
||||
if(!$getAllCols && !in_array('pages_id', $getCols)) $colSQL .= ',`pages_id`';
|
||||
|
||||
$orderby = array();
|
||||
if(!count($this->nativeFields)) $orderby[] = "FIELD(pages_id, $idsCSV)";
|
||||
if(count($sorts)) $orderby[] = implode(',', $sorts);
|
||||
|
||||
$sql = "SELECT $colSQL FROM `$table` WHERE pages_id IN($idsCSV) ";
|
||||
if(count($sorts)) $sql .= "ORDER BY " . implode(',', $sorts);
|
||||
if(count($orderby)) $sql .= "ORDER BY " . implode(',', $orderby);
|
||||
|
||||
$query = $database->prepare($sql);
|
||||
$query->execute();
|
||||
|
Reference in New Issue
Block a user