[LON-CAPA-cvs] cvs: loncom /publisher loncfile.pm

raeburn raeburn at source.lon-capa.org
Sun Oct 30 15:27:27 EDT 2011


raeburn		Sun Oct 30 19:27:27 2011 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  - use lonDocRoot perlvar in place of static string: '/home/httpd/html'
  - coding style: eliminate leaning toothpicks.
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.111 loncom/publisher/loncfile.pm:1.112
--- loncom/publisher/loncfile.pm:1.111	Mon Oct 24 22:39:21 2011
+++ loncom/publisher/loncfile.pm	Sun Oct 30 19:27:27 2011
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.111 2011/10/24 22:39:21 www Exp $
+# $Id: loncfile.pm,v 1.112 2011/10/30 19:27:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -188,8 +188,9 @@
 
 sub obsolete_unpub {
     my ($user,$domain,$construct)=@_;
+    my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
     my $published=$construct;
-    $published=~s/^\/home\/httpd\/html\/priv\//\/home\/httpd\/html\/res\//;
+    $published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/};
     if (-e $published) {
 	if (&Apache::lonnet::metadata($published,'obsolete')) {
 	    return 1;
@@ -270,8 +271,9 @@
     my ($user, $domain, $construct, $creating) = @_;
     $creating ||= 'file';
 
+    my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
     my $published=$construct;
-    $published=~s{^/home/httpd/html/priv/}{/home/httpd/html/res/};
+    $published=~s{^\Q$londocroot/priv/\E}{$londocroot/res/};
     my ($type,$result);
     if ( -d $construct ) {
 	return ('error','<p><span class="LC_error">'.&mt('Error: destination for operation is an existing directory.').'</span></p>');




More information about the LON-CAPA-cvs mailing list