planet
Finally graduated, with .... Rules & Drupal!
After about a year full of work around Drupal 7, Rules & Web services I recently graduated my master studies "Information & Knowledge Management" at the Vienna University of Technology. As finally my thesis will be presented officially with others at this year's epilog, I thought it would be a good time to share my thesis to the public.
The thesis title is "Event-Condition-Action rules for distributed content management", thus I've worked on a re-architectured version of Rules that is able to work across system boundaries, e.g. multiple Drupal installations. That resulted in Rules 2.0 as well as stuff like the Entity API being created - but better, it finally made it possible for me to fully concentrate on working on Drupal - awesome!
Thesis abstract: For the popular open source Content Management System (CMS) Drupal the Rules extension module makes it feasible for users to configure reactions on a high level without requiring any programming expertise. To achieve that, the extension allows for the specification of reactive rules - or more precisely it leverages Event-Condition- Action rules, for which the actions are executed when a specified event occurs and the conditions are met. Finally the ability to create custom reactions constitutes an opportunity for users to rapidly adapt the behavior of Drupal based web applications. In this thesis the existing Rules extension module is analyzed and revised in order to obtain an extensible and reusable solution, for which all identified flaws have been eliminated. Moreover the module is advanced to work across system boundaries, such that it can be utilized for the rule-based invocation of web services as well as for reacting on remotely occurring events. Therefore the solution obtains the ability to work with arbitrary data structures with the help of metadata, so that the data of remote systems can be seamlessly integrated based on metadata. Building upon this capability we present the rule-based utilization of RESTful and WS* web services and introduce Rules web hooks - a novel approach for the interaction of Drupal based web applications that exploits reaction rules to enable custom near-instant reactions on remotely occurring events.
Get the full-text of the thesis at https://wolfgangziegler.net/thesis. At this point, let me thank my employer epiqo for sponsoring this work, as well as my academic advisors O.Univ.Prof. Dipl.-Ing. Dr.techn. A Min Tjoa and Mag. Dipl.-Ing. Dr. Amin Anjomshoaa of the Institute of Software Technology and Interactive Systems, who already did a great job supporting the Drupalcamp Vienna 2009.Metadata, what for? - Introducing Entity Metadata!
Drupal 7 modules working with entities often face the same problems:
- How to create/save/delete an entity?
- How to get referenced entities?
- Which properties are there and how can they be accessed or modified?
Metadata for data properties, why that?
You might think, we have fields. Yes we have, but not everything is a field. There are also entity properties, like the node title and author, the term hierarchy and lots of others. Entity metadata collects information about all that available properties - regardless whether they are fields or not - and makes them accessible the same way. For that you have to provide property info via a hook, e.g. this is the info the module provides for books:Drupalcon San Francisco
Using Git to deploy code changes..
git push dev
? Well with Git that's pretty easy to achieve.
First create a new Git repository on the remote if you haven't yet:
Then push your code to this repository initially and then check it out:
So now we need to make Git automatically checking out the latest code once you pushed it in. For that create the script ".git/hooks/post-receive":
And don't forget to make the file executable.
Now as the code is automatically updated, we need to disable the usual warning when one pushes to a remote repository with a checkout:
That's it. Simple and useful, not? :)
Credits go to http://toroid.org/ams/git-website-howto, which I used to come up with this.About using git to maintain a drupal module...
First tries..
I decided to don't go back to CVS for maintaining drupal modules. First I tried using the public GIT mirror of the whole drupal CVS from the French drupal community, however I quickly noted that it was broken for the rules module, so I tried to set up my on mirror. I started using Sam Boyer's scripts, however I had some misc small troubles with them, but more important those scripts copy the whole drupal CVS - but I didn't like to waste ~6 gigs of disk space and the time to sync all the unneeded stuff. So I ended writing my own script based on the instructions in the drupal handbook for maintaining a module with git and Sam's script. After some weeks going back and forth I finally ended up with something useful, so here are my experiences:What is it about?
Currently I've set the script up to export the drupal CVS of some of my modules to GIT - its automatically pushing to my github account, which is quite convenient. It syncs only the really needed modules using rsync - which is an important step as its greatly speeding up cvsps when exporting from CVS. The nice thing is that it doesn't overwrite any changes not yet in CVS, so I can use the same git repository on github to develop new stuff and export to CVS later on.Are entities drupal's new nodes?
Introducing the concept of Extendable Object Faces (API)
- Extend an object by providing an Extender Class
- Extend an object simply by some functions, each implementing a method
- Override any dynamically added method by providing functions or an Extender Class
- Easily lazy load huge parts of an objects implementation, invisible for the caller.
- Allow modules to dynamically alter an implementation by using overriding.
Dreaming...
If we would have an object oriented "Data API" in drupal core, this could serve as a way to let modules extend those objects. So instead of writing node-centric code code could would be written in a generic way - attachable to potentially each of those data objects (users, comments, terms). Having such generic code would allow us to finally end the "Everything should be a node" debate. Apart from that this would help us to easily lazy load big chunks of code, just exploiting the code registry!Reactive rules for drupal have grown-up!

Flag module 6.x-1.0 shipping with rules integration!
Flag is a flexible flagging system that is completely customizable by the administrator. Using this module, the site administrator can provide any number of flags for nodes, comments, or users. Some possibilities include bookmarks, marking important, friends, or flag as offensive. With extensive views integration, you can create custom lists of popular content or keep tabs on important content.But even better the 1.0 (and 1.1) release is shipping with extensive rules integration. So once you have installed both modules you can create flags and use rules to add some behaviour to them, e.g. you can react once a flag is "flagged" or "unflagged" and send mail to the content node's author, unpublish it, change the content's access settings - or whatever you have actions and conditions for! Then the module also provides actions for flagging or unflagging flags, checking the flag count in case of global flags and even to "Trim flags", which allows you to restrict the number of flagged items. This way you could even create simple queues. Of course there also conditions to check whether a flag is flagged and again in case of a global flag you can check the flagging count. Amazing! Also the flag module comes with a bunch of useful settings, so you can configure the flag to have a confirmation form or to just work with an AJAX link. Together with the powerful rules integration one could implement a lot of useful stuff - want a custom link with custom permissions to publish a content node? Just use a flag and an appropriate rule!