protected function findPastDeploymentTimestamps($remote_host, $remote_dir)
	{
		$this->log('findPastDeploymentTimestamps', LOG_DEBUG);

		$this->prepareRemoteDirectory($remote_host, $remote_dir);

		if ($remote_dir === null)
			$remote_dir = $this->remote_dir;

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

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

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

        $past_deployments = array();
        $deployment_timestamps = array();

        foreach ($dirs as $dirname)
        {
            if (
                preg_match('/'. preg_quote($this->project_name) .'_\d{4}-\d{2}-\d{2}_\d{6}/', $dirname) &&
                ($time = strtotime(str_replace(array($this->project_name .'_', '_'), array('', ' '), $dirname)))
            )
            {
                $past_deployments[] = $dirname;
                $deployment_timestamps[] = $time;
            }
        }

        $count = count($deployment_timestamps);

        if ($count == 0)
            return null;

        $this->log('Past deployments:', LOG_INFO, true);
        $this->log($past_deployments, LOG_INFO, true);

        sort($deployment_timestamps);

        if ($count >= 2)
            return array_slice($deployment_timestamps, -2);

        return array(null, array_pop($deployment_timestamps));
	}