You are here

function FMDiskFileSystem::moveFiles in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7

Overrides IFMDiskFileSystem::moveFiles

File

vendor/edsdk/flmngr-server-php/src/fs/FMDiskFileSystem.php, line 257

Class

FMDiskFileSystem

Namespace

EdSDK\FlmngrServer\fs

Code

function moveFiles($filesPaths, $newPath) {
  for ($i = 0; $i < count($filesPaths); $i++) {
    $fullPathSrc = $this
      ->getAbsolutePath($filesPaths[$i]);
    $index = strrpos($fullPathSrc, "/");
    $name = $index === FALSE ? $fullPathSrc : substr($fullPathSrc, $index + 1);
    $fullPathDst = $this
      ->getAbsolutePath($newPath) . "/" . $name;
    $res = rename($fullPathSrc, $fullPathDst);
    if ($res === FALSE) {
      throw new MessageException(FMMessage::createMessage(FMMessage::FM_ERROR_ON_MOVING_FILES));
    }
  }
}