What a Drupal Camp! That was a lot of fun.
Here are the camp's photos:
(Special Thanks to Omar for inspiration on a successful camp!)
I wanted to write a selenium test script to validate calculation done in a page to make sure they match those of another page. I used the store* functions to grab the values from the source. My problem was that the second page was actually a popup.
There have been some reported problems with selectWindow and selectPopup and waitForPopup functions. They are not always working with Firefox 3.x. They were not working for me.
So I thought that maybe I could have the page NOT popup when it's being accessed by selenium. That way I will not have to use these broken functions.
The following post is about a solution to the problem of detecting if mod_rewrite is enabled or not. I worked on a project where CS-CART was used and after it was installed, it was complaining that the mod_rewrite module was not installed. I knew that mod_rewrite was installed so I looked at the code. The code that was detecting if mod_rewrite was enabled was assuming the DNS for the domain was working fine. It was doing an HTTP request. This means that if we installed the store in a temporary environment where the hostname is fake (put in the HOSTS file for example) then it would think mod_rewrite is NOT installed or enabled.
I think I came up with a better way and here it is. I submitted it to the CS-CART staff, we'll see if they like it.
I am working on a website which uses the contrib module "mysite". The client wants me to modify the landing page after you change some config. The right way of doing that would be to use hook_form_alter() and change the redirect value:
$form['#redirect'] = 'newpath';
However, this was not working for me. I found out this was because the author of the module mysite was using drupal_goto() inside the _submit functions. This is not the recommended way of specifying where you want the page to go to after your form was submitted. You have to return the path.
A friend of mine contacted me about a problem he was having on his site. He was doing a lot of tests with login/logout and he had the login_security module enabled. This little module will ban users automatically if they enter the wrong password too many times.
My friend was getting redirected to a page not found when trying to login and he did not understand why. I looked into it and it took me some time to figure out that the problem was with the way drupal_goto() was being called.
I am currently working on a project which uses the module site_user_list and I wanted to use some variables in my template. The documentation of the module said I could use the variables from the $r array but I discovered that was not working. I found someone discovered the same problem and opened an issue:
That same person also contributed a patch but I was unhappy with it. I provided my own.
If you want to use drupal_eval() and allow the code inside that to access (read-only) some of your context variables, try this:
Let's assume you want to eval the PHP code found in the variable $code. You might consider doing like this:
$options = array('foo' => 'bar');
drupal_eval('<?php ' . $code . '?>');
This would mean that whatever PHP code found in $code would have no access to $options.
This is why I recommend this:
$options = array('foo' => 'bar');
drupal_eval('<?php $options = '. var_export($options, TRUE).'; ' . $code . '?>');
The var_export() function (php core) will create valid PHP code from your array. You assign that to another variable (could be called anything) and voila. This code will be executed and the values from your $options array becomes accessible (read-only) to your $code.
I created a new patch for Drupal 7 simpletest so that we can verify that a piece of text is present on a page, but only present once and no more.
Full details can be found here:
Recently I wrote an article about how I handled semaphores in a Drupal project. I want to talk about how I actually implemented it. I needed more than one function to use the semaphore. The goal was to prevent one function to be called when the semaphore was active. The semaphore would get activated when the function would run. Basically, prevent the functions from running at the same time.
I built a system that migrate all sort of data from one legacy system to a new database. It has to be run every 15 minutes and must start with data from today and work it's way back to the oldest data. It takes some time to migrate that much data so it does one day per 15 minutes.
Paul Reinheimer wrote an article on a bug he was trying to solve.
If you want to watch the last lines of a file to see when it changes, try this in linux:
Make a Payment to Christian Roy