What's New in Drupal 7 | drupal.org
A good page to read...just in case someone asks you. ;)
'via Blog this'
JarodMS Drupal and Dev
My journey with Drupal; building Drupal websites; modules I am using or might try; other coding and development issues
Monday, April 16, 2012
Friday, March 30, 2012
Getting Drupal updates into TEST
.
- I create a branch from TEST and call it something like updates. (git checkout -b updates)
- Now I'm working in the branch updates
- Create a backup of the database - important and discussed later.
- Pull the necessary modules or Drupal updates and test it out.
- Everything look ok? Then merge the branch to TEST.
- git checkout test
- git merge updates
- handle any conflicts
Why would you do this rather than pull your Drupal updates right into TEST? Murphy's Law. If you pull the Drupal updates into TEST first, then somebody is bound to have an issue or item that needs worked on that needs to go into TEST before you had a chance to completely test and verify your Drupal upgrade.
The approach above helps you get around this. You're in the middle of testing Drupal updates and someone approaches you with a bug or change that needs to go into TEST first. How do you roll back to the TEST branch?
- checkout TEST (git checkout test)
- Restore the database using the backup you created earlier.
- You are now at the TEST version you need for the new change, without those Drupal updates that you haven't completely tested.
- Create your new bug/change branch and continue on the issue that was asked of you.
Monday, February 27, 2012
Drupal - Bootstrap for old PHP script
In a hurry and I have an old PHP application that pulls data from proprietary tables. I have connected some of the data to a node, but now I need to display the data in a separate window when applicable.
So, using the old and large PHP script, just to get it functioning, I had to bootstrap Drupal.
Place this at the beginning of OldLarge.php
$drupal_dir = getenv("DOCUMENT_ROOT");
$current_directory = getcwd();
chdir($drupal_dir);
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
...
Do my Drupal stuff here....db_query() and whatever so that I can get results back from weird tables.
...
Then at the end of OldLarge.php , add the final code....
chdir($current_directory);
So, using the old and large PHP script, just to get it functioning, I had to bootstrap Drupal.
Place this at the beginning of OldLarge.php
$drupal_dir = getenv("DOCUMENT_ROOT");
$current_directory = getcwd();
chdir($drupal_dir);
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
...
Do my Drupal stuff here....db_query() and whatever so that I can get results back from weird tables.
...
Then at the end of OldLarge.php , add the final code....
chdir($current_directory);
Eventually...some day (which ends up being never) I will convert the OldLarge.php script to something more Drupalized.
Wednesday, February 8, 2012
CiviCRM "Javascript must be enabled in your browser in order to use the dashboard features"
"Javascript must be enabled in your browser in order to use the dashboard features"
I started getting this error from some of my testers when they were using IE9. Sure enough, I couldn't access the CiviCRM dashboard or CiviCRM menu (it acted like it was disabled).
Yep, well JavaScript is enabled.
Stats on the site:
CiviCRM version 3.4.8
Latest Drupal (6.24)
Drupal module jquery_update installed (giving Drupal the jQuery version 1.3.2)
Hmmmmmm.....It works FINE with Chrome (16.0.912.77 m), Opera (11.61), Safari (5.1.2), and Firefox (10).
Oh YEAH! That's right!!! Internet Explorer doesn't handle a lot of JavaScript files very well. CSS files are limited to 32(?) I think. Not sure what the JS limit is.
So on the TEST site I enabled "Optimize JavaScript files" and all works well in IE8/IE9.
Things to look at:
http://drupal.org/project/javascript_aggregator
Great article by Vlad http://shvetsgroup.com/blog/optimizing-javascript-and-css-files-drupal
I started getting this error from some of my testers when they were using IE9. Sure enough, I couldn't access the CiviCRM dashboard or CiviCRM menu (it acted like it was disabled).
Yep, well JavaScript is enabled.
Stats on the site:
CiviCRM version 3.4.8
Latest Drupal (6.24)
Drupal module jquery_update installed (giving Drupal the jQuery version 1.3.2)
Hmmmmmm.....It works FINE with Chrome (16.0.912.77 m), Opera (11.61), Safari (5.1.2), and Firefox (10).
Oh YEAH! That's right!!! Internet Explorer doesn't handle a lot of JavaScript files very well. CSS files are limited to 32(?) I think. Not sure what the JS limit is.
So on the TEST site I enabled "Optimize JavaScript files" and all works well in IE8/IE9.
Things to look at:
http://drupal.org/project/javascript_aggregator
Great article by Vlad http://shvetsgroup.com/blog/optimizing-javascript-and-css-files-drupal
Wednesday, January 4, 2012
User Agents
A large list of user agents
http://techpatterns.com/forums/about304.html
Any other lists you know of?
http://techpatterns.com/forums/about304.html
Any other lists you know of?
Friday, December 16, 2011
My current sites/all/modules
My current "modules" folder and what it contains:
- civicrm
- contrib
- custom
- shortsitename_features
I kind of like that. Nice and sweet. There's a bunch of modules under "contrib" of course, a few under custom (but growing) and a few under shortsitename_features (but growing).
Tuesday, December 13, 2011
CiviCRM - moving your configuration changes to a different environment
I love code driven development. So when I build my Drupal sites, I immediately download and enable Features. I do not want to handle website settings between environments by comparing screens and clicking box after box. When you are running in a local DEV environment, plus you have a TEST and LIVE environment, using Features saves time (which of course equals money).
So I started a new project using CiviCRM and the thought in the back of my mind for awhile was:
"I just changed a CiviCRM setting. How do I migrate that change to my TEST and LIVE environments?".
Well the time came and I had to do it. I needed to get my TEST site going and didn't want to bother remembering all of the settings I needed to configure.
Luckily, CiviCRM comes with migrate scripts to Export and Import your settings.
First Export it from the localhost (DEV environment) using one of the options. More exist, but these are pretty basic:
I save this file to a folder in the website I am working on. Then, if it has changed, I commit it to git.
After the export file has been committed to git, then moved to your next server, import:
http://example.com/sites/all/modules/civicrm/bin/migrate/import.php?name=&pass=&key=&file=../../../../../default/CiviCRM.info
Notice the difference between this command and previous ones is that it uses import.php and specifies a file.
I noticed there were a couple of settings that did not get exported and I think those are related to CiviCRM Profiles. I need to look into this a bit and see if this is an issue or "works as designed".
What are some other options for moving CiviCRM configuration changes between environments?
So I started a new project using CiviCRM and the thought in the back of my mind for awhile was:
"I just changed a CiviCRM setting. How do I migrate that change to my TEST and LIVE environments?".
Well the time came and I had to do it. I needed to get my TEST site going and didn't want to bother remembering all of the settings I needed to configure.
Luckily, CiviCRM comes with migrate scripts to Export and Import your settings.
First Export it from the localhost (DEV environment) using one of the options. More exist, but these are pretty basic:
- Browse to
- http://localhost/virtual_dir/sites/all/modules/civicrm/bin/migrate/export.php?name=
&pass= &key= - This will download a file called CustomGroupData.xml
- Using wget (if you want to script this and update the file at 3pm for example)
- wget -O D:\dev\htdocs\virtual_dir\sites\default\CiviCRM.info "http://localhost/virtual_dir/sites/all/modules/civicrm/bin/migrate/export.php?name=
&pass= &key= "
I save this file to a folder in the website I am working on. Then, if it has changed, I commit it to git.
After the export file has been committed to git, then moved to your next server, import:
http://example.com/sites/all/modules/civicrm/bin/migrate/import.php?name=
Notice the difference between this command and previous ones is that it uses import.php and specifies a file.
I noticed there were a couple of settings that did not get exported and I think those are related to CiviCRM Profiles. I need to look into this a bit and see if this is an issue or "works as designed".
What are some other options for moving CiviCRM configuration changes between environments?
Monday, November 7, 2011
Drupal - Code Driven Development
I think most of my sites have 2 versions...LOCAL and LIVE to allow testing of various changes as well as developing new themes and modules. Some sites have 3 versions, LOCAL, USER TEST, and LIVE.
I like having a local version so that I can polish it first. Also, I use tools like NetBeans for coding and debugging.
I use "Code driven development" for all my Drupal sites. Remember, the changes you are making through the GUI in your Drupal site are being saved to the database. To use code-driven development, you need to get those changes out of the DB and into code. This is where Features comes in. My process:
I like having a local version so that I can polish it first. Also, I use tools like NetBeans for coding and debugging.
I use "Code driven development" for all my Drupal sites. Remember, the changes you are making through the GUI in your Drupal site are being saved to the database. To use code-driven development, you need to get those changes out of the DB and into code. This is where Features comes in. My process:
- Develop code or theme; make your config changes in Drupal
- Export as much as possible using Features and Strongarm - This puts the DB changes into code
- Checkin the code to your version control system
- On the server - pull code from your repo
- Enable the various Features
Debugging PHP in NetBeans (in Ubuntu)
Here are the steps I used to setup PHP debugging in NetBeans (6.8 at the time of this writing) in Ubuntu 10.
sudo apt-get install php-pear
sudo apt-get install php5-dev
sudo apt-get install php5-xdebug
Edit your PHP INI settings
sudo nano /etc/php5/apache2/php.ini
Add the following lines under extensions:
zend_extension=/usr/lib/php5//xdebug.so xdebug.remote_enable=on
In my case it was ""/usr/lib/php5/20090626+lfs". You will have to find the xdebug.so file in the correct folder.
Restart Apache
sudo /etc/init.d/apache2 restart
NetBeans PHP Debug Settings
- Goto tools->Options
- Select PHP
- On the General tab
- If this is your first time configuring xdebug, you may want to keep "Stop at First Line" checked. this way when you start debugging you should know right away that your setup is correct.
Start Debugging
- Add some break points.
- Right-click your project and select Debug
Thursday, October 13, 2011
CentOS 5.6 server setup
These are the guides and blog posts I use to setup LAMP on my new CentOS servers:
- Get a newer version of PHP
- Setup RPM Key
- cd /etc/pki/rpm-gpg
- wget http://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL
- Setup YUM repo for Git
- Install Apache, MySQL, PHP
I typically install Webmin too, so I'll document that one in a bit.
Thursday, October 6, 2011
Drupal 6 "Unable to fetch any information about available new releases and updates"
When manually trying to check for available updates I ran into this message:
"Unable to fetch any information about available new releases and updates"
I don't recall ever seeing this when running Drupal 6.
My solution: restart Apache and it worked.
http://drupal.org/node/168828
"Unable to fetch any information about available new releases and updates"
I don't recall ever seeing this when running Drupal 6.
My solution: restart Apache and it worked.
http://drupal.org/node/168828
Thursday, September 29, 2011
Updating modules and themes requires FTP access to your server
How to get rid of that pesky (D7) FTP issue when updating modules:
Updating modules and themes requires FTP access to your server
http://drupal.org/documentation/install/modules-themes/modules-7#comment-4690140
The short of it, change the owner of the sites/default directory to the whoever the Apache default user is (www-data, apache, etc.)
Updating modules and themes requires FTP access to your server
http://drupal.org/documentation/install/modules-themes/modules-7#comment-4690140
The short of it, change the owner of the sites/default directory to the whoever the Apache default user is (www-data, apache, etc.)
chown www-data sites/default
Monday, September 19, 2011
Debugging PHP in NetBeans (in Windows)
Here are the steps I used to setup PHP debugging in NetBeans (7.0 at the time of this writing).
The way to do it: http://xdebug.org/docs/install
You will need to download the correct php_xdebug from the xdebug.org site: http://xdebug.org/download.php
I downloaded the correct DLL for my environment and followed the install instructions. Below are my final php.ini settings:
This extension is disabled
;extension=php_xdebug.dll
[XDebug]
;; Only Zend OR (!) XDebug
;zend_extension_ts="D:\xampp\php\ext\php_xdebug.dll"
zend_extension_ts = "D:\xampp\php\ext\php_xdebug-2.1.1-5.2-vc6.dll"
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.profiler_enable=1
xdebug.profiler_output_dir="D:\xampp\tmp"
NetBeans PHP Debug Settings
Friday, September 2, 2011
Thursday, September 1, 2011
Drupal 6 - Remove N/A from list of Radio button options
When creating a radio button field with CCK, you can remove the "N/A" option by making the field required.
fyi...to make your options turn into checkboxes, change "Number of values" to something other than 1.
fyi...to make your options turn into checkboxes, change "Number of values" to something other than 1.
D6 - SIMPLE module to get JavaScript working on a form
The very quick and easy way to get some JavaScript working on your form:
your_module.info:
name = Demo Information
description = Custom handling of demo information
core = 6.x
package = Your Company
your_module.module:
<?php
/**
* Implementation of hook_form_alter().
*/
function your_module_form_alter(&$form, $form_state, $form_id) {
// Only include on WHATEVER node add/edit forms. Adjust these lines based on your content types.
if ($form_id == 'new_item_node_form') {
drupal_add_js(drupal_get_path('module', 'your_module') .'/your_module.js');
}
}
your_module.js:
alert("Gotcha!");
- Add the 3 files below to your basic module structure. This module is called "your_module" for example purposes.
- Enable the module
- Clear cache
your_module.info:
name = Demo Information
description = Custom handling of demo information
core = 6.x
package = Your Company
your_module.module:
<?php
/**
* Implementation of hook_form_alter().
*/
function your_module_form_alter(&$form, $form_state, $form_id) {
// Only include on WHATEVER node add/edit forms. Adjust these lines based on your content types.
if ($form_id == 'new_item_node_form') {
drupal_add_js(drupal_get_path('module', 'your_module') .'/your_module.js');
}
}
your_module.js:
alert("Gotcha!");
Look at the HTML source and you should see your_module.js listed within all the other JavaScript files.
Wednesday, August 17, 2011
Using Git with a central repository
This is a nice write up on using Git with a central repository. A good tutorial for newbies to Git.
Friday, August 12, 2011
Migrating User Guides
So you've got that awesome functionality built for your Drupal site...but the user doesn't know how to use it.
Welcome to Books and "User Guide Migration". For Drupal 6
How this came to be for me:
I needed to create some user guides, so I thought Book. I needed this to run on a TEST server, because the users were learning here, and the LIVE server was not setup yet. I needed to be able to migrate this content to the LIVE server without having to copy and paste. I could not find a usable book export and import tool. None of the ones I tried worked very well. I tried the method below and was up and running in less than an hour (maybe it was less than 30 minutes...I don't remember).
First we need the modules:
Now, you need to PUSH to your destination (LIVE) server.
Welcome to Books and "User Guide Migration". For Drupal 6
How this came to be for me:
I needed to create some user guides, so I thought Book. I needed this to run on a TEST server, because the users were learning here, and the LIVE server was not setup yet. I needed to be able to migrate this content to the LIVE server without having to copy and paste. I could not find a usable book export and import tool. None of the ones I tried worked very well. I tried the method below and was up and running in less than an hour (maybe it was less than 30 minutes...I don't remember).
First we need the modules:
At this point it is important to setup the Deploy and Services modules correctly. I say correctly because the first time I did this, it didn't work. The initial reason was that I used Drush to download the modules and I ended up getting a wrong version. I believe I had to manually download and install the correct Services module to match Deploy. Reading the documentation in the link above will get you the correct versions. This was the only issue I came up with, but that was my fault. :)
Reading the rest of the documentation will get your deployment and live server setup. You need your deployment plan on your source server as well as authentication. You also need authentication setup on your destination server.
Now create your book. I won't go into the details about making a book, just add pages and modify the outline when necessary.
- Add your pages
- Change the outline where necessary
Now we are ready for pushing the content to your destination (LIVE) server. You have your book setup on your source (or DEV or TEST) server or wherever, and now you need to go LIVE with it.
- Open the book, and you should see the option of Deploy. Select this.

- Select the Deployment Plan. In this example I am selecting the plan that was previously created.

- If successful, you should see a list of pages that are setup in your deployment plan.
- Repeat this process for EACH page in your book. It's very easy to step through the book and then open the Deploy page in a new tab and do Step 2 later.
Now, you need to PUSH to your destination (LIVE) server.
- Go to Site Building, Deployment, and you should see your list of deployments

- Select push
- Now select the Server you want to push to and the username/password fields should display. Enter your credentials and click Push Deployment Plan.

- Magical wand...bells and whistles....everything should push to your destination server.
- Verify everything looks ok on the destination.
If you make updates to your book content, then a Push will get that to your live server. This is awesome so that you can make changes, have it approved, and then push to your LIVE server. Of course this approval process can be handled by workflow, but it's nice pushing and entire book (User Guide) at one time.
Gotchas:
- If you have images or other media in your book, they will not get pushed. They need to be uploaded to the server.
- Input Format: make sure the source and destination servers are setup with the same input formats. This only needs to be done once of course.
- After you have pushed, if you change the outline of your book and have added pages and messed around with it, it's possible to miss something. You can still step through the book and add each page (even if it exists in your plan). I have not found an issue with this yet. NOTE TO SELF: It's best to remember to add the page to the deployment plan RIGHT AFTER you have created he page.
Monday, July 18, 2011
Better Formats - D6
For Drupal 6, here's another module that I will be adding to my standard Drush make file. Per the author "Most of the features in BF are in Drupal 7 core now." so that is sweet.
Tuesday, June 28, 2011
Git - weird log message
I was receiving messages in my git log with something like "Merge branch 'branchname' of /blah/blah into 'branchname'
Found this very helpful site and blurb on how to fix this.:
http://wiki.sourcemage.org/Git_Guide#Why_do_my_commit_emails_have_extra_.22Merge_branch_.27master.27.22_messages.3F
Basically, it talks about doing a rebase.
Found this very helpful site and blurb on how to fix this.:
http://wiki.sourcemage.org/Git_Guide#Why_do_my_commit_emails_have_extra_.22Merge_branch_.27master.27.22_messages.3F
Basically, it talks about doing a rebase.
Subscribe to:
Posts (Atom)


