Quick news

  • 2014-03-27: MongoDB Watchdog module ported to Drupal 8 at the Szeged Dev Days.
  • 2014-01-26: My post on the Symfony web profiler in Silex selected in Week of Symfony. w00t !
  • 2013-10-18: My first commit went into MongoDB today. And, guess what ? It's in JavaScript
  • 2013-09-20 to 29: Working on Drupal 8 EntityAPI at the extended code sprints during and around DrupalCon Prague
  • 2012-08-19: Working on Drupal 8 EntityAPI at Drupalcon Munich
  • 2012-06-15: Working on Drupal 8 EntityAPI at DrupalDevDays Barcelona
  • 2012-03-23: Working on the future Drupal Document Oriented Storage at DrupalCon Denver. D8 or later ? Bets are on Later

Latest sites

  • 2014-08-18: 400% speedup in 3 weeks for http://france3-regions.francetvinfo.fr/ : who said Drupal back-offices had to be slow ?
  • 2014-02-07: Sotchi Olympics traffic not a problem for http://www.francetvsport.fr/ , which I rearchitected on Drupal 7 in 2013
  • 2013-08-04: Classified Ads 3.1-beta1 for Drupal/Pressflow 6 and Drupal 7
  • 2011-09-14: Completed migration of FranceInfo.FR from SPIP to Drupal
  • 2011-07-13: The new social network features of Le Figaro are now powered by an OSInet-designed MongoDB implementation
  • 2010-12-21: Madame Figaro brand new site by OSInet and others
  • 2010-08-16: France.FR is back online with OSInet and Typhon
  • 2010-06-15: the new France Culture, which OSInet helped reach its performance goals, is now online

Multiple entries with Zend_Config_XML

I had been in need of a class to read config data into both the PHP-GTK OSInet back-office front end, and the back-office client UI for the Drupal 5.x offload module, and hesitated between various solutions, ranging from roll-our-own to the various frameworks out there and the existing PEAR packages.

Zend Framework logoSince Zend Framework appears to be well on its way to becoming a standard for professional PHP developers, I figured I'd give it a spin :

  1. work notes within Zend Framework (ZF) regularly allude to CLI and GTK, although I could not find any concrete example about using ZF classes within a PHP-GTK app
  2. ZF includes a tempting Zend_Config class, which seems to cover our needs in a simple fashion

The good news is that it works like a charm, although ZF has not yet reached version 1.0. The Zend_Config_XML manual page is sufficient to demonstrate how to use the code, but skips an important point : configuration files frequently have to include a list of values. A time honored practice in INI files is to number variables and read them in until failure occurs. Seeing how Zend_Config_XML parses the file, I figured it might be more useful to declare the list and use it directly, so here is a sample config file for the offload Drupal module:

<?xml version="1.0"?>
<zf>
  <offload>
    <tables>
      <list>table1,table2</list>
      <table1>
        <name>accesslog</name>
        <key>aid</key>
        </table1>
      <table2>
        <name>zeitgeist</name>
        <key>*</key>
        </table2>
      </tables>
    <drupal>
      <host>www.php-gtk.eu</host>
      </drupal>
    <db>
      <type>PDO_MYSQL</type>
      <host>localhost</host>
      <port>3306</port>
      <username>protect</username>
      <password>the</password>
      <dbname>innocent</dbname>
      </db>
    </offload>
  </zf>

And here is the simplistic code that loads the table list:

<?php
error_reporting
(E_ALL|E_STRICT);
require_once
'Zend/Config/Xml.php';

$window = new GtkWindow();
/* ... skip vanilla PHP-GTK initialization ... */

$filename = 'offload_conf.xml';
$config = new Zend_Config_Xml($filename, 'offload');
$tables = explode(',', $config->tables->list);

/* ... skip further processing ... */
$window->show_all();
Gtk::main();
?>

That's it: $tables now contains the list of tables. No need for a loop of test, just a simple array explode.

ZF and Drupal 6

Hello,
I just wonder how you are getting on with Zend Framework (now 1,5.2), and Drupal 6.2? I need to develop initially a tuition site for non-members and subscribers which includes audio and video downloads and embeds. The next stage is to take it to a community based level.

I am in a turmoil which base to use. On the one hand Drupal has almost everything out of the box, but adding modules and getting Drupal to do other things, seems difficult, more difficult than straight coding, and you need to understand the Drupal API.

Or, do I build my own using ZF, maybe add classes/fuctions from open repositories?

You seem to have worked with both, what are your thoughts?