diff --git a/package.json b/package.json index 352bccb..38e5c2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bigbite/wp-cypress", - "version": "0.8.0", + "version": "0.8.1", "description": "WordPress end to end testing with Cypress.io", "repository": "https://github.com/bigbite/wp-cypress", "author": { diff --git a/plugin/src/Plugin.php b/plugin/src/Plugin.php index e035ea7..17e5c88 100644 --- a/plugin/src/Plugin.php +++ b/plugin/src/Plugin.php @@ -62,14 +62,20 @@ public function add_user_command(): void { * @return void */ public function set_user( $args ): void { - $user = get_user_by( 'login', $args[0] ); + $user_id = 'false'; - if ( ! $user ) { - WP_CLI::error( "User {$args[0]} doesn't exits." ); - return; + if ( 'loggedout' !== $args[0] ) { + $user = get_user_by( 'login', $args[0] ); + + if ( ! $user ) { + WP_CLI::error( "User {$args[0]} doesn't exits." ); + return; + } + + $user_id = $user->ID; } - file_put_contents( get_home_path() . '.userid', $user->ID ); + file_put_contents( get_home_path() . '.userid', $user_id ); WP_CLI::success( 'Current User set to ' . $args[0] ); } diff --git a/update.sh b/update.sh index 1b716e6..11b9e64 100644 --- a/update.sh +++ b/update.sh @@ -4,6 +4,9 @@ HARD_RESET=$2 shopt -s extglob rm -rf !(wp-config.php|wp-cypress-config.php|seeds|wp-content|update.sh|.htaccess) +# Ensure uploads work +if ${HARD_RESET}; then rm -rf /var/www/html/wp-content/uploads && mkdir -p /var/www/html/wp-content/uploads && chmod -R 777 /var/www/html/wp-content/uploads; fi + if ${HARD_RESET}; then rm wp-config.php; fi cp -rfp ../${VERSION}/* ./