<?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>Matt [Danger] &#187; Matt Danger</title>
	<atom:link href="http://mattdanger.net/author/matt-danger/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattdanger.net</link>
	<description>One step closer to world domination</description>
	<lastBuildDate>Wed, 25 Apr 2012 02:09:12 +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>Facebook-Status-2.2.pl released</title>
		<link>http://mattdanger.net/2011/09/facebook-status-2-2-released/</link>
		<comments>http://mattdanger.net/2011/09/facebook-status-2-2-released/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 04:35:22 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=350</guid>
		<description><![CDATA[I have updated my Facebook status script to version 2.2. Download it from here or view the source here. Facebook made a few changes the broke the previous version. Thanks to Cary Lewis for letting me know the previous version no longer worked!]]></description>
			<content:encoded><![CDATA[<p>I have updated my Facebook status script to version 2.2. Download it from <a href="http://mattdanger.net/portfolio/facebook-status/facebook-status-2.2.pl">here</a> or view the source <a href="http://mattdanger.net/2008/11/update-your-facebook-status-from-the-command-line/">here</a>. Facebook made a few changes the broke the previous version.</p>
<p>Thanks to Cary Lewis for letting me know the previous version no longer worked!</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2011/09/facebook-status-2-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reduce Drupal system load caused by 404s</title>
		<link>http://mattdanger.net/2011/07/reduce-drupal-system-load-caused-by-404s/</link>
		<comments>http://mattdanger.net/2011/07/reduce-drupal-system-load-caused-by-404s/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 04:30:27 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[Fast 404]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[Page Not Found]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=324</guid>
		<description><![CDATA[Running multiple large Drupal sites on one machine has created some performance anxiety for us. Certain high traffic periods combined with aggressive web crawlers have ground our servers to a halt on a few occasions. My latest investigation went into cleaning up popular 404 requests on our larger sites. This noticeably reduced disk I/O. I&#8230;]]></description>
			<content:encoded><![CDATA[<p>Running multiple large Drupal sites on one machine has created some performance anxiety for us. Certain high traffic periods combined with aggressive web crawlers have ground our servers to a halt on a few occasions.</p>
<p>My latest investigation went into cleaning up popular 404 requests on our larger sites. This noticeably reduced disk I/O. I wanted to take 404 a step further and change the way Drupal 404s were handled on our machines. I turned to the <a href="http://drupal.org/project/fast_404">Fast 404</a> module.</p>
<p>Fast 404 works by intercepting the Drupal bootstrap process and performing its own path and file checking. Fast 404 configuration and execution is performed in the site&#8217;s settings.php file.</p>
<p>Version 6.x-1.1 did not work immediately out of the box and required a few changes and bug fixes. I have submitted them to the module author.</p>
<p>The whitelisting did not seem to work so I altered line 38 from:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$allowed</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// URL is whitelisted. Assumed good.</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>To:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$allowed</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$needle</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$needle</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// URL is whitelisted. Assumed good.</span>
  <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Line 111:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT path FROM menu_router WHERE '<span style="color: #009933; font-weight: bold;">%s</span>' LIKE CONCAT(path,'%')&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT pid FROM url_alias WHERE '<span style="color: #009933; font-weight: bold;">%s</span>' LIKE CONCAT(dst,'%')&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql3</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT rid FROM path_redirect WHERE '<span style="color: #009933; font-weight: bold;">%s</span>' LIKE source&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Change to:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT path FROM &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$db_prefix</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;menu_router WHERE path LIKE '<span style="color: #009933; font-weight: bold;">%%</span>s%'&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT pid FROM &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$db_prefix</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;url_alias WHERE dst LIKE '<span style="color: #009933; font-weight: bold;">%%</span>s%' &quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$sql3</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT rid FROM &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$db_prefix</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;path_redirect WHERE '<span style="color: #009933; font-weight: bold;">%s</span>' LIKE source&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I also changed line 48 to remove duplicate code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTP/1.0 404 Not Found'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fast_404_html</span> <span style="color: #339933;">=</span> variable_get<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fast_404_html'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;&lt;title&gt;404 Not Found&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Not Found&lt;/h1&gt;&lt;p&gt;The requested URL &quot;@path&quot; was not found on this server.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #990000;">strtr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fast_404_html</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'@path'</span> <span style="color: #339933;">=&gt;</span> check_plain<span style="color: #009900;">&#40;</span>request_uri<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Change to the function that calls the same code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">fast_404_error_return<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>One limitation of the Fast 404 module are that it will print a generic &#8220;Page Not Found&#8221; message on a white page. We would prefer to have a themed landing page similar to Drupal&#8217;s normal 404 page. My solution was to create a static 404.html file for the site and tell Fast 404 to print the contents of the file instead of its generic message.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$conf</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fast_404_html'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./sites/pathtosite/404.html'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I also wanted to keep track of the requests Fast 404 was catching. I added a direct <code>syslog()<code> call. If your Drupal site is not currently configured to use Syslog <a href="http://mattdanger.net/2011/02/setup-syslog-on-drupal-6-x-and-7-x/">see my post on setup and configuration</a>. The log format I chose fit our needs, you could format it however you like.</p>
<p>Around line 186, inside <code>fast_404_error_return()</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">syslog</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SERVER_NAME'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' Fast_404 '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SCRIPT_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I think monitored my Drupal log file for false positives and added them to the white list.</p>
<p>Take a look at your Drupal site and see if you have a lot of 404s being served. If so, try this module out and see if load is reduced.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2011/07/reduce-drupal-system-load-caused-by-404s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Syslog on Drupal 6.x and 7.x</title>
		<link>http://mattdanger.net/2011/02/setup-syslog-on-drupal-6-x-and-7-x/</link>
		<comments>http://mattdanger.net/2011/02/setup-syslog-on-drupal-6-x-and-7-x/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 21:13:07 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[multisite]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[syslog]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=309</guid>
		<description><![CDATA[By design Drupal 6.x sites will log all activity to the database using a core feature called watchdog. Not having to require users to configure permissions for a log file on the server reduces install instructions (and possible errors) and creates a more seamless experience for Drupal users and administrators. Unfortunately, this makes monitoring a&#8230;]]></description>
			<content:encoded><![CDATA[<p>By design Drupal 6.x sites will log all activity to the database using a core feature called watchdog. Not having to require users to configure permissions for a log file on the server reduces install instructions (and possible errors) and creates a more seamless experience for Drupal users and administrators. Unfortunately, this makes monitoring a large multisite installs more laborious.</p>
<p>Enter Syslog.</p>
<p>Syslog is a local and network logging service that has been around since the 1980s. Most *nix systems come preloaded with Syslog and fortunately for us Drupal has a Syslog module included with the 6.x and 7.x cores. Here&#8217;s how to set it up:</p>
<p><strong>1) Install &amp; configure the Syslog module</strong></p>
<p>Go to your module install page, <code>/admin/build/modules</code> and install the Syslog module. Then go to the Syslog settings page, <code>/admin/settings/logging/syslog</code>, and select which Syslog level to attach to the log messages. Choose one that is not in use by Syslog</p>
<p><strong>2) Configure Syslog</strong></p>
<p>Edit <code>/etc/syslog.conf</code> and add:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">local0.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>drupal.log</pre></div></div>

<p>Then, restart Syslog</p>
<p><strong>3) Disable Watchdog database logging</strong></p>
<p>This will require us to edit the Drupal core (oh noes)<br />
Edit drupal/modules/dblog/dblog.module and comment out the contents of dblog_watchdog() (Around line 132)</p>
<p>Original:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> dblog_watchdog<span style="color: #009900;">&#40;</span><span style="color: #000088;">$log</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$current_db</span> <span style="color: #339933;">=</span> db_set_active<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO {watchdog}
    (uid, type, message, variables, severity, link, location, referer, hostname, timestamp)
    VALUES
    (<span style="color: #009933; font-weight: bold;">%d</span>, '<span style="color: #009933; font-weight: bold;">%s</span>', '<span style="color: #009933; font-weight: bold;">%s</span>', '<span style="color: #009933; font-weight: bold;">%s</span>', <span style="color: #009933; font-weight: bold;">%d</span>, '<span style="color: #009933; font-weight: bold;">%s</span>', '<span style="color: #009933; font-weight: bold;">%s</span>', '<span style="color: #009933; font-weight: bold;">%s</span>', '<span style="color: #009933; font-weight: bold;">%s</span>', <span style="color: #009933; font-weight: bold;">%d</span>)&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uid</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'type'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'variables'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'severity'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'link'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'request_uri'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'referer'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ip'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    <span style="color: #000088;">$log</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'timestamp'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$current_db</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    db_set_active<span style="color: #009900;">&#40;</span><span style="color: #000088;">$current_db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Change to:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> dblog_watchdog<span style="color: #009900;">&#40;</span><span style="color: #000088;">$log</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">/*
  $current_db = db_set_active();
  db_query(&quot;INSERT INTO {watchdog}
    (uid, type, message, variables, severity, link, location, referer, hostname, timestamp)
    VALUES
    (%d, '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)&quot;,
    $log['user']-&gt;uid,
    $log['type'],
    $log['message'],
    serialize($log['variables']),
    $log['severity'],
    $log['link'],
    $log['request_uri'],
    $log['referer'],
    $log['ip'],
    $log['timestamp']);
&nbsp;
  if ($current_db) {
    db_set_active($current_db);
  }
*/</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And you&#8217;re done.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2011/02/setup-syslog-on-drupal-6-x-and-7-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Drush to update a module in a Drupal multisite environment</title>
		<link>http://mattdanger.net/2011/01/use-drush-to-update-a-module-in-a-drupal-multisite-environment/</link>
		<comments>http://mattdanger.net/2011/01/use-drush-to-update-a-module-in-a-drupal-multisite-environment/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 03:34:59 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[drush]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=304</guid>
		<description><![CDATA[I love Drush. It makes managing my Drupal multisite installs much less complicated. I used to write custom scripts to loop through all the sites an perform actions but this little bit of code has made my maintenance tasks so much simpler. for SITE in `ls /path/to/drupal/sites &#124; grep "\."`; do /path/to/drush --uri=$SITE --root=/path/to/drupal --yes&#8230;]]></description>
			<content:encoded><![CDATA[<p>I love <a href="http://drupal.org/projects/drush">Drush</a>. It makes managing my Drupal multisite installs much less complicated. I used to write custom scripts to loop through all the sites an perform actions but this little bit of code has made my maintenance tasks so much simpler.</p>
<pre style="bash">

for SITE in `ls /path/to/drupal/sites | grep "\."`;
do
/path/to/drush --uri=$SITE --root=/path/to/drupal --yes updatedb
done
</pre>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2011/01/use-drush-to-update-a-module-in-a-drupal-multisite-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>perl-Net-SSLeay dependency error when installing Memcached with yum</title>
		<link>http://mattdanger.net/2010/12/perl-net-ssleay-dependency-error-when-installing-memcached-with-yum/</link>
		<comments>http://mattdanger.net/2010/12/perl-net-ssleay-dependency-error-when-installing-memcached-with-yum/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 23:39:19 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[perl-IO-Socket-SSL]]></category>
		<category><![CDATA[perl-Net-SSLeay]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=297</guid>
		<description><![CDATA[Today while configuring another production CentOS 5.5 machine I ran into a problem where memcached refused to install. [root@localhost ~]# yum install memcached Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * rpmforge: apt.sw.be rpmforge &#124; 1.1 kB 00:00 rpmforge/primary &#124; 2.2 MB 00:01 rpmforge 10361/10361 Setting up Install Process Resolving Dependencies --> Running&#8230;]]></description>
			<content:encoded><![CDATA[<p>Today while configuring another production CentOS 5.5 machine I ran into a problem where memcached refused to install.</p>
<p><code>[root@localhost ~]# yum install memcached<br />
Loaded plugins: fastestmirror<br />
Loading mirror speeds from cached hostfile<br />
 * rpmforge: apt.sw.be<br />
rpmforge                                                                                                        | 1.1 kB     00:00<br />
rpmforge/primary                                                                                                | 2.2 MB     00:01<br />
rpmforge                                                                                                                   10361/10361<br />
Setting up Install Process<br />
Resolving Dependencies<br />
--> Running transaction check<br />
---> Package memcached.i386 0:1.4.5-1.el5.rf set to be updated<br />
--> Processing Dependency: perl(AnyEvent) for package: memcached<br />
--> Processing Dependency: perl(AnyEvent::Socket) for package: memcached<br />
--> Processing Dependency: perl(AnyEvent::Handle) for package: memcached<br />
--> Processing Dependency: libevent-1.1a.so.1 for package: memcached<br />
--> Processing Dependency: perl(YAML) for package: memcached<br />
--> Processing Dependency: perl(Term::ReadKey) for package: memcached<br />
--> Running transaction check<br />
---> Package compat-libevent-11a.i386 0:3.2.1-1.el5.rf set to be updated<br />
---> Package perl-AnyEvent.noarch 0:5.240-1.el5.rf set to be updated<br />
--> Processing Dependency: perl(JSON::XS) >= 2.2 for package: perl-AnyEvent<br />
--> Processing Dependency: perl(JSON) >= 2.09 for package: perl-AnyEvent<br />
--> Processing Dependency: perl(EV) >= 3.05 for package: perl-AnyEvent<br />
--> Processing Dependency: perl(Guard) >= 1.02 for package: perl-AnyEvent<br />
--> Processing Dependency: perl(Net::SSLeay) >= 1.33 for package: perl-AnyEvent<br />
---> Package perl-TermReadKey.i386 0:2.30-3.el5.rf set to be updated<br />
---> Package perl-YAML.noarch 0:0.71-1.el5.rf set to be updated<br />
--> Running transaction check<br />
---> Package perl-AnyEvent.noarch 0:5.240-1.el5.rf set to be updated<br />
--> Processing Dependency: perl(Net::SSLeay) >= 1.33 for package: perl-AnyEvent<br />
---> Package perl-EV.i386 0:3.9-1.el5.rf set to be updated<br />
--> Processing Dependency: perl(common::sense) for package: perl-EV<br />
---> Package perl-Guard.i386 0:1.021-1.el5.rf set to be updated<br />
---> Package perl-JSON.noarch 0:2.17-1.el5.rf set to be updated<br />
---> Package perl-JSON-XS.i386 0:2.27-1.el5.rf set to be updated<br />
--> Running transaction check<br />
---> Package perl-AnyEvent.noarch 0:5.240-1.el5.rf set to be updated<br />
--> Processing Dependency: perl(Net::SSLeay) >= 1.33 for package: perl-AnyEvent<br />
---> Package perl-common-sense.i386 0:3.0-1.el5.rf set to be updated<br />
--> Finished Dependency Resolution<br />
perl-AnyEvent-5.240-1.el5.rf.noarch from rpmforge has depsolving problems<br />
  --> Missing Dependency: perl(Net::SSLeay) >= 1.33 is needed by package perl-AnyEvent-5.240-1.el5.rf.noarch (rpmforge)<br />
Error: Missing Dependency: perl(Net::SSLeay) >= 1.33 is needed by package perl-AnyEvent-5.240-1.el5.rf.noarch (rpmforge)<br />
 You could try using --skip-broken to work around the problem<br />
 You could try running: package-cleanup --problems<br />
                        package-cleanup --dupes<br />
                        rpm -Va --nofiles --nodigest<br />
The program package-cleanup is found in the yum-utils package.<br />
</code></p>
<p>CentOS&#8217;s yum repository doesn&#8217;t have the latest perl-Net-SSLeay and perl-IO-Socket-SSL packages that are required by memcached. I did some Googling to find that <a href="http://www.linuxquestions.org/questions/linux-software-2/memcached-844721/">others</a> were experiencing a similar problem without resolution. Here&#8217;s the simple fix:</p>
<p>First, remove the old perl modules. Then download and install the newer versions that memcached requires.</p>
<p><code>rpm-e perl-Net-SSLeay-1.30-4.fc6<br />
rpm -e perl-IO-Socket-SSL-1.01-1.fc6<br />
wget http://packages.sw.be/perl-Net-SSLeay/perl-Net-SSLeay-1.36-1.el5.rfx.i386.rpm<br />
wget http://packages.sw.be/perl-Net-SSLeay/perl-Net-SSLeay-1.36-1.el5.rfx.x86_64.rpm<br />
wget http://packages.sw.be/perl-IO-Socket-SSL/perl-IO-Socket-SSL-1.34-1.el5.rfx.noarch.rpm<br />
rpm -i perl-Net-SSLeay-1.36-1.el5.rfx.x86_64.rpm<br />
rpm -i perl-Net-SSLeay-1.36-1.el5.rfx.i386.rpm<br />
rpm -i perl-IO-Socket-SSL-1.34-1.el5.rfx.noarch.rpm</code></p>
<p>Now you should be able to install memcached without error.</p>
<p><code>yum -y install memcached</code></p>
<p>If you experience an error removing either of the packages then you can try greping to see if you have other versions installed.</p>
<p><code>rpm -qa | grep perl-Net-SSLeay</code></p>
<p>and </p>
<p><code>rpm -qa | grep perl-IO-Socket-SSL</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2010/12/perl-net-ssleay-dependency-error-when-installing-memcached-with-yum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safari 5 hanging on page loads</title>
		<link>http://mattdanger.net/2010/09/safari-5-hanging-on-page-loads/</link>
		<comments>http://mattdanger.net/2010/09/safari-5-hanging-on-page-loads/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 17:22:07 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[Safari 5]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=289</guid>
		<description><![CDATA[Is your Safari 5 hanging when loading pages? Try switching your DNS servers or dumping your Safari cache: rm -r ~/Library/Caches/com.apple.Safari]]></description>
			<content:encoded><![CDATA[<p>Is your Safari 5 <a href="http://discussions.info.apple.com/thread.jspa?threadID=2453384">hanging when loading pages</a>? Try <a href="http://discussions.info.apple.com/thread.jspa;jsessionid=97F2128925281CEA0817DC515B33471F.node0?messageID=11758096">switching your DNS servers</a> or dumping your Safari cache:</p>
<p><code>rm -r ~/Library/Caches/com.apple.Safari</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2010/09/safari-5-hanging-on-page-loads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook-Status-2.1 released</title>
		<link>http://mattdanger.net/2010/05/facebook-status-2-1-released/</link>
		<comments>http://mattdanger.net/2010/05/facebook-status-2-1-released/#comments</comments>
		<pubDate>Thu, 06 May 2010 20:37:51 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=282</guid>
		<description><![CDATA[I have updated my original Facebook status script to version 2.1. Grab it from here. The major change for this version is a switch to Facebook&#8217;s mobile pages for easier parsing. You can include this script into all sorts of wacky things. Usage example: perl facebook-status-2.1.pl Facebook login name: some.user@example.com Password: ****** Your status (Facebook&#8230;]]></description>
			<content:encoded><![CDATA[<p>I have updated my original Facebook status script to version 2.1. Grab it from <a href="http://mattdanger.net/2008/11/update-your-facebook-status-from-the-command-line/">here</a>.</p>
<p>The major change for this version is a switch to Facebook&#8217;s mobile pages for easier parsing. You can include this script into all sorts of wacky things. </p>
<p>Usage example:<br />
<code>perl facebook-status-2.1.pl</p>
<p>Facebook login name: some.user@example.com<br />
Password: ******<br />
Your status (Facebook appears to have a 232 character limit): I'm setting my status removely!!</p>
<p>Sending... Done!</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2010/05/facebook-status-2-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New RocDubs Forum Theme</title>
		<link>http://mattdanger.net/2010/03/new-rocdubs-forum-theme/</link>
		<comments>http://mattdanger.net/2010/03/new-rocdubs-forum-theme/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 16:15:25 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=273</guid>
		<description><![CDATA[Every once in while I like to flex my design muscles. When I moved to Rochester last November I joined up with the local european car group RocDubs. These kids have been a lot of fun to hang out with. Like most car groups we have a forum (vBulletin) and we needed a personalized flavor&#8230;]]></description>
			<content:encoded><![CDATA[<p>Every once in while I like to flex my design muscles. When I moved to Rochester last November I joined up with the local european car group RocDubs. These kids have been a lot of fun to hang out with. Like most car groups we have a forum (vBulletin) and we needed a personalized flavor so I took on the task of making a theme. Today I launched it.</p>
<p><a href="http://rocdubs.com"><img src="http://img299.imageshack.us/img299/1334/picture1copy.png" alt="" border="0"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2010/03/new-rocdubs-forum-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with ._ files in Mac OS X</title>
		<link>http://mattdanger.net/2010/01/dealing-with-_-files-in-mac-os-x/</link>
		<comments>http://mattdanger.net/2010/01/dealing-with-_-files-in-mac-os-x/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 01:09:53 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[._]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=270</guid>
		<description><![CDATA[The current code base I&#8217;m working from is located on a network share and controlled by Subversion. I&#8217;ve been dealing with the Apple Double format problem a lot lately and scripted a simple clean up solution. For those unfamiliar with the Apple Double problem, it is an old bug that exists from the early days&#8230;]]></description>
			<content:encoded><![CDATA[<p>The current code base I&#8217;m working from is located on a network share and controlled by Subversion. I&#8217;ve been dealing with the <a href="http://support.apple.com/kb/TA20578">Apple Double format problem</a> a lot lately and scripted a simple clean up solution.</p>
<p>For those unfamiliar with the Apple Double problem, it is an old bug that exists from the early days of Mac OS X. Here&#8217;s the explanation from the Apple Knowledge Base:</p>
<blockquote><p>Before Mac OS X, the Mac OS used &#8216;forked&#8217; files, which have two components: a data fork and a resource fork. The Mac OS Standard (HFS) and Mac OS Extended (HFS Plus) disk formats support forked files. When you move these types of files to other disk formats, the resource fork can be lost.</p>
<p>With Mac OS X, there is a mechanism called &#8220;Apple Double&#8221; that allows the system to work with disk formats that do not have a forked file feature, such as remote NFS, SMB, WebDAV directories, or local UFS volumes. Apple Double does this by converting the file into two separate files. The first new file keeps the original name and contains the data fork of the original file. The second new file has the name of the original file prefixed by a &#8220;._ &#8221; and contains the resource fork of the original file. If you see both files, the ._ file can be safely ignored. Sometimes when deleting a file, the ._ component will not be deleted. If this occurs you can safely delete the ._ file.</p></blockquote>
<p>Essentially, when you&#8217;re working on files located on a network share you end up with duplicates of the file with a &#8220;._&#8221; prefix. The files are empty and are quite the annoyance. They are removed when the network share is unmounted. However, I leave my share mounted for long periods of time and the files make a mess of my Subversion status reports.</p>
<p>You can run the following command to clean the files up. </p>
<p><code>find . -name '._*' -exec rm '{}' ';'</code></p>
<p>You could also make this into a launchctl or cron task. Happy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2010/01/dealing-with-_-files-in-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making database changes to Drupal multi-sites</title>
		<link>http://mattdanger.net/2009/12/making-database-changes-to-drupal-multi-sites/</link>
		<comments>http://mattdanger.net/2009/12/making-database-changes-to-drupal-multi-sites/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 03:29:22 +0000</pubDate>
		<dc:creator>Matt Danger</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[multi-site]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://mattdanger.net/?p=258</guid>
		<description><![CDATA[The company I work for hosts over 150 Drupal sites in a multi-site configuration and every so often I need to publish a change to the code that requires a database change. The large number of sites we host means that performing manual changes would require too much time and carries a chance of error.&#8230;]]></description>
			<content:encoded><![CDATA[<p>The company I work for hosts over 150 Drupal sites in a multi-site configuration and every so often I need to publish a change to the code that requires a database change. The large number of sites we host means that performing manual changes would require too much time and carries a chance of error. I&#8217;ve come up with a simple solution.</p>
<p>I first create a PHP script that bootstraps Drupal. Here is an example of a script that will rebuild the menu router tables.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Bootstrap</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'includes/bootstrap.inc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'includes/common.inc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
drupal_bootstrap<span style="color: #009900;">&#40;</span>DRUPAL_BOOTSTRAP_FULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Rebuild menus</span>
menu_rebuild<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'Menu rebuild complete\n'</span><span style="color: #339933;">;</span></pre></div></div>

<p>I name this script <code>rebuild_menus.php</code> and upload it to my Drupal directory. Then, I create a text file on my desktop that contains a list of all the Drupal websites. This is an abbreviated example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//example1.com</span>
http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//example2.com</span>
http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//example3.com</span>
http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//example4.com</span></pre></div></div>

<p>Finally, I execute the script on all the sites by running the following command:</p>
<p><code>for url in `cat list.txt`; do echo "Running script on $url"; curl $url/rebuild_menus.php; echo; done</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mattdanger.net/2009/12/making-database-changes-to-drupal-multi-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

