Skip to main content
added 12 characters in body
Source Link

This is how I create a database stack and a directory for WordPress in my Ubuntu environment:

cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
    CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
    CREATE DATABASE "${domain}";
    GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
DBSTACK

curl -L http://wordpress.org/latest.tar.gz | tar -zx -C ${domain}/
cp ${domain}/wp-config-sample.php ${domain}/wp-config.php
sed -ir "s/username_here|database_name_here/${domain}/g ; s/password_here/${dbuserp}/g" ${domain}"/ ${domain}/wp-config.php

Can this code be reduced to say, two linesHow would you reduce the amount of code with WP-CLI to get the same result?

This is how I create a database stack and a directory for WordPress in my Ubuntu environment:

cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
    CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
    CREATE DATABASE "${domain}";
    GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
DBSTACK

curl -L http://wordpress.org/latest.tar.gz | tar -zx -C ${domain}/
cp ${domain}/wp-config-sample.php ${domain}/wp-config.php
sed -ir "s/username_here|database_name_here/${domain}/g ; s/password_here/${dbuserp}/g" ${domain}"/ ${domain}/wp-config.php

Can this code be reduced to say, two lines of code with WP-CLI?

This is how I create a database stack and a directory for WordPress in my Ubuntu environment:

cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
    CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
    CREATE DATABASE "${domain}";
    GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
DBSTACK

curl -L http://wordpress.org/latest.tar.gz | tar -zx -C ${domain}/
cp ${domain}/wp-config-sample.php ${domain}/wp-config.php
sed -ir "s/username_here|database_name_here/${domain}/g ; s/password_here/${dbuserp}/g" ${domain}"/ ${domain}/wp-config.php

How would you reduce the amount of code with WP-CLI to get the same result?

deleted 8 characters in body
Source Link

Automate WordPress dir and DB stack creation with WP-CLI

This is how I create a database stack and a directory for WordPress in my Ubuntu environment:

cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
    CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
    CREATE DATABASE "${domain}";
    GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
DBSTACK

curl -L http://wordpress.org/latest.tar.gz | tar -zx -C ${domain}/
cp ${domain}/wp-config-sample.php ${domain}/wp-config.php
sed -ir "s/username_here|database_name_here/${domain}/g ; s/password_here/${dbuserp}/g" ${domain}"/ ${domain}/wp-config.php

Can this code be reduced to say, two lines of code with WP-CLI? How so?

Automate WordPress dir and DB stack creation with WP-CLI

This is how I create a database stack and a directory for WordPress in my Ubuntu environment:

cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
    CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
    CREATE DATABASE "${domain}";
    GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
DBSTACK

curl -L http://wordpress.org/latest.tar.gz | tar -zx -C ${domain}/
cp ${domain}/wp-config-sample.php ${domain}/wp-config.php
sed -ir "s/username_here|database_name_here/${domain}/g ; s/password_here/${dbuserp}/g" ${domain}"/ ${domain}/wp-config.php

Can this code be reduced to say, two lines of code with WP-CLI? How so?

Automate dir and DB stack creation with WP-CLI

This is how I create a database stack and a directory for WordPress in my Ubuntu environment:

cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
    CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
    CREATE DATABASE "${domain}";
    GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
DBSTACK

curl -L http://wordpress.org/latest.tar.gz | tar -zx -C ${domain}/
cp ${domain}/wp-config-sample.php ${domain}/wp-config.php
sed -ir "s/username_here|database_name_here/${domain}/g ; s/password_here/${dbuserp}/g" ${domain}"/ ${domain}/wp-config.php

Can this code be reduced to say, two lines of code with WP-CLI?

Post Undeleted by Arcticooling
Post Deleted by Arcticooling
Source Link

Automate WordPress dir and DB stack creation with WP-CLI

This is how I create a database stack and a directory for WordPress in my Ubuntu environment:

cat <<-DBSTACK | mysql -u root -p"${dbrootp}"
    CREATE USER "${domain}"@"localhost" IDENTIFIED BY "${dbuserp}";
    CREATE DATABASE "${domain}";
    GRANT ALL PRIVILEGES ON ${domain}.* TO "${domain}"@"localhost";
DBSTACK

curl -L http://wordpress.org/latest.tar.gz | tar -zx -C ${domain}/
cp ${domain}/wp-config-sample.php ${domain}/wp-config.php
sed -ir "s/username_here|database_name_here/${domain}/g ; s/password_here/${dbuserp}/g" ${domain}"/ ${domain}/wp-config.php

Can this code be reduced to say, two lines of code with WP-CLI? How so?