diff --git a/src/Site_Command.php b/src/Site_Command.php index 14ed148a..2946852a 100644 --- a/src/Site_Command.php +++ b/src/Site_Command.php @@ -3,6 +3,9 @@ use EE\Dispatcher\CommandFactory; use EE\Model\Site; +/** + * Adds site related functionality to EasyEngine + */ class Site_Command { /** @@ -11,14 +14,14 @@ class Site_Command { protected static $site_types = []; /** - * @var Object $instance Hold an instance of the class. + * @var Site_Command $instance Hold an instance of the class. */ private static $instance; /** * The singleton method to hold the instance of site-command. * - * @return Object|Site_Command + * @return Site_Command */ public static function instance() { @@ -99,6 +102,8 @@ public function __invoke( $args, $assoc_args ) { * * @param array $args Command line arguments passed to site-command. * + * @throws \EE\ExitException + * * @return string site-type. */ private function determine_type( $args ) { diff --git a/src/helper/class-ee-site.php b/src/helper/class-ee-site.php index a95b27b2..7ed54d98 100644 --- a/src/helper/class-ee-site.php +++ b/src/helper/class-ee-site.php @@ -2,12 +2,11 @@ namespace EE\Site\Type; -use function EE\Site\Utils\reload_global_nginx; -use \Symfony\Component\Filesystem\Filesystem; -use \EE\Model\Site; -use function \EE\Site\Utils\auto_site_name; -use function \EE\Site\Utils\get_site_info; -use function \EE\Site\Utils\reload_global_nginx_proxy; +use EE\Model\Site; +use Symfony\Component\Filesystem\Filesystem; +use function EE\Site\Utils\auto_site_name; +use function EE\Site\Utils\get_site_info; +use function EE\Site\Utils\reload_global_nginx_proxy; /** * Base class for Site command @@ -73,6 +72,23 @@ public function __construct() { * - text * --- * + * ## EXAMPLES + * + * # List all sites + * $ ee site list + * + * # List enabled sites + * $ ee site list --enabled + * + * # List disabled sites + * $ ee site list --disabled + * + * # List all sites in JSON + * $ ee site list --format=json + * + * # Count all sites + * $ ee site list --format=count + * * @subcommand list */ public function _list( $args, $assoc_args ) { @@ -127,6 +143,12 @@ function ( $site ) { * * [--yes] * : Do not prompt for confirmation. + * + * ## EXAMPLES + * + * # Delete site + * $ ee site delete example.com + * */ public function delete( $args, $assoc_args ) { @@ -140,7 +162,7 @@ public function delete( $args, $assoc_args ) { /** * Function to delete the given site. * - * @param int $level Level of deletion. + * @param int $level Level of deletion. * Level - 0: No need of clean-up. * Level - 1: Clean-up only the site-root. * Level - 2: Try to remove network. The network may or may not have been created. @@ -148,6 +170,8 @@ public function delete( $args, $assoc_args ) { * may not have been created. Level - 4: Remove containers. Level - 5: Remove db entry. * @param string $site_url Name of the site to be deleted. * @param string $site_fs_path Webroot of the site. + * + * @throws \EE\ExitException */ protected function delete_site( $level, $site_url, $site_fs_path ) { @@ -221,6 +245,12 @@ protected function delete_site( $level, $site_url, $site_fs_path ) { * * [--force] * : Force execution of site up. + * + * ## EXAMPLES + * + * # Enable site + * $ ee site up example.com + * */ public function up( $args, $assoc_args ) { @@ -252,6 +282,12 @@ public function up( $args, $assoc_args ) { * * [] * : Name of website to be disabled. + * + * ## EXAMPLES + * + * # Disable site + * $ ee site down example.com + * */ public function down( $args, $assoc_args ) { @@ -284,6 +320,12 @@ public function down( $args, $assoc_args ) { * * [--nginx] * : Restart nginx container of site. + * + * ## EXAMPLES + * + * # Restart all containers of site + * $ ee site restart example.com + * */ public function restart( $args, $assoc_args, $whitelisted_containers = [] ) { @@ -321,6 +363,11 @@ public function restart( $args, $assoc_args, $whitelisted_containers = [] ) { * [--nginx] * : Reload nginx service in container. * + * ## EXAMPLES + * + * # Reload all containers of site + * $ ee site reload example.com + * */ public function reload( $args, $assoc_args, $whitelisted_containers = [], $reload_commands = [] ) { diff --git a/src/site-type/html.php b/src/site-type/html.php index 356a4ddf..3cc71cad 100644 --- a/src/site-type/html.php +++ b/src/site-type/html.php @@ -4,18 +4,13 @@ namespace EE\Site\Type; -use \EE\Model\Site; -use \Symfony\Component\Filesystem\Filesystem; -use function \EE\Site\Utils\auto_site_name; -use function \EE\Site\Utils\get_site_info; +use EE\Model\Site; +use Symfony\Component\Filesystem\Filesystem; +use function EE\Site\Utils\auto_site_name; +use function EE\Site\Utils\get_site_info; /** - * Creates a simple html Website. - * - * ## EXAMPLES - * - * # Create simple html site - * $ ee site create example.com + * Adds html site type to `site` command. * * @package ee-cli */ @@ -73,11 +68,24 @@ public function __construct() { * * [--wildcard] * : Gets wildcard SSL . + * * [--type=] * : Type of the site to be created. Values: html,php,wp etc. * * [--skip-status-check] * : Skips site status check. + * + * ## EXAMPLES + * + * # Create html site + * $ ee site create example.com + * + * # Create html site with ssl from letsencrypt + * $ ee site create example.com --ssl=le + * + * # Create html site with wildcard ssl + * $ ee site create example.com --ssl=le --wildcard + * */ public function create( $args, $assoc_args ) { @@ -111,6 +119,12 @@ public function create( $args, $assoc_args ) { * * [] * : Name of the website whose info is required. + * + * ## EXAMPLES + * + * # Display site info + * $ ee site info example.com + * */ public function info( $args, $assoc_args ) {