I'm very, very happy that someone is doing something pro-actively in this space because it is a major headache for us when upgrading 6.x versions.

Just installed version 1.0 of this module while upgrading our test site to 6.19. Unfortunately, this module doesn't seem to work after entering appropriate proxy server information. Our proxy server uses port 80 with no user name / password.

It's just seems to time out...similar to what happens when the module isn't installed.

CommentFileSizeAuthor
#13 drupal-update.zip38.76 KBmasterv-1

Comments

stacysimpson’s picture

Also, I think there is a typo on line 92 of 'update_status_proxy.module'. Three '=' characters.

Rob Knight’s picture

The three '=' characters is just comparison checking with type comparison - see http://uk.php.net/manual/en/language.operators.comparison.php

On the general issue though, what is your configuration like? I have the module working on my setup, but different proxy setups might not work so well (it's kinda hard to test given the number of different network/proxy configurations out there).

The following info would be helpful:

1) What OS is the Drupal site is running on?
2) Does your proxy use authentication? If so, what kind?
3) What proxy software is running?

Thanks!

Rob Knight’s picture

Assigned: Unassigned » Rob Knight
stacysimpson’s picture

#1. Ubuntu 6.4 (Apache/2.2.12 (Ubuntu) and PHP Version 5.2.10-2)
#2. No authentication
#3. No idea, but we have asked the question.

euskarez’s picture

1) centos, apache, php 5.2
2) no authentication
3) proxy software: squid

game’s picture

I too could not get this to work:

IIS7 on Windows Server 2008R2
Drupal 6.19
PHP 5.2
Proxy server is a Council Proxy so not sure about exact type but I have a feeling its squid.

Any update on this would be great as this has always been a nightmare.

Cheers

Rob Knight’s picture

It's weird. It works on my system. I'm going to try testing it out on some virtual machines over the next few days, to see how it behaves under different configurations. Thanks to everyone for posting version information!

bloke_zero’s picture

Doesn't work for me either, simple proxy server no user or password. Patch at http://drupal.org/node/735420 works though.

decibel.places’s picture

not working

local dev on Windows 7 32 bit + Xampp

proxy uses IP:port only no user/pass

patch in #8 http://drupal.org/node/735420 works

thomasmurphy’s picture

Also not working for me at all

1) OS is SUSE Linux Enterprise Server 11 (x86_64) PATCHLEVEL = 1

2) No authentication

3) Proxy is squid/2.7.STABLE3 (but that isn't recieving any packets from my webserver, so isn't the problem)

pieterdc’s picture

Also not working for me

1) Ubuntu 201104
2) Basic authentication
3) A Microsoft product, I guess

proxy.drupal.6.20.patch from #735420: Drupal 6 proxy server support works for me

masterv-1’s picture

Hi There,

I work in the University of Arts and we are running drupal 6.x, we also had problems making the drupal update work from within our network.

I ended up writing a perl script to do this task which does appear to be working

Our scripts are in /usr/local/scripts/

1. Configuration file drupal-update.cfg (/usr/local/scripts/drupal-update.cfg)

# Configuration File for drupal-update


# Debug mode - Can use this to see if script is runnig ok
# Change from 0 to 1 to enable debug
debug = 0


# Path that all modules are located in
module_path = /path/to/website/www/sites/all/modules/

# Drupal update url which includes version
drupal_update = http://updates.drupal.org/release-history/
drupal_version = 6.x

# module file that ends with .info
file_pattern = info

# Search pattern within the above file
search_pattern = version

# Modules not to look for
ignoremodule =  /usr/local/scripts/drupal-modules.ignore

# proxy server
proxy_server = http://your_proxy.server:3128

# Various log files that results dumped in that is then emailed
log_file = /tmp/drupal-update.log

html = drupal-update-results.html

csv = drupal-update-results.csv

security_html = drupal-security-update-results.html

security_csv = drupal-security-update-results.csv

# define your smtp host usually localhost or u can define smarthost here.
smtphost = localhost

#your domain  or servername
domain = domain.com

#your email address used when sedning out abuse emails
from = webmaster@domain.com

#This is when it fails to find a whois email - it will send the abuse email to you
to = user@domain.com


# Storage of modules that are downloaded
storage = /path/to/website/module_downloads/

wget = /usr/bin/wget

# Set download to 1 to actually download modules
download = 0;

2. /usr/local/scripts/drupal-modules.ignore
This is the file to list all modules that you wish ignore from being looked up

# list of modules to ignore simply provide folder names of modules you wish to ignore
# module_name
# module_name1
# module_name2

3. Perl script
/usr/local/scripts/drupal-update.pl

#!/usr/bin/perl

# Written by Vahid Hedayati December 2011  for University of the Arts London
# badvad@gmail.com
# Feel free to update/reuse as needed

# use warnings;
use File::Find;
## use File::Fetch;

use LWP::UserAgent;
use URI::Escape;
use HTTP::Request;
use HTTP::Response;


use MIME::Lite;
use Net::SMTP;

# $ENV{'PATH'} = /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/scripts/;

our ($debug,$module_path,$file_pattern,$search_pattern,$ignoremodule,$proxy_server,$log_file,$html,$csv,$smtphost,$from,$to,$domain,$storage,$wget,$security_csv,$security_html);
our ($drupal_update,$drupal_version);

our ($url,$go,$go1,$download);
our ($name,$newversion,$link,$download,$spec,$value,$status,$i,$rel,$reld);
our ($spec2,$pattern2,$value2,$ig,$rname,$rtype,$value3,$archive_type);

my $config=$ARGV[0];

## If run type second input = security 
## It will only return security results
my $runtype=$ARGV[1];

my $defaultconf="/usr/local/scripts/drupal-update.cfg";
if ($config eq '') { $config=$defaultconf; }

#Run through config 

open (CONFIG,"$config")|| die "Could not open $config file\n";
while (<CONFIG>) {
    chomp;                  # no newline
    s/#.*//;                # no comments
    s/^\s+//;               # no leading white
    s/\s+$//;               # no trailing white
    next unless length;     # anything left?
    my ($var, $value) = split(/\s*=\s*/, $_, 2);
    no strict 'refs';
    $$var = $value;
}


my %ignoremodule=();

#Read in known hosts ports
mass_open($ignoremodule);

$ENV{'http_proxy'} = $proxy_server;

my @list;
my %seen;


find(\&dirsearch, $module_path);
getURL();
##getURL2();

sub dirsearch {
        my ($ignore,$mod,$version);
        my $file = $File::Find::name;

        ## $file =~ s,/,\\,g;
        return unless -f $file;
        return unless $file =~ /$file_pattern/;
        open F, $file or print "couldn't open $file\n" && return;
        my $pattern="(.*)\/(.*)\.$file_pattern";
        ($ignore,$mod) = $file  =~ /$pattern/;

        while (<F>) {
                ## Within search pattern  = added so that it looks for version = 
                if (my ($found) = m/($search_pattern = )/o) {
                        my $pattern2="^version = \"(.*)\"";
                        ($version) = $_  =~ /$pattern2/;

                        next if defined($ignoremodule{$mod});

                        push(@list, "$mod,$version");
                }
        }

  close F;
}


sub getURL { 
        open(LOGFILE, ">$log_file") || warn "cannot open log file $log_file: $!";
        open(SECURITY_CSV, ">$security_csv") || warn "cannot open log file $csv: $!";
        open(SECURITY_HTML, ">$security_html") || warn "cannot open log file $html: $!";
        open(CSV, ">$csv") || warn "cannot open log file $csv: $!";
        open(HTML, ">$html") || warn "cannot open log file $html: $!";
        if ($runtype eq "security") {
                print SECURITY_HTML "<table with=100% align=center border=1>";
                print SECURITY_CSV "MODULE,NAME,INSTALLED_VERSION,NEW_VERSION,LINK,DOWNLOAD,STATUS,RELEASE_TYPE\n";
        }else{
                print HTML "<table with=100% align=center border=1>";
                print CSV "MODULE,NAME,INSTALLED_VERSION,NEW_VERSION,LINK,DOWNLOAD,STATUS,RELEASE_TYPE\n";
        }





        my @list_unique = grep { ! $seen{$_}++ } @list;
        foreach ( @list_unique ) {
                        my $pattern="(.*),(.*)";
                        ($mod,$oldversion) = $_  =~ /$pattern/;
                        $url = $drupal_update."/".$mod."/".$drupal_version."?site_key=&version=$oldversion";

                        # $url = "http://updates.drupal.org/release-history/$mod/6.x?site_key=&version=$oldversion";

                         if ($debug eq "1") {
                                print  "\n\n-----------------------------------------------------------------------------------\n";
                                print "working on $mod --- $oldversion  -- $url \n";
                        }

                        my $ua = LWP::UserAgent->new();

                        ## pulls in proxy server via config file and transmits url get via proxy
                        $ua->proxy(http => $proxy_server);
                        ##$ua->env_proxy; 

                        my $req = HTTP::Request->new(GET=> $url);
                        my $response = $ua->request($req);
                        if ($response->is_error()) {
                                $response->error_as_HTML();
                        }
                        $content = $response->content();
                        @page = split(/\n/,$content);
                        $go=0;
                        $i=0;
                        $rel="<release>";
                        $reld="<\/release>";
                        $go1=0;
                        foreach $line (@page) {
                                if ($_ =~ /$rel/) { $i++; $go=1;}
                                $line = uri_unescape($line);
                                $_=$line;
                                chomp($_);
                                $_ =~ s/^\s+//;
                                $_ =~ s/\s+$//;
                                         $pattern="\<(.*)\>(.*)\<\/(.*)\>";
                                         #  $pattern2="<term><(.*)>Release type<\/(.*)><(.*)>(.*)<\/(.*)><\/(.*)>";
                                         $pattern2="<term><name>Release type<\/name><value>(.*)<\/value>\<\/term>";
                                        if  ( ($i==1) && ($go==1)) { 
                                                if ($pattern) { 
                                                        ($spec,$value3,$ig) = $_  =~ /$pattern/;
                                                        if ($spec eq "") { 
                                                        }else{
                                                                chomp ($spec);
                                                                if ($spec =~ /name$/ ) { $name=$value3; }
                                                                if ($spec =~ /version$/ ) { $newversion=$value3; }
                                                                if  ($spec=~ /status$/) { $status=$value3; chomp $status; if ( $status=~ /published$/) { }else{ $go=0; $i--; } }
                                                                if ($spec =~ /release_link/)  { $link=$value3; }
                                                                if ($spec =~ /download_link/ )  { $download=$value3; }
                                                                if ($spec =~ /archive_type/ )  { $archive_type=$value3; }
                                                        }
                                                }
                                                if ($pattern2) { 
                                                        ($value2) = $_  =~ /$pattern2/;
                                                        if ( $value2 eq "") { 
                                                        } else { 
                                                                $rname=$value2;
                                                        }
                                                }

                                        }
                                        if ($_ =~ /$reld/) { $go=0;}
                        }
                        if ($oldversion ne $newversion) { 
                                if ($runtype eq "security") {

                                        if ($rname =~ /Security update/) { 
                                                print SECURITY_CSV  "$mod,$name,$oldversion,$newversion,$link,$download,$status,$rname\n";

                                                print SECURITY_HTML "<tr><td colspan=3><font size=+2><a href=\"$link\">$mod</a></td></tr>\n";
                                                print SECURITY_HTML "<tr><td>$name</td><td>Current: $oldversion</td><td><b>Latest: $newversion</b></td></tr>\n";
                                                print SECURITY_HTML "<tr><td><a href=\"$download\">Download</a> Downloaded to $storage/$mod.$archive_type</td>";
                                                print SECURITY_HTML "<td>Status: $status</td>";
                                                print SECURITY_HTML "<td><b>$rname</b>";
                                                print SECURITY_HTML "</td></tr>\n";
                                                print SECURITY_HTML "<tr bgcolor=#CCCCCC><td colspan=3 height=10 ></td></tr>\n";
                                                if ($download eq "1") { 
                                                        ##Download latest module
                                                        open(WGET,"$wget -q '$download' -O $storage$mod\.$archive_type|") || warn "$wget failed $!\n";
                                                }
                                        }

                                ## not looking for security only so produce overall report
                                } else {
                                        if ($debug eq "1") { 
                                                print "MOD: $mod |  NAME: $name | $oldversion -  $newversion  | $link  | $download | $status | $rname \n";
                                        }

                                        if ($download eq "1") { 
                                                ##Download latest module
                                                open(WGET,"$wget -q '$download' -O $storage$mod\.$archive_type|") || warn "$wget failed $!\n";
                                        }

                                        print CSV "$mod,$name,$oldversion,$newversion,$link,$download,$status,$rname\n";
                                        print HTML "<tr><td colspan=3><font size=+2><a href=\"$link\">$mod</a></td></tr>\n";
                                        print HTML "<tr><td>$name</td><td>Current: $oldversion</td><td><b>Latest: $newversion</b></td></tr>\n";
                                        print HTML "<tr><td><a href=\"$download\">Download</a> Downloaded to $storage/$mod.$archive_type</td>";
                                        print HTML "<td>Status: $status</td><td><b>$rname</b>";
                                        print HTML "</td></tr>\n";
                                        print HTML "<tr bgcolor=#CCCCCC><td colspan=3 height=10 ></td></tr>\n";

                                        print LOGFILE "MOD: $mod | NAME: $name | $oldversion - $newversion | $link | $download  | $status | $rname \n";
                                }

                }
        }

        my $subject;
        if ($runtype eq "security") {
                print SECURITY_HTML "</table>";
                close (SECURITY_HTML);
                close (SECURITY_CSV);
                $subject="Drupal SECURITY module updates";
        }else{
                print HTML "</table>";
                close (HTML);
                close (CSV);
                $subject="Drupal general module updates";
        }

        close (LOGFILE);
        my $body="Please review attached files ..";

        if ($runtype eq "security") {
                $filesize = -s $security_csv;
                ## Default csv header is 79k so this looks for any increment above it before sending email
                if ($filesize > 80 ) {
                        &sendmail($from,$to,$subject,$body,$security_html,$security_csv,"",$smtphost);
                }
        }else{
                $filesize = -s $csv;
                 ## Default csv header is 79k so this looks for any increment above it before sending email
                if ($filesize > 80 ) {
                        &sendmail($from,$to,$subject,$body,$html,$csv,"",$smtphost);
                }
        }

}

sub sendmail { 

  ##$spath=$_[0];
  $from=$_[0];
  $to=$_[1];
  $subject=$_[2];
  $body=$_[3];
  $attach1=$_[4];
  $attach2=$_[5];
  $attach3=$_[6];
  $smtphost=$_[7];

# print "About to send email $smtphost ";

 #print "-->$attach2<---";
 # print "\n\n$from -- $to -- $subject -- $body -- $attach1 - $smtphost";

 ### Create the multipart "container":
    $msg = MIME::Lite->new(
        From    =>$from,
        To      =>$to,
        ##Cc      =>'some@other.com, some@more.com',
        Subject =>$subject,
        Type    =>'multipart/mixed'
    );

    ### Add the text message part:
    ### (Note that "attach" has same arguments as "new"):
    $msg->attach(
        Type     =>'TEXT',
        Data     =>$body
    );
    ### Add the image part:
        if ($attach1 eq "") { }else{
                $msg->attach(
                        Type        =>'text/html',
                        Path        =>$attach1,
                        ##Path        =>$spath."/".$attach1,
                        Filename    =>$attach1,
                        Disposition => 'attachment'
                );
        }
        if ($attach2 eq "") { }else{
                $msg->attach(
                        Type        =>'text/html',
                        #Path        =>$spath."/".$attach2,
                        Path        =>$attach2,
                        Filename    =>$attach2,
                        Disposition => 'attachment'
                );
        }

   if ($attach3 eq "") { }else{
        $msg->attach(
                Type        =>'text/html',
                #Path        =>$spath."/".$attach3,
                Path        =>$attach3,
                Filename    =>$attach3,
                Disposition => 'attachment'
        );
  }


MIME::Lite->send('smtp', $smtphost, Timeout=>60);
$msg->send; 

}

sub mass_open {
  my  ($file)=@_;
   open (FILE,"<$file");
   while (<FILE>) {
   if ($_ =~ /^#/) {} else {
     $val=$_;
     chomp($val);
        $ignoremodule{$val}=1;
     }
   }
 }


4. Cron entries

## Run drupal update script
30 7 * * * root cd /usr/local/scripts/; ./drupal-update.pl ./drupal-update.cfg security
30 7 * * 1 root cd /usr/local/scripts/; ./drupal-update.pl ./drupal-update.cfg 

First runs every day looking for security upates
Second runs every monday to list all other updates.

Thanks

Vahid

masterv-1’s picture

StatusFileSize
new38.76 KB

Just to add the perl script relies on two Perl Modules Email and MIME

Both of which as well as all of the above scripts/configuration can be found in the attached file.

Enjoy

masterv-1’s picture

https://sourceforge.net/projects/drupal-update/

There was a minor bug now fixed on latest version which can be found on above sourceforge link