<?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>geekadin &#187; Web Development</title>
	<atom:link href="http://geekadin.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://geekadin.com</link>
	<description>geek.life</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:05:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=1371</generator>
		<item>
		<title>WordPress Hive Subfolders Fix Update Script</title>
		<link>http://geekadin.com/web-development/wordpress-hive-subfolders-fix-update-script/</link>
		<comments>http://geekadin.com/web-development/wordpress-hive-subfolders-fix-update-script/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 19:29:39 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://geekadin.com/?p=82</guid>
		<description><![CDATA[As a followup to my previous post on how to enable subfolders in WordPress Hive domains I created the script that will go through and update the symlinks in the appropriate folder to keep your installation up to date. You&#8217;d run this after performing an update to WordPress to keep it running smoothly. I think [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p></p><p>As a followup to my previous post on <a href="http://geekadin.com/web-development/how-to-enable-subfolders-for-wordpress-hive/">how to enable subfolders in WordPress Hive domains</a> I created the script that will go through and update the symlinks in the appropriate folder to keep your installation up to date. You&#8217;d run this after performing an update to WordPress to keep it running smoothly. I think this should keep working in the future but I can&#8217;t see the future (if only) so this is provided as is and I&#8217;m not responsible if you screw something up!</p>
<p>It&#8217;s a simple php script you&#8217;ll run from your command line with the parameters of the source folder and the destination folder. With the source being the wordpress installation of the hive and the destination is the domain that is run off of the hive but has its own subfolders. It should tell you about any symlinks it creates and warn you about any potential custom files you have which you should manually compare to the upgrade if needed to see if you need to edit them.</p>
<p>Another thing to keep in mind I&#8217;ve found you need to put the full path to the source directory that you want to copy or it will make relative symlinks that don&#8217;t seem to work.</p>
<pre class="brush: php;">

&lt;?php
// Updating the symlinks in the destination folder for the updated files in the source folder

// Get list of files for each folder
$srcDirName = $argv[1];
$destDirName = $argv[2];

if ($srcDirName == &quot;&quot; || $destDirName == &quot;&quot;) {
echo &quot;Usage: php update_symlinks_src_dest.php [source directory] [destination directory]&quot;;
echo &quot; Please leave ending slashes off of directories / &quot;;
}
echo &quot;Updating symlink from source: &quot; . $srcDirName . &quot; \n&quot;;
echo &quot;To destination:               &quot; . $destDirName . &quot; \n&quot;;

$srcDir = opendir($srcDirName);
$destDir = opendir($destDirName);

$array_dest_files = array();

while ($dest_filename = readdir($destDir)) {
array_push($array_dest_files, $dest_filename);
}

while ($src_filename = readdir($srcDir)) {
// check for file in dest
if (in_array($src_filename, $array_dest_files) ){
// Test each file in both hash against the other
// echo &quot;comparing: src- &quot; . $srcDirName . &quot;/&quot; . $src_filename . &quot; and dest- &quot; . $destDirName . &quot;/&quot; . $src_filename . &quot; \n&quot;;

$srcmd5 = md5_file( $srcDirName . &quot;/&quot; . $src_filename );
$destmd5 = md5_file( $destDirName . &quot;/&quot; . $src_filename );

// if pass then this is a symlink or copy and is ok

if ($srcmd5 != $destmd5) {
// if fail then probably this is a custom file so leave it alone but warn about it
echo &quot;Warning potential custom file not handled: &quot; . $destDirName . &quot;/&quot; . $src_filename . &quot;\n&quot;;
}
}
else {
// if file in src and not dest create a symlink for it
echo &quot;Creating symlink for file: &quot; . $srcDirName . &quot;/&quot; . $src_filename . &quot; \n&quot;;

symlink( $srcDirName . &quot;/&quot; . $src_filename , $destDirName . &quot;/&quot; . $src_filename );
}
}

// if file in dest and not src leave it alone

closedir($srcDir);
closedir($destDir);
?&gt;
</pre>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://geekadin.com/web-development/wordpress-hive-subfolders-fix-update-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Enable Subfolders for WordPress Hive</title>
		<link>http://geekadin.com/web-development/how-to-enable-subfolders-for-wordpress-hive/</link>
		<comments>http://geekadin.com/web-development/how-to-enable-subfolders-for-wordpress-hive/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 19:34:00 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp hive]]></category>

		<guid isPermaLink="false">http://geekadin.com/?p=74</guid>
		<description><![CDATA[I was going to post this over at the WP Hive forums but their forum registration doesn&#8217;t seem to work so I&#8217;ll just put it here. WordPress hive is a super useful plugin that lets you install one copy of WordPress and run a bunch of different sites on it. Quite useful for the enterprising [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a class="post_image_link" href="http://geekadin.com/web-development/how-to-enable-subfolders-for-wordpress-hive/" title="Permanent link to How To Enable Subfolders for WordPress Hive"><img class="post_image alignnone remove_bottom_margin" src="http://geekadin.com/wp-content/wp-hive/geekadin.com/uploads/2010/03/3861233459_f9d31d9106.jpg" width="500" height="355" alt="Wordpress Hive" /></a>
</p><p>I was going to post this over at the WP Hive forums but their forum registration doesn&#8217;t seem to work so I&#8217;ll just put it here.</p>
<p><a href="http://wp-hive.com/">WordPress hive</a> is a super useful plugin that lets you install one copy of WordPress and run a bunch of different sites on it. Quite useful for the enterprising web developer. It does however have some limitations one of which is that since all your sites are pointed to the same place if you want subfolders to hold files or images or whatever that subfolder would be accessible from all the sites run off of the hive installation. Not something you want obviously.</p>
<p>So I figured out a way around this and thought I&#8217;d share. To do this you&#8217;re going to need shell access to your server probably unless you can talk your admins into doing it for you but it could be a bit of a pain.</p>
<p>Anyway typically you&#8217;d install the site into the WordPress Hive plugin using their directions and to get it to work you&#8217;d &#8220;point&#8221; that domain to the domain running the hive. Basically this amounts to adding the domain as an addon domain in your cPanel then making the folder that would hold the domain files into a symlink pointing at the folder holding the hive installation.</p>
<p>Now if you want to enable subfolders for this new site, say you want to host a file people could download or something, what you&#8217;re going to do is instead of making that folder be a symlink you&#8217;ll create that folder. Then you&#8217;re going to go in there and make a symlink to each file in the hive installations folder with the same name. Pretty simple but can take a bit of time. You may want to write a script to do it as well, I haven&#8217;t yet but probably will as you&#8217;ll also have to keep these symlinks up to date when you upgrade WordPress. Another trick is to make a folder that holds all these symlinks (using absolute file names or relative to your home directory)  and just copy it over whenever you want a new site with subfolders enabled. Also keep in mind that if you&#8217;re looking at this folder in your FTP client it&#8217;s going to look like all those files are there instead of just symlinks so be careful that you know what is what if you go messing around with FTPing things around. Oh and always remember to back up stuff before you go messing around you know how unforgiving Unix is.</p>
<p>Now viola you&#8217;ve got subfolders. Now you can put whatever you want in that folder along with the symlinks and serve up other files. For instance you could have a subfolder with another WordPress install in it or another piece of software in that folder.</p>
<p>Sweet huh? Now get back to work! <img src='http://geekadin.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>UPDATE: I&#8217;ve coded up that script to keep the symlinks up to date and made a new post about how to <a href="http://geekadin.com/web-development/wordpress-hive-subfolders-fix-update-script/">how to keep your custom WordPress hive installation up to date</a>.</p>
<p><a href="http://www.flickr.com/photos/fdecomite/3861233459/">Photo Attribution</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://geekadin.com/web-development/how-to-enable-subfolders-for-wordpress-hive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

