/** * Update urlShare info (if any) when we move/rename a file * @param <String> $filename */ protected static function updateUrlShare($source, $target) { /** * Execute a search to detect if this file has Url */ $urlShareController = UrlShareController::getInstance(); $filepath = $source; $filename = basename($filepath); $shareFile = new UrlFile(); $shareFile->setPath($filepath); $founded = $urlShareController->searchFile($shareFile); if ($founded) { $founded = current($founded); } else { return; } $founded->setPath($target); $urlShareController->updateFile($founded); }
public static function getShareURLSByFilePath($filePath) { $UrlShareController = UrlShareController::getInstance(); $fileToSearch = new UrlFile(); $fileToSearch->setPath($filePath); $urlFile = $UrlShareController->searchFile($fileToSearch); if ($urlFile === null || count($urlFile) < 1) { return null; } $urlFile = current($urlFile); $fileId = $urlFile->getId(); $urlShareToSearch = new UrlShare(); $urlShareToSearch->setFileId($fileId); $urlShares = $UrlShareController->searchUrl($urlShareToSearch); return self::toArray($urlShares); }