Skip to content

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

@halftrainedharry

Description

@halftrainedharry

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions