Showing posts with label D6. Show all posts
Showing posts with label D6. Show all posts

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:

  1. Browse to
    1.  http://localhost/virtual_dir/sites/all/modules/civicrm/bin/migrate/export.php?name=&pass=&key=
      1. This will download a file called CustomGroupData.xml
  2. Using wget (if you want to script this and update the file at 3pm for example)
    1. 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=&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?

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

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.

D6 - SIMPLE module to get JavaScript working on a form

The very quick and easy way to get some JavaScript working on your form:

  1. Add the 3 files below to your basic module structure.  This module is called "your_module" for example purposes.
  2. Enable the module
  3. 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.

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:
  1. Book (standard in Drupal, but needs to be enabled)
  2. Deploy
  3. Services
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.
  1. Add your pages
  2. 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.

  1. Open the book, and you should see the option of Deploy. Select this.
  2. Select the Deployment Plan. In this example I am selecting the plan that was previously created.
  3. If successful, you should see a list of pages that are setup in your deployment plan.
  4. 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.
  1. Go to Site Building,  Deployment, and you should see your list of deployments
  2. Select push
  3. Now select the Server you want to push to and the username/password fields should display.  Enter your credentials and click Push Deployment Plan.
  4. Magical wand...bells and whistles....everything should push to your destination server.
  5. 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.

Better Formats | drupal.org