protected function preRestoreBackupTask(
        $worker,
        AbstractAuth $auth,
        $remote,
        $opts = ['files' => false, 'data' => false]
    ) {
        if (!$opts['files'] && !$opts['data']) {
            $opts['files'] = true;
            $opts['data'] = true;
        }
        if ($opts['files']) {
            $removeFiles = 'rm -rf';
            if (!$this->fileBackupSubDirs) {
                $removeFiles .= ' ./* ./.??*';
            }
            foreach ($this->fileBackupSubDirs as $subdir) {
                $removeFiles .= ' ' . $subdir . '/* ' . $subdir . '/.??*';
            }

            return $this->taskSsh($worker, $auth)
                ->remoteDirectory($remote['filesdir'], true)
                // Files dir can be pretty big on large sites.
                ->timeout($this->getTimeoutSetting('pre_restore_remove_files'))
                ->exec($removeFiles);
        }

        return false;
    }