Stub method for code to be run *after* deployment and *before* the cache clears

@param string $remote_host
@param string $remote_dir
@param string $target_dir
188231
protected function postDeploy($remote_host, $remote_dir, $target_dir)
	{
		$this->log("postDeploy($remote_host, $remote_dir, $target_dir)", LOG_DEBUG);

		$this->restartGearmanWorkers($remote_host, $remote_dir, $target_dir);
	}
671484
protected function createNewBltSiteYml(
    $new_site_dir,
    $site_name,
    $url,
    $remote_alias
  ) {
    $site_yml_filename = $new_site_dir . '/blt.yml';
    $site_yml['project']['machine_name'] = $site_name;
    $site_yml['project']['human_name'] = $site_name;
    $site_yml['project']['local']['protocol'] = $url['scheme'];
    $site_yml['project']['local']['hostname'] = $url['host'];
    $site_yml['drush']['aliases']['local'] = "self";
    $site_yml['drush']['aliases']['remote'] = $remote_alias;
    YamlMunge::mergeArrayIntoFile($site_yml, $site_yml_filename);
  }
1306787
public function putAll($source_directory, $target_directory, $mode = FTP_BINARY)
    {
        $d = dir($source_directory);
        // do this for each file in the directory
        while ($file = $d->read()) {
            // to prevent an infinite loop
            if ($file != '.' && $file != '..') {
                // do the following if it is a directory
                if (is_dir($source_directory . '/' . $file)) {
                    if (!@$this->ftp->chdir($target_directory . '/' . $file)) {
                        // create directories that do not yet exist
                        $this->ftp->mkdir($target_directory . '/' . $file);
                    }
                    // recursive part
                    $this->putAll(
                        $source_directory . '/' . $file, $target_directory . '/' . $file,
                        $mode
                    );
                } else {
                    // put the files
                    $this->ftp->put(
                        $target_directory . '/' . $file, $source_directory . '/' . $file,
                        $mode
                    );
                }
            }
        }

        return $this;
    }
385639
protected function _move($source, $targetDir, $name) {
		$target = $targetDir.DIRECTORY_SEPARATOR.$name;
		return ftp_rename($this->connect, $source, $target) ? $target : false;
	}
570832
protected function collectPastDeployments($remote_host, $remote_dir)
	{
		$this->log('collectPastDeployments', LOG_DEBUG);

		$dirs = array();
		$return = null;
		$this->sshExec($remote_host, "ls -1 $remote_dir", $dirs, $return);

		if ($return !== 0) {
			throw new DeployException('ssh initialize failed');
		}

		if (!count($dirs))
            return null;

        $deployment_dirs = array();

        foreach ($dirs as $dirname)
        {
            if (preg_match('/'. preg_quote($this->project_name) .'_\d{4}-\d{2}-\d{2}_\d{6}/', $dirname))
            {
                $deployment_dirs[] = $dirname;
            }
        }

        // the two latest deployments always stay
        if (count($deployment_dirs) <= 2)
            return null;

        $dirs_to_delete = array();

        sort($deployment_dirs);

        $deployment_dirs = array_slice($deployment_dirs, 0, -2);

        foreach ($deployment_dirs as $key => $dirname)
        {
            $time = strtotime(str_replace(array($this->project_name .'_', '_'), array('', ' '), $dirname));

            // deployments older than a month can go
            if ($time < strtotime('-1 month')) {
                $this->log("$dirname is older than a month");

                $dirs_to_delete[] = $dirname;
            }
            // of deployments older than a week only the last one of the day stays
            elseif ($time < strtotime('-1 week'))
            {
                if (isset($deployment_dirs[$key+1]))
                {
                    $time_next = strtotime(str_replace(array($this->project_name .'_', '_'), array('', ' '), $deployment_dirs[$key+1]));

                    // if the next deployment was on the same day this one can go
                    if (date('j', $time_next) == date('j', $time))
                    {
                        $this->log("$dirname was replaced the same day");

                        $dirs_to_delete[] = $dirname;
                    }
                    else
                    {
                        $this->log("$dirname stays");
                    }
                }
            }
            else
            {
                $this->log("$dirname stays");
            }
        }

        return $dirs_to_delete;
	}
406873
private function mirror($origin, $target, $delete = false)
    {
        $this->filesystem->mirror($origin, $target, null, ['override' => true, 'delete' => $delete]);
    }
1277510
private void initRemoteCache(RemoteCacheImpl remoteCache, OperationsFactory operationsFactory) {
      if (configuration.statistics().jmxEnabled()) {
         remoteCache.init(marshaller, operationsFactory, configuration.keySizeEstimate(),
               configuration.valueSizeEstimate(), configuration.batchSize(), mbeanObjectName);
      } else {
         remoteCache.init(marshaller, operationsFactory, configuration.keySizeEstimate(),
               configuration.valueSizeEstimate(), configuration.batchSize());
      }
   }
1342222
protected function prepareRemoteDirectory($remote_host, $remote_dir)
	{
		$this->log('Initialize remote directory: '. $remote_host .':'. $remote_dir, LOG_INFO, true);

		$output = array();
		$return = null;
		$this->sshExec($remote_host, "mkdir -p $remote_dir", $output, $return, '', '', LOG_DEBUG);

		if (empty($this->data_dirs))
            return;

        $data_dirs = count($this->data_dirs) > 1 ? '{'. implode(',', $this->data_dirs) .'}' : implode(',', $this->data_dirs);

        $cmd = "mkdir -v -m 0775 -p $remote_dir/{$this->data_dir_prefix}/$data_dirs";

        $output = array();
        $return = null;
        $this->sshExec($remote_host, $cmd, $output, $return, '', '', LOG_DEBUG);
	}
1366776
def set_scan_host_finished(self, scan_id, target, host):
        
        self.scan_collection.set_host_finished(scan_id, target, host)
572848
public function ircConnect($targetserver, $port = null, $remoteserver = null)
    {
        $this->queueIrcRequest('CONNECT', [ $targetserver, $port, $remoteserver ]);
    }
786689
private function doAddDir(string $origin, string $target, $recursive): void
    {
        if (!$recursive) {
            throw new InvalidOperationException('Add dir without recursive');
        }

        $finder = Finder::create()
            ->in($origin)
            ->ignoreVCS(true)
            ->ignoreDotFiles(false)
        ;
        $fs = new Filesystem();
        $fs->mirror($origin, $target, $finder);
        $this->output->writeln(sprintf(
            'copy files from <comment>%s</comment> to <comment>%s</comment>',
            $origin,
            $target
        ));
    }
556956
public function copyDir($source, $target, $dir)
    {
        $this->mkDir($target);
        $serverOs = (new \Zest\Common\OperatingSystem())->get();
        $command = ($serverOs === 'Windows') ? 'xcopy ' : 'cp -r ';
        if (is_dir($source.$dir)) {
            shell_exec($command.$source.$dir.' '.$target);
        }
    }
1312903
private static HttpHost determineTarget(HttpUriRequest request) throws ClientProtocolException {
		// A null target may be acceptable if there is a default target.
		// Otherwise, the null target is detected in the director.
		HttpHost target = null;
		URI requestURI = request.getURI();
		if (requestURI.isAbsolute()) {
			target = URIUtils.extractHost(requestURI);
			if (target == null) {
				throw new ClientProtocolException(
						"URI does not specify a valid host name: " + requestURI);
			}
		}
		return target;
	}
1333602
function (source, target, callback) {
    source = fss.slashify(source);
    target = fss.slashify(target);

    if (!shell.which('rsync')) {
        log('sync error', 'no rsync command found');
        callback();
    } else {
        log('rsync', fss.baseRelative(source));
        log('remote', target);
        var cmd = [config.rsync, source, target].join(' ');
        var opt = { maxBuffer: 5000*1024 };
        exec(cmd, opt, rsync_end(callback));
    }
}
836934
public static function init($data_directory = null)
	{
		$coverage_tool = new self($data_directory);
		$mode = isset($_GET['rct_mode']) ? $_GET['rct_mode'] : '';

		if ( $mode == 'output' ) {
			echo $coverage_tool->aggregateCoverageInformation();
		}
		else {
			$coverage_tool->startCollection();
			register_shutdown_function(array($coverage_tool, 'stopCollection'));
		}
	}
68705
public function remoteDownload($url, $target)
	{
		$client = new \GuzzleHttp\Client();
		
		try {
			$client->get($url, array('save_to' => $target));
		}
		catch (\GuzzleHttp\Exception\RequestException $e) {
			return false;
		}
		
		return true;
	}
514855
public void changeDir(String dir)
        throws IOException, ServerException {
        if (dir == null) {
            throw new IllegalArgumentException("Required argument missing");
        }
        Command cmd = new Command("CWD", dir);
        try {
            controlChannel.execute(cmd);
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(
                                urce,
                                "Server refused changing directory");
        }
    }