Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Support for WordPress example repo #39

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ machine:
TERMINUS_SITE: build-tools-$CIRCLE_BUILD_NUM
TERMINUS_ORG: CI for Drupal 8 + Composer
GITHUB_USERNAME: pantheon-ci-bot
SOURCE_COMPOSER_PROJECT: pantheon-systems/example-drops-8-composer:dev-test
SOURCE_COMPOSER_PROJECT: stevector/example-wordpress-composer:dev-wordpress-build-plugin
TARGET_REPO: $GITHUB_USERNAME/$TERMINUS_SITE
TARGET_REPO_WORKING_COPY: $HOME/$TERMINUS_SITE
BRANCH: $(echo $CIRCLE_BRANCH | grep -v '^\(master\|[0-9]\+.x\)$')
Expand Down
11 changes: 8 additions & 3 deletions src/Commands/BuildToolsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ public function createProject(
'account-pass' => $circle_env['ADMIN_PASSWORD'],
'site-mail' => $circle_env['ADMIN_EMAIL'],
'site-name' => $circle_env['TEST_SITE_NAME'],
'site-url' => "https://dev-{$site_name}.pantheonsite.io"
];
$this->doInstallSite("{$site_name}.dev", $composer_json, $site_install_options);

Expand Down Expand Up @@ -658,9 +659,13 @@ protected function expandSourceAliases($source)
*/
protected function autodetectUpstream($siteDir)
{
return 'Empty Upstream';
// or 'Drupal 7' or 'WordPress'
// return 'Drupal 8';
if (file_exists($siteDir . '/web/wp-config.php')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevector and @greg-1-anderson WordPress will first look for wp-config.php wherever core is. If WordPress core is in a subdirectory, say wp, then web/wp/wp-config.php will take precedence over web/wp-config.php if it exists.

That tripped me up when first implementing WordPress is a subdirectory via Composer as the Pantheon WordPress upstream includes wp-config.php. When installing core from our upstream repo into a subdirectory web/wp/wp-config.php must be deleted.

All that being said someone could have web/wp/wp-config.php, or wherever they have installed WordPress core, without web/wp-config.php and have a properly working site. I think it's okay for us to be opinionated about using wp for the directory name as well as having wp-config.php live in the we docroot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A variant of this line was already committed as part of a separate PR. We could check for both web/wp-config.php and web/wp/wp-config.php, or test some file that is always in the docroot, even when core is relocated, if such a candidate exists.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's continue in #60.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use something like find -maxdepth 2 -type f -name 'wp-config.php rather than hard-coding directories or guessing what subdirectory will have WordPress core.

return 'WordPress';
}
else {
// This upstream works for Drupal 8.
return 'Empty Upstream';
}
}

/**
Expand Down