Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Avoid Breaking All the Things: How to Develop Safely

Avoid Breaking All the Things: How to Develop Safely

A look at some best practices when developing for the web.

Alison Barrett

April 26, 2014
Tweet

More Decks by Alison Barrett

Other Decks in Programming

Transcript

  1. Comes with three WordPress installations: ! wordpress-default (latest stable version)

    wordpress-trunk (latest development version) wordpress-develop (for working on WP core)
  2. 1. Copy the files 2. Copy the database* 3. Profit

    *Replace the live URL with your local URL
  3. master branch first commit Author: Vincent Driessen Original blog post:

    http://nvie.com/archives/323 License: Creative Commons
  4. master Author: Vincent Driessen Original blog post: http://nvie.com/archives/323 License: Creative

    Commons Overwrote a change? ! It's okay; that change was recorded right there.
  5. The fix needs to be in functions.php… ! …but an

    unfinished feature has changes in functions.php
  6. header(  'HTTP/1.1  503  Service  Unavailable',  true,  503  );   header(

     'Content-­‐Type:  text/html;  charset=utf-­‐8'  );   header(  'Retry-­‐After:  600'  );  //  10  minutes
  7. mail(    '[email protected]',    "example.com  is  down,  but  I'm  on

     the  case!",    "Howdy  Client,        Your  site  is  currently  down,  but  I'm  aware  of   the  problem  and  am  working  on  a  fix  right  now.   I'll  let  you  know  as  soon  as  it's  back  up.   ! -­‐Alison  Barrett"   );
  8. <?php   header(  'HTTP/1.1  503  Service  Unavailable',  true,  503  );

      header(  'Content-­‐Type:  text/html;  charset=utf-­‐8'  );   header(  'Retry-­‐After:  600'  );  //  10  minutes   ?>   <!DOCTYPE  html>   <html  lang="en-­‐US"  dir="ltr">   <head>     <title>Sorry,  We're  Getting  Tuned  Up</title>     <meta  charset="utf-­‐8"  />     <link  rel="stylesheet"  href="http://alisothegeek.com/wp-­‐content/themes/…/style.css"  />   </head>   <body>   ! <div  id="content">     <h1>We  needed  a  tune-­‐up.</h1>     <p>We're  doing  a  bit  of  site  maintenance  that  should  only  last  a  few  minutes.</p>     <p>Go  grab  a  cup  of  coffee,  and  we  should  be  back  by  the  time  you  are!</p>   </div>   ! </body>   </html>   <?php  die();
  9. master Author: Vincent Driessen Original blog post: http://nvie.com/archives/323 License: Creative

    Commons develop hotfixes revert work with the broken code on your development site
  10. 1. Make development & staging sites 2. Use git and

    Git Flow 3. Use the Restricted Site Access plugin 4. Customize error pages 5. Revert code in case of emergency