示例#1
0
/** 
 * print table with database checking
 *  
 * @param integer &$errCounter reference to error counter
 * @author Martin Havlat
 **/
function reportCheckingDatabase(&$errCounter, $type = null)
{
    if (checkInstallStatus()) {
        $type = DB_TYPE;
    }
    if (!is_null($type)) {
        echo '<h2>Database checking</h2><table class="common" style="width: 100%;">';
        echo checkDbType($errCounter, $type);
        echo "</table>\n";
    }
}
示例#2
0
function performPreinstallChecks($qubitWebRoot, $qubitDataRoot, $qubitDbType, $qubitDbName, $qubitDbUser, $qubitDbPassword, $qubitDbHost, $qubitDbPort)
{
    global $fileSystemPathToTarball;
    printStatusReportTop();
    /*
     * Set the $error variable to FALSE to keep track of whether any errors are reported by
     * the various check_x functions. If $error is false at the end of performPreinstallChecks,
     * we can procede to the installQubit().
     */
    $error = false;
    $error = checkPHPversion($error);
    $error = checkAllowUrlFopen($error);
    $error = checkXMLEnabled($error);
    $error = checkXSLEnabled($error);
    $error = checkOS($error);
    $error = checkExists($error, $qubitWebRoot, 'web root');
    $error = checkExists($error, $qubitDataRoot, 'data directory');
    $error = checkDbType($error, $qubitDbType);
    // This parameter list should work for mysql and pgsql, but not for sqlite
    $error = checkDbConnection($error, $qubitDbType, $qubitDbName, $qubitDbUser, $qubitDbPassword, $qubitDbHost, $qubitDbPort);
    /*
     * If everything is OK (i.e., no $error = true returned from the check_x functions),
     * actually install the distribution.
     */
    if ($error) {
        // Exit and report that errors reported above need to be fixed.
        print '<p>Sorry, the installer can\'t procede until all the <span class="problem">problems</span> identified below have been fixed.</p>';
        printStatusReportBottom();
    } else {
        global $distro;
        // Get the web path of this script by removing the server's web root path from $qubitWebRoot.
        $documentRootPattern = '#' . $_SERVER['DOCUMENT_ROOT'] . '#';
        $pathToWebsite = preg_replace($documentRootPattern, '', $qubitWebRoot);
        $pathToWebsite .= 'index.php';
        $urlToWebsite = '<a target="_blank" title="Opens your new ' . $distro . ' site in new browser/tab" href="http://' . $_SERVER['SERVER_NAME'] . $pathToWebsite . '/search/buildIndex">' . $distro . '</a>';
        installQubit($qubitWebRoot, $qubitDataRoot);
        printStatusReportBottom();
        print "<p>Congratulations, the installation is complete. Before you leave this page, please perform the following\n          post-installation security tasks:</p>";
        print "<ul>";
        print "<li>Remove the installation files at {$fileSystemPathToTarball}</li>";
        print "<li>Change permissions on {$qubitWebRoot} so that directory is not writable by your web server</li>";
        print "</ul>";
        print "<p>Test your new instance of the {$urlToWebsite} (with email admin@qubit-toolkit.org and password admin), and\n          if everything looks good, complete the above security tasks. <strong>It is very important that you do not forget\n          to do these things!</strong> Not doing them puts your\n          website at a high security risk.</p>";
    }
}