Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move database and external program settings #2338

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
18 changes: 4 additions & 14 deletions bin/addcourse
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ sub usage_error {
warn "@_\n";
warn "usage: $0 [options] COURSEID\n";
warn "Options:\n";
warn " [--db-layout=LAYOUT]\n";
warn " [--users=FILE [--professors=USERID[,USERID]...] ]\n";
exit;
}
Expand All @@ -99,7 +98,6 @@ my ($dbLayout, $users, $templates_from) = ('', '', '');
my @professors;

GetOptions(
"db-layout=s" => \$dbLayout,
"users=s" => \$users,
"professors=s" => \@professors,
"templates-from=s" => \$templates_from,
Expand All @@ -114,23 +112,15 @@ $ce = WeBWorK::CourseEnvironment->new({ courseName => $courseID });
die "Aborting addcourse: Course ID cannot exceed $ce->{maxCourseIdLength} characters."
if length($courseID) > $ce->{maxCourseIdLength};

if ($dbLayout) {
die "Database layout $dbLayout does not exist in the course environment.",
" (It must be defined in defaults.config.)\n"
unless exists $ce->{dbLayouts}{$dbLayout};
} else {
$dbLayout = $ce->{dbLayoutName};
}

usage_error("Can't specify --professors without also specifying --users.")
if @professors && !$users;

my @users;
if ($users) {
# This is a hack to create records without bringing up a DB object
my $userClass = $ce->{dbLayouts}{$dbLayout}{user}{record};
my $passwordClass = $ce->{dbLayouts}{$dbLayout}{password}{record};
my $permissionClass = $ce->{dbLayouts}{$dbLayout}{permission}{record};
my $userClass = $ce->{dbLayout}{user}{record};
my $passwordClass = $ce->{dbLayout}{password}{record};
my $permissionClass = $ce->{dbLayout}{permission}{record};

runtime_use($userClass);
runtime_use($passwordClass);
Expand Down Expand Up @@ -190,7 +180,7 @@ eval {
addCourse(
courseID => $courseID,
ce => $ce,
courseOptions => { dbLayoutName => $dbLayout },
courseOptions => {},
users => \@users,
%optional_arguments,
);
Expand Down
9 changes: 2 additions & 7 deletions bin/old_scripts/wwaddindexing
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@

=head1 NAME

wwaddindexing - add indices to an existing sql_single course.
wwaddindexing - add indices to an existing course.

=head1 SYNOPSIS

wwaddindexing COURSEID

=head1 DESCRIPTION

Adds indices to the course named COURSEID. The course must use the sql_single
database layout.
Adds indices to the course named COURSEID.

=cut

Expand Down Expand Up @@ -74,10 +73,6 @@ my $ce = WeBWorK::CourseEnvironment->new({
courseName => $courseID,
});

# make sure the course actually uses the 'sql_single' layout
usage_error("$courseID: does not use 'sql_single' database layout.")
unless $ce->{dbLayoutName} eq "sql_single";

# get database layout source data
my %sources = dbLayoutSQLSources($ce->{dbLayout});

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 @@ -212,7 +212,7 @@ BEGIN
},
);

my $db = new WeBWorK::DB($ce->{dbLayouts}{ $ce->{dbLayoutName} });
my $db = new WeBWorK::DB($ce->{dbLayout});
my @table_types = sort(grep { !$db->{$_}{params}{non_native} } keys %$db);

sub checkAndUpdateTableColumnTypes {
Expand Down
5 changes: 2 additions & 3 deletions conf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Basic webwork2 configuration files.
- `localOverrides.conf.dist` should be copied to `localOverrides.conf`. `localOverrides.conf` will be read after the
`defaults.config` file is processed and will overwrite configurations in `defaults.config`. Use this file to make
changes to the settings in `defaults.config`.
- `database.conf.dist` contains database configuration parameters. It is included by `defaults.config`. This file
should not be copied or modified unless you really know what you are doing.

Configuration extension files.

Expand All @@ -30,7 +28,8 @@ Configuration extension files.
Server configuration files.

- `webwork2.mojolicious.dist.yml` contains the webwork2 Mojolicious app configuration settings. Copy this file to
`webwork2.mojolicious.yml` if you need to change those settings. You usually will need to do this.
`webwork2.mojolicious.yml` if you need to change those settings. You usually will need to do this. This file
contains server settings, database settings and paths to external programs.
- `webwork2.dist.service` is a systemd configuration file for linux systems that serves the webwork2 app via the
Mojolicious hypnotoad server. If you need to change it, then copy it to `webwork2.service`.
- `webwork2-job-queue.dist.service` is a systemd configuration file for linux systems that runs the webwork2 job queue
Expand Down
Loading