Пример #1
0
function check_database_support()
{
    if (check_mysql() || check_postgresql()) {
        return true;
    }
    return false;
}
Пример #2
0
include_once "system_checks.php";
function getPostVar($name)
{
    return isset($_POST[$name]) ? $_POST[$name] : null;
}
$defaults = array("language" => "en", "step" => "step1", "database_host" => "localhost");
if (check_svn() && check_svn_write()) {
    $defaults['enable_svn'] = 1;
} else {
    $defaults['enable_svn'] = 0;
}
$languages = array("en" => "English", "nl" => "Nederlands");
$steps = array("step1" => "step1.php", "step2" => "step2.php", "step3" => "step3.php", "step4" => "step4.php", "step5" => "step5.php", "step6" => "step6.php", "step7" => "login.php");
$databases = array();
if (check_mysql()) {
    $databases['mysql'] = "MySQL";
    //		$databases['mysql_workspaces'] = "MySQL Workspaced (EXPERIMENTAL)";
}
if (check_postgresql()) {
    $databases['postgresql'] = "PostgreSQL";
}
$language = getPostVar('language');
$step = getPostVar('step');
$database = getPostVar('database');
$database_host = getPostVar('database_host');
$database_user = getPostVar('database_user');
$database_pass = getPostVar('database_pass');
$database_name = getPostVar('database_name');
$admin_pass = getPostVar('admin_pass');
$admin_pass_repeat = getPostVar('admin_pass_repeat');
Пример #3
0
function doSystemChecks()
{
    // Do system checking.
    if (version_compare(phpversion(), "5.2.1", "<")) {
        addError(kPHPVersion, sprintf(_('This version of PHPDevShell only supports PHP version %s and later. You are currently running version %s.'), '5.2.1', phpversion()));
    }
    if (check_apache() == false) {
        addWarning(kApache, _('You are not running Apache as your web server. This version of PHPDevShell does not officially support non-Apache driven webservers.'));
    }
    if (check_mysql() == false) {
        addError(kMYSQL, _('The MySQL extension for PHP is missing. The installation script will be unable to continue'));
    }
    if (check_gettext() == false) {
        addError(kGETTEXT, _('The gettext extension for PHP is missing. The installation script will be unable to continue'));
    }
    global $errors;
    return count($errors) == 0;
}
Пример #4
0
 * Xunsearch PHP-SDK 运行条件检测
 *
 * @author hightman
 * @link http://www.xunsearch.com/
 * @copyright Copyright &copy; 2011 HangZhou YunSheng Network Technology Co., Ltd.
 * @license http://www.xunsearch.com/license/
 * @version $Id$
 */
require_once dirname(__FILE__) . '/../lib/XS.php';
require dirname(__FILE__) . '/XSUtil.class.php';
// magick output charset
XSUtil::parseOpt(array('c', 'charset'));
$charset = XSUtil::getOpt('c', 'charset');
XSUtil::setCharset($charset);
// result number record
$result = array('PHP 版本' => array('type' => (version_compare(PHP_VERSION, '5.2.0', '>=') ? '' : 'ERROR:') . PHP_VERSION, 'used' => 'XS(core)', 'note' => 'PHP 5.2.0 或更高版本是必须的。'), 'SPL 扩展' => array('type' => extension_loaded('spl') ? 'OK' : 'ERROR', 'used' => 'XS(core)', 'note' => 'SPL 扩展用于自动加载和对象戏法'), 'PCRE 扩展' => array('type' => extension_loaded('pcre') ? 'OK' : 'ERROR', 'used' => 'XSDocument, XSSearch', 'note' => '用于字符串切割、判断'), '编码转换' => array('type' => check_conv(), 'used' => 'XSDocument, XSSearch', 'note' => '用于支持非 UTF-8 字符集'), '缓存模块' => array('type' => check_cache(), 'used' => 'XS', 'note' => '用于缓存项目配置文件的解析结果'), 'JSON 扩展' => array('type' => extension_loaded('json') ? 'OK' : 'WARNING', 'used' => 'util.Quest, util.Indexer', 'note' => '用于读取或输出 JSON 格式的数据'), 'XML 扩展' => array('type' => extension_loaded('xml') ? 'OK' : 'WARNING', 'used' => 'util.Indexer', 'note' => '用于读取导入 XML 格式的数据'), 'MySQL 扩展' => array('type' => check_mysql(), 'used' => 'util.Indexer', 'note' => '用于读取导入 MySQL 的数据库'), 'SQLite 扩展' => array('type' => check_sqlite(), 'used' => 'util.Indexer', 'note' => '用于读取导入 SQLite 的数据库'));
// output
?>
Xunsearch PHP-SDK 运行需求检查
==============================

检查内容
--------

本程序用于确认您的服务器配置是否能满足运行 Xunsearch PHP-SDK 的要求。
它将检查服务器所运行的 PHP 版本,查看是否安装了合适的PHP扩展模块,以及
确认 php.ini 文件是否正确设置。

<?php 
out_line();
out_line('项目', '结果', '用于', '备注');
Пример #5
0
        // Check memcached server connection
        case 'memcached':
            $result = check_memcached();
            break;
            // Check solr server connection
        // Check solr server connection
        case 'solr':
            $result = check_solr();
            break;
            // None of them
        // None of them
        default:
            $result = FALSE;
    }
} else {
    $result = check_mysql();
    if ($result) {
        $result = check_memcached();
    }
}
// Return error code 500 in case of failure
if (!$result) {
    header('HTTP/1.1 500 Internal Server Error');
}
// End of the script
exit;
/**
 * Check mysql connection (master & slaves).
 *
 * @return FALSE in case of failure and TRUE otherwise.
 */
Пример #6
0
 if (isset($_POST['proceed']) || $configured) {
     // If not DB information not defined, prompt the user to download the plog-config.php file
     if (!defined('PLOGGER_DB_HOST')) {
         echo "\n\t" . '<h1>' . plog_tr('Plogger Configuration Complete') . '</h1>';
         echo "\n\n\t" . '<form action="_install.php" method="post">';
         echo "\n\n\t\t" . '<p>' . plog_tr('Configuration setup is now complete.') . '</p>';
         echo "\n\n\t\t" . '<p>' . plog_tr('Click <strong>Install</strong> to complete the installation.') . '</p>';
         if (!empty($_SESSION['plogger_config'])) {
             echo "\n\n\t\t" . '<p>' . sprintf(plog_tr('Before you can proceed, please %s to download configuration file for your gallery, then upload it to your webhost (into the same directory where you installed Plogger itself).'), '<input type="submit" class="submit-inline" name="dlconfig" value="' . plog_tr('click here') . '" />') . '</p>';
         }
         echo "\n\n\t\t" . '<p><input type="submit" class="submit" name="proceed" id="proceed" value="' . plog_tr('Install') . '" /></p>';
         echo "\n\n\t" . '</form>' . "\n";
         // Otherwise, do the install
     } else {
         $errors = array();
         $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME);
         if (empty($mysql)) {
             create_tables();
             configure_plogger($_SESSION['install_values']);
             // undefined index install_values
             include_once PLOGGER_DIR . 'plog-load-config.php';
             // If open permissions, have Plogger fix them
             if (isset($_SESSION['plogger_close_perms'])) {
                 fix_open_perms($_SESSION['plogger_close_perms'], 'delete');
             }
             $col = add_collection(plog_tr('Plogger Test Collection'), plog_tr('Feel free to delete it'));
             // Only attempt to create an album if the collection was created - sloppy fix for multiple installs
             if (!empty($col['id'])) {
                 $alb = add_album(plog_tr('Plogger Test Album'), plog_tr('Feel free to delete it'), $col['id']);
             }
         } else {
function do_install($form)
{
    $form = array_map('stripslashes', $form);
    $form = array_map('trim', $form);
    // First check the requirements
    $errors = check_requirements();
    if (sizeof($errors) > 0) {
        echo "\t" . '<p class="errors">' . plog_tr('Plogger cannot be installed until the following problems are resolved') . ':</p>';
        echo "\n\n\t\t" . '<ul class="info">';
        foreach ($errors as $error) {
            echo "\n\t\t\t" . '<li class="margin-5">' . $error . '</li>';
        }
        echo "\n\t\t" . '</ul>';
        echo "\n\n\t" . '<form method="get" action="' . $_SERVER['REQUEST_URI'] . '">
		<p><input class="submit" type="submit" value="' . plog_tr('Try again') . '" /></p>
	</form>' . "\n";
        return false;
    }
    $ok = false;
    $errors = array();
    // If we've already defined the database information, pass the values and skip them on the form
    if (defined('PLOGGER_DB_HOST')) {
        $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME);
        if (!empty($mysql)) {
            $mysql_fail = true;
        } else {
            unset($_SESSION['plogger_config']);
        }
        // Set the form values equal to config values if already set
        if (empty($form['db_host'])) {
            $form['db_host'] = PLOGGER_DB_HOST;
        }
        if (empty($form['db_user'])) {
            $form['db_user'] = PLOGGER_DB_USER;
        }
        if (empty($form['db_pass'])) {
            $form['db_pass'] = PLOGGER_DB_PW;
        }
        if (empty($form['db_name'])) {
            $form['db_name'] = PLOGGER_DB_NAME;
        }
    }
    if (isset($form['action']) && $form['action'] == 'install') {
        if (!defined('PLOGGER_DB_HOST') || isset($mysql_fail)) {
            $mysql_form_check = check_mysql_form($form);
            if (!empty($mysql_form_check)) {
                $errors = array_merge($errors, $mysql_form_check);
            }
        }
        if (empty($form['gallery_name'])) {
            $errors[] = plog_tr('Please enter the name for your gallery.');
        }
        if (empty($form['admin_email'])) {
            $errors[] = plog_tr('Please enter your email address.');
        }
        if (empty($form['admin_username'])) {
            $errors[] = plog_tr('Please enter a username.');
        }
        if (empty($form['admin_password'])) {
            $errors[] = plog_tr('Please enter a password.');
        }
        if ($form['admin_password'] != $form['admin_password_confirm']) {
            $errors[] = plog_tr('Your passwords do not match. Please try again.');
        }
        if (is_safe_mode()) {
            // If safe_mode enabled, check the FTP information form inputs
            $ftp_form_check = check_ftp_form($form);
            $form = $ftp_form_check['form'];
            if (!empty($ftp_form_check['form']['errors'])) {
                $errors = array_merge($errors, $ftp_form_check['form']['errors']);
            }
        }
        if (empty($errors)) {
            $mysql_errors = check_mysql($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']);
            if (is_safe_mode()) {
                $ftp_errors = check_ftp($form['ftp_host'], $form['ftp_user'], $form['ftp_pass'], $form['ftp_path']);
            } else {
                $ftp_errors = array();
            }
            $errors = array_merge($mysql_errors, $ftp_errors);
            $ok = empty($errors);
        }
        if (!$ok) {
            echo '<ul class="errors" style="background-image: none;">' . "\n\t" . '<li class="margin-5">';
            echo join("</li>\n\t<li class=\"margin-5\">", $errors);
            echo "</li>\n</ul>\n\n";
        } else {
            $_SESSION['install_values'] = array('gallery_name' => $form['gallery_name'], 'admin_email' => $form['admin_email'], 'admin_password' => $form['admin_password'], 'admin_username' => $form['admin_username']);
            if (is_safe_mode()) {
                $_SESSION['ftp_values'] = array('ftp_host' => $form['ftp_host'], 'ftp_user' => $form['ftp_user'], 'ftp_pass' => $form['ftp_pass'], 'ftp_path' => $form['ftp_path']);
            }
            if (!defined('PLOGGER_DB_HOST') || isset($mysql_fail)) {
                // Serve the config file and ask user to upload it to webhost
                $_SESSION['plogger_config'] = create_config_file($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']);
            }
            return true;
        }
    }
    include PLOGGER_DIR . 'plog-admin/includes/install-form-setup.php';
    return false;
}
Пример #8
0
function is_plogger_installed()
{
    global $config;
    $installed = false;
    if (defined('PLOGGER_DB_HOST')) {
        $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME);
        if (empty($mysql)) {
            $sql = "DESCRIBE `" . PLOGGER_TABLE_PREFIX . "config`";
            $result = mysqli_query($GLOBALS["PLOGGER_DBH"], $sql);
            if ($result) {
                $installed = true;
                $config_sql = "SELECT * FROM `" . PLOGGER_TABLE_PREFIX . "config`";
                $config_result = mysqli_query($GLOBALS["PLOGGER_DBH"], $config_sql);
                $config = mysqli_fetch_assoc($config_result);
            }
        }
    }
    return $installed;
}
Пример #9
0
function do_install($form)
{
    $form = array_map('stripslashes', $form);
    $form = array_map('trim', $form);
    $errors = check_requirements();
    if (sizeof($errors) > 0) {
        print '<p>Plogger wont work until the following problems are resolved</p>';
        print '<ul>';
        foreach ($errors as $error) {
            print '<li>' . $error . '</li>';
        }
        print '</ul>';
        print '<form method="GET" action="_install.php"><input type="submit" value="Try again"/></form>';
        return false;
    }
    if (defined('PLOGGER_DB_HOST')) {
        $mysql = check_mysql(PLOGGER_DB_HOST, PLOGGER_DB_USER, PLOGGER_DB_PW, PLOGGER_DB_NAME);
        // looks like we are already configured
        if (empty($mysql)) {
            print '<p>Plogger is already installed!</p>';
            return false;
        }
    }
    $ok = false;
    $errors = array();
    if (!empty($form['action']) && 'install' == $form['action']) {
        if (empty($form['db_host'])) {
            $errors[] = 'Please enter the name of your MySQL host.';
        }
        if (empty($form['db_user'])) {
            $errors[] = 'Please enter the MySQL username.';
        }
        if (empty($form['db_pass'])) {
            $errors[] = 'Please enter the MySQL password.';
        }
        if (empty($form['db_name'])) {
            $errors[] = 'Please enter the MySQL database name.';
        }
        if (empty($form['gallery_name'])) {
            $errors[] = 'Please enter the name for your gallery.';
        }
        if (empty($form['admin_email'])) {
            $errors[] = 'Please enter your e-mail address.';
        }
        if (empty($errors)) {
            $errors = check_mysql($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']);
            $ok = empty($errors);
        }
        if (!$ok) {
            print '<ul><li>';
            print join("</li>\n<li>", $errors);
            print '</li></ul>';
        } else {
            $password = generate_password();
            $_SESSION["install_values"] = array("gallery_name" => $form["gallery_name"], "admin_email" => $form["admin_email"], "admin_password" => $password, "admin_username" => "admin");
            $conf = create_config_file($form['db_host'], $form['db_user'], $form['db_pass'], $form['db_name']);
            // if configuration file is writable, then set the values
            // otherwise serve the config file to user and ask her to
            // upload it to webhost
            if (config_writable()) {
                write_config($conf);
            } else {
                $_SESSION["plogger_config"] = $conf;
            }
            require PLOGGER_DIR . 'lib/plogger/form_setup_complete.php';
            return true;
        }
    }
    // most of the time it's probably running on localhost
    if (empty($form['db_host'])) {
        $form['db_host'] = 'localhost';
    }
    $init_vars = array('db_user', 'db_pass', 'db_name', 'gallery_name', 'admin_email');
    foreach ($init_vars as $var) {
        if (empty($form[$var])) {
            $form[$var] = "";
        }
    }
    require PLOGGER_DIR . 'lib/plogger/form_setup.php';
}