From 46db49a9bad26640f4522ee0311726cc3a464827 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 1 May 2005 08:35:29 +0000 Subject: [PATCH] Remove stub experimental installer (incomplete). --- config/installer.php | 276 ------------------------------------------- 1 file changed, 276 deletions(-) delete mode 100644 config/installer.php diff --git a/config/installer.php b/config/installer.php deleted file mode 100644 index cb0c39f166..0000000000 --- a/config/installer.php +++ /dev/null @@ -1,276 +0,0 @@ - -# 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., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# http://www.gnu.org/copyleft/gpl.html - - -/** - * This is to be the fancy new installer package for MediaWiki, - * which will work with table prefixes, both MySQL and PostgreSQL, and - * ideally such wacky things as text-based install as well as web. - * - * It's not done yet. - * - * @todo finish... - * @package MediaWiki - * @subpackage Installer - */ - -$IP = ".."; # Just to suppress notices, not for anything useful -define( "MEDIAWIKI", true ); -define( "MEDIAWIKI_INSTALL", true ); -require_once( "../includes/Defines.php" ); -require_once( "../includes/DefaultSettings.php" ); -require_once( "../includes/MagicWord.php" ); -require_once( "../includes/Namespace.php" ); -require_once( "../install-utils.inc" ); -require_once( "../maintenance/updaters.inc" ); -require_once( "../maintenance/convertLinks.inc" ); -require_once( "../maintenance/archives/moveCustomMessages.inc" ); - -class InstallInterface { - function message( $text ) { - echo $text . "\n"; - } - - function warning( $text ) { - echo "** $text **\n"; - } - - function formatLink( $url, $text = '' ) { - if( $text ) { - return "$text ($url)"; - } else { - return $url; - } - } - - function showHeader() { - global $wgVersion; - echo "MediaWiki $wgVersion installation\n\n"; - } -} - -class Installer { - var $settings = array(); - - function Installer( &$interface ) { - $this->ui =& $interface; - } - - function runInstall() { - $this->ui->showHeader(); - $this->preInstallChecks(); - } - - function override( $var, $value ) { - $this->settings[$var] = $value; - } - - function preInstallChecks() { - $checks = array( - 'checkConfigured', - 'checkInstalled', - 'checkWritable', - 'checkPHP', - 'checkGlobals', - 'checkSafeMode', - 'checkSAPI', - 'checkMemory', - 'checkZlib', - 'checkImageMagick', - 'checkGD' - ); - foreach( $checks as $check ) { - if( !$this->$check() ) { - $this->ui->warning( "Installation aborted." ); - return false; - } - } - } - - function checkConfigured() { - if( file_exists( "../LocalSettings.php" ) ) { - $this->ui->warning( "Already configured." ); - return false; - } - return true; - } - - function checkInstalled() { - if( file_exists( "./LocalSettings.php" ) ) { - $this->ui->warning( "Already configured; move LocalSettings.php from this directory to the parent dir and take the wiki for a spin." ); - return false; - } - return true; - } - - function checkWritable() { - if( !is_writable( "." ) ) { - $this->ui->warning( "

Can't write config file, aborting

- -

In order to configure the wiki you have to make the config subdirectory - writable by the web server. Once configuration is done you'll move the created - LocalSettings.php to the parent directory, and for added safety you can - then remove the config subdirectory entirely.

- -

To make the directory writable on a Unix/Linux system:

- -
-	cd /path/to/wiki
-	chmod a+w config
-	
" ); - - return false; - } - return true; - } - - function checkPHP() { - $ver = phpversion(); - if( version_compare( $ver, "4.1.2", "lt" ) ) { - $this->ui->warning( "Your version of PHP ($ver) is too old and will probably not work. We try to support 4.1.2 and above, but a current 4.3 or 5.0 release is preferred." ); - return false; - } - $this->ui->message( "PHP version $ver, ok" ); - if( version_compare( $ver, "gte", "5.0" ) ) { - $this->ui->warning( "A PHP5-compatible version of the PHPTAL template system is not yet bundled. To get the regular default page layout, you will need to manually install a development snapshot. (The wiki will function normally using an older layout if you do not.)" ); - } - return true; - } - - function checkGlobals() { - if( ini_get( 'register_globals' ) ) { - $this->ui->warning( "PHP's " . - $this->ui->formatLink( "http://php.net/register_globals", "register_globals" ) . - "option is enabled." . - "MediaWiki will work correctly, but this setting - increases your exposure to potential security vulnerabilities in PHP-based - software running on your server. You should disable it if you are able." ); - } - return true; - } - - function checkSafeMode() { - if( ini_get( 'safe_mode' ) ) { - $this->ui->warning( "PHP's - safe mode is active! - You will likely have problems caused by this. You may need to make the - 'images' subdirectory writable or specify a TMP environment variable pointing to - a writable temporary directory owned by you, since safe mode breaks the system - temporary directory." ); - $this->ui->message( "...due to safe mode restrictions, uploads will use flat directory mode if enabled." ); - $this->override( 'wgHashedUploadDirectory', true ); - } else { - $this->ui->message( "PHP is not running in safe mode (this is good!)" ); - $this->ui->message( "...uploads will use hashed directory tree mode if enabled." ); - } - return true; - } - - function checkSAPI() { - $sapi = php_sapi_name(); - $this->ui->message( "PHP server API is $sapi..." ); - switch( $sapi ) { - case "apache": - case "apache2handler": - $this->ui->message( "...ok, using pretty URLs (index.php/Page_Title)" ); - break; - case "cgi": - case "cgi-fcgi": - case "apache2filter": - $this->ui->message( "using ugly URLs (index.php?title=Page_Title)" ); - $this->override( 'prettyURLs', false ); - # FIXME - break; - default: - $this->ui->message( "unknown; using pretty URLs (index.php/Page_Title), if you have trouble change this in LocalSettings.php" ); - } - return true; - } - - function checkMemory() { - $memlimit = ini_get( "memory_limit" ); - if( empty( $memlimit ) ) { - $this->ui->message( "PHP is configured with no memory_limit." ); - return true; - } else { - $this->ui->message( "PHP's memory_limit is $memlimit... " ); - $n = IntVal( $memlimit ); - if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) { - $n = IntVal( $m[1] * (1024*1024) ); - } - if( $n < 20*1024*1024 ) { - if( false === ini_set( "memory_limit", "20M" ) ) { - $this->ui->warning( "...failed to raise the limit to 20M; you may have problems" ); - } else { - $this->ui->message( "...raising limit to 20M" ); - $this->override( 'raiseMemory', true ); - } - } - return true; - } - } - - function checkZlib() { - $zlib = function_exists( "gzencode" ); - if( $zlib ) { - $this->ui->message( "Have zlib support; enabling output compression." ); - # This is a runtime thing, we're just letting the user know about it? - } else { - $this->ui->message( "No zlib support." ); - } - return true; - } - - function checkImageMagick() { - $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" ); - foreach( $imcheck as $dir ) { - $im = "$dir/convert"; - if( file_exists( $im ) ) { - $this->ui->message( "Found ImageMagick: $im; image thumbnailing will be enabled if you enable uploads." ); - $this->override( "wgImageMagick", $im ); - $this->override( "wgUseImageResize", true ); - break; - } - } - return true; - } - - function checkGD() { - $gd = function_exists( "imagejpeg" ); - if( $gd ) { - $this->ui->message( "Found GD graphics library built-in, image thumbnailing will be enabled if you enable uploads" ); - $this->override( "wgUseImageResize", true ); - } else { - if( !isset( $this->settings['wgUseImageResize'] ) ) { - $this->warning( "Couldn't find GD library or ImageMagick; image thumbnailing disabled." ); - } - } - return true; - } - - -} - -$ui =& new InstallInterface(); -$i =& new Installer( $ui ); -$i->runInstall(); - -?> -- 2.20.1