Make WordPress Core

Ticket #1936: nicer-no-config.diff

File nicer-no-config.diff, 2.6 KB (added by chuyskywalker, 20 years ago)

patch to make the ugly error not so ugly, and much more helpful

  • wp-blog-header.php

     
    44if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
    55        if ( strstr( $_SERVER['PHP_SELF'], 'wp-admin') ) $path = '';
    66        else $path = 'wp-admin/';
    7     die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='{$path}setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
     7       
     8        if( is_writable( dirname(__FILE__) . '/wp-config.php' ) || is_writable( dirname(__FILE__) ) ) $use_tool = true;
     9        ?>
     10        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     11        <html xmlns="http://www.w3.org/1999/xhtml">
     12        <head>
     13                <title>WordPress &rsaquo; Error</title>
     14                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     15                <style media="screen" type="text/css">
     16                <!--
     17                html {
     18                        background: #eee;
     19                }
     20                body {
     21                        background: #fff;
     22                        color: #000;
     23                        font-family: Georgia, "Times New Roman", Times, serif;
     24                        margin-left: 25%;
     25                        margin-right: 25%;
     26                        padding: .2em 2em;
     27                }
     28               
     29                h1 {
     30                        color: #006;
     31                        font-size: 18px;
     32                        font-weight: lighter;
     33                }
     34               
     35                h2 {
     36                        font-size: 16px;
     37                }
     38               
     39                p, li, dt {
     40                        line-height: 140%;
     41                        padding-bottom: 2px;
     42                }
     43       
     44                ul, ol {
     45                        padding: 5px 5px 5px 20px;
     46                }
     47                #logo {
     48                        margin-bottom: 2em;
     49                }
     50                -->
     51                </style>
     52        </head>
     53        <body>
     54        <h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1>
     55       
     56        <h1>Missing The <code>wp-config.php</code> File</h1>
     57       
     58        <p>There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started.</p>
     59        <?php if( $use_tool ) { ?>
     60        <p>It looks like you can <a href="<?php echo $path ?>setup-config.php">create a <code>wp-config.php</code> file through a web interface</a>, but this may not work. The safest way is to manually create the file.</p>
     61        <?php } else { ?>
     62        <p>It looks like you'll need to create the <code>wp-config.php</code> file by hand. There is an example file called <code>wp-config-example.php</code> which you can use as a starting point.</p>
     63        <?php } ?>
     64        <p>Need more help? <a href="http://codex.wordpress.org/Editing_wp-config.php">We got it</a>.</p>
     65       
     66       
     67        </body></html>
     68        <?
     69        exit;
    870}
    971
    1072$wp_did_header = true;