Project

General

Profile

Actions

Feature #62830

closed

Epic #83669: Improve file list / file browser

Improved folder moving/copying

Added by Christian Opitz about 10 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Start date:
2014-11-10
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
medium
Sprint Focus:

Description

The methods for moving and copying in TYPO3\CMS\Core\Resource\ResourceStorage require several improvements:
  1. Implement moving and copying folders between storages
  2. Implement conflict handling for moving and copying folders
    • renameNewFolder would generate another name for the target folder, when it already exists at target parent
    • renameNewFile would add new directories and add the files with new names, when they already exist
    • integrate would add new directories and overwrite existing files
    • cancel would cancel
  3. Implement a way to allow custom drivers to import files from other drivers/storages rather than forcing it to add a local copy (see thread on mailing list for upfront discussions):
    Will provide an TYPO3\CMS\Core\Resource\Driver\ImportableDriverInterface with importFile(\TYPO3\CMS\Core\Resource\FileInterface $file, $targetFolderIdentifier, $newFileName = null, $removeOriginal = TRUE). When the driver implements this interface, this method instead of addFile() will be called in ResourceStorage::moveFile() and ResourceStorage::copyFile()
  4. Allow to moveFile/moveFolder without removing the source file (usefull for migrations between two different drivers)
  5. Create functional tests for the move and copy methods

Related issues 3 (1 open2 closed)

Related to TYPO3 Core - Bug #65983: Clipboard does not work between two filestoragesClosedFrans Saris2015-03-24

Actions
Related to TYPO3 Core - Bug #64363: Copy files in Filelist backendAccepted2015-01-19

Actions
Related to TYPO3 Core - Feature #66514: Better UI to move multiple files or foldersClosed2015-04-21

Actions
Actions #1

Updated by Gerrit Code Review about 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #2

Updated by Gerrit Code Review about 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #3

Updated by Gerrit Code Review about 10 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #4

Updated by Gerrit Code Review about 10 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #5

Updated by Gerrit Code Review about 10 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #6

Updated by Gerrit Code Review about 10 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #7

Updated by Gerrit Code Review about 10 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #8

Updated by Gerrit Code Review about 10 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/33955

Actions #9

Updated by Christian Opitz almost 10 years ago

The most basic ImportableDriver would just call addFile (untested):

<?php
namespace TYPO3\CMS\Core\Resource\Driver;

class LocalImportableDriver extends LocalDriver implements ImportableDriverInterface {
    /**
     * Add an already existing FAL File from another storage
     *
     * @param \TYPO3\CMS\Core\Resource\FileInterface $file
     * @param string $targetFolderIdentifier
     * @param string $newFileName optional, if not given original name is used
     * @return string The new identifier
     */
    public function importFile(\TYPO3\CMS\Core\Resource\FileInterface $file, $targetFolderIdentifier, $newFileName = NULL) {
        return $this->addFile(
            $file->getForLocalProcessing(FALSE),
            $targetFolderIdentifier,
            $newFileName,
            FALSE
        );
    }
}

A more sophisticated one, could download the files from another storage (untested):

<?php
namespace TYPO3\CMS\Core\Resource\Driver;

use TYPO3\CMS\Core\Utility\GeneralUtility;

class LocalImportableDriver extends LocalDriver implements ImportableDriverInterface {
    /**
     * Change to suit your host
     */
    const IMPORT_SOURCE_BASE = 'http://localhost';

    /**
     * Add an already existing FAL File from another storage
     *
     * @param \TYPO3\CMS\Core\Resource\FileInterface $file
     * @param string $targetFolderIdentifier
     * @param string $newFileName optional, if not given original name is used
     * @return string The new identifier
     */
    public function importFile(\TYPO3\CMS\Core\Resource\FileInterface $file, $targetFolderIdentifier, $newFileName = NULL) {        
        $newFileName = $this->sanitizeFileName($newFileName ? $newFileName : $file->getName());
        $newFileIdentifier = $this->canonicalizeAndCheckFolderIdentifier($targetFolderIdentifier) . $newFileName;
        $targetPath = $this->absoluteBasePath . $newFileIdentifier;

        $handle = fopen(self::IMPORT_SOURCE_BASE . $file->getPublicUrl(), 'r');
        if (!$handle) {
            throw new \RuntimeException('Could not open file via URL');
        }

        if (!file_put_contents($targetPath, $handle) || !file_exists($targetPath)) {
            throw new \RuntimeException('Adding file ' . $localFilePath . ' at ' . $newFileIdentifier . ' failed.');
        }

        clearstatcache();
        GeneralUtility::fixPermissions($targetPath);

        return $newFileIdentifier;
    }
}
Actions #10

Updated by Mathias Schreiber almost 10 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)
Actions #11

Updated by Markus Klein over 9 years ago

  • Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
  • Complexity set to medium
Two things:
  1. If I move a folder /foo/bla. There must not be a paste sign on the /foo folder. Neither in list-view on the folder / nor in the toolbar when in folder /foo
  2. If I copy a folder /foo/bla. Then there must be a check if the folder already exists, when I try to paste it into /foo again (edited)
Actions #12

Updated by Susanne Moog over 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #13

Updated by Benni Mack about 9 years ago

  • Target version changed from 7.5 to 7 LTS
Actions #14

Updated by Gerrit Code Review about 8 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #15

Updated by Michael Oehlhof about 8 years ago

  • Target version changed from 7 LTS to 8 LTS
Actions #16

Updated by Gerrit Code Review about 8 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #17

Updated by Gerrit Code Review about 8 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #18

Updated by Gerrit Code Review about 8 years ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #19

Updated by Gerrit Code Review about 8 years ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #20

Updated by Gerrit Code Review about 8 years ago

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #21

Updated by Gerrit Code Review about 8 years ago

Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #22

Updated by Gerrit Code Review about 8 years ago

Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #23

Updated by Gerrit Code Review about 8 years ago

Patch set 17 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #24

Updated by Gerrit Code Review about 8 years ago

Patch set 18 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #25

Updated by Gerrit Code Review about 8 years ago

Patch set 19 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/33955

Actions #26

Updated by Riccardo De Contardi over 7 years ago

  • Target version changed from 8 LTS to 9.0
Actions #27

Updated by Riccardo De Contardi almost 7 years ago

  • Related to Feature #66514: Better UI to move multiple files or folders added
Actions #28

Updated by Riccardo De Contardi almost 7 years ago

  • Parent task set to #83669
Actions #29

Updated by Susanne Moog almost 7 years ago

  • Target version changed from 9.0 to 9.2
Actions #30

Updated by Susanne Moog over 6 years ago

  • Target version changed from 9.2 to Candidate for Major Version
Actions #31

Updated by Susanne Moog over 5 years ago

  • Status changed from Under Review to Accepted
  • Assignee deleted (Christian Opitz)

Review has been abandoned.

Actions #32

Updated by Christian Kuhn about 1 year ago

  • Status changed from Accepted to Closed

Closing here: It seems this issue is totaly stuck and the API had various changes meanwhile. Let's start with a fresh issue if this is still a problem.

Actions

Also available in: Atom PDF