version 1.84, 2002/07/17 18:23:45
|
version 1.85, 2002/07/26 19:35:20
|
Line 235 sub set_allow {
|
Line 235 sub set_allow {
|
return $return_url |
return $return_url |
} |
} |
|
|
|
sub get_subscribed_hosts { |
|
my ($target)=@_; |
|
my @subscribed; |
|
my $filename; |
|
$target=~/(.*)\/([^\/]+)$/; |
|
my $srcf=$2; |
|
opendir(DIR,$1); |
|
while ($filename=readdir(DIR)) { |
|
if ($filename=~/$srcf\.(\w+)$/) { |
|
my $subhost=$1; |
|
if ($subhost ne 'meta' && $subhost ne 'subscription') { |
|
push(@subscribed,$subhost); |
|
} |
|
} |
|
} |
|
closedir(DIR); |
|
my $sh; |
|
if ( $sh=Apache::File->new("$target.subscription") ) { |
|
&Apache::lonnet::logthis("opened $target.subscription"); |
|
while (my $subline=<$sh>) { |
|
&Apache::lonnet::logthis("Trying $subline"); |
|
if ($subline =~ /(^\w+):/) { push(@subscribed,$1); } else { |
|
&Apache::lonnet::logthis("No Match for $subline"); |
|
} |
|
} |
|
} else { |
|
&Apache::lonnet::logthis("Un able to open $target.subscription"); |
|
} |
|
&Apache::lonnet::logthis("Got list of ".join(':',@subscribed)); |
|
return @subscribed; |
|
} |
|
|
sub publish { |
sub publish { |
|
|
my ($source,$target,$style)=@_; |
my ($source,$target,$style)=@_; |
Line 931 if (-e $target) {
|
Line 963 if (-e $target) {
|
|
|
# --------------------------------------------------- Send update notifications |
# --------------------------------------------------- Send update notifications |
|
|
{ |
my @subscribed=&get_subscribed_hosts($target); |
|
foreach my $subhost (@subscribed) { |
my $filename; |
$scrout.='<p>Notifying host '.$subhost.':'; |
|
print $logfile "\nNotifying host ".$subhost.':'; |
$target=~/(.*)\/([^\/]+)$/; |
my $reply=&Apache::lonnet::critical('update:'.$target,$subhost); |
my $srcf=$2; |
$scrout.=$reply; |
opendir(DIR,$1); |
print $logfile $reply; |
while ($filename=readdir(DIR)) { |
|
if ($filename=~/$srcf\.(\w+)$/) { |
|
my $subhost=$1; |
|
if ($subhost ne 'meta') { |
|
$scrout.='<p>Notifying host '.$subhost.':'; |
|
print $logfile "\nNotifying host '.$subhost.':'"; |
|
my $reply=&Apache::lonnet::critical('update:'.$target,$subhost); |
|
$scrout.=$reply; |
|
print $logfile $reply; |
|
} |
|
} |
|
} |
} |
closedir(DIR); |
|
|
|
} |
|
|
|
# ---------------------------------------- Send update notifications, meta only |
# ---------------------------------------- Send update notifications, meta only |
|
|
{ |
my @subscribedmeta=&get_subscribed_hosts("$target.meta"); |
|
foreach my $subhost (@subscribedmeta) { |
my $filename; |
$scrout.='<p>Notifying host for metadata only '.$subhost.':'; |
|
print $logfile "\nNotifying host for metadata only ".$subhost.':'; |
$target=~/(.*)\/([^\/]+)$/; |
my $reply=&Apache::lonnet::critical('update:'.$target.'.meta', |
my $srcf=$2.'.meta'; |
$subhost); |
opendir(DIR,$1); |
$scrout.=$reply; |
while ($filename=readdir(DIR)) { |
print $logfile $reply; |
if ($filename=~/$srcf\.(\w+)$/) { |
|
my $subhost=$1; |
|
if ($subhost ne 'meta') { |
|
$scrout.= |
|
'<p>Notifying host for metadata only '.$subhost.':'; |
|
print $logfile |
|
"\nNotifying host for metadata only '.$subhost.':'"; |
|
my $reply=&Apache::lonnet::critical( |
|
'update:'.$target.'.meta',$subhost); |
|
$scrout.=$reply; |
|
print $logfile $reply; |
|
} |
|
} |
|
} |
} |
closedir(DIR); |
|
|
|
} |
|
|
|
# ------------------------------------------------ Provide link to new resource |
# ------------------------------------------------ Provide link to new resource |
|
|