Skip to content

Commit

Permalink
improve version deletion for ezplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Sep 30, 2017
1 parent 4999f9a commit 585f4ee
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Core/Executor/ContentVersionManager.php
Expand Up @@ -33,8 +33,14 @@ protected function delete($step)
try {
if ($versionId < 0) {
$contentVersions = $contentService->loadVersions($content->contentInfo);
$contentVersions = array_slice($contentVersions, $versionId * -1);
// different eZ kernels apparently sort versions in different order...
$sortedVersions = array();
foreach($contentVersions as $versionInfo) {
$sortedVersions[$versionInfo->versionNo] = $versionInfo;
}
ksort($sortedVersions);
$sortedVersions = array_slice($sortedVersions, $versionId * -1);
foreach($sortedVersions as $versionInfo) {
$contentService->deleteVersion($versionInfo);
}
} else {
Expand Down

0 comments on commit 585f4ee

Please sign in to comment.