diff --git a/config/current.ver b/config/current.ver index adf1ebc..84da421 100644 --- a/config/current.ver +++ b/config/current.ver @@ -1 +1 @@ -1.2.38 \ No newline at end of file +1.2.39 \ No newline at end of file diff --git a/src/ApiKernel.php b/src/ApiKernel.php index 5511020..6b652a4 100644 --- a/src/ApiKernel.php +++ b/src/ApiKernel.php @@ -1104,7 +1104,7 @@ class ApiKernel $stmt = $this->pdo->prepare($sql); foreach ($vdata as $k => $v) $stmt->bindValue(":$k", $v); $stmt->execute(); - $updatedExistingVersion = $stmt->rowCount() > 0; + $updatedExistingVersion = true; if ($updatedExistingVersion && $activateVersion) { $this->activateContentVersion($customerId, (int)$id, (int)$requestedVersionId); } @@ -1185,9 +1185,11 @@ class ApiKernel $select = ['`id`','`content_id`','`section_id`','`version_no`','`editor_type`','`created_at`']; if (!empty($cols['is_active'])) $select[] = "`{$cols['is_active']}` AS is_active"; if (!empty($cols['was_active'])) $select[] = "`{$cols['was_active']}` AS was_active"; + $limit = (int)$this->val($this->in, ['limit', 'per_page', 'perPage'], 0); + if ($limit <= 0 || $limit > 500) $limit = 200; $stmt = $this->pdo->prepare( "SELECT " . implode(',', $select) . " FROM `$table` WHERE `customer_id` = :cid AND `content_id` = :content - ORDER BY `id` DESC LIMIT 10" + ORDER BY `id` DESC LIMIT " . $limit ); $stmt->execute([':cid' => $customerId, ':content' => $contentId]); $rows = $stmt->fetchAll() ?: [];