Drupal Plugin Manager – Could not login to the ftp server

March 1st, 2010

Hi guys,

Since yesterday I discovered this awesome module! First off, kudos to the creator(s), we’ll be using this on all our companies’ websites and will save us a truckload of time!

Second, I must say I’m not so convinced about the provided documentation as it took me about half a day to get this working.

It seemed that all my FTP credentials were correct under “Plugin Manager – Settings”:


Host: notorious.halecomm.net
User: ftp_user
Pass: xxxxxxx

I tried these with cuteFTP and got it working.

After this issue, it seemed that Plugin Manager could not retrieve the installation path for drupal, so I had to put in the full linux path to my drupal installation:

Path: /home/ftp_user/www/drupal6 (with beginning / and no trailing / as “sites/default/” or “sites/all” is being added…

With these settings I managed to download all the necessairy files, but was unable to extract and copy them through the FTP system to my “/sites/all/modules/” directory.

After some Googling I found out the following on the PHP.net website, about the usage of “ftp_connect”:

http://be.php.net/manual/en/function.ftp-connect.php

thomas g.
03-Mar-2003 11:35
always keep an eye on the ftp_pasv function, if you are behind a firewall or nat’ed and your scripts won’t do a listing or put files to the ftp

As our company webserver is behind our firewall, I suspected the problem was indeed in the lacking of PASV mode so I added the following line of code to “plugin_manager/ftp.backend.inc” on line 133:

ftp_pasv ($connect, true);

So the whole code block from line 115 to line 138 looks something like:

  // Try to guess which how far in we are chrooted...
  if (empty($ftp_path)) {
    foreach ($local_path AS $index => $value) {
      unset($local_path[$index]);
      if (@ftp_nlist($connect, implode('/', $local_path) .'/'. $dir)) {
        $ftp_path = implode('/', $local_path) .'/'. $dir;
        drupal_set_message(t('A drupal install was automatically located on ftp at @ftp_path.', array('@ftp_path' => $ftp_path)));
        break;
      }
    }
  }
  else {
    $ftp_path = $ftp_path .'/'. $dir;
    if (!@ftp_chdir($connect, $ftp_path)) {
      drupal_set_message(t('Your provided drupal install directory is invalid.') . l(t('Change it here.'), 'admin/plugin_manager/settings'),  'error');
      return FALSE;
    }
  }
 
  ftp_pasv ($connect, true);
 
  // If we couldn't guess it, then quit.
  if (!isset($ftp_path) || !@ftp_chdir($connect, $ftp_path)) {
    drupal_set_message(l(t('Could not guess the ftp directory for drupal.  Set it here.'), 'admin/plugin_manager/settings'), 'error');
    return FALSE;
  }

I hope to be of any assistance,
Kind regards,
Kim

Author: Kim Categories: Content Management Systems, Drupal, General Tags:

CakePHP created and modified fields

February 8th, 2010

For a project of a client of ours, we had to create a custom web-application. After some online investigation Googling, CakePHP came out as the best-value-for-money PHP framework, and it comes with a super-duper handbook.

After implementing the outlines of the application, we had a first evaluation round which attended us at a small bug (?) in the system…

The “created” and “modified” (or “updated” as alternative) columns in the database scheme should, according to the CakePHP book, be updated automagically when using the built-in model->save() method.

After a few test-rounds we noticed that these values were initialised when first adding the data to the database, but were not updated afterwards when editing the model data.

The traceback lead me to the /cakeframework/cake/libs/model/model.php line 1204:

1204
if ($this->hasField($updateCol) && !in_array($updateCol, $fields)) {

This if checks if a model has access to a database column “created”, “modified” or “updated” with the hasField() model-method and also does a simple in_array() check and here’s the caveat: The second check requires the datetime-field NOT to be in a preset array with the following values “created”, “modified” or “updated”.

Rather tricky to result in both requirements returning “true” and update the datetimefields if available ^^.

So to fix it and have your modified / updated datetime-fields kept up-to-date change the line to the following:

1204
if ($this->hasField($updateCol) && in_array($updateCol, $fields)) {

Hoping to be of any assistance!

Author: Kim Categories: Coding, PHP Tags:

Drupal 6 multi language menu items – a mystery…

January 7th, 2010

I am currently deeply involved in translating our current D6 website. It exists in English, we already foresaw that we would translate it, so i18n was activated.

First of all, I made sure that all my content and menu items were correctly set to English. Next step was to add the new languages, so I added Dutch and French. I configured the language negotiation so that we only use path prefix.

Activated the language switcher block and lo and behold…. SOME of my menu items staid visible in NL while others disappeared as they should. So, I went over all my settings again, checked all my content, but everything was set and configured as it should have been.

Slowly becoming desperate, I finally simply deactivated the menu items giving me this problem and reactivated them.

This, ladies and gentlemen, did the trick…

If anyone out there has a good explanation for this, please enlighten us.

ps: caching was off since I was working on my local dev site.

Drupal version:           6.15
i18n version:                6.x.1.2

Author: lhe Categories: Drupal, Leiv Hendrickx Tags: