<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Screaming Code Monkey &#187; wordpress</title>
	<atom:link href="http://screamingcodemonkey.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://screamingcodemonkey.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Mon, 21 May 2012 09:16:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How I learned to stop being a Cowboy and Love the SVN</title>
		<link>http://screamingcodemonkey.com/how-i-learned-to-stop-being-a-cowboy-and-love-the-svn/</link>
		<comments>http://screamingcodemonkey.com/how-i-learned-to-stop-being-a-cowboy-and-love-the-svn/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 02:15:47 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-e-commerce]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://screamingcodemonkey.com/?p=498</guid>
		<description><![CDATA[<p>Cowboy, you been barking up the wrong tree. If you&#8217;re editing your site, and/or your clients site live. Well then buddy your doing it wrong. Don&#8217;t get defensive, and don&#8217;t be ashamed. Till recently I too was a gun slinging, rope totting Cowboy. I always knew there was a better way to do things, I just didn&#8217;t quite understand how. Then at WordCamp NZ 2011 John Ford from automattic mentioned in passing &#8216;.. that if the hacked site is running on SVN you can just do an svn st and svn diff to see the hacked files..&#8217; Which made me raise an eyebrow. I mean, I&#8217;ve used SVN for Plugin development, I&#8217;m no self-proclaimed expert but I know enough to run a Plugin on the WordPress Plugin repository but an entire site? HOW? wouldn&#8217;t that get messy if you had ... <a href="http://screamingcodemonkey.com/how-i-learned-to-stop-being-a-cowboy-and-love-the-svn/">Read More &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Cowboy, you been barking up the wrong tree. If you&#8217;re editing your site, and/or your clients site live. Well then buddy your doing it wrong. Don&#8217;t get defensive, and don&#8217;t be ashamed. Till recently I too was a gun slinging, rope totting Cowboy. I always knew there was a better way to do things, I just didn&#8217;t quite understand how. Then at WordCamp NZ 2011 John Ford from automattic mentioned in passing &#8216;.. that if the hacked site is running on SVN you can just do an svn st and svn diff to see the hacked files..&#8217; Which made me raise an eyebrow. I mean, I&#8217;ve used SVN for Plugin development, I&#8217;m no self-proclaimed expert but I know enough to run a Plugin on the WordPress Plugin repository but an entire site? HOW? wouldn&#8217;t that get messy if you had Plugins from one repository themes from another? How is this possible? I kidnapped John after the WordCamp was over so he could teach me his trick, and now I feel less like a Cowboy and more like a hippy. Why? &#8216;Cause I LOVE the SVN <img src='http://screamingcodemonkey.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Ok so what are we planning on achieving here?</h3>
<p>Basically we want to have the ability to make changes, and test them on our local computer (or staging site) before pushing those changes to the live site.</p>
<p>I know in a real deployment we would have development, staging, live but for this tutorial I am only going to run through development and live. Why? Cause Im a lazy Hippy not a full blown developer.</p>
<p>So while we were going through the processes of settings things up I came across a this resource that might help you out as well:</p>
<ul>
<li>http://ottopress.com/2011/creating-a-wordpress-site-using-svn/</li>
</ul>
<p>Before I start my ramblings I assume you know the basics of SVN, if not check out these resources before hand:</p>
<ul>
<li>http://codex.wordpress.org/Using_Subversion</li>
<li>http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion</li>
<li>http://svnbook.red-bean.com/</li>
</ul>
<h4>What you need:</h4>
<ul>
<li>A sense of humor</li>
<li>An Empty SVN Repository &#8211; (in this tutorial I will call this repository http://svn.example.com/site1)</li>
<li>LAMP, XAMP or MAMP</li>
<li>Some basic Terminal knowledge</li>
</ul>
<h3>1. Create your Work Environment</h3>
<p>Create a folder &#8216;site1&#8242; to hold the site (usually in your htdocs folder) navigate your way into it using terminal and Checkout a fresh, empty copy of your SVN repository:</p>
<p><code> svn co http://svn.example.com/site1 .</code></p>
<p>This should checkout a copy of the repository which should just a .svn folder and no other files.</p>
<h3>2. Setup your Externals</h3>
<p>This was the new and fun part, svn externals. we are going to include a copy of WordPress into a new folder called wp. In terminal navigate into your site1 folder and type in this command:</p>
<p><code> svn propedit svn:externals .</code></p>
<p>This will open up a text editor like vim, in here hit &#8216;i&#8217; for insert. Then type :</p>
<p><code> wp http://core.svn.wordpress.org/tags/3.1/</code></p>
<p>Then hit &#8216;esc :wq&#8217; and hit enter, you should see a message like &#8220;Set new value for property &#8216;svn:externals&#8217; on &#8216;.&#8217;&#8221;</p>
<h3>3. Update your Working Copy</h3>
<p>With your new external in place type <code>svn up</code> to start downloading WordPress!</p>
<h3>4. Setting up your wp-content folder</h3>
<p>From the site1 folder in terminal type:</p>
<p><code> svn mkdir wp-content<br />
svn mkdir wp-content/plugins<br />
svn mkdir wp-content/uploads<br />
svn mkdir wp-content/themes</code></p>
<p>Now instead of copying the akismet plugin and twentyten theme from wp/wp-content to wp-content we will add them as symbolic links (we will also do this with the index.php files which live in each folder, inside the wp-content folder in terminal type:</p>
<p><code> ln -s ../wp/wp-content/index.php index.php</code></p>
<p>Then in the themes folder:<br />
<code><br />
ln -s ../../wp/wp-content/themes/index.php index.php<br />
ln -s ../../wp/wp-content/themes/twentyten twentyten<br />
</code><br />
Then in the plugins folder:<br />
<code><br />
ln -s ../../wp/wp-content/plugins/index.php index.php<br />
ln -s ../../wp/wp-content/plugins/akismet akismet<br />
</code><br />
If you navigate into the site1 folder and do an svn st you will see all the symbolic links we just made have not been added to the repository yet. so we will have to go ahead and do that:<br />
<code><br />
svn add wp-content/index.php<br />
svn add wp-content/plugins/*<br />
svn add wp-content/themes/*<br />
</code></p>
<h3>5. Setting up your external Plugins</h3>
<p>Thats great but we want a few other bits and pieces too, for example, I do a lot of work on the WP e-Commerce Plugin so I&#8217;d like to run the latest and greatest of that (or any other Plugin I run). Navigate to the plugins directory in terminal and type:<br />
<code><br />
svn propedit svn:externals .<br />
</code><br />
This will open up a text editor like vim, in here hit &#8216;i&#8217; for insert. Then type :</p>
<p><code>wp-e-commerce http://svn.wp-plugins.org/wp-e-commerce/branches/3.8-development</code></p>
<p>Then hit &#8216;esc :wq&#8217; and hit enter, you should see a message like &#8220;Set new value for property &#8216;svn:externals&#8217; on &#8216;.&#8217;&#8221; Now all you need to do is type &#8216;svn up&#8217; in terminal and wp-e-commerce plugin directory will be populated with the latest and greatest <img src='http://screamingcodemonkey.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>6. Setup your .htaccess</h3>
<p>So this part was awfully tricky for me, I&#8217;m no expert at .htaccess rules, so I just copied this part from the above resource. Essentially add a new .htaccess file to your site1 folder and add this to the file:<br />
<code><br />
Options -Indexes<br />
RedirectMatch 404 /.svn.*$<br />
RewriteEngine on<br />
RewriteCond %{REQUEST_URI} !^/site1/wp/<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^(.*)$ /site1/wp/$1<br />
RewriteRule ^(/)?$ wp/index.php [L]<br />
</code><br />
Once you have done that, make sure you add it to the repository, in terminal:<br />
<code><br />
svn add .htaccess<br />
</code></p>
<h3>7. Setup your config file</h3>
<p>With the .htaccess file rocking, you should now be able to navigate to site1 using a web browser and complete the normal WordPress Install which setups your DB and wp-config files. Once that has been done, I strongly suggest you</p>
<p>a. Change the permissions on your .htaccess file so WordPress can&#8217;t overwrite it.</p>
<p>b. Add these lines to your wp-config.php file so your install uses the correct wp-content folder:<br />
<code><br />
define( 'WP_HOME', 'http://sites/site1' );<br />
define('WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content');<br />
define('WP_CONTENT_URL',  WP_HOME.'/wp-content');<br />
</code></p>
<h3>8. Make your config file not part of the SVN repository</h3>
<p>Ok, so having your wp-config file in the repository is a no-no. If someone accidentally got into your SVN Repo, or hacked in, then they will have your username, password and DB details.. which is a scary thought. So what we do here is make SVN ignore the wp-config.php file, so it doesn&#8217;t get added to the repo. In terminal navigate to site1 and type:<br />
<code><br />
svn propedit svn:ignore .<br />
</code><br />
This will open up a text editor like vim, in here hit &#8216;i&#8217; for insert. Then type :<br />
<code><br />
wp-config.php<br />
</code><br />
Then hit &#8216;esc :wq&#8217; and hit enter, you should see a message like &#8220;Set new value for property &#8216;svn:ignore&#8217; on &#8216;.&#8217;&#8221;</p>
<h3>9. Check in your new repo</h3>
<p>With everything said and done, head over to site1 in terminal and type:<br />
<code><br />
svn ci -m 'Checking in my new Website while learning how not to be a cowboy'<br />
</code><br />
That&#8217;s that. We now have a repo for our new website, and can work on any computer without having to deal with the live site.. Things to consider:</p>
<ul>
<li>Data. What we have comitted had nothing to do with live data, so for instance if you are trying to do this with a currently active site I would import the DB and change the wp-config file once we have completed the steps above.</li>
<li>Uploads Folder. now I haven&#8217;t heard any good / bad way to do this, and personally I log in to my live server every now and then and check in all my files in the uploads directory. That way I can download the latest DB and the files can associate after an svn up on my local working directory.</li>
</ul>
<p>If you have any tips, advice, or found this post useful please leave a comment. I&#8217;m interested in extending this deployment strategy and learning how other people stopped being cowboys.</p>
<p>Note: If you are trying to setup propedits and are getting an error please try this in terminal:<br />
<code><br />
vi ~/.bash_profile<br />
</code><br />
This will open up a text editor like vim, in here hit &#8216;i&#8217; for insert. Then type :<br />
<code><br />
export EDITOR=vim<br />
export SVN_EDITOR=vim<br />
</code><br />
Then hit &#8216;esc :wq&#8217; and hit enter, Quit terminal and try again, you should be able to get through successfully.</p>
<p>Till Next time,</p>
<p>Peace man!</p>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/how-i-learned-to-stop-being-a-cowboy-and-love-the-svn/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>My Delicious Links (August 17th &#8211; August 20th)</title>
		<link>http://screamingcodemonkey.com/my-delicious-links-august-17th-august-20th/</link>
		<comments>http://screamingcodemonkey.com/my-delicious-links-august-17th-august-20th/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 04:01:01 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[Delicious]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=362</guid>
		<description><![CDATA[<p>These are My Delicious links for August 17th through August 20th:</p>

500 Internal Server Error &#8211; 500 Internal Server Error
Mangling strings for fun and profit &#171; follow the white rabbit &#8211; 
New in WordPress 2.9: Post Thumbnail Images &#171; Mark on WordPress &#8211; 

]]></description>
			<content:encoded><![CDATA[<p>These are <a href='http://delicious.com/jghazally' title='My Delicious Account'>My Delicious</a> links for August 17th through August 20th:</p>
<ul>
<li><a href="http://feeds.delicious.com/v2/rss/jghazally">500 Internal Server Error</a> &#8211; 500 Internal Server Error</li>
<li><a href="http://blog.ftwr.co.uk/archives/2010/01/02/mangling-strings-for-fun-and-profit/">Mangling strings for fun and profit &laquo; follow the white rabbit</a> &#8211; </li>
<li><a href="http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/">New in WordPress 2.9: Post Thumbnail Images &laquo; Mark on WordPress</a> &#8211; </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/my-delicious-links-august-17th-august-20th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Delicious Links (July 17th &#8211; August 8th)</title>
		<link>http://screamingcodemonkey.com/my-delicious-links-july-17th-august-8th/</link>
		<comments>http://screamingcodemonkey.com/my-delicious-links-july-17th-august-8th/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 04:00:10 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[Delicious]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[upgrade]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=349</guid>
		<description><![CDATA[<p>These are My Delicious links for July 17th through August 8th:</p>

500 Internal Server Error &#8211; 500 Internal Server Error
Amazon.com: Test Driven Development: By Example (9780321146533): Kent Beck: Books &#8211; 
Installing/Updating WordPress with Subversion &#171; WordPress Codex &#8211; 

]]></description>
			<content:encoded><![CDATA[<p>These are <a href='http://delicious.com/jghazally' title='My Delicious Account'>My Delicious</a> links for July 17th through August 8th:</p>
<ul>
<li><a href="http://feeds.delicious.com/v2/rss/jghazally">500 Internal Server Error</a> &#8211; 500 Internal Server Error</li>
<li><a href="http://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530">Amazon.com: Test Driven Development: By Example (9780321146533): Kent Beck: Books</a> &#8211; </li>
<li><a href="http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion">Installing/Updating WordPress with Subversion &laquo; WordPress Codex</a> &#8211; </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/my-delicious-links-july-17th-august-8th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Delicious Links (July 6th &#8211; July 12th)</title>
		<link>http://screamingcodemonkey.com/my-delicious-links-july-6th-july-12th/</link>
		<comments>http://screamingcodemonkey.com/my-delicious-links-july-6th-july-12th/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 00:05:29 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[Delicious]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[bp-e-commerce]]></category>
		<category><![CDATA[buddypress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[docs]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firephp]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[REPO]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=343</guid>
		<description><![CDATA[<p>These are My Delicious links for July 6th through July 12th:</p>

Source Checkout &#8211; bp-e-commerce &#8211; Project Hosting on Google Code &#8211; 
BuddyPress.org &#8594; Docs &#8594; Make your plugin BuddyPress aware (v1.2) &#8211; 
Benchmarking WordPress SQL using FirePHP &#8211; 

]]></description>
			<content:encoded><![CDATA[<p>These are <a href='http://delicious.com/jghazally' title='My Delicious Account'>My Delicious</a> links for July 6th through July 12th:</p>
<ul>
<li><a href="http://code.google.com/p/bp-e-commerce/source/checkout">Source Checkout &#8211; bp-e-commerce &#8211; Project Hosting on Google Code</a> &#8211; </li>
<li><a href="http://codex.buddypress.org/how-to-guides/make-your-plugin-buddypress-aware-v1-2/">BuddyPress.org &rarr; Docs &rarr; Make your plugin BuddyPress aware (v1.2)</a> &#8211; </li>
<li><a href="http://www.codediesel.com/mysql/benchmarking-wordpress-sql-using-firephp/">Benchmarking WordPress SQL using FirePHP</a> &#8211; </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/my-delicious-links-july-6th-july-12th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From the web ,,,</title>
		<link>http://screamingcodemonkey.com/from-the-web-8/</link>
		<comments>http://screamingcodemonkey.com/from-the-web-8/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 00:01:41 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[Delicious]]></category>
		<category><![CDATA[codex]]></category>
		<category><![CDATA[custom-post-types]]></category>
		<category><![CDATA[customfields]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[hierarchy]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[taxonomy]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress-plugins]]></category>
		<category><![CDATA[wordpress3]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=339</guid>
		<description><![CDATA[<p>From the Web:</p>

WordPress &#8250; Custom Post Type UI &#171; WordPress Plugins &#8211; 
Function Reference/register post type &#171; WordPress Codex &#8211; 
Template Hierarchy &#171; WordPress Codex &#8211; 

]]></description>
			<content:encoded><![CDATA[<p>From the Web:</p>
<ul>
<li><a href="http://wordpress.org/extend/plugins/custom-post-type-ui/">WordPress &rsaquo; Custom Post Type UI &laquo; WordPress Plugins</a> &#8211; </li>
<li><a href="http://codex.wordpress.org/Function_Reference/register_post_type">Function Reference/register post type &laquo; WordPress Codex</a> &#8211; </li>
<li><a href="http://codex.wordpress.org/Template_Hierarchy">Template Hierarchy &laquo; WordPress Codex</a> &#8211; </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/from-the-web-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Delicious Links (May 13th &#8211; June 17th)</title>
		<link>http://screamingcodemonkey.com/my-delicious-links-may-13th-june-17th/</link>
		<comments>http://screamingcodemonkey.com/my-delicious-links-may-13th-june-17th/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 22:03:48 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[Delicious]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[checklist]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=321</guid>
		<description><![CDATA[<p>These are My Delicious links for May 13th through June 17th:</p>

Theme Development Checklist &#171; WordPress Codex &#8211; 
5 tips for using AJAX in WordPress &#8211; WordPress Hardcore &#8211; 
7 Simple and Useful Command-Line Tips &#124; Nettuts+ &#8211; 

]]></description>
			<content:encoded><![CDATA[<p>These are <a href='http://delicious.com/jghazally' title='My Delicious Account'>My Delicious</a> links for May 13th through June 17th:</p>
<ul>
<li><a href="http://codex.wordpress.org/Theme_Development_Checklist">Theme Development Checklist &laquo; WordPress Codex</a> &#8211; </li>
<li><a href="http://www.wphardcore.com/2010/5-tips-for-using-ajax-in-wordpress/">5 tips for using AJAX in WordPress &#8211; WordPress Hardcore</a> &#8211; </li>
<li><a href="http://net.tutsplus.com/tutorials/other/7-simple-and-useful-command-line-tips/">7 Simple and Useful Command-Line Tips | Nettuts+</a> &#8211; </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/my-delicious-links-may-13th-june-17th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Duplicate a site for testing</title>
		<link>http://screamingcodemonkey.com/duplicate-a-site-for-testing/</link>
		<comments>http://screamingcodemonkey.com/duplicate-a-site-for-testing/#comments</comments>
		<pubDate>Mon, 17 May 2010 06:48:13 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-e-commerce]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[duplicating a site]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=322</guid>
		<description><![CDATA[So I've been asked how and what I use to duplicate WordPress sites for testing purposes. I do this fairly regularly on my own site and sites I host for clients and friends,, I recently found a new trick using SSH to make the mysql backups too which I'll go through.]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been asked how and what I use to duplicate WordPress sites for testing purposes. I do this fairly regularly on my own site and sites I host for clients and friends,, I recently found a new trick using SSH to make the mysql backups too which I&#8217;ll go through. I assume you have a fairly straight forward install of WordPress in this post since if you have something customized you probably know the importance in backups and have your own system in place. I work mainly on WordPress sites but most of these commands can be used for backing up other websites,, there is only one last extra step when setting up your WordPress site locally that is important.</p>
<p>Some of you may ask &#8216;Why is duplicating a WordPress site necessary?&#8217;</p>
<ul>
<li>Well I do it to test upgrades of wp-e-commerce, to make sure things don&#8217;t break after an upgrade and serves as a file backup if I ever need one in the future.</li>
<li>They are also useful for backups</li>
<li>It also comes in handy when developing new functionality specific to a site</li>
</ul>
<p>A few things to note, if you are unfamiliar with SSH and terminal then I&#8217;d suggest you learning a little about that.. SSH is a more secure form if FTP, and it allows you to perform some functions that are either impossible or slow to do via FTP.  Just Google &#8216;basic SSH commands&#8217; and you should get some good info&#8230; I also just read a good &#8216; <a href="http://net.tutsplus.com/tutorials/other/7-simple-and-useful-command-line-tips/">7 usefull terminal commands</a> &#8216; article on nettuts recently which I would highly recommend bookmarking.<br />
I also assume you are running MAMP on your mac or XAMP on your PC and are familiar with using it.. If you are not and you are wanting to learn about being a web developer than you should Google them and download and install them.</p>
<h3>Obtaining the files</h3>
<p>1. Login to your server via SSH:<br />
<code><br />
ssh Username@mywebsite.com<br />
</code><br />
you will then be prompted to enter in your password.</p>
<p>2. Navigate to just outside your websites folder then use the zip command to zip up your files ( this might take awhile depending on the size of your site)<br />
<code><br />
zip -r mybackup.zip mysite/<br />
</code><br />
3. Move this file to a place accessible via a webbrowser (downloading it via SSH or FTP will take longer- I put it in the site the make sure to delete it once I&#8217;ve downloaded it)<br />
<code><br />
mv mybackup.zip mysite/mybackup.zip<br />
</code><br />
4. In a web browser navigate to http://mysite.com/mybackup.zip and download it.. Once it&#8217;s downloaded i usually move it into a folder outside of site so other people can&#8217;t download it instead of deleting it. Ie mv mysite/backup/mybackup.zip mybackup.zip</p>
<p>5. Now that we have the files it&#8217;s time to export the database, there&#8217;s a few ways of doing this.. I used to just use phpMyAdmin but there&#8217;s an even easier way if your already logged into SSH. All you need is the database host (usually localhost but can sometimes be different), username, password and database name.<br />
In SSH type:<br />
<code><br />
mysqldump --host=mysql.mysite.com --user=username --password=password --all-databases &gt; mysite_db.sql<br />
</code><br />
Once that&#8217;s done you should have a new sql file called mysite_db.sql repeat step 3 and 4 to download the file to your local computer.</p>
<h3>Using the files</h3>
<p>Cool now you should have two files on your computer that&#8217;s all we need to install a working version of your WordPress site locally.<br />
Steps for installing are rather straight forward,</p>
<p>1. In your localhost environment unzip the mybackup.zip file so you have localhost/mybackup</p>
<p>2. In your localhost/mybackup/wp-config.php change your WP_USER, WP_PASS,WP_DB, and WP_HOST values to suit your localhost environment.</p>
<p>3. So now we have the files ready it&#8217;s time to make the database.. Login to your localhost phpMyAdmin and create a new database mysitedb then in the upper right corner select import and navigate to the files we downloaded (mysite_db.sql) and hit import</p>
<p>4. WordPress stores two options called &#8216;siteurl&#8217; and &#8216;home&#8217; which need to be changed otherwise if you try to login or view your site you will keep being sent to your real site online! This part confused the hell out of me the first time I tried it but was so aparent afterwards~ In your wp_options table search for the value siteurl and home then change them to the new location ie http://localhost/mybackup</p>
<p>Once this is done you should be ready to test your upgrades, work on modifications etc&#8230; Note sometimes you might get permissons errors on your wp-content folders, I usually resolve this issue by checking the sections in wp-admin&gt;wordpress&gt;miscellaneous section. You might also get the dreaded 500 Internal Server Error, in which case I usually delete the .htaccess rules or modify them slightly&#8230;</p>
<p>Well I hope you find this useful. I&#8217;m sure I&#8217;ll be reading this article again the next time I have to do a backup <img src='http://screamingcodemonkey.com/wp/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Good luck and happy coding!</p>
<p>Best<br />
Jeff</p>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/duplicate-a-site-for-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My Delicious Links (March 29th &#8211; April 27th)</title>
		<link>http://screamingcodemonkey.com/my-delicious-links-march-29th-april-27th/</link>
		<comments>http://screamingcodemonkey.com/my-delicious-links-march-29th-april-27th/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 03:09:44 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[Delicious]]></category>
		<category><![CDATA[coda]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=292</guid>
		<description><![CDATA[<p>These are My Delicious links for March 29th through April 27th:</p>

Setting Up Your Mac For Local Development Using Coda, WordPress &#38; MAMP &#183; Jay Robinson &#8211; 
Xdebug: Documentation &#8211; 
How To Create and Apply Image Filters in PHP &#8211; 

]]></description>
			<content:encoded><![CDATA[<p>These are <a href='http://delicious.com/jghazally' title='My Delicious Account'>My Delicious</a> links for March 29th through April 27th:</p>
<ul>
<li><a href="http://jayrobinson.org/2009/08/10/setting-up-your-mac-for-local-development-using-coda-wordpress-mamp/">Setting Up Your Mac For Local Development Using Coda, WordPress &amp; MAMP &middot; Jay Robinson</a> &#8211; </li>
<li><a href="http://www.xdebug.org/docs/install">Xdebug: Documentation</a> &#8211; </li>
<li><a href="http://www.devx.com/webdev/Article/37179/1954">How To Create and Apply Image Filters in PHP</a> &#8211; </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/my-delicious-links-march-29th-april-27th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Wp-e-Commerce Module Framework</title>
		<link>http://screamingcodemonkey.com/wpsc-module-skeleton/</link>
		<comments>http://screamingcodemonkey.com/wpsc-module-skeleton/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 08:52:09 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-e-commerce]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[resources]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=174</guid>
		<description><![CDATA[<p>So I&#8217;ve made a couple of modules (Upgrades) for wp-e-commerce now, and I&#8217;m starting to get the hang of things. Theres a few key things to make a module actually tick with wp-e-commerce but don&#8217;t worry it takes it&#8217;s inspiration from WordPress so if your familiar at all with developing in WordPress then you should pick it up quick and easy.</p>
<p>I&#8217;ve made a basic frame for building my wp-e-commerce modules quick and effortless. It&#8217;s really simple, it does the first two things every module needs&#8230; well sort of apart from actually DOING anything.</p>

Has an Upgrades File Header
Adds a new page to the Products sidebar in wp-admin

<p>Step 1 : Location and File Structure</p>
<p>All upgrades either live in this folder or in a folder in this folder
wp-content/uploads/wpsc/upgrades</p>
<p>All upgrades have a main file with its comment header (just like themes and plugins with ... <a href="http://screamingcodemonkey.com/wpsc-module-skeleton/">Read More &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve made a couple of modules (Upgrades) for wp-e-commerce now, and I&#8217;m starting to get the hang of things. Theres a few key things to make a module actually tick with wp-e-commerce but don&#8217;t worry it takes it&#8217;s inspiration from WordPress so if your familiar at all with developing in WordPress then you should pick it up quick and easy.</p>
<p>I&#8217;ve made a basic frame for building my wp-e-commerce modules quick and effortless. It&#8217;s really simple, it does the first two things every module needs&#8230; well sort of apart from actually DOING anything.</p>
<ol>
<li>Has an Upgrades File Header</li>
<li>Adds a new page to the Products sidebar in wp-admin</li>
</ol>
<p>Step 1 : Location and File Structure</p>
<p>All upgrades either live in this folder or in a folder in this folder<br />
<code>wp-content/uploads/wpsc/upgrades</code></p>
<p>All upgrades have a main file with its comment header (just like themes and plugins with WordPress)</p>
<p><code><br />
/*<br />
Upgrade Name:WPSC Skeleton Module<br />
Upgrade URI: http://www.screamingcodemonkey.com<br />
Description: A skeleton module for wpec<br />
Version: 0.0<br />
Author: ScreamingCodeMonkey<br />
Author URI: http://www.screamingcodemonkey.com</code> */</p>
<p>Then Some but not all modules/upgrades require a new page in the &#8216;Products&#8217; wp-admin Sidebar Widget:</p>
<p><code><br />
if (is_admin()) {<br />
function wpsc_add_modules_admin_pages($page_hooks, $base_page) {<br />
$page_hooks[] =  add_submenu_page($base_page, __('-New Page','wpsc'),  __('-New Page','wpsc'), 7, 'wpsc-module-admin', 'wpsc_display_admin_pages');<br />
return $page_hooks;<br />
}<br />
add_filter('wpsc_additional_pages', 'wpsc_add_modules_admin_pages',10, 2);<br />
}<br />
*/<br />
</code><br />
It&#8217;s pretty basic, hope you find this useful. If you have any suggestions I&#8217;d like to hear from you. You can download a .zip of the moduleSkeleton bellow.<br />
[dm]1[/dm] </p>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/wpsc-module-skeleton/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>From the web ,,,</title>
		<link>http://screamingcodemonkey.com/from-the-web-7/</link>
		<comments>http://screamingcodemonkey.com/from-the-web-7/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 10:06:53 +0000</pubDate>
		<dc:creator>jghazally</dc:creator>
				<category><![CDATA[Delicious]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[templates]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.screamingcodemonkey.com/?p=134</guid>
		<description><![CDATA[<p>These are my links for October 29th through October 30th:</p>

Command Line &#8211; OS X Daily &#8211; 
StudioPress &#8250; Support &#8211; 
500 Internal Server Error &#8211; 500 Internal Server Error

]]></description>
			<content:encoded><![CDATA[<p>These are my links for October 29th through October 30th:</p>
<ul>
<li><a href="http://osxdaily.com/category/command-line/">Command Line &#8211; OS X Daily</a> &#8211; </li>
<li><a href="http://www.studiopress.com/support/">StudioPress &rsaquo; Support</a> &#8211; </li>
<li><a href="http://feeds.delicious.com/v2/rss/jghazally">500 Internal Server Error</a> &#8211; 500 Internal Server Error</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://screamingcodemonkey.com/from-the-web-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

