fix nasty error due to /dev/random exhaustion
[lhc/web/wiklou.git] / config / index.php
index 69fd27e..2a6567b 100644 (file)
@@ -244,7 +244,9 @@ $conf->xml = function_exists( "utf8_encode" );
 if( $conf->xml ) {
        print "<li>Have XML / Latin1-UTF-8 conversion support.</li>\n";
 } else {
-       print "<li><b>XML / Latin1-UTF-8 conversion is missing! Wiki will probably not work.</b></li>\n";
+       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." );
 }
 
 $memlimit = ini_get( "memory_limit" );
@@ -329,6 +331,9 @@ $errs = array();
 if( $conf->Sitename == "" || $conf->Sitename == "MediaWiki" || $conf->Sitename == "Mediawiki" ) {
        $errs["Sitename"] = "Must not be blank or \"MediaWiki\".";
 }
+if( $conf->DBuser == "" ) {
+       $errs["DBuser"] = "Must not be blank";
+}
 if( $conf->DBpassword == "" ) {
        $errs["DBpassword"] = "Must not be blank";
 }
@@ -473,6 +478,8 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                        do_objectcache_update(); flush();
                        do_categorylinks_update(); flush();
                        do_image_name_unique_update(); flush();
+                       do_logging_update(); flush();
+                       do_user_rights_update(); flush();
 
                        if ( isTemplateInitialised() ) {
                                print "Template namespace already initialised\n";
@@ -784,7 +791,7 @@ function writeLocalSettings( $conf ) {
        $ugly = ($conf->prettyURLs ? "# " : "");
        $rights = ($conf->RightsUrl) ? "" : "# ";
 
-       $file = @fopen( "/dev/random", "r" );
+       $file = @fopen( "/dev/urandom", "r" );
        if ( $file ) {
                $proxyKey = bin2hex( fread( $file, 32 ) );
                fclose( $file );
@@ -798,7 +805,10 @@ function writeLocalSettings( $conf ) {
 
        # Add slashes to strings for double quoting
        $slconf = array_map( "escapePhpString", get_object_vars( $conf ) );
-
+       if( $conf->License == 'gfdl' ) {
+               # Needs literal string interpolation for the current style path
+               $slconf['RightsIcon'] = $conf->RightsIcon;
+       }
 
        $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":";
        return "
@@ -819,7 +829,7 @@ if ( \$wgCommandLineMode ) {
        }
 } elseif ( empty( \$wgConfiguring ) ) {
        ## Compress output if the browser supports it
-       {$zlib}if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
+       {$zlib}if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
 }
 
 \$wgSitename         = \"{$slconf['Sitename']}\";
@@ -889,10 +899,10 @@ if ( \$wgCommandLineMode ) {
 ## License and Creative Commons licenses are supported so far.
 {$rights}\$wgEnableCreativeCommonsRdf = true;
 \$wgRightsPage = \"\"; # Set to the title of a wiki page that describes your license/copyright
-\$wgRightsUrl = \"{$conf->RightsUrl}\";
-\$wgRightsText = \"{$conf->RightsText}\";
-\$wgRightsIcon = \"{$conf->RightsIcon}\";
-# \$wgRightsCode = \"{$conf->RightsCode}\"; # Not yet used
+\$wgRightsUrl = \"{$slconf['RightsUrl']}\";
+\$wgRightsText = \"{$slconf['RightsText']}\";
+\$wgRightsIcon = \"{$slconf['RightsIcon']}\";
+# \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
 ";
 }