virtualmin / virtualmin-gpl

Virtualmin web hosting control panel for Webmin
https://www.virtualmin.com
GNU General Public License v3.0
331 stars 102 forks source link

Add WP Workbench CLI (GPL) #934

Closed iliajie closed 3 weeks ago

iliajie commented 1 month ago

Hey Jamie,

As we discussed earlier, here’s the CLI API for WP Workbench. It includes command examples to make it easier for users.

Just a note, there’s another PR in the Pro repo.

~# virtualmin modify-script --script-type wordpress --help
Modify the web app script using the workbench API

virtualmin modify-script --script-type name | [--script-path path]
                         --domain name
                         --opt 'option'

  Available options for --opt:

    Options:
         wp_memory_limit        256M|1G
         wp_max_memory_limit    512M|2G
         fail2ban_foreign       0|1
         wp_auto_update_core    false|minor|true

         siteurl                url
         home                   url
         blogname               blog_name
         blogdescription        blog_description
         permalink_structure    permalink_structure
         uid                    admin_user_id
         user_pass              admin_user_password
         admin_email            admin_email_address
         blog_public            0|1
         default_pingback_flag  0|1
         default_ping_status    open|closed
         disallow_file_edit     true|false

         debug                  off|on|log
         maintenance            activate|deactivate
         disable_wp_cron        true|false
         concatenate_scripts    true|false

         virtualmin modify-script --script-type wordpress \
           --domain example.com \
           --opt 'wp_memory_limit 512M' \
           --opt 'blogname "Blog Name"'

    Plugins options:
         plugins action plugin1,plugin2,...
           Actions: 
             activate, deactivate, update, delete,
             enable-auto-updates, disable-auto-updates

         virtualmin modify-script --script-type wordpress \
           --domain example.com \
           --opt 'plugins activate plugin1,plugin2'

    Themes options:
         themes action theme1,theme2,...
           Actions: 
             activate, update, delete,
             enable-auto-updates, disable-auto-updates

         virtualmin modify-script --script-type wordpress \
           --domain example.com \
           --opt 'themes update theme1,theme2,theme3'

    Backup options:
         backup action [filename1,filename2,...]
           Actions: full|files|db|restore|delete

         virtualmin modify-script --script-type wordpress \
           --domain example.com --opt 'backup full'

         virtualmin modify-script --script-type wordpress \
           --domain example.com \
           --opt 'backup restore example.com_20241020-231846_full.tar.gz'

    Clone options:
         clone target --param=value [--param=value ...]
           Targets:
             same        - clone to the same domain under a different directory
             existing    - clone to a different existing domain
             sub         - clone as a new subdomain
             top         - clone as a new top-level domain

           Parameters:
             dir         - directory for the clone (optional)

             dom         - existing domain name
             dom_dir     - directory under existing domain (optional)

             sub_dir     - directory under the new subdomain (optional)
             sub_name    - subdomain name
             sub         - parent domain name for the subdomain name

             top_dir     - directory under the new top-level domain (optional)
             top         - new top-level domain name

             admin_email - administrator email for the cloned site (optional)
             admin_pass  - administrator password for the cloned site (optional)
             blogname    - blog name for the cloned site (optional)
             siteurl     - site URL for the cloned site (optional)

         virtualmin modify-script --script-type wordpress --domain example.com \
           --opt 'clone same --dir=wordpress-clone --blogname="Clone Name"'

         virtualmin modify-script --script-type wordpress --domain example.com \
           --opt 'clone existing --dom=otherdomain.com --dom_dir=wordpress'

         virtualmin modify-script --script-type wordpress --domain example.com \
           --opt 'clone sub --sub_name=sub1 --sub=example.com \
           --sub_dir=wordpress --admin_email=sub1@example.com'

         virtualmin modify-script --script-type wordpress --domain example.com \
           --opt 'clone top --top=example.net --top_dir=wordpress \
           --admin_email=admin@example.net --siteurl=https://www.example.net'
jcameron commented 1 month ago

Let me know when this is ready for initial review!

iliajie commented 1 month ago

It’s already ready for the initial review.

jcameron commented 1 month ago

Hmm, I can't see any the diffs from this PR? What's the link for that..

iliajie commented 1 month ago

Hmm, I can't see any the diffs from this PR? What's the link for that..

I think, this PR itself we're talking about, right? Please check Files Changed.