private function uploadPaths(array $paths)
{
$prevDir = NULL;
foreach ($paths as $num => $path) {
$remotePath = $this->remoteDir . $path;
$isDir = substr($remotePath, -1) === '/';
$remoteDir = $isDir ? substr($remotePath, 0, -1) : str_replace('\\', '/', dirname($remotePath));
if ($remoteDir !== $prevDir) {
$prevDir = $remoteDir;
$this->server->createDir($remoteDir);
}
if ($isDir) {
$this->writeProgress($num + 1, count($paths), $path, NULL, 'green');
continue;
}
$localFile = $this->preprocess($path);
if ($localFile !== $this->localDir . $path) {
$path .= ' (filters applied)';
}
$this->server->writeFile($localFile, $remotePath . self::TEMPORARY_SUFFIX, function ($percent) use($num, $paths, $path) {
$this->writeProgress($num + 1, count($paths), $path, $percent, 'green');
});
$this->writeProgress($num + 1, count($paths), $path, NULL, 'green');
}
}