Make-course-archive.pl

From WeBWorK
(Difference between revisions)
Jump to: navigation, search
(Created page with ' #!/usr/bin/perl # # Hal Sadofsky, September 4, 2010 # # Called with a course name to archive. This just calls the perl subroutine # "archiveCourse" that should exist in th…')
 
 
Line 40: Line 40:
 
   
 
   
 
  archiveCourse(%archivearg);
 
  archiveCourse(%archivearg);
 +
 +
[[Category:Scripts]]

Latest revision as of 10:24, 17 January 2011

#!/usr/bin/perl
#
# Hal Sadofsky, September 4, 2010
#
# Called with a course name to archive.  This just calls the perl subroutine
# "archiveCourse" that should exist in the CourseManagement.pm distributed with
# WeBWorK.  It makes a .tar.gz file in the courses directory.  It doesn't
# delete the course.
# 
# usage from the shell is
#
# perl make-course-archive.pl courseID
#
# where courseID is an existing WeBWorK course.
#
#
use strict;
$ENV{'WEBWORK_ROOT'} = '/opt/webwork/webwork2';

use lib "$ENV{WEBWORK_ROOT}/lib";
use WeBWorK::Utils qw(runtime_use readFile cryptPassword);
use WeBWorK::CourseEnvironment;
use WeBWorK::DB;
use WeBWorK::CGI;
use WeBWorK::Utils::CourseManagement qw(archiveCourse);

my ( $archiveDir, $wwHome, $wwCourseDir, $courseID, $key, $value );

$archiveDir = '/opt/webwork/old/';
$wwHome = '/opt/webwork/webwork2/';
$wwCourseDir = "$wwHome/courses";
$courseID = "$ARGV[0]";

my $ce = WeBWorK::CourseEnvironment->new( { webwork_dir=>$wwHome,
                                            courseName=>$courseID } );
my %archivearg = (
      courseID => $courseID, 
      ce       => $ce,
      db0ptions => '()'); 

archiveCourse(%archivearg);
follow us