Archive for the ‘drupal’ Category

drupal: gmap module generating a ‘js/gmap_markers.js’ error

Tuesday, July 21st, 2009

Gmap module in drupal kept generating the following error “Le fichier choisi /tmp/file2to4S3 n’a pas pu être transféré, car le répertoire de destination js/gmap_markers.js n’est pas correctement configuré.” claiming that destination folder ‘js/gmap_markers.js” is not properly configured.

Screenshot-1

I searched the web and did not find a solution to it. I tried gmap module settings, but without any success.
Since the maps I use are pretty basics and do not make use of markers, I simply modified gmap.module file and commented out the following line:

#file_save_data($contents, "$jspath/gmap_markers.js", FILE_EXISTS_REPLACE);

By doing so (prepending ‘#’ to the line), error is no longer displayed and map is still working great.

=> case closed.

drupal: admin_menu working in drupal-6.12 but not in drupal-6.13

Tuesday, July 21st, 2009

Today I upgraded drupal from version 6.12 to 6.13 and it ended up with a nice error message:

Fatal error: Only variables can be passed by reference in /drupal-6.13/sites/all/modules/admin_menu/admin_menu.inc on line 536

At first, I thought it was an error in admin_menu 3rd-party module, but after looking at it more closely, it appeared to be a drupal bug.
system_clear_cache_submit() signature changed from drupal-6.12 to drupal-6.13 with no obvious reason.

Below are the signatures in both drupal-6.12 & drupal-6.13 (system_clear_cache_submit function is declared in /drupal/components/system/system.admin.inc:1360):

function system_clear_cache_submit(&$form_state, $form) { // drupal-6.12
function system_clear_cache_submit($form, &$form_state) { // drupal-6.13

Arguments have been switched, making other third party modules, such as ‘admin_menu’, crash php  with above error message.

solution

Proposed patch is simply to restore previous signature of system_clear_cache_submit function so that all previous modules based on it will continue to work properly (moreover since this variable switch looks unjustified by  the function’s body).

--- system.admin.inc	2009-06-09 12:58:09.000000000 +0200
+++ system.admin.inc.new	2009-07-21 00:27:49.000000000 +0200
@@ -1357,7 +1357,7 @@
*
* @ingroup forms
*/
-  function system_clear_cache_submit($form, &$form_state) {
+ function system_clear_cache_submit(&$form_state, $form) {
    drupal_flush_all_caches();
    drupal_set_message(t('Caches cleared.'));
   }

sources

drupal: steps to set your website live (localhost to server)

Monday, June 15th, 2009

Here are the steps to move your drupal website from localhost to live server:

  1. update /drupal/sites/<all_your_site_folders>/settings.php to match your new sql settings
  2. empty localhost db caching tables (all those tables starting with ‘cache_’ or ‘<prefix>_cache_’ )
    this is an IMPORTANT step, website did not work for me until I cleared caching tables
  3. export your sql table and load sql data on your online sql server
  4. upload your drupal files online
  5. if you are on a multisite mode:
    1. you must also rename your site folders to match new domain-name
      ex: /drupal/sites/site1.localhost should be renamed into /drupal/sites/site1.mydomain.com
    2. you might need to update filepath column values on all ‘<prefix_>files’ db tables to reflect your new folder names (otherwise documents and images uploaded via drupal (ie. not css images) will still point to localhost and not be visible). Below is slq query I used:
      UPDATE <prefix_>files SET filepath = REPLACE(filepath, 'sites/<old_folder_name>/', 'sites/<new_folder_name>/');

      note: replace <xxx> with corresponding values. In my case, prefix was ‘site3_’, old_folder_name was ‘site3.localhost’ and new_folder_name was ‘site3.example.com’
      => here is the query I ran: UPDATE site3_files SET filepath = REPLACE(filepath, ‘sites/site3.localhost/’, ‘sites/site3.example.com/’);

That’s it.

(don’t forget to correctly set up your apache / bind settings)

sources