Horde_Test::appTests PHP Method

appTests() public method

Any application specific tests that need to be done.
public appTests ( ) : string
return string HTML output.
    public function appTests()
    {
        /* File upload information. */
        $upload_check = $this->phpSettingCheck(array('file_uploads' => array('error' => 'file_uploads must be enabled for some features like sending emails with IMP.', 'setting' => true)));
        $upload_tmp_dir = ($dir = ini_get('upload_tmp_dir')) ? '<li>upload_tmp_dir: <strong style="color:"' . (is_writable($dir) ? 'green' : 'red') . '">' . $dir . '</strong></li>' : '';
        $ret = '<h1>File Uploads</h1><ul>' . $upload_check . $upload_tmp_dir . '<li>upload_max_filesize: ' . ini_get('upload_max_filesize') . '</li>' . '<li>post_max_size: ' . ini_get('post_max_size') . '<br />' . 'This value should be several times the expect largest upload size (notwithstanding any upload limits present in an application). Any upload that exceeds this size will cause any state information sent along with the uploaded data to be lost. This is a PHP limitation and can not be worked around.' . '</li></ul>';
        /* Check for supported translations. */
        $ret .= '<h1>Supported locales</h1><ul>';
        $missing = false;
        foreach ($GLOBALS['registry']->nlsconfig->languages as $code => $language) {
            if ($GLOBALS['registry']->nlsconfig->validLang($code)) {
                $color = 'green';
            } else {
                $color = 'red';
                $missing = true;
            }
            $ret .= sprintf('<li>%s &#x202d;(%s): <strong style="color:%s">%s</strong></li>', $language, $code, $color, $color == 'green' ? 'Yes' : 'No');
        }
        $ret .= '</ul>';
        /* Determine if 'static' is writable by the web user. */
        $user = function_exists('posix_getuid') ? posix_getpwuid(posix_getuid()) : null;
        $static_dir = $GLOBALS['registry']->get('staticfs', 'horde');
        $ret .= '<h1>Local File Permissions</h1><ul>' . sprintf('<li>Is <tt>%s</tt> writable by the web server user%s? ', htmlspecialchars($static_dir), $user ? ' (' . $user['name'] . ')' : '');
        $ret .= is_writable($static_dir) ? '<strong style="color:green">Yes</strong>' : '<strong style="color:red">No</strong><br /><strong style="color:orange">If caching javascript and CSS files by storing them in static files (HIGHLY RECOMMENDED), this directory must be writable as the user the web server runs as%s.</strong>';
        /* Determine if 'tmpdir' is writable by the web user. */
        $tmpdir = Horde::getTempDir();
        $ret .= sprintf('<li>Is tmpdir <tt>%s</tt> writable by the web server user%s? ', htmlspecialchars($tmpdir), $user ? ' (' . $user['name'] . ')' : '');
        $ret .= is_writable($tmpdir) ? '<strong style="color:green">Yes</strong>' : '<strong style="color:red">No</strong><br />';
        if (extension_loaded('imagick')) {
            $im = new Imagick();
            $imagick = is_callable(array($im, 'getIteratorIndex'));
            $ret .= '</li></ul><h1>Imagick</h1><ul>' . '<li>Imagick compiled against current ImageMagick version: <strong style="color:' . ($imagick ? 'green">Yes' : 'red">No') . '</strong>';
        }
        return $ret . '</li></ul>';
    }