index.php

来自「php 开发的内容管理系统」· PHP 代码 · 共 1,666 行 · 第 1/4 页

PHP
1,666
字号
<?php# MediaWiki web-based config/installation# Copyright (C) 2004 Brion Vibber <brion@pobox.com>, 2006 Rob Church <robchur@gmail.com># http://www.mediawiki.org/## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License along# with this program; if not, write to the Free Software Foundation, Inc.,# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.# http://www.gnu.org/copyleft/gpl.htmlerror_reporting( E_ALL );header( "Content-type: text/html; charset=utf-8" );@ini_set( "display_errors", true );# In case of errors, let output be clean.$wgRequestTime = microtime( true );# Attempt to set up the include path, to fix problems with relative includes$IP = dirname( dirname( __FILE__ ) );define( 'MW_INSTALL_PATH', $IP );$sep = PATH_SEPARATOR;if( !ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ) ) {	set_include_path( ".$sep$IP$sep$IP/includes$sep$IP/languages" );}# Define an entry point and include some filesdefine( "MEDIAWIKI", true );define( "MEDIAWIKI_INSTALL", true );// Run version checks before including other files// so people don't see a scary parse error.require_once( "install-utils.inc" );install_version_checks();require_once( "includes/Defines.php" );require_once( "includes/DefaultSettings.php" );require_once( "includes/MagicWord.php" );require_once( "includes/Namespace.php" );## Databases we support:$ourdb = array();$ourdb['mysql']['fullname']      = 'MySQL';$ourdb['mysql']['havedriver']    = 0;$ourdb['mysql']['compile']       = 'mysql';$ourdb['mysql']['bgcolor']       = '#ffe5a7';$ourdb['postgres']['fullname']   = 'PostgreSQL';$ourdb['postgres']['havedriver'] = 0;$ourdb['postgres']['compile']    = 'pgsql';$ourdb['postgres']['bgcolor']    = '#aaccff';?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>	<meta http-equiv="Content-type" content="text/html; charset=utf-8">	<title>MediaWiki <?php echo( $wgVersion ); ?> Installation</title>	<style type="text/css">		@import "../skins/monobook/main.css";		.env-check {			font-size: 90%;			margin: 1em 0 1em 2.5em;		}		.config-section {			margin-top: 2em;		}		.config-section label.column {			clear: left;			font-weight: bold;			width: 13em;			float: left;			text-align: right;			padding-right: 1em;			padding-top: .2em;		}		.config-input {			clear: left;			zoom: 100%; /* IE hack */		}		.config-section .config-desc {			clear: left;			margin: 0 0 2em 18em;			padding-top: 1em;			font-size: 85%;		}		.iput-text, .iput-password {			width: 14em;			margin-right: 1em;		}		.error {			color: red;			background-color: #fff;			font-weight: bold;			left: 1em;			font-size: 100%;		}		.error-top {			color: red;			background-color: #FFF0F0;			border: 2px solid	 red;			font-size: 130%;			font-weight: bold;			padding: 1em 1.5em;			margin: 2em 0 1em;		}		ul.plain {			list-style-type: none;			list-style-image: none;			float: left;			margin: 0;			padding: 0;		}		.btn-install {			font-weight: bold;			font-size: 110%;			padding: .2em .3em;		}		.license {			font-size: 85%;			padding-top: 3em;		}	</style>	<script type="text/javascript">	<!--	function hideall() {		<?php foreach (array_keys($ourdb) as $db) {		echo "document.getElementById('$db').style.display='none';\n";		}		?>	}	function togglearea(id) {		hideall();		var dbarea = document.getElementById(id).style;		dbarea.display = dbarea.display = 'none' ? 'block' : 'none';  	}	// -->	</script></head><body><div id="globalWrapper"><div id="column-content"><div id="content"><div id="bodyContent"><h1>MediaWiki <?php print $wgVersion ?> Installation</h1><?php/* Check for existing configurations and bug out! */if( file_exists( "../LocalSettings.php" ) ) {	dieout( "	<p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>	<p>Please delete the /config directory for extra security.</p></div></div></div></div>" );}if( file_exists( "./LocalSettings.php" ) ) {	writeSuccessMessage();	dieout( '' );}if( !is_writable( "." ) ) {	dieout( "<h2>Can't write config file, aborting</h2>	<p>In order to configure the wiki you have to make the <tt>config</tt> subdirectory	writable by the web server. Once configuration is done you'll move the created	<tt>LocalSettings.php</tt> to the parent directory, and for added safety you can	then remove the <tt>config</tt> subdirectory entirely.</p>	<p>To make the directory writable on a Unix/Linux system:</p>	<pre>	cd <i>/path/to/wiki</i>	chmod a+w config	</pre>" );}require_once( "maintenance/updaters.inc" );class ConfigData {	function getEncoded( $data ) {		# removing latin1 support, no need...		return $data;	}	function getSitename() { return $this->getEncoded( $this->Sitename ); }	function getSysopName() { return $this->getEncoded( $this->SysopName ); }	function getSysopPass() { return $this->getEncoded( $this->SysopPass ); }}?><ul>	<li>		<b>Don't forget security updates!</b> Keep an eye on the		<a href="http://mail.wikimedia.org/mailman/listinfo/mediawiki-announce">low-traffic		release announcements mailing list</a>.	</li></ul><h2>Checking environment...</h2><p><em>Please include all of the lines below when reporting installation problems.</em></p><ul class="env-check"><?php$endl = "";$wgNoOutputBuffer = true;$conf = new ConfigData;install_version_checks();print "<li>PHP " . phpversion() . " installed</li>\n";## Temporarily turn off all errors as we try to discover installed databases$olderrnum = error_reporting(0);$phpdatabases = array();foreach (array_keys($ourdb) as $db) {	$compname = $ourdb[$db]['compile'];	if (extension_loaded($compname) or dl($compname . '.' . PHP_SHLIB_SUFFIX)) {		array_push($phpdatabases, $db);		$ourdb[$db]['havedriver'] = 1;	}}error_reporting($olderrornum);if (!$phpdatabases) {	print "Could not find a suitable database driver!<ul>";	foreach (array_keys($ourdb) AS $db) {		$comp = $ourdb[$db]['compile'];		$full = $ourdb[$db]['fullname'];		print "<li>For <b>$full</b>, compile PHP using <b>--with-$comp</b>, "			."or install the $comp.so module</li>\n";	}	dieout( "</ul></ul>" );}print "<li>Found database drivers for:";foreach (array_keys($ourdb) AS $db) {	if ($ourdb[$db]['havedriver']) {		$DefaultDBtype = $db;		print "  ".$ourdb[$db]['fullname'];	}}print "</li>\n";if (count($phpdatabases) != 1)	$DefaultDBtype = '';if( ini_get( "register_globals" ) ) {	?>	<li>		<div style="font-size:110%">		<strong class="error">Warning:</strong>		<strong>PHP's	<tt><a href="http://php.net/register_globals">register_globals</a></tt>	option is enabled. Disable it if you can.</strong>		</div>		MediaWiki will work, but your server is more exposed to PHP-based security vulnerabilities.	</li>	<?php}$fatal = false;if( ini_get( "magic_quotes_runtime" ) ) {	$fatal = true;	?><li class='error'><strong>Fatal: <a href='http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-runtime'>magic_quotes_runtime</a> is active!</strong>	This option corrupts data input unpredictably; you cannot install or use	MediaWiki unless this option is disabled.	<?php}if( ini_get( "magic_quotes_sybase" ) ) {	$fatal = true;	?><li class='error'><strong>Fatal: <a href='http://www.php.net/manual/en/ref.sybase.php#ini.magic-quotes-sybase'>magic_quotes_sybase</a> is active!</strong>	This option corrupts data input unpredictably; you cannot install or use	MediaWiki unless this option is disabled.	<?php}if( ini_get( "mbstring.func_overload" ) ) {	$fatal = true;	?><li class='error'><strong>Fatal: <a href='http://www.php.net/manual/en/ref.mbstring.php#mbstring.overload'>mbstring.func_overload</a> is active!</strong>	This option causes errors and may corrupt data unpredictably;	you cannot install or use MediaWiki unless this option is disabled.	<?php}if( $fatal ) {	dieout( "</ul><p>Cannot install MediaWiki.</p>" );}if( ini_get( "safe_mode" ) ) {	$conf->safeMode = true;	?>	<li><b class='error'>Warning:</b> <strong>PHP's	<a href='http://www.php.net/features.safe-mode'>safe mode</a> is active.</strong>	You may have problems caused by this, particularly if using image uploads.	</li>	<?php} else {	$conf->safeMode = false;}$sapi = php_sapi_name();$conf->prettyURLs = true;print "<li>PHP server API is $sapi; ";switch( $sapi ) {case "apache":case "apache2handler":	print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";	break;default:	print "unknown; ";case "cgi":case "cgi-fcgi":case "apache2filter":case "isapi":	print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";	$conf->prettyURLs = false;	break;}print "</li>\n";$conf->xml = function_exists( "utf8_encode" );if( $conf->xml ) {	print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";} else {	dieout( "PHP's XML module is missing; the wiki requires functions in		this module and won't work in this configuration.		If you're running Mandrake, install the php-xml package." );}# Crude check for session supportif( !function_exists( 'session_name' ) )	dieout( "PHP's session module is missing. MediaWiki requires session support in order to function." );# Likewise for PCREif( !function_exists( 'preg_match' ) )	dieout( "The PCRE regular expression functions are missing. MediaWiki requires these in order to function." );$memlimit = ini_get( "memory_limit" );$conf->raiseMemory = false;if( empty( $memlimit ) || $memlimit == -1 ) {	print "<li>PHP is configured with no <tt>memory_limit</tt>.</li>\n";} else {	print "<li>PHP's <tt>memory_limit</tt> is " . htmlspecialchars( $memlimit ) . ". <strong>If this is too low, installation may fail!</strong> ";	$n = intval( $memlimit );	if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) {		$n = intval( $m[1] * (1024*1024) );	}	if( $n < 20*1024*1024 ) {		print "Attempting to raise limit to 20M... ";		if( false === ini_set( "memory_limit", "20M" ) ) {			print "failed.";		} else {			$conf->raiseMemory = true;			print "ok.";		}	}	print "</li>\n";}$conf->zlib = function_exists( "gzencode" );if( $conf->zlib ) {	print "<li>Have zlib support; enabling output compression.</li>\n";} else {	print "<li>No zlib support.</li>\n";}$conf->turck = function_exists( 'mmcache_get' );if ( $conf->turck ) {	print "<li><a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> installed</li>\n";}$conf->apc = function_exists('apc_fetch');if ($conf->apc ) {	print "<li><a href=\"http://www.php.net/apc\">APC</a> installed</li>";}$conf->eaccel = function_exists( 'eaccelerator_get' );if ( $conf->eaccel ) {    $conf->turck = 'eaccelerator';    print "<li><a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> installed</li>\n";}if (!$conf->turck && !$conf->eaccel && !$conf->apc) {	print "<li>Neither <a href=\"http://turck-mmcache.sourceforge.net/\">Turck MMCache</a> nor ".		"<a href=\"http://eaccelerator.sourceforge.net/\">eAccelerator</a> nor ".		"<a href=\"http://www.php.net/apc\">APC</a> are installed, " .		"can't use object caching functions</li>\n";

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?