protected function _copyPackage($clearDestination = false)
    {
        $source = new Folder($this->_workingDir);
        $destinationPath = normalizePath(ROOT . "/plugins/{$this->_plugin['name']}/");

        // allow to install from destination folder
        if ($this->_workingDir === $destinationPath) {
            return true;
        }

        if (!$clearDestination && is_readable($destinationPath)) {
            $this->err(__d('installer', 'Destination directory already exists, please delete manually this directory: {0}', $destinationPath));

            return false;
        } elseif ($clearDestination && is_readable($destinationPath)) {
            $destination = new Folder($destinationPath);
            if (!$destination->delete()) {
                $this->err(__d('installer', 'Destination directory could not be cleared, please check write permissions: {0}', $destinationPath));

                return false;
            }
        }

        if ($source->copy(['to' => $destinationPath])) {
            return true;
        }

        $this->err(__d('installer', 'Error when moving package content.'));

        return false;
    }
protected function _copyPackage($clearDestination = false)
    {
        $source = new Folder($this->_workingDir);
        $destinationPath = normalizePath(ROOT . "/plugins/{$this->_plugin['name']}/");

        // allow to install from destination folder
        if ($this->_workingDir === $destinationPath) {
            return true;
        }

        if (!$clearDestination && is_readable($destinationPath)) {
            $this->err(__d('installer', 'Destination directory already exists, please delete manually this directory: {0}', $destinationPath));

            return false;
        } elseif ($clearDestination && is_readable($destinationPath)) {
            $destination = new Folder($destinationPath);
            if (!$destination->delete()) {
                $this->err(__d('installer', 'Destination directory could not be cleared, please check write permissions: {0}', $destinationPath));

                return false;
            }
        }

        if ($source->copy(['to' => $destinationPath])) {
            return true;
        }

        $this->err(__d('installer', 'Error when moving package content.'));

        return false;
    }
protected function _copyPackage ( $ clearDestination = false ) { $ source = new Folder ( $ this -> _workingDir ) ; $ destinationPath = normalizePath ( ROOT . "/plugins/{$this->_plugin['name']}/" ) ; // allow to install from destination folder if ( $ this -> _workingDir === $ destinationPath ) { return true ; } if ( ! $ clearDestination && is_readable ( $ destinationPath ) ) { $ this -> err ( __d ( 'installer' , 'Destination directory already exists, please delete manually this directory: {0}' , $ destinationPath ) ) ; return false ; } elseif ( $ clearDestination && is_readable ( $ destinationPath ) ) { $ destination = new Folder ( $ destinationPath ) ; if ( ! $ destination -> delete ( ) ) { $ this -> err ( __d ( 'installer' , 'Destination directory could not be cleared, please check write permissions: {0}' , $ destinationPath ) ) ; return false ; } } if ( $ source -> copy ( [ 'to' => $ destinationPath ] ) ) { return true ; } $ this -> err ( __d ( 'installer' , 'Error when moving package content.' ) ) ; return false ; }
Copies the extracted package to its final destination.

@param bool $clearDestination Set to true to delete the destination directory
if already exists. Defaults to false; an error will occur if destination
already exists. Useful for upgrade tasks
@return bool True on success
Copies the extracted package to its final destination .