|
10 | 10 | use Symfony\Component\Filesystem\Filesystem; |
11 | 11 | use function EE\Site\Utils\auto_site_name; |
12 | 12 | use function EE\Site\Utils\get_site_info; |
| 13 | +use function EE\Utils\get_flag_value; |
13 | 14 |
|
14 | 15 | /** |
15 | 16 | * Adds `wp` site type to `ee site` command. |
@@ -202,6 +203,9 @@ public function __construct() { |
202 | 203 | * # Create WordPress site with wildcard ssl |
203 | 204 | * $ ee site create example.com --type=wp --ssl=le --wildcard |
204 | 205 | * |
| 206 | + * # Create WordPress site with self signed certificate |
| 207 | + * $ ee site create example.com --type=wp --ssl=self |
| 208 | + * |
205 | 209 | * # Create WordPress site with remote database |
206 | 210 | * $ ee site create example.com --type=wp --dbhost=localhost --dbuser=username --dbpass=password |
207 | 211 | * |
@@ -1296,6 +1300,61 @@ public function reload( $args, $assoc_args, $whitelisted_containers = [], $reloa |
1296 | 1300 | } |
1297 | 1301 |
|
1298 | 1302 |
|
| 1303 | + /** |
| 1304 | + * Publishes site online using ngrok. |
| 1305 | + * |
| 1306 | + * ## OPTIONS |
| 1307 | + * |
| 1308 | + * <site-name> |
| 1309 | + * : Name of website. |
| 1310 | + * |
| 1311 | + * [--disable] |
| 1312 | + * : Take online link down. |
| 1313 | + * |
| 1314 | + * [--refresh] |
| 1315 | + * : Refresh site publish if link has expired. |
| 1316 | + * |
| 1317 | + * [--token=<token>] |
| 1318 | + * : ngrok token. |
| 1319 | + * |
| 1320 | + * ## EXAMPLES |
| 1321 | + * |
| 1322 | + * # Publish site online |
| 1323 | + * $ ee site publish example.com |
| 1324 | + * |
| 1325 | + * # Refresh published link if expired |
| 1326 | + * $ ee site publish example.com --refresh |
| 1327 | + * |
| 1328 | + * # Disable online link |
| 1329 | + * $ ee site publish example.com --disable |
| 1330 | + * |
| 1331 | + */ |
| 1332 | + public function publish( $args, $assoc_args ) { |
| 1333 | + |
| 1334 | + parent::publish( $args, $assoc_args ); |
| 1335 | + |
| 1336 | + $disable = get_flag_value( $assoc_args, 'disable', false ); |
| 1337 | + $refresh = get_flag_value( $assoc_args, 'refresh', false ); |
| 1338 | + |
| 1339 | + if ( $refresh ) { |
| 1340 | + return; |
| 1341 | + } |
| 1342 | + |
| 1343 | + EE::log( 'Running additional WordPress configurations.' ); |
| 1344 | + chdir( $this->site_data->site_fs_path ); |
| 1345 | + if ( $disable ) { |
| 1346 | + EE::exec( 'docker-compose exec --user=\'www-data\' php wp plugin delete relative-url' ); |
| 1347 | + EE::exec( 'docker-compose exec --user=\'www-data\' php wp config delete WP_SITEURL' ); |
| 1348 | + EE::exec( 'docker-compose exec --user=\'www-data\' php wp config delete WP_HOME' ); |
| 1349 | + } else { |
| 1350 | + EE::exec( 'docker-compose exec --user=\'www-data\' php wp plugin install relative-url --activate' ); |
| 1351 | + EE::exec( 'docker-compose exec --user=\'www-data\' php wp config set --type=constant WP_SITEURL "\'http://\' . $_SERVER[\'HTTP_HOST\']" --raw' ); |
| 1352 | + EE::exec( 'docker-compose exec --user=\'www-data\' php wp config set --type=constant WP_HOME "\'http://\' . $_SERVER[\'HTTP_HOST\']" --raw' ); |
| 1353 | + } |
| 1354 | + |
| 1355 | + EE::success( 'WordPress configurations updated for publish.' ); |
| 1356 | + } |
| 1357 | + |
1299 | 1358 | /** |
1300 | 1359 | * Catch and clean exceptions. |
1301 | 1360 | * |
|
0 commit comments