public function handle($absolutePath, $relativePath)
    {
        $sharedFiles = $this->getSharedFiles();

        $md5 = md5_file($absolutePath);
        if (isset($sharedFiles[$md5])) {
            \common_Logger::i('Auxiliary file \'' . $absolutePath . '\' linked to shared storage.');
            return $sharedFiles[$md5];
        }

        SharedStimulusImporter::isValidSharedStimulus($absolutePath);
        $newXmlFile = SharedStimulusPackageImporter::embedAssets($absolutePath);
        $itemContent = $this->sharedStorage->add($newXmlFile, basename($relativePath), $this->parentPath);

        if (method_exists($this->sharedStorage, 'forceMimeType')) {
            $asset = $this->itemSource->resolve($itemContent['uri']);
            $this->sharedStorage->forceMimeType($asset->getMediaIdentifier(), 'application/qti+xml');
        }

        $this->addSharedFile($md5, $itemContent);
        \common_Logger::i('Auxiliary file \'' . $absolutePath . '\' added to shared storage.');

        return $itemContent;
    }
public function handle($absolutePath, $relativePath)
    {
        $sharedFiles = $this->getSharedFiles();

        $md5 = md5_file($absolutePath);
        if (isset($sharedFiles[$md5])) {
            \common_Logger::i('Auxiliary file \'' . $absolutePath . '\' linked to shared storage.');
            return $sharedFiles[$md5];
        }

        SharedStimulusImporter::isValidSharedStimulus($absolutePath);
        $newXmlFile = SharedStimulusPackageImporter::embedAssets($absolutePath);
        $itemContent = $this->sharedStorage->add($newXmlFile, basename($relativePath), $this->parentPath);

        if (method_exists($this->sharedStorage, 'forceMimeType')) {
            $asset = $this->itemSource->resolve($itemContent['uri']);
            $this->sharedStorage->forceMimeType($asset->getMediaIdentifier(), 'application/qti+xml');
        }

        $this->addSharedFile($md5, $itemContent);
        \common_Logger::i('Auxiliary file \'' . $absolutePath . '\' added to shared storage.');

        return $itemContent;
    }
public function handle ( $ absolutePath , $ relativePath ) { $ sharedFiles = $ this -> getSharedFiles ( ) ; $ md5 = md5_file ( $ absolutePath ) ; if ( isset ( $ sharedFiles [ $ md5 ] ) ) { \ common_Logger :: i ( 'Auxiliary file \'' . $ absolutePath . '\' linked to shared storage.' ) ; return $ sharedFiles [ $ md5 ] ; } SharedStimulusImporter :: isValidSharedStimulus ( $ absolutePath ) ; $ newXmlFile = SharedStimulusPackageImporter :: embedAssets ( $ absolutePath ) ; $ itemContent = $ this -> sharedStorage -> add ( $ newXmlFile , basename ( $ relativePath ) , $ this -> parentPath ) ; if ( method_exists ( $ this -> sharedStorage , 'forceMimeType' ) ) { $ asset = $ this -> itemSource -> resolve ( $ itemContent [ 'uri' ] ) ; $ this -> sharedStorage -> forceMimeType ( $ asset -> getMediaIdentifier ( ) , 'application/qti+xml' ) ; } $ this -> addSharedFile ( $ md5 , $ itemContent ) ; \ common_Logger :: i ( 'Auxiliary file \'' . $ absolutePath . '\' added to shared storage.' ) ; return $ itemContent ; }
Handle the process to manage shared stimulus files

@param $absolutePath
@param $relativePath
@return array
@throws \qtism\data\storage\xml\XmlStorageException
Handle the process to manage shared stimulus files