<?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>Guy Rutenberg &#187; Wordpress</title>
	<atom:link href="http://www.guyrutenberg.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Wed, 16 Jun 2010 19:53:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Improved FTP Backup for WordPress</title>
		<link>http://www.guyrutenberg.com/2010/02/28/improved-ftp-backup-for-wordpress/</link>
		<comments>http://www.guyrutenberg.com/2010/02/28/improved-ftp-backup-for-wordpress/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 06:38:44 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=637</guid>
		<description><![CDATA[This script backups both the database and files of a WordPress blog into a remote FTP server (while keeping a local copy). It&#8217;s an update of my WordPress Backup to FTP script. The main changes are auto-detecting database settings and better support for caching plugins (specifically WP-Cache). The new version makes it easier to backup [...]]]></description>
			<content:encoded><![CDATA[<p>This script backups both the database and files of a WordPress blog into a remote FTP server (while keeping a local copy). It&#8217;s an update of my <a href="/2009/01/06/wordpress-backup-to-ftp/">WordPress Backup to FTP</a> script. The main changes are auto-detecting database settings and better support for caching plugins (specifically WP-Cache). The new version makes it easier to backup multiple WordPress blogs to the same FTP server.<br />
<span id="more-637"></span><br />
Usage is pretty simple after a short initial configuration. First, save the the script and make it executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x wp-backup</pre></div></div>

<p>(assuming you saved it under the name <code>wp-backup</code>). After saving it edit the file with your favorite editor and set the 5 configuration variable to whatever is appropriate for you. <code>BACKUP_DIR</code> is the folder to save the local backups to. <code>FTP_HOST</code>, <code>FTP_USER</code>, <code>FTP_PASS</code> control the FTP host, username and password, respectively, for the remote backup server. <code>FTP_BACKUP_DIR</code> sets the folder on the FTP server to save the remote backup to.</p>
<p>Now that the initial configuration is done, all you need to do is execute the script and give the path to the blog as an argument. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>wp-backup <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>myblog</pre></div></div>

<p>And that it, the script will backup your files (excluding cache) and database to both a local and remote locations. This allows using the same script to backup multiple WordPress blogs, unlike the previous script which had to be modified for each blog.</p>
<p>And now the script itself:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Copyright 2008, 2010 Guy Rutenberg &lt;http://www.guyrutenberg.com/contact-me&gt;</span>
<span style="color: #666666; font-style: italic;"># WordPress FTP backup 2.0</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Easily backup wordpress instances via ftp.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Change Log:</span>
<span style="color: #666666; font-style: italic;"># ===========</span>
<span style="color: #666666; font-style: italic;"># 2.0:</span>
<span style="color: #666666; font-style: italic;">#  - Auto-detect database settings.</span>
<span style="color: #666666; font-style: italic;">#  - Exclude cache data from backups.</span>
&nbsp;
<span style="color: #007800;">BACKUP_DIR</span>=
<span style="color: #007800;">FTP_HOST</span>=
<span style="color: #007800;">FTP_USER</span>=
<span style="color: #007800;">FTP_PASS</span>=
<span style="color: #007800;">FTP_BACKUP_DIR</span>=
&nbsp;
<span style="color: #666666; font-style: italic;"># end of configuration - you probably don't need to touch anything bellow</span>
&nbsp;
<span style="color: #007800;">PROG</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;$0&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
print_usage <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;USAGE: <span style="color: #007800;">${PROG}</span> [options] BLOG_ROOT&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Backup a WordPress blog&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
print_help <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>  <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    print_usage
    <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt; EOF
&nbsp;
Options:
    -h, --help          show this help message and exit
&nbsp;
EOF</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">TEMP</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">getopt</span> <span style="color: #660033;">-o</span> h <span style="color: #660033;">--long</span> <span style="color: #7a0874; font-weight: bold;">help</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PROG</span>&quot;</span> <span style="color: #660033;">--</span> <span style="color: #ff0000;">&quot;$@&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$?</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    print_usage
    <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">--</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$TEMP</span>&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">true</span> ; <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
        -h<span style="color: #000000; font-weight: bold;">|</span>--help<span style="color: #7a0874; font-weight: bold;">&#41;</span> print_help; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000; font-weight: bold;">;;</span>
        --<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">shift</span>; <span style="color: #7a0874; font-weight: bold;">break</span><span style="color: #000000; font-weight: bold;">;;</span>
    <span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
 print_usage <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>stderr
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #007800;">BLOG_DIR</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">DB_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_NAME;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DB_USER</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_USER;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DB_PASS</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_PASSWORD;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">DB_HOST</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php require_once(<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${BLOG_DIR}</span>/wp-config.php<span style="color: #000099; font-weight: bold;">\&quot;</span>); echo DB_HOST;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> php<span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #007800;">BLOG_DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BLOG_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BLOG_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">BACKUP_DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BACKUP_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BACKUP_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;dumping database... &quot;</span>
<span style="color: #007800;">DUMP_NAME</span>=<span style="color: #800000;">${DB_NAME}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.sql.bz2
mysqldump <span style="color: #660033;">--user</span>=<span style="color: #800000;">${DB_USER}</span> <span style="color: #660033;">--password</span>=<span style="color: #800000;">${DB_PASS}</span> <span style="color: #660033;">--host</span>=<span style="color: #800000;">${DB_HOST}</span> \
 <span style="color: #660033;">--databases</span> <span style="color: #800000;">${DB_NAME}</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${DUMP_NAME}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Creating tarball... &quot;</span>
<span style="color: #007800;">TAR_NAME</span>=<span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cjf</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2 <span style="color: #660033;">--exclude</span> cache <span style="color: #800000;">${BLOG_DIR}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Uploading SQL dump and tarball to FTP... &quot;</span>
lftp <span style="color: #660033;">-u</span> <span style="color: #800000;">${FTP_USER}</span>,<span style="color: #800000;">${FTP_PASS}</span> <span style="color: #800000;">${FTP_HOST}</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
cd &quot;${FTP_BACKUP_DIR}&quot;
put &quot;${BACKUP_DIR}/${DUMP_NAME}&quot;
put &quot;${BACKUP_DIR}/${TAR_NAME}&quot;
&nbsp;
EOF</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">3</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2010/02/28/improved-ftp-backup-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>RTL and Hebrew Adaptation of the Fusion Wordpress Theme</title>
		<link>http://www.guyrutenberg.com/2009/08/15/rtl-and-hebrew-adaptation-of-the-fusion-wordpress-theme/</link>
		<comments>http://www.guyrutenberg.com/2009/08/15/rtl-and-hebrew-adaptation-of-the-fusion-wordpress-theme/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 05:52:22 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[RTL]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=455</guid>
		<description><![CDATA[I&#8217;ve ported the Fusion theme by digitalnature to RTL, and adapted it to Hebrew.


 Porting this theme to RTL was the main catalysis for improving my cssrtl.py script. Beside translating the theme to Hebrew and making the necessary CSS adaptation to RTL, I had also to adopt the fonts used. The font selected by the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve ported the <a href="http://digitalnature.ro/projects/fusion">Fusion</a> theme by <a href="http://digitalnature.ro/">digitalnature</a> to RTL, and adapted it to Hebrew.</p>
<p><img src="http://www.guyrutenberg.com/wp-content/uploads/2009/08/screenshot.png" alt="screenshot" title="screenshot" width="300" height="225" class="alignnone size-full wp-image-527" /><br />
<span id="more-455"></span><br />
 Porting this theme to RTL was the main catalysis for improving my <a href="/2009/08/05/designing-a-better-a-css-rtl-convertor/">cssrtl.py</a> script. Beside translating the theme to Hebrew and making the necessary CSS adaptation to RTL, I had also to adopt the fonts used. The font selected by the author weren&#8217;t compatible with Hebrew, and the alternatives looked awful. So I&#8217;ve chose some other fonts from the same family to keep the overall look of the theme, but make it more Hebrew friendly.</p>
<p>You can see a live version of the theme in <a href="http://www.davidzadok.co.il">David Zadok</a>&#8217;s site. The theme can be downloaded from here: <a href="/wp-content/uploads/2009/08/fusion-rtl-2.6.zip">fusion-rtl-2.6.zip</a> [326.8kb]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/08/15/rtl-and-hebrew-adaptation-of-the-fusion-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Sociable Plugin Doesn&#8217;t Play Nice</title>
		<link>http://www.guyrutenberg.com/2009/08/12/sociable-plugin-doesnt-play-nice/</link>
		<comments>http://www.guyrutenberg.com/2009/08/12/sociable-plugin-doesnt-play-nice/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 08:48:06 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=441</guid>
		<description><![CDATA[I&#8217;ve been using the Sociable plugin for adding easy &#8220;share&#8221; links to the bottom of my posts. Up until yesterday I&#8217;ve been using the 2.x versions of the plugin, but yesterday I&#8217;ve upgraded to 3.4.4. Today I&#8217;ve noticed to my surprise that the plugin automatically adds a box to my admin dashboard with &#8220;The Latest [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using the <a href="http://wordpress.org/extend/plugins/sociable/"><code>Sociable</code></a> plugin for adding easy &#8220;share&#8221; links to the bottom of my posts. Up until yesterday I&#8217;ve been using the 2.x versions of the plugin, but yesterday I&#8217;ve upgraded to 3.4.4. Today I&#8217;ve noticed to my surprise that the plugin automatically adds a box to my admin dashboard with &#8220;The Latest news from Yoast&#8221;, Yoast beeing the plugin&#8217;s maintainer, Joost de Valk, blog. The plugin itself doesn&#8217;t feature any way to completely disable this &#8220;feature&#8221;. One has to hide it using the dashboard settings. While this may seems benign, in my opinion its pushing the limit. If I&#8217;m interested in getting updates from that blog, I would sign up to its RSS feed. I don&#8217;t like getting &#8220;free&#8221; functionality not advertised in the plugin description.</p>
<p>I must add that as a user of the Sociable plugin, I&#8217;m more than satisfied. I probably won&#8217;t stop using the plugin just because of this issue, but it still seems to me like improper manners.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/08/12/sociable-plugin-doesnt-play-nice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Backup to FTP</title>
		<link>http://www.guyrutenberg.com/2009/01/06/wordpress-backup-to-ftp/</link>
		<comments>http://www.guyrutenberg.com/2009/01/06/wordpress-backup-to-ftp/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 13:46:33 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[FTP]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=187</guid>
		<description><![CDATA[Update: A newer version of the script is available.
This script allows you to easily backup your WordPress blog to an FTP server. It&#8217;s actually a modification of my Wordpress Backup to Amazon S3 Script, but instead of saving the backup to Amazon S3 it uploads it to an FTP server. Another update is that now [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> A newer version of the script is <a href="/2010/02/28/improved-ftp-backup-for-wordpress/">available</a>.</p>
<p>This script allows you to easily backup your WordPress blog to an FTP server. It&#8217;s actually a modification of my <a href="/2008/10/11/wordpress-backup-to-amazon-s3-script/">Wordpress Backup to Amazon S3 Script</a>, but instead of saving the backup to Amazon S3 it uploads it to an FTP server. Another update is that now the SQL dump includes the database creation instructions so you don&#8217;t need to create it manually before restoring from the backup.</p>
<p>Although I&#8217;ve written it with WordPress in mind (to creates backups of my blog), it isn&#8217;t WordPress specific. It can be used to backup any website that consists of a MySQL database and files. I&#8217;ve successfully used it to backup MediaWiki installation.<br />
<span id="more-187"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># (C) 2008 Guy Rutenberg</span>
<span style="color: #666666; font-style: italic;"># This is a script that creates backups of my blog.</span>
&nbsp;
<span style="color: #007800;">DB_NAME</span>=guy_blog
<span style="color: #007800;">DB_USER</span>=<span style="color: #000000; font-weight: bold;">******</span>
<span style="color: #007800;">DB_PASS</span>=<span style="color: #000000; font-weight: bold;">******</span>
<span style="color: #007800;">DB_HOST</span>=localhost
&nbsp;
<span style="color: #007800;">BLOG_DIR</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>guyru<span style="color: #000000; font-weight: bold;">/</span>guyrutenberg.com<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #007800;">BACKUP_DIR</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>guyru<span style="color: #000000; font-weight: bold;">/</span>backups<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #007800;">FTP_HOST</span>=88.198.42.4
<span style="color: #007800;">FTP_USER</span>=<span style="color: #000000; font-weight: bold;">******</span>
<span style="color: #007800;">FTP_PASS</span>=<span style="color: #000000; font-weight: bold;">******</span>
<span style="color: #007800;">FTP_BACKUP_DIR</span>=guyru<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># end of configuration - you probably don't need to touch anything bellow</span>
<span style="color: #007800;">BLOG_DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BLOG_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BLOG_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">BACKUP_DIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BACKUP_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$BACKUP_DIR</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;dumping database... &quot;</span>
<span style="color: #007800;">DUMP_NAME</span>=<span style="color: #800000;">${DB_NAME}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.sql.bz2
mysqldump <span style="color: #660033;">--user</span>=<span style="color: #800000;">${DB_USER}</span> <span style="color: #660033;">--password</span>=<span style="color: #800000;">${DB_PASS}</span> <span style="color: #660033;">--host</span>=<span style="color: #800000;">${DB_HOST}</span> \
 <span style="color: #660033;">--databases</span> <span style="color: #800000;">${DB_NAME}</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${DUMP_NAME}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Creating tarball... &quot;</span>
<span style="color: #007800;">TAR_NAME</span>=<span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cjf</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2 <span style="color: #800000;">${BLOG_DIR}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Uploading SQL dump and tarball to FTP... &quot;</span>
lftp <span style="color: #660033;">-u</span> <span style="color: #800000;">${FTP_USER}</span>,<span style="color: #800000;">${FTP_PASS}</span> <span style="color: #800000;">${FTP_HOST}</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
cd &quot;${FTP_BACKUP_DIR}&quot;
put &quot;${BACKUP_DIR}/${DUMP_NAME}&quot;
put &quot;${BACKUP_DIR}/${TAR_NAME}&quot;
&nbsp;
EOF</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">3</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span></pre></div></div>

<p>The configuration is done using the variables in the beginning of the script (until the &#8220;end of configuration&#8221; line). They are pretty self explanatory, and you should adjust them for your site before using the script. If there are variables you don&#8217;t understand what they do, see the post about the <a href="/2008/10/11/wordpress-backup-to-amazon-s3-script">previous script</a>, and don&#8217;t hesitate to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2009/01/06/wordpress-backup-to-ftp/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Wordpress Backup to Amazon S3 Script</title>
		<link>http://www.guyrutenberg.com/2008/10/11/wordpress-backup-to-amazon-s3-script/</link>
		<comments>http://www.guyrutenberg.com/2008/10/11/wordpress-backup-to-amazon-s3-script/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 09:19:22 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Amazon AWS]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=110</guid>
		<description><![CDATA[This is an updated version of my Wordpress Backup Script. The new version basically does the same thing: backup up a wordpress blog (actually any site that consists of files and a MySQL database). The new thing about the script is that instead of only saving the backup locally, it also uploads it to Amazon [...]]]></description>
			<content:encoded><![CDATA[<p>This is an updated version of my <a href="/2008/05/07/wordpress-backup-script/">Wordpress Backup Script</a>. The new version basically does the same thing: backup up a wordpress blog (actually any site that consists of files and a MySQL database). The new thing about the script is that instead of only saving the backup locally, it also uploads it to Amazon S3.</p>
<p><span id="more-110"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># (C) 2008 Guy Rutenberg</span>
<span style="color: #666666; font-style: italic;"># This is a script that creates backups of my blog.</span>
&nbsp;
<span style="color: #007800;">DB_NAME</span>=database_name
<span style="color: #007800;">DB_USER</span>=database_user
<span style="color: #007800;">DB_PASS</span>=<span style="color: #000000; font-weight: bold;">****</span>
<span style="color: #007800;">DB_HOST</span>=localhost
&nbsp;
<span style="color: #666666; font-style: italic;">#no trailing slash</span>
<span style="color: #007800;">BLOG_DIR</span>=<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>blog
<span style="color: #007800;">BACKUP_DIR</span>=<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>backups
<span style="color: #007800;">S3BUCKET</span>=s3:<span style="color: #000000; font-weight: bold;">//</span>bucket-name<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># end of configuration - you probably don't need to touch anything bellow</span>
<span style="color: #007800;">DUMP_NAME</span>=<span style="color: #800000;">${DB_NAME}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.sql.bz2
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;dumping database... &quot;</span>
mysqldump <span style="color: #660033;">--user</span>=<span style="color: #800000;">${DB_USER}</span> <span style="color: #660033;">--password</span>=<span style="color: #800000;">${DB_PASS}</span> <span style="color: #660033;">--host</span>=<span style="color: #800000;">${DB_HOST}</span> <span style="color: #800000;">${DB_NAME}</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${DUMP_NAME}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #007800;">TAR_NAME</span>=<span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Creating tarball... &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cjf</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2 <span style="color: #800000;">${BLOG_DIR}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Uploading SQL dump to Amazon S3... &quot;</span>
s3cmd put <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${DUMP_NAME}</span> <span style="color: #800000;">${S3BUCKET}</span><span style="color: #800000;">${DUMP_NAME}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Uploading tarball to Amazon S3... &quot;</span>
s3cmd put <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${TAR_NAME}</span> <span style="color: #800000;">${S3BUCKET}</span><span style="color: #800000;">${TAR_NAME}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span></pre></div></div>

<p>As with the older <a href="/2008/03/01/backup-directories-to-amazon-s3-script/">Amazon S3 backup script</a>, this one also required you to install the <a href="http://s3tools.logix.cz/s3cmd">s3cmd</a> package.</p>
<p>The first six variables:</p>
<ul>
<li><code>DB_NAME</code></li>
<li><code>DB_USER</code></li>
<li><code>DB_PASS</code></li>
<li><code>DB_HOST</code></li>
<li><code>BLOG_DIR</code></li>
<li><code>BACKUP_DIR</code></li>
</ul>
<p>Are the pretty self explanatory and have the same meaning as in the <a href="/2008/05/07/wordpress-backup-script/">old script</a>.</p>
<p>The script has one new variable: <code>S3BUCKET</code>. This should be set to the S3 bucket to which the backups should be saved. If you want to add some prefix to the backups files on S3 this is the place.</p>
<p>The script keeps the backups both in the local backup directory and the Amazon S3.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/10/11/wordpress-backup-to-amazon-s3-script/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Clean URLs (Permalinks) for WordPress on Lighttpd</title>
		<link>http://www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/</link>
		<comments>http://www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/#comments</comments>
		<pubDate>Sat, 24 May 2008 07:43:21 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Lighttpd]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=58</guid>
		<description><![CDATA[I&#8217;ve moved my blog in the last few days to a new bigger dedicated server (as well as some other sites I own). After doing some benchmarks (I plan to post those soon) I&#8217;ve decided to switch to Lighttpd. While the exact migration notes are the topic of another post, I can say that I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve moved my blog in the last few days to a new bigger dedicated server (as well as some other sites I own). After doing some benchmarks (I plan to post those soon) I&#8217;ve decided to switch to <a href="http://trac.lighttpd.net/">Lighttpd</a>. While the exact migration notes are the topic of another post, I can say that I&#8217;m fairly satisfied with the move.</p>
<p>After setting up the server, I started moving the blog. Importing the files and the database was pretty straight forward. But when I thought every thing is ready and I transfered the domain to the new server I&#8217;ve found out that none of my inner pages are accessible. The reason, as it turned up pretty quickly, is that the Wordpress depends on Apache&#8217;s <code>mod_rewrite</code> to create the clean URLs (the so called permalinks). This actually posed two problems:</p>
<ol>
<li>Wordpress depends on Apache&#8217;s <code>mod_rewrite</code>.</li>
<li>Wordpress used <code>.htaccess</code> files for the clean URLs configuration</li>
</ol>
<p><span id="more-58"></span></p>
<p>Luckily, Lighttpd has its own <a href="http://trac.lighttpd.net/trac/wiki/Docs:ModRewrite"><code>mod_rewrite</code></a>, however it operates a bit differently. The Wordpress generated <code>.htaccess</code> has the following lines:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
&lt;/IfModule&gt;</pre></div></div>

<p>This rules tells Apache to check if the requested URL is a file or directory that exist on the server, otherwise append the requested URL to <code>index.php</code>. The last statement can be written in Lighttpd&#8217;s <code>mod_rewrite</code> syntax as</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&quot;^/(.+)/?$&quot; =&gt; &quot;/index.php/$1&quot;</pre></div></div>

<p>If we only use this rule, the posts will load up fine, but all static files will not be available, that includes CSS files and images which isn&#8217;t desired. Apache handles this by checking if the requested URL exist as a file or directory. Unfortunately Lighttpd&#8217;s <code>mod_rewrite</code> has no way to check if a file exists. I&#8217;ve found out that a possible workaround for this is to use <code>mod_magent</code> which allows to embed LUA code in Lighttpd, and use it to check if files exist and handle the clean URLs. This seemed to me an overkill, and as some people noted it has some performance hit which I wanted to avoid.</p>
<p>I&#8217;ve figured out that I shouldn&#8217;t just translate the rewrite rules, instead I need to adapt them. In Apache we check if a file exist in order to be able to serve the static files. The directories are checked so the server would be able to list them. The problem is now to achieve those objectives in Lighttpd. First we don&#8217;t really need to allow the directories to be listed (actually I&#8217;ve planed to block this option in my blog a long time ago). So the rule about the directories can be fully ignored. All the static files that need to be served have an extension, this includes all the files I&#8217;ve uploaded. We note that Wordpress generated permalinks never have a dot (&#8216;.&#8217;) in their URLs. So we can exploit this behavior to achieve our goal. The following condition uses regular expressions to check if a given url has an extension, and if so serves it.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&quot;^/(.*)\.(.+)$&quot; =&gt; &quot;$0&quot;</pre></div></div>

<p>The only difference from the Apache configuration is that the web-server itself returns the 404 message when a requested file is missing, instead of passing it to Wordpress and letting it return the error.</p>
<p>To sum everything up, our <code>mod_rewrite</code> configuration should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">url.rewrite = (
	&quot;^/(.*)\.(.+)$&quot; =&gt; &quot;$0&quot;,
	&quot;^/(.+)/?$&quot; =&gt; &quot;/index.php/$1&quot;
)</pre></div></div>

<p>As I noted before (the second problem), there is no equivalent to <code>.htaccess</code> files in Lighttpd. So this configuration has to go directly into the main configuration file in <code>/etc/lighttpd/lighttpd.conf</code> (or where it exists in your server). Make sure you&#8217;ve enabled <code>mod_rewrite</code>, as this is required. You can enable it by putting the following line some where above the <code.url.rewrite</code> block.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server.modules += (&quot;mod_rewrite&quot;)</pre></div></div>

<p>If you have multiple sites hosted, you should use include the <code>url.rewrite</code> block inside a conditional statement. For example my configuration looks like this</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$HTTP[&quot;host&quot;] =~ &quot;(www.)?guyrutenberg.com&quot; {
	url.rewrite = (
		&quot;^/(.*)\.(.+)$&quot; =&gt; &quot;$0&quot;,
		&quot;^/(.+)/?$&quot; =&gt; &quot;/index.php/$1&quot;
	)
&nbsp;
	[...other unrelated configurations...]
}</pre></div></div>

<p>And I've enabled the <code>mod_rewrite</code> at the top of the <code>/etc/lighttpd/lighttpd.conf</code> file.</p>
<p>This workaround works well, as you can read this post now. If you run into problems, or have any question about why or how I did soemthing, don't hesitate to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/05/24/clean-urls-permalinks-for-wordpress-on-lighttpd/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>WordPress Backup Script</title>
		<link>http://www.guyrutenberg.com/2008/05/07/wordpress-backup-script/</link>
		<comments>http://www.guyrutenberg.com/2008/05/07/wordpress-backup-script/#comments</comments>
		<pubDate>Wed, 07 May 2008 08:15:52 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=54</guid>
		<description><![CDATA[This is a small script I&#8217;ve written to automate my server-side backups of my blogs. It creates a backup of both the database and the actual WordPress files.

#!/bin/bash
&#160;
# (C) 2008 Guy Rutenberg - http://www.guyrutenberg.com
# This is a script that creates backups of blogs.
&#160;
DB_NAME=guy_blog
DB_USER=guy_root
DB_PASS=****
DB_HOST=localhost
&#160;
#no trailing slash
BLOG_DIR=/home/guyru/guyrutenberg.com
BACKUP_DIR=/home/guyru/backups
&#160;
&#160;
echo -n &#34;dumping database... &#34;
mysqldump --user=${DB_USER} --password=${DB_PASS} --host=${DB_HOST} ${DB_NAME} \
 &#124; [...]]]></description>
			<content:encoded><![CDATA[<p>This is a small script I&#8217;ve written to automate my server-side backups of my blogs. It creates a backup of both the database and the actual WordPress files.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># (C) 2008 Guy Rutenberg - http://www.guyrutenberg.com</span>
<span style="color: #666666; font-style: italic;"># This is a script that creates backups of blogs.</span>
&nbsp;
<span style="color: #007800;">DB_NAME</span>=guy_blog
<span style="color: #007800;">DB_USER</span>=guy_root
<span style="color: #007800;">DB_PASS</span>=<span style="color: #000000; font-weight: bold;">****</span>
<span style="color: #007800;">DB_HOST</span>=localhost
&nbsp;
<span style="color: #666666; font-style: italic;">#no trailing slash</span>
<span style="color: #007800;">BLOG_DIR</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>guyru<span style="color: #000000; font-weight: bold;">/</span>guyrutenberg.com
<span style="color: #007800;">BACKUP_DIR</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>guyru<span style="color: #000000; font-weight: bold;">/</span>backups
&nbsp;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;dumping database... &quot;</span>
mysqldump <span style="color: #660033;">--user</span>=<span style="color: #800000;">${DB_USER}</span> <span style="color: #660033;">--password</span>=<span style="color: #800000;">${DB_PASS}</span> <span style="color: #660033;">--host</span>=<span style="color: #800000;">${DB_HOST}</span> <span style="color: #800000;">${DB_NAME}</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">bzip2</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${DB_NAME}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.sql.bz2
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>mysqldump failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
&nbsp;
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Creating tarball... &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cjf</span> <span style="color: #800000;">${BACKUP_DIR}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${BLOG_DIR##*/}</span>-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.bz2 <span style="color: #800000;">${BLOG_DIR}</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>tarball creation failed!&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span></pre></div></div>

<p><span id="more-54"></span><br />
Copy the above code and save it to a file called <code>backup-blog</code>. Before you can use it there are some configurations to be done. At the beginning of the script (right after the copyright notice), you will find some variable you need to set.</p>
<p>The first set of variables is the database configuration. Set <code>DB_NAME</code> to the name of your database, <code>DB_USER</code> to your database username, <code>DB_PASS</code> to the user&#8217;s password and <code>DB_HOST</code> to the hostname of the database server. For most users the <code>DB_HOST</code> should be set for <code>localhost</code> (but some users need to specify a different value here).</p>
<p>The next variable is <code>BLOG_DIR</code>. Set it to the full path of the directory where you installed WordPress. <code>BACKUP_DIR</code> should be set to the full path of the directory you to keep the backups in, make sure the user which will run the script has write access to it. Notice that both paths shouldn&#8217;t end with a trailing &#8216;/&#8217; (slash).</p>
<p>Now that the configuration is over, make the script executable:<br />
<code>chmod +x backup-blog</code><br />
Now you can test that everything works ok by running the script: <code>./backup-blog</code>. If the script failed for some reason make sure your configuration is correct.</p>
<p>The next step is to automate the backup process using <code>cron</code>. Run <code>crontab -e</code> to add an entry to the backup script. Append the following line to the <code>crontab</code>:<br />
<code>30 1 * * 4 /path/to/backup-blog</code><br />
This will run the script automatically for you once a week, on 01:30 AM every Friday. Be sure to check up the backup folder from time to time to make sure everything is running smooth.</p>
<p>Note that while the script was originally intended to create backups of WordPress blogs it can also be used to backup any kind of website that needs both files and database backups, like MediaWiki, Drupal, or almost any kind of CMS and blogging platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/05/07/wordpress-backup-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hidden Spam Links in Wordpress</title>
		<link>http://www.guyrutenberg.com/2008/04/05/hidden-spam-links-in-wordpress/</link>
		<comments>http://www.guyrutenberg.com/2008/04/05/hidden-spam-links-in-wordpress/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 21:08:51 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/2008/04/05/hidden-spam-links-in-wordpress/</guid>
		<description><![CDATA[About a week ago, I&#8217;ve decided to look at the HTML source of my blog. I was in total shock to find a spam link hidden there. This is how it looked:

&#60;!-- ocadia theme credits, downloaded from wpthemesfree.com --&#62;
&#60;u id=&#34;ocadia&#34; style=&#34;display: none&#34;&#62;Buy some &#60;a href=&#34;http://detoxbuddy.com/categories/191.html&#34;&#62;marijuana drug testing&#60;/a&#62; products&#60;/u&#62;

Ocadia is the name of theme I&#8217;m using, [...]]]></description>
			<content:encoded><![CDATA[<p>About a week ago, I&#8217;ve decided to look at the HTML source of my blog. I was in total shock to find a spam link hidden there. This is how it looked:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!-- ocadia theme credits, downloaded from wpthemesfree.com --&gt;
&lt;u id=&quot;ocadia&quot; style=&quot;display: none&quot;&gt;Buy some &lt;a href=&quot;http://detoxbuddy.com/categories/191.html&quot;&gt;marijuana drug testing&lt;/a&gt; products&lt;/u&gt;</pre></div></div>

<p>Ocadia is the name of theme I&#8217;m using, so I guessed the hidden link came from there. I was partially right. The code indeed resided in  the <code>index.php</code> file of the theme, but as I later found out, the theme had nothing to do with that. I removed link and the comment immediately, and went to see if the it was distributed this way from <a href="http://beccary.com">Beccary</a> (the author of the theme.<br />
<span id="more-48"></span><br />
I&#8217;ve downloaded the theme again and inspected its files. There was no spam link, and no mention of the WPthemesfree site. I was happy to know that the theme is benign. I remembered I got it directly from the author&#8217;s site, and couldn&#8217;t remember if I&#8217;ve ever visited WPthemesfree&#8217;s site. I&#8217;ve glanced at the code of all the plugins I had installed to see if I pick anything suspicious, but nothing came up. Anyhow, I had a lot of things to do that day, so I sort of let things go.</p>
<p>A day later, I decided to look again at the HTML source of the blog, and to my horror, I discovered the link came back. This time I&#8217;ve decided to get to the root of the problem and stop this from happening again. I keep a backup of all the original packages for everything I install on the web server, including themes. I looked in the original package I&#8217;ve downloaded when I installed the Ocadia theme, and it was clean. At this point I was sure the link didn&#8217;t came from it. I&#8217;ve <code>grep</code>ed the whole source-tree of the blog for <code>wpthemefree</code> and </code>detox</code>, but I came up with nothing.</p>
<p>The next step was to google for the spam link itself. I've came up with a number of Wordpres blog, that had the same spam message hidden, like my blog had. I've checked their installed plugins and themes, and I've found out that our blogs didn't have any plugins or themes in common. This reassured me that the link didn't came from something I've installed.</p>
<p>At this point I realized that the spammer used some kind of security vulnerability in the Wordpress that I'm using (2.2.2) to inject the code to my theme files. This has much riskier potential, as in the same way they code inject arbitrary PHP code that will be executed by the web server.</p>
<p>I've came up with the solution to lock theme files for writing, only leaving a read permission. This allows Wordpress to use them, but it has the downside of disabling the option to edit them from the dashboard. This turned out to be a good fix, as the link didn't came back again. Upgrading the Wordpress version could also be a good solution (it's something I think it's time I should do). </p>
<p>The conclusion from this should be is that one should lock all the PHP files, that don't need to be updated, for writing and only leave them with read permission. This precaution can also help protect you from other kinds of PHP injections that can happen.</p>
<p>I've contacted the authors of some of the blogs I found to be infected with the spam links, and I hope they will solve it too. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/04/05/hidden-spam-links-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.057 seconds -->
