Mar 29 2011
mg
Mar 29

Amazon AWS + Drupal

(Some familiarity with Amazon AWS is assumed.)

I have always wanted to setup a high performance Drupal on an AWS EC2. There are several advantages of running your website (or web application) on the AWS. Amazon EC2 creates and provisions virtual Linux (or Windows) servers for you and charge you an hourly rate for usage.

With AWS, it becomes easy to distribute and share the Drupal image with others. And of course it is much easier to scale and is definitely cheaper. You can have different virtual servers running the search engine, database and application servers, therefore all scaling independently of each other.

With the introduction of Micro instances and better yet, free micro instances, the barrier to entry for a new user has really dropped. 

I assume you have or can create an Amazon AWS account and use their management console. These aspects are very well covered in Amazon's site and I will not get into the details of creating an account, etc. Amazon has done a great job of creating the documentation and tutorials for getting started.

I will show how to:

1. Setup a LAMP stack on Ubuntu

2. Setup Drupal on the LAMP stack

3. How to install phpmyadmin

4. Configure the database to reside in the EBS instead of the ephemeral instance storage.

1. Setup a LAMP stack on Ubuntu:

I used a 64 bit image Ubuntu image for my purpose. Amazon provides both 32 bit and 64 bit micro instances, but I wanted to start with 64 bit, because their larger servers are only 64 bit and I can use the same image to scale up to larger Amazon servers. I used the Ubuntu image as my base image. This image is available in the US west region only. (Images are unique to regions and you can get similar images for the region you want to use).

Once your AWS account is setup, sign into the Amazon AWS console. Click on the EC2 tab. Check the region you are running in. If you want to run in US West, select it and click on launch instance. The popup following that will allow you to select an image. Search the image id: ami-01772744. Click on start and continue with default options. You will have to select a key-pair and security group. Make sure the port 80 and port 22 are open in the security group you want to use. Port 80 will allow the HTTP access and port 22 will allow the ssh connectivity to the server. 

You also have to know the location of the Amazon's private key file (.pem) for the key-value pair. The Ubuntu server takes a few minutes to start and be available. 

From the command line on your local machine type:

The part following [email protected] has to be replaced by your server's public dns name that Amazon provides on the console. Note there is no root user and all commands will work through sudo. Ubuntu does this to avoid any root user logins. You can access all the administrative functionality using sudo.

BTW, if the command above does not read and execute due to permission problem, you might want to first run:

        chmod 600 [path to key file]/[key file name].pem

Once connected to the remote server console (your first big milestone BTW), you can create a password for the ubuntu user by typing in (optional):

sudo passwd ubuntu

If you want to enable SSH access via passwords so you don't require the .pem file every time you can do the following:

 edit /etc/ssh/sshd_config to have

PasswordAuthentication yes

Restart the ssh deamon

sudo service ssh restart
OR 
sudo /etc/init.d/apache2 restart

Now with the basic logistics in place, let's set up the LAMP stack on this Ubuntu instance. I found this to be simpler than what I had expected. Write down any usernames and passwords you create from this point on

sudo tasksel install lamp-server

Drupal will need the re-write functionality to be able to perform clean URLs, so run the command

sudo a2enmod rewrite

That's it. You lamp stack is setup.

Go to http://[your public dns] and you should see some output form Apache.

BTW, what I also find really useful is to create some short cuts in the .profile file. For example instead of typing ls -al I can then type la and since I make spelling mistakes while typing sudo, I can point sodu to sudo as well. To do this, edit the /home/ubuntu/.profile file

sudo vim /home/ubuntu/.profile

Add the line:

alias la='ls -al'
alias sodu='sudo'

2. Setup Drupal on the LAMP stack

Setting up Drupal on the LAMP stack is usually just 1 line command and we will need to perform some basic operations:

        sudo apt-get install drupal6

edit the file /etc/apache2/sites-enabled/000-default and change the make the change so that DocumentRoot is now as follows:

        DocumentRoot /usr/share/drupal6

You can install Drupal anywhere and just point the DocumentRoot to that location. Also comment our the block that starts with 

        <Directory />

Also edit the file /etc/apache2/conf.d/drupal6.conf and comment out the line 

        Alias /drupal6 /usr/share/drupal6

restart the Apache so the above configuration changes are reflected correctly

        sudo service apache2 restart

Now go to http://[your public dns/install.php] and voila you are in business.

3. Setup phpmyadmin:

To access the database through phpmyadmin, you will need to install the phpmyadmin and access the URL of the application. Again, this is only optional and you can access all the SQL functionality form command line also. Installing phpmyadmin is trivial:

        sudo apt-get install phpmyadmin

And you are done. Follow the install options if any.

Go the the phpmyadmin application via:

http://[your public dns/phpmyadmin]

The user name is usually root.

4. Configure the database to reside in the EBS instead of the ephemeral instance storage:

Amazon's instances are ephemeral and the storage on the instance is ephemeral as well. That is if the instance is shutdown, the data on it will go away. Now that is not a very desirable configuration. However, Amazon allows you to mount persistant storage on top of the instance. You can mount any number of 1 TB drives on the instance. You can chose the size of the mounted drive at instance startup time.

Essentially, there will already be a mounted drive which you can find by typing:

        mount

The on the mounted drive you can create corresponding directories for logs, DB files and lib

You link the directories on the the mounted drive to the directories on your instance.  The set of commands are as follows:

Shut down the SQL first:
        sudo /etc/init.d/mysql stop

And then create the folders and link them:

        sudo mkdir /vol/etc /vol/lib /vol/log
sudo mv /etc/mysql     /vol/etc/
sudo mv /var/lib/mysql /vol/lib/
sudo mv /var/log/mysql /vol/log/

sudo mkdir /etc/mysql
sudo mkdir /var/lib/mysql
sudo mkdir /var/log/mysql

echo "/vol/etc/mysql /etc/mysql     none bind" | sudo tee -a /etc/fstab
sudo mount /etc/mysql

echo "/vol/lib/mysql /var/lib/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/lib/mysql

echo "/vol/log/mysql /var/log/mysql none bind" | sudo tee -a /etc/fstab
sudo mount /var/log/mysql

        sudo /etc/init.d/mysql start

So, in summary, we saw how to setup the LAMP server, install Drupal and make sure the DB runs on the persistant storage. There is still work to harden the image and to create the image from the instance, and that will be covered in a subsequent blog.

Jan 21 2011
mg
Jan 21

Drupal is widely recognized as a great content management system, but we strongly believe that Drupal offers a lot more than that – a framework, a platform, and a set of technology – to build and run enterprise applications, specifically on the cloud. This post is an attempt to explore the benefits and potential of Drupal on the cloud.

Elasticity

One of the last things the customers should worry about their websites is the performance degradation due to sudden spike in the traffic. For years, the customers had to size their servers to meet the peak demand. They overpaid, and still failed to deliver on promise, at peak load. Cloud solves this elasticity problem really well, and if you are using Drupal, you automatically get the elasticity benefits, since Drupal’s modularized architecture - user management, web services, caching etc. - is designed for scale-up and scale-down on the cloud for elastic load.

PaaS

If Heroku’s $212 million acquisition by Salesforce.com is any indication, the future of PaaS is bright. Drupal, at its core, is a platform. The companies such as Acquia through Drupal Gardens are doing a great job delivering the power of Drupal by making it incredible easy for the people to create, run, and maintain their websites. This is not a full-blown PaaS, but I don’t see why they cannot make it one. We also expect to see a lot more players jumping into this category. The PaaS players such as phpfog and djangy have started gaining popularity amongst web developers.

Time-to-market and time-to-value:

Drupal has helped customers move from concept to design to a fully functional content-rich interactive website in relatively short period of time using built-in features and thousands of modules. Cloud further accelerates this process. Amazon and Rackspace have pre-defined high-performance Drupal images that the customers can use to get started. Another option is to leverage PaaS as we described above. The cloud not only accelerates time-to-market and time-to-value but it also provides economic benefits during scale-up and scale-down situations.

Management

The cloud management tools experienced significant growth in the last two years and this category is expected to grown even more as the customers opt for simplifying and unifying their hybrid landscapes. With Drupal, the customers not only could leverage the cloud management tools but also augment their application-specific management capabilities with Drupal’s modules such as Quant for tracking usage, Admin for managing administrative tasks, and Google Analytics for integration with Google Analytics. There is still a disconnect between the cloud native management tools and Drupal-specific management tools, but we expect them to converge and provide a unified set of tools to manage the entire Drupal landscape on the cloud.

Open source all the way

Not only Drupal is completely open source but it also has direct integration with major open source components such as memcached, Apache SOLR, and native support for jQuery. This not only provides additional scale and performance benefits to Drupal on the cloud but the entire stack on the cloud is backed by vibrant open source communities.

Security

It took a couple of years for the customers to overcome the initial adoption concerns around the cloud security. They are at least asking the right questions. Anything that runs on the cloud is expected to be scrutinized for its security as well. We believe that the developers should not explicitly code for security. Their applications should be secured by the framework that they use. Drupal not only leverages the underlying cloud security but it also offers additional security features to prevent the security attacks such as cross-site scripting, session hijacking, SQL injection etc. Here is the complete list by OWASP on top 10 security risks.

Search and Semantic Web

One of the core functionally that any content website needs is search. Developers shouldn’t have to reinvent the wheel. Integration with SOLR is a great way to implement search functionality without putting in monumental efforts. Drupal also has built-in support for RDF and SPARQL for the developers that are interested in Semantic Web.

NoSQL

The cloud is a natural platform for NoSQL and there has been immense ongoing innovation in the NoSQL category. For the modern applications and websites, using NoSQL on the cloud is a must-have requirement in many cases. Cloud makes it a great platform for NoSQL is so is Drupal. Drupal has modules for MongoDB and Cassandra and the modules for other NoSQL stores are currently being developed.

Drupal started out as an inexpensive content management system, but it has crossed the chasm. Not only the developers are trying to extend Drupal by adding more modules and designing different distributions, but importantly enterprise ISVs have also actively started exploring Drupal to make their offerings more attractive by creating extensions and leveraging the multi-site feature to set up multi-tenant infrastructure for their SaaS solutions. We expect that, the cloud as a runtime platform, will help Drupal, ISVs, and the customers to deliver compelling content management systems and applications on the cloud.

Jan 12 2011
mg
Jan 12

I had written about setting up php debugging environment with Eclipse on windows.

Well, turns out, setting up the debug environment on Mac OS X is also a little tricky since the library files do not always work.

I used the Helios Eclipse PDT distribution. I tried using the Zend debugging environment. But after struggling with the settings in the php.ini file, I decided to try XDebug. XDebug is straightforward, once you have crossed the windy roads. 

Here is the main gottcha - the default xdebug.so which ships with MAMP server might not always work. xdebug.org does not have the mac os x distribution for the .so file either. The one that ships with komodo editor however works and you can get it from here. Once you download the right file, save it and note the location.

Next edit the php.ini located at /Applications/MAMP/conf/php5.3 - Add the following to it

zend_extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.profiler_enable = On
xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.idekey=ECLIPSE_DBGP

Now if you run phpinfo(), you should get some output about xdebug. The basic debugging is setup.

Make sure your eclipse is configured to work with php5.3 and that it uses the xdebug.

Don't modify ini files or other setting for php5.2 or in the incorrect directory. This usually makes up for most errors.

You should be on your way to happily debug Drupal now.

Dec 25 2010
mg
Dec 25

Sure there are modules for getting an auto complete textfield in Drupal. But where would the fun be then :)

Here I will show you how to write your own auto complete AJAX textfield. It is surprisingly easy and we will walk through all the steps from defining a text box to writing a SQL query to fetch the results to display.

Basically there are following steps to the whole process:

1. Define a textfield which will act as an auto complete

2. Define a menu item which will be invoked by our textfield(form element)

3. Call a function (handler function) which will hit a SQL query and fetch the results.

1. Define the form element - textfield:

$form['item'] = array(
'#type' => 'textfield',
'#title' => t('Select the entry'),
'#autocomplete_path' => 'nodes/autocomplete',
);

Drupal offers an #autocomplete_path attribute for textfields. This tells Drupal to look at the menu which handles the url and react accordingly. So next we define the menu which will handle this URL

2. Menu item to handle the URL

$items['nodes/autocomplete'] = array(
'page callback' => 'nodes_autocomplete',
'access arguments' => user_access('access example autocomplete'),
'type' => MENU_CALLBACK,
);

This entry in the hook_menu() will forward the request to the function 

nodes_autocomplete()

3. Guts of the autocomplete

In the function, nodes_autocomplete() you will implement the code the return the list of items to be shown in the textfield. In this case, we can fetch a node of type my_type

function nodes_autocomplete($string){
$items = array();
$result = db_query("SELECT nid, title FROM {node} WHERE status = 1 AND
type='my_type' AND title LIKE LOWER ('%s%%')", $string) ;
while($obj = db_fetch_object($result)) {
$items[$obj->nid] = check_plain($obj->title);
}
drupal_json($items);
}

This function makes the SQL query to retrive all nodes of type my_type and searches the title for autocomplete. drupal_json() formats the data in JSON format. So the $items will be returned as JSON which our javascript will be able to handle and show the results.

This is all you need and you should be on your way to having your own autocomplete textfield in Drupal. Drupal has all the built in support for these kinds of calls.

Dec 04 2010
mg
Dec 04

This is the part III of the Drupal Database Abstraction Layer

In part I of the database series we saw how to

1. Creating and deleting the tables when a module is installed or uninstalled.

2. Updating the table structure once the module is in use. So the users can apply a patch easily

In Part II we visited 

1. Ways to write secure database calls that can eliminate SQL injection

2. Reading from the database and iterating over results

Here we will look at the following mechaisms in Drupal Database Abstraction

1. Reading only a certain number of records where the query can specify start and end result number.

2. Making table names unique in a shared hosting environment

1. Reading only a certain number of records where the query can specify start and end result number.

If you substitute db_query with db_query_range($query), you can specify start and end of the result. This function will run a limited-range query.

db_query_range($query, $from, $count, array $args = array(), array $options = array())

$from = starting result number

$count = number of results

This can be a great way to implement stateless pagination.

2. Making table names unique in a shared hosting environment

While writing your queries did you notice that you wrap your tabel names in curly braces {}? There is no evil intention behind this. This actually is a very interesting feature from Drupal's database abstraction layer. The {} tells the query processor to add a unique prefix to your table names. The prefix name resolution is done via the function db_prefix_tables(). This function searches for this syntax and adds Drupal's table prefix to all tables, allowing Drupal to coexist with other systems in the same database if necessary. The prefix is defined in the settings.php with key $db_prefix.

This is useful in a shared hosting environment to resolve any naming clashes.

Hope you find it useful. Please refer api.drupal.org for more details

Nov 30 2010
mg
Nov 30

In the previous blog we saw how to

1. Create and delete tables when the modules are installed or uninstalled

2. Updating a table once the module is in use. This allows for applying patches easily

In this blog we will see two other aspects of the Drupal database layer

1. Writing secure SQL to avoid SQL injection

2. Reading from a database and iterating over results

1. Writing secure SQL:

What is SQL injection attack? 

It is a way to modify the request URL in a way to force the server to execute unintended SQL query. If the application is not performing any sanitization and constructs SQL statements on the fly, SQL injections can be easy to manufacture. For example if you type a query:

"SELECT * from node where type = '$type'";

And $type is a parameter that coming from the URL:

http:yourSite.com/q=story (for Story)

Now all a user has to do is modify the URL and type 

http:yourSite.com/q=story' OR type = 'page'

This will return back all the nodes of type story and page. Think of all the conditions a user can enter in the where clause and retrieve different information from your site.

A simple fix for this is to use placeholders in the query and escaping the inputing. So instead of typing the query as:

$result = db_query( "SELECT * from node where type = '$type'");

you would type it as 

$sql = "SELECT * from node where type = '%s';

$result = db_query($sql, $type);

%s converts the $type to a string so if the user modified the URL as shown above to story' OR type = 'page' the SQL will be converted to 

"SELECT * from node where type = 'story/' OR type = 'page/'; There are no content types that contain / at the end which is basically escaping the single quote. Thus the query would fail and the attack would be useless.

2. Reading data from database

First look at a database statement returning a single value:

So if you had a query:

$sql = "SELECT molecule_name from {molecule} where id = '%s'";

$result = db_query($sql, id);

then a convenience function db_result will will return the result. So to return a single value the code would be:

return db_result($result);

And that's it.

If however the query returns multiple rows then the following while loop is required:

while ($res = db_fetch_object($result)){

  do something with $res2

}

db_fetch_object will parse and iterate over the $result.

These handy trips can be quite useful. Don't forget to refer to http://api.drupal.org for more details. In the next blog, we will cover reading specific number of records from the database and unique table names in a shared hosting environment.

Nov 29 2010
mg
Nov 29

If you develop modules in Drupal you know what I am talking about here. However for the uninitiated, this might be useful.

Drupal provides an abstraction on the database and whether you are using mysql or postgres, you write only one code and call drupal's in built functions. 

The DB layer takes care of 

1. Creating and deleting the tables when a module is installed or uninstalled.

2. Updating the table structure once the module is in use. So the users can apply a patch easily

3. Provides ways to write secure database calls that can eliminate SQL injection

4. Reading from the database and iterating over results

5. It even allows for reading only a certain number of records where the query can specify start and end result number.

6. Making table names unique in a shared hosting environment

In this blog we will only cover 1 and 2. Part II covers 3, 4

Of course there is a lot more, but these are the most commonly encountered actions and we will only cover these. Feel free to comment about your favorite database features that Drupal supports.

Let's assume that your module name is Molecule.

1. Creating and deleting table when a module is installed or uninstalled:

In the molecule.install file, you will use the schema hook (molecule_schema()) to create the required tables. 

This is how you would create a molecule table with a column molecule_name

$schema['molecule'] = array(

  'description' => t('Contain Molecule information'),

  'fields' => array(

    'molecule_id' => array(

      'description' => t('id of the stalker - viewing'),

      'type' => 'int',

      'unsigned' => TRUE,

      'not null' => TRUE,

      'default' => 0,

    ),

  ),

);

To have the table and column created, you would implement the install hook (molecule_install). This will be called when the module is enabled.

function molecule_install(){

  if(!db_table_exists('molecule')){

   drupal_install_schema('molecule');

 }

}

To uninstall the module when the module is deleted, implement the hook molecule_uninstall()

function molecule_uninstall(){

  drupal_uninstall_schema('molecule');

}

2. Updating the table structure once the module is in use. So the users can apply a patch easily:

Let's say after shipping the module, you implemented additional functionality and did 2 things - added a new column and modified the name of and existing column. Drupal provides a very convenient hook to write updates to your existing module. This is exposed when the the user runs update.php.

The code to add and update columns is below. We are adding a column scientific_name and changing the molecule_id to just id.

function molecule_update_6001(){

  $ret = array();

  

  $spec = array(

      'description' => t('Scientific name of the molecule'),

      'type' => 'int',

      'unsigned' => TRUE,

      'not null' => TRUE,

      'default' => 0,

    );

    

    $spec2 = array(

      'description' => t('Id'),

      'type' => 'int',

      'unsigned' => TRUE,

      'not null' => TRUE,

      'default' => 0,

    );

  

  db_add_field($ret, 'molecule', 'scientific_name', $spec);

  

  db_change_field($ret, 'molecule', 'molecule_id', 'id', $spec2);

  

  return $ret;

}

When the user now runs the update.php, he will see 6001 as the update for the molecule module. He can apply the updates and the changes to the database table are made.

In part II we will cover some more details.
Nov 12 2010
mg
Nov 12

Hooks is the central mechanism which allows Drupal its extensibility. New functionality can interact with or extend existing functionality using hooks. Use hook, don't hack is a standard way to write code in Drupal.

user_hook() is a hook which is called when an activity is performed on the user. e.g. A user logs in, logs out, clicks on user profile, etc.. 

In Drupal 6, user_hook is a single hook and there are operations accessible through $op for accessing the operation that was performed. The documentation is available here.

But in Drupal 7, this will change. The $op is gone and there are different hooks, depending on what operation is performed. List of available hooks are here.

There might be different repercussions of this:

First the big switch will not be required, making the code simpler from it is in Drupal 6

However, with one hook a dsm could always print which operations are called for a given operation. That will be harder to track now. A developer would need to implement different hook to figure out which ones get called on certain user related activities. It will be interesting to see what coding pattern emerges.

However, the documentation is very good and its intuitive to know which hook should be called, but still sometimes it can be hard to tell without a generic method.

Jun 25 2010
mg
Jun 25

RDFa (or Resource Description Framework – in – attributes) is a W3C recommendation that adds a set of attribute level extensions to XHTML for embedding rich metadata within Web documents. This metadata protocol (RDFa) is used by the open graph protocol to enable any web page to become a rich object in a social graph. Facebook uses the open graph protocol to to make any web page look like facebook's pages. Example of properties defined in the open graph protocol are (Refer http://opengraphprotocol.org/ for more details):

  • og:title - The title of your object as it should appear within the graph, e.g., "The Rock".
  • og:type - The type of your object, e.g., "movie". Depending on the type you specify, other properties may also be required.
  • og:image - An image URL which should represent your object within the graph.
  • og:url - The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/".

Great - so what about it? Recently Dries Buytaert gave his keynote at DrupalCon (which I highly recommend watching) and laid out the support for open graph protocol in Drupal 7. Meaning that Drupal 7 will inherently support RDF. Here is an update on the progress of this feature in Drupal 7. Facebook CEO Mark Zuckerberg also announced his support for open graph protocol in Facebook. 10s of thousands of website have converted their sites to also publish data in open graph protocol using RDF. Essentially all this makes sense if you also read the post which talks about Facebook search strategy. Facebook will compete with Google in the search market. The sites that implement the open graph protocol to publish data have inherent advantage of being indexed, searched and presented along with Facebook search results. This is huge for websites, since users can 'like' a site or 'comment' on a site like they do to native Facebook objects. The websites would get a lot direct feedback. This would also make the search results more relevant over time since there is a significant user input. This will give facebook a Semantic search engine enriched by inputs from its 100s of millions of users. And to Drupal websites an easy hook to leverage this move seamlessly to their advantage.

May 24 2010
mg
May 24

As some you might have experienced, some of the content types in your Drupal site might get too unwieldy because of their sheer size. Displaying a form for the content type of displaying the node is not elegant anymore and the user has to scroll till figures hurt. I had a similar situation recently (attached image with the fields lists all the fields in this 'Event' content type:

All fields in the Event object The simple and elegant solution is to divide the object into logical tabs both for the form and view. and the final output looked like below for me: After doing all the tab work The way to achieve this is to: 1. Divide the fields in the object into fieldgroups, which will eventually be the different tabs (these are standard groups). 2. Have a custom module where you will override the form and do at least these changes: 2.1 edit form_alter hook to have something like

 

$group_eventcontacts = $form['group_eventcontacts']; unset($form['group_eventcontacts']); $form['group_tabs']['group_eventcontacts'] = $group_eventcontacts;

where eventcontacts is the name of the fieldgroup. So we are creating a new group and removing the fieldgroup from the original form. 2.2. Override the theme hook to have the following: return array( 'myfunc' => array( 'arguments' => array('form' => NULL), ),2.3 In the myfunc function: have the following (refer 2.1 above): $event_keyContacts = drupal_render($form['group_tabs']['group_eventcontacts']); and append the $event_keyContacts variable to the $output. $output .= <div id="event_keycontacts-'.$nid.'">'.$event_keyContacts.'</div> Thats pretty much all for the form. Do this for all the groups(tabs) you want to create . 3. Now for the node viewing part. I created a separate node-event.tpl.php for handling my event content type. This file is created in the theme directory. $content = preg_replace('~<fieldset.+ class="content-multigroup-group-eventcontacts"?</fieldset>~s','',$content); this removes the fieldgroup content from the $content. Do this for all the groups. Now get the contents from $node->content if (isset($node->content['group_eventcontacts'])){ $group_eventcontacts = $node->content['group_eventcontacts']['#children'];Add the $group_eventcontact variable to the tab $tabs_div .= '<div id="event_contacts-'.$nid.'">'.$group_eventcontacts.'</div>';It is important to understand the difference between $content and $node->content. Former is the formatted representation of the content and later is a data structure containing the contents. $node->content has to be themed to become $content. There be sure to manipulate both variables correctly. That is all for getting the tabs. Happy coding

Apr 26 2010
mg
Apr 26

Dries Buytaert gives a state of Drupal talk at every DrupalCon. Here are some of the excerpts from DrupalCon2010, The entire talk is online and I highly recommend you to listen to it. Some of the key highlights of Drupal

  • CVS – RIP. Starting Drupal 8 development, source code will move to Git from CVS
  • 19 different distributions of Drupal are available currently. This phenomenon is mostly unique to Drupal where multiple distributions are available.
  • Jacob Redding has been appointed at the Interim GM of Drupal Association
  • Semantic Web and linked data: Move from WWW to GGG (Global Giant Graph). This is the based on the vision of Tim Berners-Lee. RDF is part of core in Drupal 7. This will enable to mark up different objects with RDF (e.g. products in a web shop application). Essentially RDF lets you turn the internet into a database and reuse data.
  • More big companies are getting involved in Drupal. There are now multi-million dollar Drupal projects and Drupal is hitting on the radar of companies like Cap Gemini. Accenture, IBM, etc. These consulting companies will jump on a bandwagon only if the market is big enough. Microsoft is a platinum sponsor of DrupalCon 2010. Drupal is now being supported on MS SQL server as well.
  • No SQL movement: Drupal 7 now works with CouchDB, mongoDB, Cassandra, etc. This is one of the most interesting developments for me, since this is truly forward looking vision.
  • Pro Drupal Development book, will be available in July
  • Drupal amounts for more than 1% of the web. But there is ground to cover. Wordpress owns 8.5% of the web and Joomla 1.5%. I will leave the translation for you. Drupal 6 is the most used version.
Jan 25 2010
mg
Jan 25

I was trying to create different tabs (using YUI) to edit a form. I wanted to create a separate tab for each of the field groups. However, in the form_alter method of the form for my module, I could not see the fields in the fieldgroup. On debugging I found my fields in the fieldgroup to be present in the form_alter of other modules. Problem: The CCK fieldgroup module has a weight of 9. If your module has a weight less than 9, then it is called before CCK fieldgroup, hence the problem. Solution: Set your module's weight more than 9. The setting is in the system table, under the column weight. This fixed the problem for me. It took a long time to solve the problem and thanks to some of the other posts mentioned below for writing about this.

Dec 19 2009
mg
Dec 19

There are several modules I have used during building sites. I am not going to get into details of the modules because you should visit the modules. But by far, the most important / useful modules for me have been:

1. Views ; You can think of views as output to your custom query (except you don't write the query). There are several ways to present the views and Calendar is one example. So this is a query builder which can execute queries at run time and present the data however you want.

2. : You can add custom fields to a node or define a new content type based on CCK, This is powerful functionality with no coding. You can order the fields according to your preference. And CCK will become very powerful once is introduced. As of now, Multigroup is in alpha, but I have been using it with no problems. It lets you create a composite or a compound field, consisting of different base CCK fields.

3. : The module renders all administrative menu items below 'administer' in a clean, attractive and purely CSS-based menu at the top of your website. This is a life saver if you are administering a site. Essentially it is a overlay of the entire admin functionality as a ribbon on the top of your web site.

4. : I have to give it to katrib for this module. This is great if you want spreadsheet functionality in your website. We did some pretty advanced things with the module like embedding it within a node as a tab and YUI integration. We also configured a java bridge to be able to upload excel sheets from desktop to the website. Google spread sheet integration is pretty straightforward. This is based on SocialText platform

5. Enables users to create and manage their own groups (like forums). This can bring great social aspects to your website. For some of the sites, we changed the module to represent a company and it was great.

6. : This adds a lot of umph to the site. It is Mainly used to showcase featured content at a prominent place on the frontpage of the site. Demos and tutorials are excellent.

7. : Essential for developers and themers It can generate SQL query summaries, create data for your test site, show the theme information on your site. Don't develop without this module.

8. Pathauto : It automatically generates path aliases for various kinds of content (nodes, categories, users) without requiring the user to manually specify the path alias. Helps get rid of default / ugly paths (node/3 ... )

9. jQuery : jQuery depends on jQuery UI and jQuery update in drupal 6. And here is a good overview of jQuery.This architectural diagram might also be a useful reference. jQuery modules provides all the nice functionality jQuery library.

10. : This module provides several useful extensions to the login system of drupal. What I found really useful was to allow email based logins, email confirmation during registration and auto logout. Happy drupaling :)

Nov 26 2009
mg
Nov 26

This was one of the most frustrating setups for me, not because it is difficult, but because it is very important to get the xdebug library absolutely correct. For a long time it seemed that everyone could debug but me. There were no posting pointing to the problems I was having, so here it is: I have a wamp install with Eclipse. I am running php5.2.9-2. This is important to know because the library has to match the php version.

1. For this version of php, I downloaded the debug library : http://xdebug.org/files/php_xdebug-2.0.4-5.2.8.dll . There are several libraries listed on the site, and the hard part was to get to the right one.

2. This file was copied to <something>\wamp\bin\php\php5.2.9-2\ext

3. Next: edit the php.ini: Mine looks like following:

zend_extension_ts="C:\wamp\bin\php\php5.2.9-2\ext\php_xdebug-2.0.4-5.2.8.dll"

xdebug.remote_autostart=off

xdebug.remote_enable=1

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

xdebug.remote_host=127.0.0.1

xdebug.remote_port=9000

4. Restart server (WAMP)

5. Run command (type in the URL on the browser) http://localhost/?phpinfo=1 - you are running phpinfo(). This should display all the properties for you. You should see something for Xdebug on the displayed page.

6. If it does, your server is configured. Client configuration is straightforward: On Eclipse, under debug configuration, I selected "Server Debugger" to be XDebug from the drop down And the debug type is php web page. So you have to create e new php web page, give it a name and start debugging. Let me know if you have questions. I can feel the pain of debug setup.

Happy Drupaling :)

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web