示例#1
0
            echo "=====================================================================";
            echo get_summary(false, false);
        }
        if ($html_output) {
            fclose($html_file);
        }
        if ($output_file != '' && $just_save_results) {
            save_or_mail_results();
        }
        if (getenv('REPORT_EXIT_STATUS') == 1 and preg_match('/FAILED(?: |$)/', implode(' ', $test_results))) {
            exit(1);
        }
        exit(0);
    }
}
verify_config();
write_information($html_output);
// Compile a list of all test files (*.phpt).
$test_files = array();
$exts_tested = count($exts_to_test);
$exts_skipped = 0;
$ignored_by_ext = 0;
sort($exts_to_test);
$test_dirs = array();
$optionals = array('tests', 'ext', 'Zend', 'ZendEngine2', 'sapi/cli', 'sapi/cgi');
foreach ($optionals as $dir) {
    if (@filetype($dir) == 'dir') {
        $test_dirs[] = $dir;
    }
}
// Convert extension names to lowercase
示例#2
0
function save_via_ftp($ftphost, $username, $password, $ftpdir, $config_text)
{
    global $errors;
    list($host, $port) = explode(':', $ftphost);
    if (empty($port)) {
        $port = 21;
    }
    $ftp = ftp_connect($host, $port, 10);
    if ($ftp) {
        if (@ftp_login($ftp, $username, $password)) {
            if ($ftpdir == '' || @ftp_chdir($ftp, $ftpdir)) {
                $file = tempnam(".", "psconf");
                if ($fh = fopen($file, "w")) {
                    fwrite($fh, $config_text);
                    fclose($fh);
                    // delete it first, since some FTP's complain if you overwrite.
                    // we don't care if it fails.
                    @ftp_delete($ftp, 'config.php');
                    if (!@ftp_put($ftp, 'config.php', $file, FTP_ASCII)) {
                        $errors[] = "Unable to upload file to '" . ftp_pwd($ftp) . "'";
                        if (!empty($php_errormsg)) {
                            $errors[] = $php_errormsg;
                        }
                    }
                    @unlink($file);
                } else {
                    $errors[] = "Error creating temporary file for upload!";
                }
            } else {
                $errors[] = "FTP Directory '{$ftpdir}' does not exist!";
            }
        } else {
            $errors[] = "Unable to login to FTP server. Invalid username or password.";
        }
    } else {
        $errors[] = "Unable to connect to FTP server '{$host}:{$port}'";
    }
    if (!$errors) {
        if (!verify_config()) {
            $errors[] = "Config was uploaded to the wrong directory '{$ftpdir}' (DB config doesn't match).";
            $errors[] = "Make sure the FTP directory below is the proper local directory of your PsychoStats website";
            @ftp_delete($ftp, 'config.php');
        }
    }
    if ($ftp) {
        @ftp_close($ftp);
    }
    return $errors;
}