SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
Manage WordPress with
 Awesome using wp-cli
         WordCamp Vancouver 2012




    Mike Schroder (DH-Shredder)
    @GetSource - http://www.getsource.net
Who Am I?

•   Mike Schroder, a.k.a DH-Shredder, a.k.a. @GetSource

•   Third Culture Kid, enjoy Coffee & Sailing

•   WordPress Core and wp-cli Contributor

•   Happy DreamHost Employee
There are two groups
     of people.
Those who use the
  command line
Those who are going to use
    the command line
Don’t be afraid of the CLI.
       It’s your friend.
Oh, you like the CLI?
wp-cli will make your life better.
What’s wp-cli?

super-cool Open Source tool
  to manage WordPress
Why so cool?
Headed up by Andreas Creten and
     Cristi Burcă (scribu)
Why so cool?
Uses WordPress itself to perform
         operations
Why so cool?
 Automation!
What can I do with it?
No, Really.
Update WordPress

wp core update
Install a Theme

wp theme install sunspot
Reset to default theme

wp theme activate twentytwelve
Backup your Database

wp db export backup.sql
Update Plugins

wp plugin update --all
What do I need to run it?
What do I need to run it?
•   SSH access to your WordPress install's directory
What do I need to run it?
•   SSH access to your WordPress install's directory

•   PHP 5.3+
What do I need to run it?
•   SSH access to your WordPress install's directory

•   PHP 5.3+

•   WordPress 3.3+
What do I need to run it?
•   SSH access to your WordPress install's directory

•   PHP 5.3+

•   WordPress 3.3+

•   Enough RAM for shell processes to run WordPress
What do I need to run it?
•   SSH access to your WordPress install's directory

•   PHP 5.3+

•   WordPress 3.3+

•   Enough RAM for shell processes to run WordPress

•   Easiest on Linux & MacOS
Okay. Got that covered.
  How can I get this
     Awesomeness?
Download wp-cli
git clone --recursive git://github.com/wp-cli/wp-cli.git
Make it runnable from your
    WordPress Install.
If you have sudo:

sudo utils/dev-build
Otherwise, add an alias
      (.bashrc/.bash_profile)

alias wp='/home/user/wp-cli/src/bin/wp';
In ~/.bash_profile:
if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi



(http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html)
You’ve got it installed?

   Let’s dig deeper.
wp-cli is extensible.
Add your own directly
wp-cli/src/php/wp-cli/commands/community/cmd_name.php
Or, define in your plugins.

if ( defined('WP_CLI') && WP_CLI ) {
! include( PLUGIN_DIR . '/lib/wp-cli.php' );
}
Sample Plugin:

WCYVR Backup.
Goal:
wp wcyvr backup [--no-db] [/dir/outputfile.tar.gz]
Our Plan:

- Use built-in SQL Backup
- Create a .tar.gz of install and db
Define the Base Command
<?php

// Let WP_CLI know we exist!
// Earlier versions of wp-cli used WP_CLI::addCommand()
WP_CLI::add_command( 'wcyvr', 'WCYVR_Backup_Command' );

/**
 * The WCYVR Backup Plugin
 *
 * @package WCYVR_Backup
 * @subpackage commands/community
 * @maintainer Mike Schroder
 */
class WCYVR_Backup_Command extends WP_CLI_Command {
...
Define Sub-Commands
•   $args: stand-alone arguments

•   $assoc_args: --arg=value style in associative array


class WCYVR_Backup_Command extends WP_CLI_Command {

!   function backup( $args, $assoc_args ) {
!   !   $filename = $dbname = null;
!   !   ...
!   }

! public static function help() {
! !   WP_CLI::line( "usage: wp wcyvr backup [--no-db] [path/to/file]" );
! }
}
Grab Filename

function backup( $args, $assoc_args ) {
! $filename = $dbname = null;

!   // If a filename isn't specified, default to "Site's Title.tar.gz".
!   if ( empty( $args ) )
!   !   $filename = '../' . escapeshellarg( get_bloginfo() ) . '.tar.gz';
!   else
!   !   $filename = $args[0];
Handle --no-db
•   SQL file not using temp location for simplicity of demo.




! // If --no-db is specified, don't include the database in backup
! if ( ! isset( $assoc_args['no-db'] ) ) {
! !   $dbname = '../database_temp.sql';

!   !   // This is cheating a bit, since wp-cli doesn't currently support
!   !   // running commands within commands without re-launching itself.
!   !   WP_CLI::run_command( array( 'db', 'export', $dbname ), array() );
!   }
Back it up!
•   See class-wp-cli.php for more magical functions




! // GZ/Tar and Backup the install!
! WP_CLI::line( "Backing up to '$filename' ..." );
! $result = WP_CLI::launch( "tar -zcvf $filename . $dbname", false );

! // If we created a database backup, remove the temp file.
! if ( $dbname && ! unlink( $dbname ) )
! !   WP_CLI::warning( "Couldn't remove temporary database backup,
'$dbname'." );
ERROR ERROR


!   // Will automatically exit on WP_CLI::error, but not WP_CLI::success.
!   if ( 0 == $result ) {
!   !   WP_CLI::success( "Backup Complete." );
!   } else {
!   !   WP_CLI::error( "Backup Failed." );
!   }
}
Resources!
    •   https://github.com/wp-cli/wp-cli

    •   https://github.com/wp-cli/wp-cli/wiki/List-of-internal-commands

    •   https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook

    •   http://scribu.net/wordpress/a-command-line-interface-for-
        wordpress.html

    •   http://wp.tutsplus.com/tutorials/using-wp-cli-for-fun-and-profit/

    •   http://halfelf.org/2012/command-line-wp/

    •   http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html


Mike Schroder (DH-Shredder)
@GetSource - http://www.getsource.net

Weitere ähnliche Inhalte

Was ist angesagt?

PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
Graham Dumpleton
 
Task 1
Task 1Task 1
Task 1
EdiPHP
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
Graham Dumpleton
 

Was ist angesagt? (20)

Node.js
Node.jsNode.js
Node.js
 
Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
Bower - A package manager for the web
Bower - A package manager for the webBower - A package manager for the web
Bower - A package manager for the web
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
 
Workshop On WP-CLI
Workshop On WP-CLIWorkshop On WP-CLI
Workshop On WP-CLI
 
Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)Improving WordPress performance (xdebug and profiling)
Improving WordPress performance (xdebug and profiling)
 
Task 1
Task 1Task 1
Task 1
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP World
 
Automatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress pluginsAutomatic testing and quality assurance for WordPress plugins
Automatic testing and quality assurance for WordPress plugins
 
Dc kyiv2010 jun_08
Dc kyiv2010 jun_08Dc kyiv2010 jun_08
Dc kyiv2010 jun_08
 
體驗 Hhvm
體驗 Hhvm體驗 Hhvm
體驗 Hhvm
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long BeachTake Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long Beach
 
Search in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize itSearch in WordPress - how it works and howto customize it
Search in WordPress - how it works and howto customize it
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2PyCon US 2012 - State of WSGI 2
PyCon US 2012 - State of WSGI 2
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developers
 
Making Magic with WP-CLI
Making Magic with WP-CLIMaking Magic with WP-CLI
Making Magic with WP-CLI
 
Plone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weightPlone: The CMS that hits above it's weight
Plone: The CMS that hits above it's weight
 

Ähnlich wie WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli

Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
LumoSpark
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009
Helgi Þormar Þorbjörnsson
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
andymccurdy
 

Ähnlich wie WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli (20)

WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Extending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIExtending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLI
 
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
 
DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!DevOps for Humans - Ansible for Drupal Deployment Victory!
DevOps for Humans - Ansible for Drupal Deployment Victory!
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Drupal Deployment Troubles and Problems
Drupal Deployment Troubles and ProblemsDrupal Deployment Troubles and Problems
Drupal Deployment Troubles and Problems
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
 
A WordPress workshop at Cefalo
A WordPress workshop at Cefalo A WordPress workshop at Cefalo
A WordPress workshop at Cefalo
 
Beyond the WordPress 5 minute Install
Beyond the WordPress 5 minute InstallBeyond the WordPress 5 minute Install
Beyond the WordPress 5 minute Install
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.com
 
Getting to The Loop - London Wordpress Meetup July 28th
Getting to The Loop - London Wordpress Meetup  July 28thGetting to The Loop - London Wordpress Meetup  July 28th
Getting to The Loop - London Wordpress Meetup July 28th
 
Administer WordPress with WP-CLI
Administer WordPress with WP-CLIAdminister WordPress with WP-CLI
Administer WordPress with WP-CLI
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli

  • 1. Manage WordPress with Awesome using wp-cli WordCamp Vancouver 2012 Mike Schroder (DH-Shredder) @GetSource - http://www.getsource.net
  • 2. Who Am I? • Mike Schroder, a.k.a DH-Shredder, a.k.a. @GetSource • Third Culture Kid, enjoy Coffee & Sailing • WordPress Core and wp-cli Contributor • Happy DreamHost Employee
  • 3. There are two groups of people.
  • 4. Those who use the command line
  • 5. Those who are going to use the command line
  • 6. Don’t be afraid of the CLI. It’s your friend.
  • 7. Oh, you like the CLI? wp-cli will make your life better.
  • 8. What’s wp-cli? super-cool Open Source tool to manage WordPress
  • 9. Why so cool? Headed up by Andreas Creten and Cristi Burcă (scribu)
  • 10. Why so cool? Uses WordPress itself to perform operations
  • 11. Why so cool? Automation!
  • 12. What can I do with it?
  • 13.
  • 16. Install a Theme wp theme install sunspot
  • 17. Reset to default theme wp theme activate twentytwelve
  • 18. Backup your Database wp db export backup.sql
  • 19. Update Plugins wp plugin update --all
  • 20. What do I need to run it?
  • 21. What do I need to run it? • SSH access to your WordPress install's directory
  • 22. What do I need to run it? • SSH access to your WordPress install's directory • PHP 5.3+
  • 23. What do I need to run it? • SSH access to your WordPress install's directory • PHP 5.3+ • WordPress 3.3+
  • 24. What do I need to run it? • SSH access to your WordPress install's directory • PHP 5.3+ • WordPress 3.3+ • Enough RAM for shell processes to run WordPress
  • 25. What do I need to run it? • SSH access to your WordPress install's directory • PHP 5.3+ • WordPress 3.3+ • Enough RAM for shell processes to run WordPress • Easiest on Linux & MacOS
  • 26. Okay. Got that covered. How can I get this Awesomeness?
  • 27. Download wp-cli git clone --recursive git://github.com/wp-cli/wp-cli.git
  • 28. Make it runnable from your WordPress Install.
  • 29. If you have sudo: sudo utils/dev-build
  • 30. Otherwise, add an alias (.bashrc/.bash_profile) alias wp='/home/user/wp-cli/src/bin/wp';
  • 31. In ~/.bash_profile: if [ -f ~/.bashrc ]; then source ~/.bashrc fi (http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html)
  • 32. You’ve got it installed? Let’s dig deeper.
  • 34. Add your own directly wp-cli/src/php/wp-cli/commands/community/cmd_name.php
  • 35. Or, define in your plugins. if ( defined('WP_CLI') && WP_CLI ) { ! include( PLUGIN_DIR . '/lib/wp-cli.php' ); }
  • 37. Goal: wp wcyvr backup [--no-db] [/dir/outputfile.tar.gz]
  • 38. Our Plan: - Use built-in SQL Backup - Create a .tar.gz of install and db
  • 39. Define the Base Command <?php // Let WP_CLI know we exist! // Earlier versions of wp-cli used WP_CLI::addCommand() WP_CLI::add_command( 'wcyvr', 'WCYVR_Backup_Command' ); /** * The WCYVR Backup Plugin * * @package WCYVR_Backup * @subpackage commands/community * @maintainer Mike Schroder */ class WCYVR_Backup_Command extends WP_CLI_Command { ...
  • 40. Define Sub-Commands • $args: stand-alone arguments • $assoc_args: --arg=value style in associative array class WCYVR_Backup_Command extends WP_CLI_Command { ! function backup( $args, $assoc_args ) { ! ! $filename = $dbname = null; ! ! ... ! } ! public static function help() { ! ! WP_CLI::line( "usage: wp wcyvr backup [--no-db] [path/to/file]" ); ! } }
  • 41. Grab Filename function backup( $args, $assoc_args ) { ! $filename = $dbname = null; ! // If a filename isn't specified, default to "Site's Title.tar.gz". ! if ( empty( $args ) ) ! ! $filename = '../' . escapeshellarg( get_bloginfo() ) . '.tar.gz'; ! else ! ! $filename = $args[0];
  • 42. Handle --no-db • SQL file not using temp location for simplicity of demo. ! // If --no-db is specified, don't include the database in backup ! if ( ! isset( $assoc_args['no-db'] ) ) { ! ! $dbname = '../database_temp.sql'; ! ! // This is cheating a bit, since wp-cli doesn't currently support ! ! // running commands within commands without re-launching itself. ! ! WP_CLI::run_command( array( 'db', 'export', $dbname ), array() ); ! }
  • 43. Back it up! • See class-wp-cli.php for more magical functions ! // GZ/Tar and Backup the install! ! WP_CLI::line( "Backing up to '$filename' ..." ); ! $result = WP_CLI::launch( "tar -zcvf $filename . $dbname", false ); ! // If we created a database backup, remove the temp file. ! if ( $dbname && ! unlink( $dbname ) ) ! ! WP_CLI::warning( "Couldn't remove temporary database backup, '$dbname'." );
  • 44. ERROR ERROR ! // Will automatically exit on WP_CLI::error, but not WP_CLI::success. ! if ( 0 == $result ) { ! ! WP_CLI::success( "Backup Complete." ); ! } else { ! ! WP_CLI::error( "Backup Failed." ); ! } }
  • 45. Resources! • https://github.com/wp-cli/wp-cli • https://github.com/wp-cli/wp-cli/wiki/List-of-internal-commands • https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook • http://scribu.net/wordpress/a-command-line-interface-for- wordpress.html • http://wp.tutsplus.com/tutorials/using-wp-cli-for-fun-and-profit/ • http://halfelf.org/2012/command-line-wp/ • http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html Mike Schroder (DH-Shredder) @GetSource - http://www.getsource.net