Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions bin/OPL-update
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ use strict;
use warnings;

BEGIN {
die "WEBWORK_ROOT not found in environment.\n"
unless exists $ENV{WEBWORK_ROOT};
# Unused variable, but define it to avoid an error message.
$WeBWorK::Constants::WEBWORK_DIRECTORY = '';
die "WEBWORK_ROOT not found in environment.\n" unless exists $ENV{WEBWORK_ROOT};
$ENV{PG_ROOT} //= "$ENV{WEBWORK_ROOT}/../pg";
die "The pg directory must be defined in PG_ROOT" unless (-e $ENV{PG_ROOT});
Expand All @@ -34,7 +30,7 @@ use lib "$ENV{WEBWORK_ROOT}/bin";
use WeBWorK::CourseEnvironment;
use Helper 'runScript';

my $ce = new WeBWorK::CourseEnvironment({webwork_dir=>$ENV{WEBWORK_ROOT}});
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $ENV{PG_ROOT} });

print "\nDownloading the latest OPL release.\n";
runScript("$ENV{WEBWORK_ROOT}/bin/download-OPL-metadata-release.pl");
Expand Down
9 changes: 3 additions & 6 deletions bin/OPL-update-legacy
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ use DBI;
#You can increase path length to 4096 for mysql > 5.0.3)

BEGIN {
die "WEBWORK_ROOT not found in environment.\n"
unless exists $ENV{WEBWORK_ROOT};
# Unused variable, but define it to avoid an error message.
$WeBWorK::Constants::WEBWORK_DIRECTORY = '';
die "WEBWORK_ROOT not found in environment.\n" unless exists $ENV{WEBWORK_ROOT};
}

# Taxonomy global variables
Expand Down Expand Up @@ -90,7 +87,7 @@ use WeBWorK::CourseEnvironment;
use WeBWorK::Utils::Tags;
use OPLUtils qw/build_library_directory_tree build_library_subject_tree build_library_textbook_tree writeJSONtoFile/;

my $ce = new WeBWorK::CourseEnvironment({webwork_dir=>$ENV{WEBWORK_ROOT}});
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_dir });

# decide whether the mysql installation can handle
# utf8mb4 and that should be used for the OPL
Expand Down Expand Up @@ -715,7 +712,7 @@ sub pgfiles {
my $lang = $tags->{Language} || 'en';
my $mathobj = $tags->{MO} || 0;
my $static = $tags->{Static} || 0;

my @pgfile_ids = ();

for my $DBsection_id (@DBsection_ids) {
Expand Down
2 changes: 1 addition & 1 deletion bin/addcourse
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ use lib "$pg_dir/lib";
use WeBWorK::CourseEnvironment;

# Grab course environment (by reading webwork2/conf/defaults.config)
my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => $webwork_dir });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $webwork_dir, pg_dir => $pg_dir });

use WeBWorK::DB;
use WeBWorK::File::Classlist;
Expand Down
3 changes: 2 additions & 1 deletion bin/change_user_id
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ my $new_user_id = shift;

my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
courseName => $courseID
pg_dir => $pg_dir,
courseName => $courseID
});

my $db = new WeBWorK::DB($ce->{dbLayout});
Expand Down
3 changes: 2 additions & 1 deletion bin/delcourse
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ usage_error("must specify COURSEID.") unless $courseID;
# bring up a minimal course environment
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
courseName => $courseID,
pg_dir => $ENV{PG_ROOT},
courseName => $courseID,
});

my $dbLayout = $ce->{dbLayoutName};
Expand Down
2 changes: 1 addition & 1 deletion bin/download-OPL-metadata-release.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ BEGIN
use WeBWorK::CourseEnvironment;
use Helper 'runScript';

my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => $ENV{WEBWORK_ROOT} });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_dir });

my $rawData;
my $releaseDataFF =
Expand Down
4 changes: 1 addition & 3 deletions bin/dump-OPL-tables.pl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ BEGIN

# get course environment and configured OPL path

my $ce = new WeBWorK::CourseEnvironment({
webwork_dir => $ENV{WEBWORK_ROOT},
});
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_dir });

my $configured_OPL_path = $ce->{problemLibrary}{root};

Expand Down
6 changes: 4 additions & 2 deletions bin/dump_past_answers
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ my $csv = new Text::CSV->new({ binary => 1 })
or die "Cannot use CSV: " . Text::CSV->error_diag();
$csv->eol("\n");

my $ce = new WeBWorK::CourseEnvironment({
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir,
});

my @courses = listCourses($ce);
Expand All @@ -140,8 +141,9 @@ my @row;
foreach my $courseID (@courses) {
next if $courseID eq 'admin' || $courseID eq 'modelCourse';

$ce = new WeBWorK::CourseEnvironment({
$ce = WeBWorK::CourseEnvironment->({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir,
courseName => $courseID,
});
$db = new WeBWorK::DB($ce->{dbLayout});
Expand Down
2 changes: 1 addition & 1 deletion bin/generate-OPL-set-def-lists.pl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BEGIN
use OPLUtils qw/writeJSONtoFile/;
use WeBWorK::CourseEnvironment;

my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => $ENV{WEBWORK_ROOT} });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_root });
my $libraryRoot = $ce->{problemLibrary}{root};
my $contribRoot = $ce->{contribLibrary}{root};

Expand Down
1 change: 1 addition & 0 deletions bin/importClassList.pl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ BEGIN

my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir,
courseName => $courseID
});

Expand Down
3 changes: 2 additions & 1 deletion bin/integrity_check.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ BEGIN

my $courseName = "tmp_course";

my $ce = new WeBWorK::CourseEnvironment({
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir,
courseName => $courseName
});

Expand Down
3 changes: 2 additions & 1 deletion bin/load-OPL-global-statistics.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ BEGIN

# get course environment and configured OPL path

my $ce = new WeBWorK::CourseEnvironment({
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir
});

my $dbh = DBI->connect(
Expand Down
1 change: 1 addition & 0 deletions bin/newpassword
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ sub dopasswd {
# bring up a minimal course environment
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir,
courseName => $courseID
});

Expand Down
2 changes: 1 addition & 1 deletion bin/remove_stale_images
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ sub count_report {


# bring up a minimal course environment
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT} });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_dir });

my $dirHead = $ce->{webworkDirs}->{equationCache};
my $cachePath = $ce->{webworkFiles}->{equationCacheDB};
Expand Down
3 changes: 2 additions & 1 deletion bin/restore-OPL-tables.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ BEGIN

# get course environment and configured OPL path

my $ce = new WeBWorK::CourseEnvironment({
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir
});

my $configured_OPL_path = $ce->{problemLibrary}{root};
Expand Down
2 changes: 1 addition & 1 deletion bin/setfilepermissions
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ BEGIN {
use lib "$ENV{WEBWORK_ROOT}/lib";
use lib "$pg_dir/lib";
use WeBWorK::CourseEnvironment;
my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => $ENV{WEBWORK_ROOT} });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_dir });

# who is really running this script (even if sudo'ed)
# We set relevant directories so that script runner owns them
Expand Down
5 changes: 1 addition & 4 deletions bin/test_library_build.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ BEGIN
die "WEBWORK_ROOT not found in environment.\n" unless exists $ENV{WEBWORK_ROOT};
$pg_dir = $ENV{PG_ROOT} // "$ENV{WEBWORK_ROOT}/../pg";
die "The pg directory must be defined in PG_ROOT" unless (-e $pg_dir);

# Unused variable, but define it to avoid an error message.
$WeBWorK::Constants::WEBWORK_DIRECTORY = '';
}

# Get database connection
Expand All @@ -19,7 +16,7 @@ BEGIN
use OPLUtils qw/build_library_directory_tree build_library_subject_tree build_library_textbook_tree/;
use DBI;

my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => $ENV{WEBWORK_ROOT} });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_dir });
my $dbh = DBI->connect(
$ce->{database_dsn},
$ce->{database_username},
Expand Down
3 changes: 2 additions & 1 deletion bin/update-OPL-statistics.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ BEGIN
my $time = time();

# get course environment and open up database
my $ce = new WeBWorK::CourseEnvironment({
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir
});

# decide whether the mysql installation can handle
Expand Down
2 changes: 1 addition & 1 deletion bin/updateOPLextras.pl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ BEGIN
use WeBWorK::CourseEnvironment;
use OPLUtils qw/build_library_directory_tree build_library_subject_tree build_library_textbook_tree/;

my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => $ENV{WEBWORK_ROOT} });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $pg_dir });

# decide whether the mysql installation can handle
# utf8mb4 and that should be used for the OPL
Expand Down
2 changes: 1 addition & 1 deletion bin/upgrade-database-to-utf8mb4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ BEGIN
use WeBWorK::Utils::CourseManagement qw{listCourses};

# Load a minimal course environment.
my $ce = new WeBWorK::CourseEnvironment({ webwork_dir => $ENV{WEBWORK_ROOT} });
my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT}, pg_dir => $ENV{PG_ROOT} });

# Get DB connection settings.
my $dbname = $ce->{database_name};
Expand Down
3 changes: 2 additions & 1 deletion bin/upgrade_admin_db.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ BEGIN
##########################
my $upgrade_courseID = 'admin';

my $ce = new WeBWorK::CourseEnvironment({
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir,
courseName => $upgrade_courseID,
});
#warn "do_upgrade_course: updating |$upgrade_courseID| from" , join("|",@upgrade_courseIDs);
Expand Down
5 changes: 3 additions & 2 deletions bin/upload-OPL-statistics.pl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ BEGIN
use Net::Domain qw/domainname/;
use String::ShellQuote;

my $ce = new WeBWorK::CourseEnvironment({
my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
pg_dir => $pg_dir,
});

# Get DB connection settings
Expand Down Expand Up @@ -66,7 +67,7 @@ BEGIN
* the average number of attempts made per user on the problem
* the average completion percentage for each user who attempted the problem

Share OPL usage statistics with the WeBWorK community [Y/N]:
Share OPL usage statistics with the WeBWorK community [Y/N]:
END_REQUEST
$input = <STDIN>;
chomp $input;
Expand Down
3 changes: 0 additions & 3 deletions bin/webwork2
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ BEGIN {

$WeBWorK::SeedCE{webwork_dir} = $ENV{WEBWORK_ROOT};
$WeBWorK::SeedCE{pg_dir} = $ENV{PG_ROOT};
# Define these twice to avoid annoying used only once warnings.
$WeBWorK::Constants::WEBWORK_DIRECTORY = $WeBWorK::Constants::WEBWORK_DIRECTORY = $ENV{WEBWORK_ROOT};
$WeBWorK::Constants::PG_DIRECTORY = $WeBWorK::Constants::PG_DIRECTORY = $ENV{PG_ROOT};
}

use Mojolicious::Commands;
Expand Down
3 changes: 2 additions & 1 deletion bin/ww_purge_old_nonces
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ usage() unless $course ;

my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
courseName => $course,
pg_dir => $pg_dir,
courseName => $course,
});

my $db = WeBWorK::DB->new($ce->{dbLayout});
Expand Down
3 changes: 2 additions & 1 deletion bin/wwdb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ usage() unless $course and $command and $file;

my $ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
courseName => $course,
pg_dir => $pg_dir,
courseName => $course,
});

my $db = WeBWorK::DB->new($ce->{dbLayout});
Expand Down
3 changes: 2 additions & 1 deletion bin/wwsh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ die 'You must pass scriptFile in as a path to the file' unless -e $scriptFile;

$ce = WeBWorK::CourseEnvironment->new({
webwork_dir => $ENV{WEBWORK_ROOT},
courseName => $courseID,
pg_dir => $pg_dir,
courseName => $courseID,
});


Expand Down
73 changes: 0 additions & 73 deletions clients/README

This file was deleted.

Loading