Thursday, May 22, 2008

Introducing Kickstart and JPA

One of the most notable additions in JoomlaPack 1.2 - which is still in Alpha - is that we now offer a renowned archive format, the JoomlaPack Archive (JPA) format. Its major benefit is that it can be more reliably created in the context of PHP script, such as JoomlaPack. On the downside, it is a custom format, without support from external tools. In here I will tell you not only how you can extract the archive, but how you can easily restore a site's backup too! But first, let's see how and why we got there...

Most people upload files to their sites using FTP. Despite of being the most widely used file transfer protocol for uploading files, it comes with some drawbacks. The most prominent is slow uploads when you have lots of small files. A Joomla! installation is a typical example, with over 3000 files occupying a mere 15Mb. No matter how much bandwidth you have, uploading takes at best half an hour.

Wait a minute! Half an hour for 15Mb worth of files?! It reminds me the dark days when I used PSTN to connect to the internet... But, what else can you do? If you upload the backup archive itself, it certainly gets uploaded fast (the more bandwidth you have, the faster it's uploaded), but you can't "run" the ZIP/JPA file. Or can you?

Using this thought, I decided to create a script which can "bootstrap" the installation process. I won't take credit for the original idea; I took it from the way software such as Joomla.Start works. I just enhanced the original idea in order to:

  • use AJAX-powered, multiple step unpacking, so that it can operate on huge archives
  • support both ZIP and JPA formats
  • handle .htaccess renaming automatically
  • delete itself, the installation folder and the archive after the installation is complete

It has one fundamental limitation, which is actually a limitation of PHP itself: the Safe Mode has to be turned off, or the folder on which you'll extract the archive has to be owned by the same user as the one the web server runs under. Just setting the permissions won't help it.

So far this software is alpha as well and you can get it through our SVN repository (directory kickstart). In order to use it just upload the backup archive and the kickstart.php to your server, then visit http://www.mysite.com/kickstart.php. Just follow the instructions from that point. In the end you'll have a fully functional site set up in -literally- minutes!