Skip to content

Commit 9069562

Browse files
committed
do no longer request all idsites by default as it would otherwise load the metadata for each site and if one has 20k sites would request it 20k times!
1 parent 03ea8fb commit 9069562

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

core/API/DataTableManipulator.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ protected function loadSubtable($dataTable, $row)
124124
}
125125
}
126126

127-
$method = $this->getApiMethodForSubtable();
127+
$method = $this->getApiMethodForSubtable($request);
128128
return $this->callApiAndReturnDataTable($this->apiModule, $method, $request);
129129
}
130130

@@ -144,10 +144,16 @@ protected abstract function manipulateSubtableRequest($request);
144144
* @throws Exception
145145
* @return string
146146
*/
147-
private function getApiMethodForSubtable()
147+
private function getApiMethodForSubtable($request)
148148
{
149149
if (!$this->apiMethodForSubtable) {
150-
$meta = API::getInstance()->getMetadata('all', $this->apiModule, $this->apiMethod);
150+
if (!empty($request['idSite'])) {
151+
$idSite = $request['idSite'];
152+
} else {
153+
$idSite = 'all';
154+
}
155+
156+
$meta = API::getInstance()->getMetadata($idSite, $this->apiModule, $this->apiMethod);
151157

152158
if (empty($meta)) {
153159
throw new Exception(sprintf(

0 commit comments

Comments
 (0)