Migration: Remove unnecessary cid parameter from resourceFile url

pull/5458/head
christianbeeznst 7 months ago
parent 9c937efab3
commit ff7aaf3fc9
  1. 6
      src/CoreBundle/Migrations/Schema/V200/Version20230913162700.php

@ -421,13 +421,11 @@ final class Version20230913162700 extends AbstractMigrationChamilo
if ($documentFile) {
$newUrl = $documentRepo->getResourceFileUrl($documentFile);
if (!empty($newUrl)) {
$queryChar = strpos($newUrl, '?') === false ? '?' : '&';
$newUrlWithCid = $newUrl . $queryChar . 'cid=' . $courseId;
$patternForReplacement = '/'.$matches[1][$index].'=(["\'])'.preg_quote($videoPath, '/').'\1/i';
$replacement = $matches[1][$index].'=$1'.$newUrlWithCid.'$1';
$replacement = $matches[1][$index].'=$1'.$newUrl.'$1';
$contentText = preg_replace($patternForReplacement, $replacement, $contentText);
error_log('$documentPath ->'.$documentPath);
error_log('newUrl ->'.$newUrlWithCid);
error_log('newUrl ->'.$newUrl);
}
}
}

Loading…
Cancel
Save