Welcome to Centmin Mod Community
Register Now

Install working with wpsetup.inc / customwp_domain.inc / wp-cli

Discussion in 'Add Ons' started by apidevlab, May 20, 2016.

  1. apidevlab

    apidevlab Member

    88
    30
    18
    Mar 22, 2016
    /dev/null
    Ratings:
    +54
    Local Time:
    1:31 PM
    1.11.1
    5.2.14-122
    I want to take some of the discussion on Option 22 - WordPress install with default plugins | Centmin Mod Community and Beta Branch - update inc/wpsetup.inc extend wordpress plugin whitelist | Centmin Mod Community a little further as mentioned here

    I am seeing if I can put something together that will provide some additional options for the current install in terms of plugins / themes etc wether this is by hacking the current wpsetup.inc or providing a customwp_domain.inc

    Browsing the code of wpsetup.inc I have been able to get a general feel for how WordPress installation is currently handled mostly via WP-CLI however there are a few issues I want to clarify before I continue.

    Code (Text):
    Enter vhost domain name you want to add (without www. prefix): newdomain1.com
    
    Create a self-signed SSL certificate Nginx vhost? [y/n]: n
    
    Theme Setup:
    Install CyberChimps Responsive Theme (cyberchimps.com/responsive-theme/) [y/n]: n
    
    Wordpress Setup:
    Set custom WP Admin Display Name ? [y/n]: George
    Install Wordpress in subdirectory /blog ? [y/n]: y
    Enter subdirectory name i.e. /blog enter = blog ? : blog
    Disable Auto Generated WP Admin Username / Password ? [y/n]: n
    Disable wp-login.php password protection ? (less security) [y/n]: y
    Enter email address for Admin User for Wordpress Installation: EMAIL ADDY
    Do you want to install WP Cache Enabler Plugin instead of WP Super Cache ? (easier to setup) [y/n]: y
    Create FTP username for vhost domain (enter username): user1
    Do you want to auto generate FTP password (recommended) [y/n]: y
    

    So this all makes sense
    I could use the current Theme install routine with a pre-chosen theme (or via customwp_domain.inc)
    Code (Text):
    if [[ "$responsivetheme" = [yY] ]]; then
      cecho "------------------------------------------------------------" $boldgreen
      wp theme install responsive --activate --allow-root
      cecho "------------------------------------------------------------" $boldgreen
    fi
    


    It's the plugin installation that is (possibly) problematic

    Code (Text):
    if [[ "$WPPLUGINS_ALL" = [yY] ]]; then
    


    (even with this set to 'Y' via /etc/centminmod/custom.inc) I haven't seen the plugins installed and indeed I have just spotted
    Code (Text):
    fi # WPPLUGINS_ALL=y
    is that commented out?

    I know at the moment this thread may not make sense but I intend to try and figure out a way to setup the required theme (possibly from a small selection. The same would apply to the plugins and other tweaks as I can as per...
    Code (Text):
    # allows user to add custom wp-cli commands after initiall install to
    # further customise their installation. you create a custom file at
    # /etc/centminmod/customwp_domain.com.inc where domain.com is the
    # intended centmin.sh menu option 22 vhost site domain for your wp
    # installation. Then in that file add your wp-cli commands to the file
    # wrapped in a shell function named mywpcmds() { yourcode }. i.e. for
    # wp language install https://community.centminmod.com/posts/26045/
    # the below check will check for /etc/centminmod/customwp_domain.com.inc
    # file and then source include it into this routine and run the shell
    # function named mywpcmds which contains your custom wp-cli cmds that will
    # trigger and run
    if [ -f "${CONFIGSCANBASE}/customwp_${vhostname}.inc" ]; then
        # default is at /etc/centminmod/customwp_${vhostname}.inc
        source "${CONFIGSCANBASE}/customwp_${vhostname}.inc"
        mywpcmds
    fi
    


    Will clean this thread up as I progress.
     
    • Informative Informative x 1
  2. eva2000

    eva2000 Administrator Staff Member

    30,850
    6,905
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,396
    Local Time:
    11:31 PM
    Nginx 1.13.x
    MariaDB 5.5
    fyi it's /etc/centminmod/custom_config.inc you're missing the _config in file name ;)
     
    • Informative Informative x 1
  3. apidevlab

    apidevlab Member

    88
    30
    18
    Mar 22, 2016
    /dev/null
    Ratings:
    +54
    Local Time:
    1:31 PM
    1.11.1
    5.2.14-122
    Will clean up the thread as I go.

    Any suggestions regarding the # ?Am learning Bash as I go ATM and am 80% the # on that line wouldn't be treated as a comment.

    I have wondered why the plugins (apart from the cache / cdn & security) don't get installed even if I set the option to 'Y' via custom_config.inc? The idea of providing a 'one size fits all' WP install is impossible, my 'current thinking' is leaning towards via customwp_domain.com.inc this would allow people to simply copy a theme name and plugin list.

    It's all great learning and the beauty is the code is fairly easy to follow :)