Implements \Phergie\Irc\GeneratorInterface->ctcpSourceResponse().

@param string $nickname
@param string $host
@param string $directories
@param string $files
163010
public function ctcpSourceResponse($nickname, $host, $directories, $files)
    {
        $this->queueCtcpResponse('SOURCE', [ $nickname, $host, $directories, $files ]);
    }
113224
public function renameDir($dirname, $rename)
    {
        $this->renameDirectory($this->absolutizePath($dirname), $this->absolutizePath($rename));
    }
476379
public function deleteFiles($container, $files, $root = '')
    {
        $root = FileUtilities::fixFolderPath($root);
        foreach ($files as $key => $file) {
            try {
                // path is full path, name is relative to root, take either
                $path = array_get($file, 'path');
                $name = array_get($file, 'name');
                if (!empty($path)) {
                    $path = static::removeContainerFromPath($container, $path);
                } elseif (!empty($name)) {
                    $path = $root . $name;
                } else {
                    throw new BadRequestException('No path or name found for file in delete request.');
                }
                if (!empty($path)) {
                    $this->deleteFile($container, $path);
                } else {
                    throw new BadRequestException('No path or name found for file in delete request.');
                }
            } catch (\Exception $ex) {
                // error whole batch here?
                $files[$key]['error'] = ['message' => $ex->getMessage(), 'code' => $ex->getCode()];
            }
        }

        return $files;
    }
570294
public function setHost($host)
    {
        if (preg_match(self::PATTERN_MATCH_HOST, $host) !== 1) {
            throw new \InvalidArgumentException('"' . $host . '" is not valid host as part of a URI.', 1184071240);
        }

        $this->host = $host;
    }
901179
public static function dieIfDirectoriesNotWritable($directoriesToCheck = null)
    {
        $resultCheck = self::checkDirectoriesWritable($directoriesToCheck);
        if (array_search(false, $resultCheck) === false) {
            return;
        }

        $directoryList = '';
        foreach ($resultCheck as $dir => $bool) {
            $realpath = Filesystem::realpath($dir);
            if (!empty($realpath) && $bool === false) {
                $directoryList .= self::getMakeWritableCommand($realpath);
            }
        }

        // Also give the chown since the chmod is only 755
        if (!SettingsServer::isWindows()) {
            $realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/');
            $directoryList = "<code>chown -R ". self::getUserAndGroup() ." " . $realpath . "</code><br />" . $directoryList;
        }

        if (function_exists('shell_exec')) {
            $currentUser = self::getUser();
            if (!empty($currentUser)) {
                $optionalUserInfo = " (running as user '" . $currentUser . "')";
            }
        }

        $directoryMessage  = "<p><b>Matomo couldn't write to some directories $optionalUserInfo</b>.</p>";
        $directoryMessage .= "<p>Try to Execute the following commands on your server, to allow Write access on these directories"
            . ":</p>"
            . "<blockquote>$directoryList</blockquote>"
            . "<p>If this doesn't work, you can try to create the directories with your FTP software, and set the CHMOD to 0755 (or 0777 if 0755 is not enough). To do so with your FTP software, right click on the directories then click permissions.</p>"
            . "<p>After applying the modifications, you can <a href='index.php'>refresh the page</a>.</p>"
            . "<p>If you need more help, try <a target='_blank' rel='noreferrer noopener' href='https://matomo.org'>Matomo.org</a>.</p>";

        $ex = new MissingFilePermissionException($directoryMessage);
        $ex->setIsHtmlMessage();

        throw $ex;
    }
1076149
private function runTask(array $hosts, Task $task): int
    {
        $processes = [];

        foreach ($hosts as $host) {
            if ($task->shouldBePerformed($host)) {
                $processes[$host->getHostname()] = $this->getProcess($host, $task);
                if ($task->isOnce()) {
                    $task->setHasRun();
                }
            }
        }

        $callback = function (string $type, string $host, string $output) {
            $output = rtrim($output);
            if (strlen($output) !== 0) {
                $this->output->writeln($output);
            }
        };

        $this->startProcesses($processes);

        while ($this->areRunning($processes)) {
            $this->gatherOutput($processes, $callback);
            usleep(1000);
        }
        $this->gatherOutput($processes, $callback);

        return $this->gatherExitCodes($processes);
    }
734198
protected function _setSslContext($host)
    {
        foreach ($this->_config as $key => $value) {
            if (substr($key, 0, 4) !== 'ssl_') {
                continue;
            }
            $contextKey = substr($key, 4);
            if (empty($this->_config['context']['ssl'][$contextKey])) {
                $this->_config['context']['ssl'][$contextKey] = $value;
            }
            unset($this->_config[$key]);
        }
        if (!isset($this->_config['context']['ssl']['SNI_enabled'])) {
            $this->_config['context']['ssl']['SNI_enabled'] = true;
        }
        if (empty($this->_config['context']['ssl']['peer_name'])) {
            $this->_config['context']['ssl']['peer_name'] = $host;
        }
        if (empty($this->_config['context']['ssl']['cafile'])) {
            $dir = dirname(dirname(__DIR__));
            $this->_config['context']['ssl']['cafile'] = $dir . DIRECTORY_SEPARATOR .
                'config' . DIRECTORY_SEPARATOR . 'cacert.pem';
        }
        if (!empty($this->_config['context']['ssl']['verify_host'])) {
            $this->_config['context']['ssl']['CN_match'] = $host;
        }
        unset($this->_config['context']['ssl']['verify_host']);
    }
1243223
public function mkdir($dirs, $mode = 0777)
    {
        foreach ($this->toIterator($dirs) as $dir) {
            if (is_dir($dir)) {
                continue;
            }

            if (true !== @mkdir($dir, $mode, true)) {
                throw new IOException(sprintf('Failed to create %s', $dir));
            }
        }
    }
982979
private function parseHostAndPath(array $locationParts): void
    {
        $path = $locationParts['path'] ?? '';
        $host = $locationParts['host'] ?? '';

        if ($this->getScheme() === 'file') {
            $this->path = $host . $path;
        } else {
            $this->host = $host;
            $this->path = $path;
        }
    }
438784
public function setNickname(
        string $nickname,
        string $idCardMediaId = '',
        string $licenseMediaId = '',
        array $otherStuffs = []
    ) {
        $params = [
            'nick_name' => $nickname,
            'id_card' => $idCardMediaId,
            'license' => $licenseMediaId,
        ];

        for ($i = \count($otherStuffs) - 1; $i >= 0; --$i) {
            $params['naming_other_stuff_'.($i + 1)] = $otherStuffs[$i];
        }

        return $this->httpPostJson('wxa/setnickname', $params);
    }
470678
protected function createDirectory($paths)
    {
        if (!is_array($paths)) {
            $paths = array($paths);
        }

        foreach ($paths as $path) {
            if (!is_dir($dir = dirname($path)) && false === @mkdir($dir, 0777, true)) {
                // @codeCoverageIgnoreStart
                throw new \RuntimeException(sprintf('Unable to create directory "%s".', $dir));
                // @codeCoverageIgnoreEnd
            }
        }
    }
413778
public static function create($host, $cacheDir = null, EventManager $eventManager = null)
    {
        $cache = $cacheDir ?: sys_get_temp_dir();
        $client = ClientBuilder::create()
            ->addConnection('default', $host)
            ->build();

        return new self($client, $cache, $eventManager);
    }
364819
public function copyDirs($source, $target, $dirs)
    {
        foreach ($dirs as $dir) {
            $this->copyDir($source, $target, $dir);
        }
    }
1042735
private static function buildMap(array $files, array & $destination) : void
    {
        foreach ($files as $structure) {
            foreach ($structure as $key => $value) {
                $subFiles = [];
                foreach ($files as $uploadKey => $data) {
                    $subFiles[$uploadKey] = $data[$key];
                }

                if (is_array($value)) {
                    $destination[$key] = [];
                    self::buildMap($subFiles, $destination[$key]);
                } else {
                    $destination[$key] = UploadedFile::create($subFiles);
                }
            }

            // Only one of the entries was needed to get the structure.
            break;
        }
    }
63797
public function setPeername($host, $port)
    {
        $this->host = $host;
        $this->port = $port;
        $this->addr = '[' . $this->host . ']:' . $this->port;
        if ($this->pool->allowedClients !== null) {
            if (!TCP::netMatch($this->pool->allowedClients, $this->host)) {
                Daemon::log('Connection is not allowed (' . $this->host . ')');
                $this->ready = false;
                $this->finish();
            }
        }
    }
951291
public function setUp(
        $kernelDir,
        FileLocatorInterface $fileLocator
    )
    {
        $this->kernelDir   = realpath($kernelDir);
        $this->fileLocator = $fileLocator;
    }
880028
function SetServer ( $host, $port = 0 )
    {
        assert ( is_string($host) );
        if ( $host[0] == '/')
        {
            $this->_path = 'unix://' . $host;
            return;
        }
        if ( substr ( $host, 0, 7 )=="unix://" )
        {
            $this->_path = $host;
            return;
        }

        $this->_host = $host;
        $port = intval($port);
        assert ( 0<=$port && $port<65536 );
        $this->_port = ( $port==0 ) ? 9312 : $port;
        $this->_path = '';
    }