Skip to content

Commit 1dfc58e

Browse files
committed
Continued removal of old dbLayouts
This removes all references to dbLayoutName and cases where the dbLayouts hash is used. With this, there is only the standard dbLayout, which is now defined in `WeBWorK::DB::Layout`.
1 parent f90b557 commit 1dfc58e

23 files changed

+465
-916
lines changed

bin/addcourse

+4-14
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ sub usage_error {
9090
warn "@_\n";
9191
warn "usage: $0 [options] COURSEID\n";
9292
warn "Options:\n";
93-
warn " [--db-layout=LAYOUT]\n";
9493
warn " [--users=FILE [--professors=USERID[,USERID]...] ]\n";
9594
exit;
9695
}
@@ -99,7 +98,6 @@ my ($dbLayout, $users, $templates_from) = ('', '', '');
9998
my @professors;
10099

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

117-
if ($dbLayout) {
118-
die "Database layout $dbLayout does not exist in the course environment.",
119-
" (It must be defined in defaults.config.)\n"
120-
unless exists $ce->{dbLayouts}{$dbLayout};
121-
} else {
122-
$dbLayout = $ce->{dbLayoutName};
123-
}
124-
125115
usage_error("Can't specify --professors without also specifying --users.")
126116
if @professors && !$users;
127117

128118
my @users;
129119
if ($users) {
130120
# This is a hack to create records without bringing up a DB object
131-
my $userClass = $ce->{dbLayouts}{$dbLayout}{user}{record};
132-
my $passwordClass = $ce->{dbLayouts}{$dbLayout}{password}{record};
133-
my $permissionClass = $ce->{dbLayouts}{$dbLayout}{permission}{record};
121+
my $userClass = $ce->{dbLayout}{user}{record};
122+
my $passwordClass = $ce->{dbLayout}{password}{record};
123+
my $permissionClass = $ce->{dbLayout}{permission}{record};
134124

135125
runtime_use($userClass);
136126
runtime_use($passwordClass);
@@ -190,7 +180,7 @@ eval {
190180
addCourse(
191181
courseID => $courseID,
192182
ce => $ce,
193-
courseOptions => { dbLayoutName => $dbLayout },
183+
courseOptions => {},
194184
users => \@users,
195185
%optional_arguments,
196186
);

bin/old_scripts/wwaddindexing

+2-7
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616

1717
=head1 NAME
1818
19-
wwaddindexing - add indices to an existing sql_single course.
19+
wwaddindexing - add indices to an existing course.
2020
2121
=head1 SYNOPSIS
2222
2323
wwaddindexing COURSEID
2424
2525
=head1 DESCRIPTION
2626
27-
Adds indices to the course named COURSEID. The course must use the sql_single
28-
database layout.
27+
Adds indices to the course named COURSEID.
2928
3029
=cut
3130

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

77-
# make sure the course actually uses the 'sql_single' layout
78-
usage_error("$courseID: does not use 'sql_single' database layout.")
79-
unless $ce->{dbLayoutName} eq "sql_single";
80-
8176
# get database layout source data
8277
my %sources = dbLayoutSQLSources($ce->{dbLayout});
8378

bin/upgrade-database-to-utf8mb4.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ BEGIN
212212
},
213213
);
214214

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

218218
sub checkAndUpdateTableColumnTypes {

conf/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ Configuration extension files.
2828
Server configuration files.
2929

3030
- `webwork2.mojolicious.dist.yml` contains the webwork2 Mojolicious app configuration settings. Copy this file to
31-
`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.
31+
`webwork2.mojolicious.yml` if you need to change those settings. You usually will need to do this. This file
32+
contains server settings, database settings and paths to external programs.
3233
- `webwork2.dist.service` is a systemd configuration file for linux systems that serves the webwork2 app via the
3334
Mojolicious hypnotoad server. If you need to change it, then copy it to `webwork2.service`.
3435
- `webwork2-job-queue.dist.service` is a systemd configuration file for linux systems that runs the webwork2 job queue

conf/defaults.config

+4-6
Original file line numberDiff line numberDiff line change
@@ -1017,12 +1017,10 @@ $pg{displayModeOptions}{images} = {
10171017
# as 'baseline' or 'middle'.
10181018
dvipng_align => 'baseline',
10191019

1020-
# If dbsource is set to a nonempty value, then this database connection information will be used to store dvipng
1021-
# depths. It is assumed that the 'depths' table exists in the database.
1022-
# These are set in the CourseEnvironment.
1023-
dvipng_depth_db => {}
1024-
},
1025-
};
1020+
# The dvipng_depth_db will be used to store dvipng depths. It is assumed that the 'depths'
1021+
# table exists in the database. If you wish to override using the standard database connections
1022+
# see localOverrides.conf
1023+
},
10261024

10271025
##### Directories used by PG
10281026

conf/localOverrides.conf.dist

+25
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,31 @@ $mail{feedbackRecipients} = [
404404

405405
#push (@{${pg}{modules}}, [qw(LaTeXImage)]);
406406

407+
408+
##############################
409+
# Additional Database options
410+
###############################
411+
412+
# If dbsource is set to a nonempty value, then this database connection information will be used to store dvipng
413+
# depths. It is assumed that the 'depths' table exists in the database.
414+
415+
# $pg{displayModeOptions}{images}{dvipng_depth_db} => {
416+
# dbsource => 'dsn_database_string',
417+
# user => 'dsn_database_username',
418+
# passwd => 'dsn_database_password',
419+
# },
420+
421+
# Problem Library SQL database connection information
422+
423+
# $problemLibrary_db = {
424+
# dbsource => 'database_dsn',
425+
# user => 'database_username',
426+
# passwd => 'database_password',
427+
# storage_engine => 'myisam',
428+
# };
429+
430+
431+
407432
################################################################################
408433
# Using R with WeBWorK
409434
################################################################################

conf/site.conf.dist

-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ $admin_course_id = 'admin';
9393
# status.
9494
#$new_courses_hidden_status = 'hidden';
9595

96-
# External Programs and database settings are now defined in webwork2.mojolicious.yml
97-
9896
#################################################################################
9997
# These variables describe the locations of various components of WeBWorK on your
10098
# server. You may use the defaults unless you have things in different places.

conf/webwork2.mojolicious.dist.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ externalPrograms:
252252
mkdir: /bin/mkdir
253253
tar: /bin/tar
254254
gzip: /bin/gzip
255-
git: /bin/git
255+
git: /usr/bin/git
256256
curl: /usr/bin/curl
257257
mysql: /usr/bin/mysql
258258
mysqldump: /usr/bin/mysqldump
@@ -266,8 +266,13 @@ externalPrograms:
266266
# use polyglossia and fontspec packages (which require xelatex or lualatex).
267267
# pdflatex: /usr/bin/xelatex --no-shell-escape
268268

269-
dvipng: /usr/bin/dvipng
269+
270+
# In order to use imagemagick convert you need to change the rights for PDF files from
271+
# "none" to "read" in the policy file /etc/ImageMagick-6/policy.xml. This has possible
272+
# security implications for the server.
270273
convert: /usr/bin/convert
274+
275+
dvipng: /usr/bin/dvipng
271276
dvisvgm: /usr/bin/dvisvgm
272277
pdf2svg: /usr/bin/pdf2svg
273278

@@ -296,15 +301,12 @@ database:
296301
# Standard permissions command used to initialize the webwork database
297302
# GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, INDEX, LOCK TABLES ON webwork.* TO webworkWrite@localhost IDENTIFIED BY 'passwordRW';
298303
# where webworkWrite and passwordRW must match the corresponding variables in the next section.
299-
username: ''
300-
password: ''
304+
username: webworkWrite
305+
password: passwordRW
301306

302307
# For a DB on localhost - default to using Unix socket. Change to 0 to use a TCP connection to 127.0.0.1.
303308
use_socket_if_localhost: 1
304309

305-
# Need to add the code in lines 209-217 to a perl file
306-
# Add line 234 to same file
307-
308310
# The default storange engine to use is set here:
309311
storage_engine: myisam
310312

courses.dist/modelCourse/course.conf

-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22

33
# This file is used to override the global WeBWorK course environment for this course.
44

5-
# Database Layout (global value typically defined in global.conf)
6-
# Several database are defined in the file conf/database.conf and stored in the
7-
# hash %dbLayouts.
8-
# The database layout is always set here, since one should be able to change the
9-
# default value in global.conf without disrupting existing courses.
10-
# global.conf values:
11-
# $dbLayoutName = 'sql_single';
12-
# *dbLayout = $dbLayouts{$dbLayoutName};
13-
$dbLayoutName = 'sql_single';
14-
*dbLayout = $dbLayouts{$dbLayoutName};
15-
165
# Users for whom to label problems with the PG file name
176
# For users in this list, PG will display the source file name when rendering a problem.
187
#$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_FOR} = ['user_id1'];

lib/Mojolicious/WeBWorK.pm

+1-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ sub startup ($app) {
172172
writeTimingLogEntry(
173173
$c->ce,
174174
'[' . $c->url_for . ']',
175-
sprintf('runTime = %.3f sec', $c->timing->elapsed('content_generator_rendering')) . ' '
176-
. $c->ce->{dbLayoutName},
177-
''
175+
sprintf('runTime = %.3f sec', $c->timing->elapsed('content_generator_rendering')), ''
178176
);
179177
}
180178
}

lib/WeBWorK/Authen.pm

+6-10
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,22 @@ sub class {
9393
if (exists $ce->{authen}{$type}) {
9494
if (ref $ce->{authen}{$type} eq "ARRAY") {
9595
my $authen_type = shift @{ $ce->{authen}{$type} };
96+
97+
#debug("ref of authen_type = |" . ref($authen_type) . "|");
9698
if (ref($authen_type) eq "HASH") {
97-
if (exists $authen_type->{ $ce->{dbLayoutName} }) {
98-
return $authen_type->{ $ce->{dbLayoutName} };
99-
} elsif (exists $authen_type->{"*"}) {
99+
if (exists $authen_type->{"*"}) {
100100
return $authen_type->{"*"};
101101
} else {
102-
die "authentication type '$type' in the course environment has no entry for db layout '",
103-
$ce->{dbLayoutName}, "' and no default entry (*)";
102+
die "authentication type '$type' in the course environment has no default entry (*)";
104103
}
105104
} else {
106105
return $authen_type;
107106
}
108107
} elsif (ref $ce->{authen}{$type} eq "HASH") {
109-
if (exists $ce->{authen}{$type}{ $ce->{dbLayoutName} }) {
110-
return $ce->{authen}{$type}{ $ce->{dbLayoutName} };
111-
} elsif (exists $ce->{authen}{$type}{"*"}) {
108+
if (exists $ce->{authen}{$type}{"*"}) {
112109
return $ce->{authen}{$type}{"*"};
113110
} else {
114-
die "authentication type '$type' in the course environment has no entry for db layout '",
115-
$ce->{dbLayoutName}, "' and no default entry (*)";
111+
die "authentication type '$type' in the course environment has no default entry (*)";
116112
}
117113
} else {
118114
return $ce->{authen}{$type};

0 commit comments

Comments
 (0)