Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODX 3: Error when creating/renaming a directory in the file manager #36

Open
halftrainedharry opened this issue Apr 13, 2023 · 1 comment

Comments

@halftrainedharry
Copy link

halftrainedharry commented Apr 13, 2023

Creating/renaming a directory in the file manager generates this error:

Call to undefined method League\Flysystem\Filesystem::rename()

It looks like the function rename() only exists in V1 of the Flysystem Filesystem API.
In V2 (that is used by MODX 3) it probably has to be replaced with the function move():

try {
return $source->getFilesystem()->rename($oldPath, $newPath);
} catch (Exception $exception) {
$tmpName = $newPath . '-tmp-' . time();
$source->getFilesystem()->rename($oldPath, $tmpName);
$source->getFilesystem()->getAdapter()->getCache()->flush();
try {
return $source->getFilesystem()->rename($tmpName, $newPath);
} catch (Exception $exception) {
$this->modx->log(xPDO::LOG_LEVEL_ERROR, '[FileSluggy] Failed renaming directory: ' . $exception->getMessage());
}
}

(Also, $source->getFilesystem()->getAdapter()->getCache()->flush(); doesn't seem to work either.)


MODX 3.0.3-pl
FileSluggy 1.3.5-pl

@gpsietzema
Copy link
Contributor

@halftrainedharry We personally decided not to use filesluggy in MODX3 anymore, because file sanitizing has been implemented in the MODX 3 core. So I'd recommend to just remove it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants