Moosh\Command\Generic\Apache\ApacheParsePerfLog::analyzeURL PHP Method

analyzeURL() private method

private analyzeURL ( $row )
    private function analyzeURL($row)
    {
        $script = '';
        $query = NULL;
        $path = NULL;
        $type = 'other';
        if ($row['url'] == '<cron>') {
            // Nothing to analyze here.
            return array($script, $query, $path, 'cli');
        }
        // Split row on first .php
        $exploded = explode('.php', $row['url']);
        if (count($exploded) < 2) {
            $script = rtrim($exploded[0], '?') . 'index.php';
        } else {
            $script = $exploded[0] . '.php';
        }
        // Determine a type of request.
        if ($script == '/pluginfile.php' || $script == '/webservice/pluginfile.php' || $script == '/file.php' || $script == '/draftfile.php') {
            $type = 'download';
        } elseif (preg_match('/download=zip$/', $row['url']) || preg_match('/action=downloadall$/', $row['url'])) {
            $type = 'download';
        } elseif (preg_match('/repository_ajax.php\\?action=upload/', $row['url'])) {
            $type = 'upload';
        } else {
            $type = 'script';
        }
        //echo $script . ' ' . $type . "\n";
        unset($exploded[0]);
        $queryorpath = implode('.php', $exploded);
        if ($queryorpath) {
            if ($queryorpath[0] == '/') {
                $path = $queryorpath;
            } elseif ($queryorpath[0] == '?') {
                $query = ltrim($queryorpath, '?');
            } else {
                cli_problem('Invalid query or path part: ' . $queryorpath);
            }
        }
        return array($script, $query, $path, $type);
    }