Skip to content

Commit

Permalink
Bugfix: 0039089: Forum migration "forum.ilForumDraftsFilesMigration"
Browse files Browse the repository at this point in the history
  • Loading branch information
nmatuschek committed Nov 28, 2023
1 parent 225ac08 commit b0c02dc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,25 @@ public function step(Environment $environment): void
$base_path = $this->buildBasePath() . $draft_id . '/';
$pattern = '/(.+)/m';

$collection_id = $this->helper->moveFilesOfPatternToCollection(
$base_path,
$pattern,
$resource_owner_id,
ResourceCollection::NO_SPECIFIC_OWNER,
null,
$this->getRevisionNameCallback()
);

$save_colletion_id = $collection_id === null ? '-' : $collection_id->serialize();
$this->helper->getDatabase()->update(
'frm_posts_drafts',
['rcid' => ['text', $save_colletion_id]],
['draft_id' => ['integer', $draft_id]]
);
if (is_dir($base_path)) {
if (count(scandir($base_path)) > 2) {
$collection_id = $this->helper->moveFilesOfPatternToCollection(
$base_path,
$pattern,
$resource_owner_id,
ResourceCollection::NO_SPECIFIC_OWNER,
null,
$this->getRevisionNameCallback()
);

$save_colletion_id = $collection_id === null ? '-' : $collection_id->serialize();
$this->helper->getDatabase()->update(
'frm_posts_drafts',
['rcid' => ['text', $save_colletion_id]],
['draft_id' => ['integer', $draft_id]]
);
}
}
}

public function getRemainingAmountOfSteps(): int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,25 @@ public function step(Environment $environment): void
$filename_pattern = '/^' . $object_id . '\_' . $posting_id . '\_(.*)/m';
$pattern = '/.*\/' . $object_id . '\_' . $posting_id . '\_(.*)/m';

$collection_id = $this->helper->moveFilesOfPatternToCollection(
$base_path,
$pattern,
$resource_owner_id,
ResourceCollection::NO_SPECIFIC_OWNER,
$this->getFileNameCallback($filename_pattern),
$this->getRevisionNameCallback()
);

$save_colletion_id = $collection_id === null ? '-' : $collection_id->serialize();
$this->helper->getDatabase()->update(
'frm_posts',
['rcid' => ['text', $save_colletion_id]],
['pos_pk' => ['integer', $posting_id],]
);
if (is_dir($base_path)) {
if (count(scandir($base_path)) > 2) {
$collection_id = $this->helper->moveFilesOfPatternToCollection(
$base_path,
$pattern,
$resource_owner_id,
ResourceCollection::NO_SPECIFIC_OWNER,
$this->getFileNameCallback($filename_pattern),
$this->getRevisionNameCallback()
);

$save_colletion_id = $collection_id === null ? '-' : $collection_id->serialize();
$this->helper->getDatabase()->update(
'frm_posts',
['rcid' => ['text', $save_colletion_id]],
['pos_pk' => ['integer', $posting_id],]
);
}
}
}

public function getRemainingAmountOfSteps(): int
Expand Down

0 comments on commit b0c02dc

Please sign in to comment.