Horde_Test::pearModuleCheck PHP Method

pearModuleCheck() public method

Check the list of PEAR modules.
public pearModuleCheck ( ) : string
return string The HTML output.
    public function pearModuleCheck()
    {
        $output = '';
        /* Turn tracking of errors on. */
        ini_set('track_errors', 1);
        /* Print the include_path. */
        $output .= $this->_outputLine(array("<strong>PEAR Search Path (PHP's include_path)</strong>", '&nbsp;<tt>' . get_include_path() . '</tt>'));
        /* Check for PEAR in general. */
        @(include_once 'PEAR.php');
        $entry = array('PEAR', $this->_status(!isset($php_errormsg)));
        if (isset($php_errormsg)) {
            $entry[] = 'Check your PHP include_path setting to make sure it has the PEAR library directory.';
            $output .= $this->_outputLine($entry);
            ini_restore('track_errors');
            return $output;
        }
        $output .= $this->_outputLine($entry);
        /* Go through module list. */
        $succeeded = array();
        foreach ($this->_pearList as $key => $val) {
            $entry = array();
            /* If this module depends on another module that we
             * haven't succesfully found, fail the test. */
            if (!empty($val['depends']) && empty($succeeded[$val['depends']])) {
                $result = false;
            } elseif (empty($val['path'])) {
                $result = @class_exists($key);
            } else {
                $result = @(include_once $val['path']);
            }
            $error_msg = $val['error'];
            if ($result && isset($val['function'])) {
                $func_output = call_user_func(array($this, $val['function']));
                if ($func_output) {
                    $result = false;
                    $error_msg = $func_output;
                }
            }
            $entry[] = $key;
            $entry[] = $this->_status($result, !empty($val['required']));
            if ($result) {
                $succeeded[$key] = true;
            } else {
                if (!empty($val['required'])) {
                    $error_msg .= ' THIS IS A REQUIRED MODULE!';
                }
                $entry[] = $error_msg;
                if (empty($val['required'])) {
                    $entry[] = 1;
                }
            }
            $output .= $this->_outputLine($entry);
        }
        /* Restore previous value of 'track_errors'. */
        ini_restore('track_errors');
        return $output;
    }