ZurmoでNginxをインストーラーで使えるようにする

公式ではApacheとIISしかサポートしておらずインストーラーの途中でとまってしまうのでインストーラーを拡張します。

zurmo/app/protected/modules/install/serviceHelpers/WebServerServiceHelper.php
--------------------
        protected $minimumVersion = array('microsoft-iis' => '5.0.0', 'apache' => '2.2.1', 'nginx' => '1.4.7');

        protected function checkService()
        {
            $serverName = $_SERVER['SERVER_SOFTWARE'];
            if (strrpos($serverName, 'Apache') !== false && strrpos($serverName, 'Apache') >= 0)
            {
                return $this->checkServiceAndSetMessagesByMethodNameAndDisplayLabel('checkWebServer', Zurmo::t('InstallModule', 'Apache'));
            }
            elseif (strrpos($serverName, 'Microsoft-IIS') !== false && strrpos($serverName, 'Microsoft-IIS') >= 0)
            {
                return $this->checkServiceAndSetMessagesByMethodNameAndDisplayLabel('checkWebServer', Zurmo::t('InstallModule', 'Microsoft-IIS'));
            }
            elseif (strrpos($serverName, 'nginx') !== false && strrpos($serverName, 'nginx') >= 0)
            {
                return $this->checkServiceAndSetMessagesByMethodNameAndDisplayLabel('checkWebServer', Zurmo::t('InstallModule', 'Nginx'));
            }
            else
            {
                $this->message  = Zurmo::t('InstallModule', 'Zurmo runs only on Apache {apacheMinVersion} and higher or Microsoft-IIS {iisMinVersion} or higher web servers.',
                        array(
                              '{apacheMinVersion}' => $this->minimumVersion['apache'],
                              '{iisMinVersion}'    => $this->minimumVersion['microsoft-iis'])
                        );
                return false;
            }
        }
--------------------
        protected function getMinimumVersionLabel()
        {
            assert('is_array($this->minimumVersion)');
            $serverName = $_SERVER['SERVER_SOFTWARE'];
            if (strrpos($serverName, 'Microsoft-IIS') !== false && strrpos($serverName, 'Microsoft-IIS') >= 0)
            {
                return $this->minimumVersion['microsoft-iis'];
            }
            elseif (strrpos($serverName, 'Apache') !== false && strrpos($serverName, 'Apache') >= 0)
            {
                return $this->minimumVersion['apache'];
            }
            elseif (strrpos($serverName, 'nginx') !== false && strrpos($serverName, 'nginx') >= 0)
            {
                return $this->minimumVersion['nginx'];
            }
        }
--------------------

zurmo/app/protected/modules/install/utils/InstallUtil.php
--------------------
        public static function checkWebServer(array $minimumRequiredVersions, /* out */ &$actualVersion)
        {
            $matches = array();
            $serverName = $_SERVER['SERVER_SOFTWARE'];
            if (strrpos($serverName, 'Microsoft-IIS') !== false && strrpos($serverName, 'Microsoft-IIS') >= 0)
            {
                if (preg_match('/([^\/]+)\/(\d+\.\d)?/', $_SERVER['SERVER_SOFTWARE'], $matches)) // Not Coding Standard
                {
                    $serverName = strtolower($matches[1]);
                    $actualVersion = $matches[2];
                    if (array_key_exists($serverName, $minimumRequiredVersions))
                    {
                        return static::checkVersion($minimumRequiredVersions[$serverName], $actualVersion);
                    }
                }
            }
            elseif (strrpos($serverName, 'Apache') !== false && strrpos($serverName, 'Apache') >= 0)
            {
                if (preg_match('/([^\/]+)\/(\d+\.\d+(.\d+))?/', $_SERVER['SERVER_SOFTWARE'], $matches)) // Not Coding Standard
                {
                    $serverName = strtolower($matches[1]);
                    $actualVersion = $matches[2];
                    if (array_key_exists($serverName, $minimumRequiredVersions))
                    {
                        return static::checkVersion($minimumRequiredVersions[$serverName], $actualVersion);
                    }
                }
            }
            elseif (strrpos($serverName, 'nginx') !== false && strrpos($serverName, 'nginx') >= 0)
            {
                if (preg_match('/([^\/]+)\/(\d+\.\d+(.\d+))?/', $_SERVER['SERVER_SOFTWARE'], $matches)) // Not Coding Standard
                {
                        $serverName = strtolower($matches[1]);
                        $actualVersion = $matches[2];
                        return static::checkVersion($minimumRequiredVersions[$serverName], $actualVersion);
                }
            }
            return false;
        }
--------------------