From 52c62379624722d778f717d87b58ed82f770f76c Mon Sep 17 00:00:00 2001 From: saxmatt Date: Fri, 23 Jul 2004 08:45:55 +0000 Subject: [PATCH] Rev of installer. Friendlier and better setup. Still needs error checking on admin_email and weblog title, real magic quotes handling, and to use an external DB structure to check everything. git-svn-id: http://svn.automattic.com/wordpress/trunk@1477 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/install.php | 192 ++++++++++++++++++++----------------------- 1 file changed, 91 insertions(+), 101 deletions(-) diff --git a/wp-admin/install.php b/wp-admin/install.php index cab58ca529..b30c12cdd6 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -2,9 +2,12 @@ $_wp_installing = 1; if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file."); + require_once('../wp-config.php'); require('upgrade-functions.php'); +$guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $HTTP_HOST . $REQUEST_URI); + if (isset($_GET['step'])) $step = $_GET['step']; else @@ -14,72 +17,109 @@ else WordPress › Installation - + -

WordPress

+

WordPress

hide_errors(); $installed = $wpdb->get_results("SELECT * FROM $wpdb->users"); -if ($installed) die(__('

You appear to already have WordPress installed. If you would like to reinstall please clear your old database files first.

')); +if ($installed) die(__('

Already Installed

You appear to have already installed WordPress. To reinstall please clear your old database tables first.

')); $wpdb->show_errors(); + switch($step) { case 0: ?> -

Welcome to WordPress. We’re now going to go through a few steps to get - you up and running with the latest in personal publishing platforms. Before - we get started, remember that we require a PHP version of at least 4.1.0, you - have . Look good? You also need to set up the database - connection information in wp-config.php. Have you looked at the - readme? If you’re all ready, let's - go!

+

Welcome to WordPress installation. We’re now going to go through a few steps to get you up and running with the latest in personal publishing platforms. You may want to peruse the ReadMe documentation at your leisure.

+

First Step »

-

Step 1

-

Okay first we’re going to set up the links database. This will allow you to host your own blogroll, complete with Weblogs.com updates.

+

First Step

+

Before we begin we need a little bit of information. Don't worry, you can always change these later.

+ +
+ + + + + + + + + +
Weblog title:
Your e-mail:
+

+ +

+
+ + +

Second Step

+

Now we’re going to create the database tables and fill them with some default data.

+ -

Installing WP-Links.

-

Checking for tables...

\n"; } if (!$got_cats) { - echo "

Can't find table '$wpdb->linkcategories', gonna create it...

\n"; $sql = "CREATE TABLE $wpdb->linkcategories ( " . " cat_id int(11) NOT NULL auto_increment, " . " cat_name tinytext NOT NULL, ". @@ -115,15 +154,12 @@ if (!$got_cats) { ") "; $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.
" . $sql . "
" . mysql_error()); if ($result != false) { - echo "

Table '$wpdb->linkcategories' created OK

\n"; $got_cats = true; } } else { - echo "

Found table '$wpdb->linkcategories', don't need to create it...

\n"; $got_cats = true; } if (!$got_links) { - echo "

Can't find '$wpdb->links', gonna create it...

\n"; $sql = "CREATE TABLE $wpdb->links ( " . " link_id int(11) NOT NULL auto_increment, " . " link_url varchar(255) NOT NULL default '', " . @@ -149,47 +185,29 @@ if (!$got_links) { if ($result != false) { - echo "

Table '$wpdb->links' created OK

\n"; $got_links = true; } } else { - echo "

Found table '$wpdb->links', don't need to create it...

\n"; $got_links = true; } if ($got_links && $got_cats) { - echo "

Looking for category 1...

\n"; $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 "; $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.
" . $sql . "
" . mysql_error()); if ($result != false) { if ($row = mysql_fetch_object($result)) { - echo "

You have at least 1 category. Good!

\n"; $got_row = true; } else { - echo "

Gonna insert category 1...

\n"; $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Links')"; $result = mysql_query($sql) or print ("Can't query insert category.
" . $sql . "
" . mysql_error()); if ($result != false) { - echo "

Inserted category Ok

\n"; $got_row = true; } } } } -if ($got_row) { - echo "

All done!

\n"; -} ?> -

Did you defeat the boss monster at the end? Great! You’re ready for Step - 2.

- -

Step 2

-

First we’re going to create the necessary blog tables in the database...

- posts ( $q = $wpdb->query($query); ?> -

The first table has been created! ...

- posts (post_author, post_date, post_date_gmt, post_ $q = $wpdb->query($query); ?> -

The test post has been inserted correctly...

- categories"; // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->categories\" in the database."); @@ -261,8 +275,6 @@ $query = "UPDATE $wpdb->posts SET post_category = 1"; $result = $wpdb->query($query); ?> -

Categories are up and running...

- comments"; // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->comments\" in the database."); @@ -290,8 +302,6 @@ $query = "INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_ $q = $wpdb->query($query); ?> -

Comments are groovy...

- postmeta ( @@ -310,8 +320,6 @@ $q = $wpdb->query($query); ?> -

Post metadata table ready to go...

- options"; // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->options\" in the database."); @@ -394,8 +402,6 @@ $q = $wpdb->query($query); ?> -

Option Tables created okay.

- optiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')", //base options from b2cofig -"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, 'http://example.com', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)", +"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, '$guessurl', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)", -"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(3,'blogname', 3, 'My Weblog', 'blogname is the name of your blog', 8, 20)", +"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(3,'blogname', 3, '$weblog_title', 'blogname is the name of your blog', 8, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(4,'blogdescription', 3, 'My WordPress weblog', 'blogdescription is the description of your blog', 8, 40)", //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(6,'search_engine_friendly_urls', 2, '0', 'Querystring Configuration ** (don\'t change if you don\'t know what you\'re doing)', 8, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(7,'new_users_can_blog', 2, '0', 'whether you want new users to be able to post entries once they have registered', 8, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(8,'users_can_register', 2, '1', 'whether you want to allow users to register on your blog', 8, 20)", -"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(54,'admin_email', 3, 'you@example.com', 'Your email (obvious eh?)', 8, 20)", +"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(54,'admin_email', 3, '$admin_email', 'Your email (obvious eh?)', 8, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level) VALUES (93, 'blog_charset', 3, 'utf-8', 'Your blog’s charset (here’s a list of possible charsets)', 8)", // general blog setup "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(9 ,'start_of_week', 5, '1', 'day at the start of the week', 8, 20)", @@ -589,7 +595,6 @@ foreach ($option_data as $query) { } ?> -

Option Data inserted okay.

-

Links option data inserted okay.

-

Geo option data inserted okay.

- - -

OK. We're nearly done now. We just need to ask you a couple of things:

-
- -

What is the web address of your WordPress installation? (We probably guessed it for you correctly.)
- - -

-

On to - -

-
+

Groovy. We're almost done.

+

Final Step »

-

Step 3

- +

Third Step

options set option_value='$url' where option_id=1"; //siteurl - $q = $wpdb->query($query); -} - // $query = "DROP TABLE IF EXISTS $wpdb->users"; // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->users\" in the database."); @@ -753,12 +736,19 @@ upgrade_all(); "admin" and password "".

Note that password carefully! It is a random password that was generated just for you. If you lose it, you - will have to delete the tables from the database yourself, and re-install WordPress. + will have to delete the tables from the database yourself, and re-install WordPress. So to review:

+
+
Login
+
admin
+
Password
+
+

Were you expecting more steps? Sorry to disappoint. All done!

+ \ No newline at end of file