/** * Copies the preview images from one preview to a new preview object. * * @param int $a_src_id The id of the object to copy from. * @param int $a_dest_id The id of the object to copy to. */ public static function copyPreviews($a_src_id, $a_dest_id) { if (!ilPreviewSettings::isPreviewEnabled()) { return; } // get source preview $src = new ilPreview($a_src_id); $status = $src->getRenderStatus(); // created? copy the previews if ($status == self::RENDER_STATUS_CREATED) { // create destination preview and set it's properties $dest = new ilPreview($a_dest_id); $dest->setRenderDate($src->getRenderDate()); $dest->setRenderStatus($src->getRenderStatus()); // create path $dest->getStorage()->create(); // copy previews ilUtil::rCopy($src->getStoragePath(), $dest->getStoragePath()); // save copy $dest->doCreate(); } else { // all other status need no action // self::RENDER_STATUS_FAILED // self::RENDER_STATUS_NONE // self::RENDER_STATUS_PENDING } }