Skip to content

Commit

Permalink
Merge pull request #2707 from wp-cli/858-siteurl-doc
Browse files Browse the repository at this point in the history
Document how to handle WP in subdirectory; add test to doc behavior
  • Loading branch information
danielbachhuber committed Apr 29, 2016
2 parents 5713d1e + b51b05f commit 18e12f4
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
60 changes: 60 additions & 0 deletions features/core.feature
Expand Up @@ -260,3 +260,63 @@ Feature: Manage WordPress installation
"""
Error: WordPress files seem to already be present here.
"""

Scenario: Install WordPress in a subdirectory
Given an empty directory
And a wp-config.php file:
"""
<?php
// ** MySQL settings ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wp_cli_test');
/** MySQL database username */
define('DB_USER', 'wp_cli_test');
/** MySQL database password */
define('DB_PASSWORD', 'password1');
/** MySQL hostname */
define('DB_HOST', '127.0.0.1');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
$table_prefix = 'wp_';
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
"""
And a wp-cli.yml file:
"""
path: wp
"""

When I run `wp core download`
Then the wp directory should exist
And the wp/wp-blog-header.php file should exist

When I run `wp db create`
And I run `wp core install --url=wp.dev --title="WP Dev" --admin_user=wpcli --admin_password=wpcli --admin_email=wpcli@example.com`
Then STDOUT should not be empty

When I run `wp option get home`
Then STDOUT should be:
"""
http://wp.dev
"""

When I run `wp option get siteurl`
Then STDOUT should be:
"""
http://wp.dev
"""
12 changes: 11 additions & 1 deletion php/commands/core.php
Expand Up @@ -414,7 +414,17 @@ public function is_installed( $_, $assoc_args ) {
}

/**
* Create the WordPress tables in the database.
* Runs the standard WordPress installation process.
*
* Creates the WordPress tables in the database using the URL, title, and
* default admin user details provided. Performs the famous 5 minute install
* in seconds or less.
*
* Note: if you've installed WordPress in a subdirectory, then you'll need
* to `wp option update siteurl` after `wp core install`. For instance, if
* WordPress is installed in the `/wp` directory and your domain is wp.dev,
* then you'll need to run `wp option update siteurl http://wp.dev/wp` for
* your WordPress install to function properly.
*
* ## OPTIONS
*
Expand Down

0 comments on commit 18e12f4

Please sign in to comment.