[LON-CAPA-cvs] cvs: modules /gerd/authorspace cpfiles.pl
www
www@source.lon-capa.org
Fri, 24 Jun 2011 16:29:51 -0000
www Fri Jun 24 16:29:51 2011 EDT
Modified files:
/modules/gerd/authorspace cpfiles.pl
Log:
Seems like it's working
Index: modules/gerd/authorspace/cpfiles.pl
diff -u modules/gerd/authorspace/cpfiles.pl:1.2 modules/gerd/authorspace/cpfiles.pl:1.3
--- modules/gerd/authorspace/cpfiles.pl:1.2 Fri Jun 24 15:54:50 2011
+++ modules/gerd/authorspace/cpfiles.pl Fri Jun 24 16:29:51 2011
@@ -20,6 +20,8 @@
my $parameter=shift;
+my ($login,$pass,$uid,$gid) = getpwnam('www');
+
my $commit=($parameter=~/commit/);
if ($commit) {
@@ -33,6 +35,7 @@
if ($commit) {
print "\nMaking /home/httpd/html/priv\n";
mkdir('/home/httpd/html/priv');
+ chown($uid,$gid,'/home/httpd/html/priv');
}
# Authors hosted on this server
@@ -41,6 +44,14 @@
foreach my $domain_directory (</home/httpd/lonUsers/*>) {
my ($domain) = ($domain_directory=~/\/([^\/]+)$/);
print "Found domain: $domain\n";
+ my $dom_target="/home/httpd/html/priv/$domain";
+ if ($commit) {
+ print "Making $dom_target\n";
+ mkdir($dom_target);
+ chown($uid,$gid,$dom_target);
+ } else {
+ print "Would make $dom_target\n";
+ }
my @domauth=();
foreach my $domain_author (</home/httpd/html/res/$domain/*>) {
my ($author)=($domain_author=~/\/([^\/]+)$/);
@@ -79,8 +90,18 @@
}
}
}
- unless ($domain) {
+ if ($domain) {
+ my $source_path="/home/$author/public_html";
+ my $target_path="/home/httpd/html/priv/$domain/$author";
+ if ($commit) {
+ print "Moving $source_path to $target_path\n";
+ move($source_path,$target_path);
+ chown($uid,$gid,$target_path);
+ } else {
+ print "Would move $source_path to $target_path\n";
+ }
+ } else {
print "*** WARNING: $author has no domain. The author may not have published.\n";
}
-
}
+print "\nDone.\n";