private function FMDiskFileSystem::renameFileOrDir in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7
2 calls to FMDiskFileSystem::renameFileOrDir()
- FMDiskFileSystem::renameDir in vendor/
edsdk/ flmngr-server-php/ src/ fs/ FMDiskFileSystem.php - FMDiskFileSystem::renameFile in vendor/
edsdk/ flmngr-server-php/ src/ fs/ FMDiskFileSystem.php
File
- vendor/
edsdk/ flmngr-server-php/ src/ fs/ FMDiskFileSystem.php, line 147
Class
Namespace
EdSDK\FlmngrServer\fsCode
private function renameFileOrDir($path, $newName) {
if (strpos($newName, "..") !== FALSE || strpos($newName, "/") !== FALSE) {
throw new MessageException(FMMessage::createMessage(FMMessage::FM_DIR_NAME_CONTAINS_INVALID_SYMBOLS));
}
$fullPath = $this
->getAbsolutePath($path);
$i = strrpos($fullPath, "/");
$fullPathDst = substr($fullPath, 0, $i + 1) . $newName;
if (is_file($fullPathDst)) {
throw new MessageException(Message::createMessage(Message::FILE_ALREADY_EXISTS, $newName));
}
$res = rename($fullPath, $fullPathDst);
if ($res === FALSE) {
throw new MessageException(FMMessage::createMessage(FMMessage::FM_UNABLE_TO_RENAME));
}
}