Monthly Archive for March, 2007

Qemu 0.9 for Mandriva 2007

I’ve just backported qemu 0.9 to Mandriva 2007. This release include the kqemu 1.3.0pre11 kernel module, which was released under the GPL some weeks ago.

As usual, this package is available in my RPM repository.

Website Backup Script: MySQL dumps and SSH supported.

Three months after the last version, here is a big update of my backup scripts for websites. The script was greatly improved and among new features, the most important is the support of backups over SSH and backups of MySQL databases.

Change log:

  • Each item of the user’s backup_list must specify the type property (FTP, FTPs, SSH, MySQLdump or MySQLdump+ssh).
  • The property previously known as site is now host.
  • File system structure changed: /ftp-mirror folders renamed to /mirror.
  • Add SSH backups.
  • The script is able to detect if a SSH connexion can be initiated without a password. This was designed for people who don’t like the idea of storing clear password in the script. Thanks to this feature, you can benefit public key authentication from OpenSSH.
  • Use of rsync whenever it’s possible for bandwidth efficiency.
  • FTP and FTPs (aka FTP over SSL) are now handled separately: this supress the default fall-back to FTP if FTPs is not supported by the remote server. This is safer as it doesn’t let lftp make the decision for you to send your clear password on the net.
  • All ports are optionnal, no need to specify it you use default ports.
  • Add MySQL backups thanks to mysqldump.
  • Two mode of MySQL backups: through SSH or direct connection to server.
  • A particular database to backup can be specified. Else, all databases are backed up.
  • Much more detailed logs that include external command’s output.
  • Auto-detect the existence of required external tools and commands at launch.
  • Use pexpect lib to simulate user password input.
  • Run all external commands in english for consistency.
  • Check that the script is running in a posix environnement.
  • Fix bug related to directory creation.

If you were using a previous version of my backup script and want to use this updated version, take care of changes, especially the ones describes in the first 3 items of the change log above.

Ultimate Regular Expression for HTML tag parsing with PHP

Tonight I found the ultimate regex to get HTML tags out of a string. It was written a year ago by Phil Haack on his blog. His regex is quite bullet-proof: it’s able to parse HTML tags written on multiple lines which contain any sort of attributes (with or without a value, with single or double quotes).

Unfortunately his regular expression was designed for Microsoft .NET, so I’ve spend some time to convert it to PHP. Here is the result:

$regex = "/<\/?\w+((\s+\w+(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)\/?>/i";

And finally, my version based on the one above:

$regex = "/<\/?\w+((\s+(\w|\w[\w-]*\w)(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)\/?>/i";

The latter include the following enhancement:

  • accept hyphens as attribute’s middle characters (thanks Ged)

Sapphire style for K2 Wordpress theme

Sapphire custom style for K2 Wordpress Theme

Yesterday I’ve build a new K2 style based on the legacy Sapphire 1.0 Wordpress theme by Michael Martine. This is the result of my love to the blue bend of Sapphire and the versatility of K2.

As you can see in the footer of that blog, I’m using my Sapphire 0.1 style right now. So if you like the look and feel of that blog, don’t ask yourself and download Sapphire 0.1 for for K2 !

To install it, unzip the archive to your /wp-content/themes/k2/styles/ folder.

e107 to WordPress v0.7: support Categories and Private Pages

e107 to WordPress import plugin v0.7: News and Categories Imported screenshotI’ve released a new version of my e107 migration script for WordPress. This release is numbered v0.7.

Here is the change-log:

  • Import e107 news categories.
  • Mails can be sent to each user to warn them about their new password. This is the only solution I found to fix the issue about reseted passwords.
  • Thanks to the 2.1 branch of Wordpress, static pages can be set as private. This version of my script use this feature.
  • Private pages also deprecate the questions asked to the user when importing pages. So I deleted those parameters (”Warning 2” on the screenshot) to make the import process easier.
  • Embedded e107 code updated from v0.7.8.
  • Tested with Wordpress 2.1.2.
  • Some little UI imporvements (to match admin UI consistency).

Because of its de-facto standard status, my import script is now packaged as a .zip file. It can be downloaded from my Linux Scripts section.