diff --git a/Dockerfile b/Dockerfile index f735e07e69..806a620228 100644 --- a/Dockerfile +++ b/Dockerfile @@ -244,7 +244,7 @@ COPY docker-config/docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] -# Add enviroment variables to control some things during container startup +# Add environment variables to control some things during container startup ENV SSL=0 \ PAPERSIZE=letter \ SYSTEM_TIMEZONE=UTC \ diff --git a/DockerfileStage2 b/DockerfileStage2 index f14bf34b5b..2b2e4dc231 100644 --- a/DockerfileStage2 +++ b/DockerfileStage2 @@ -106,7 +106,7 @@ COPY docker-config/docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] -# Add enviroment variables to control some things during container startup +# Add environment variables to control some things during container startup ENV SSL=0 \ PAPERSIZE=letter \ SYSTEM_TIMEZONE=UTC \ diff --git a/conf/README.md b/conf/README.md index 4ef53a321d..1cb2910fc5 100644 --- a/conf/README.md +++ b/conf/README.md @@ -9,8 +9,6 @@ are made to `.dist` files, then the modifications will be lost or cause conflict Basic webwork2 configuration files. -- `site.conf.dist` should be copied to `site.conf`, and contains global variables required for basic server - configuration. This file is read first in the initialization sequence. - `defaults.config` contains initial settings for many customizable options in WeBWorK. This file is read second in the initialization sequence. **This file should not be changed** - `localOverrides.conf.dist` should be copied to `localOverrides.conf`. `localOverrides.conf` will be read after the @@ -29,8 +27,7 @@ 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.dist.yml` contains the webwork2 Mojolicious app configuration settings. - `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 @@ -42,8 +39,9 @@ Server configuration files. ## Initial configururation of webwork2 -- Copy `site.conf.dist` to `site.conf` and `localOverrides.conf.dist` to `localOverrides.conf`, and adjust the variables - in `site.conf` as needed. In particular you will need to set `$server_root_url` to the server name, and set +- Copy `webwork2.mojolicious.dist.yml` to `webwork2.mojolicious.yml` and change appropriate settings. +- Copy `localOverrides.conf.dist` to `localOverrides.conf`, and adjust the variables + as needed. In particular you will need to set `$server_root_url` to the server name, and set `$database_password` to the password for the database. - Adjust the variables in `localOverrides.conf` to customize your server for your needs. - Copy any of the other `.dist` files and adjust the variables in them as needed. Note that those files will need to be diff --git a/conf/database.conf.dist b/conf/database.conf.dist deleted file mode 100644 index 3b13b4e393..0000000000 --- a/conf/database.conf.dist +++ /dev/null @@ -1,340 +0,0 @@ -#!perl -################################################################################ -# WeBWorK Online Homework Delivery System -# Copyright © 2000-2023 The WeBWorK Project, https://github.com/openwebwork -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of either: (a) the GNU General Public License as published by the -# Free Software Foundation; either version 2, or (at your option) any later -# version, or (b) the "Artistic License" which comes with this package. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the -# Artistic License for more details. -################################################################################ - -=head1 NAME - -database.conf - define standard database layouts - -=head1 SYNOPSIS - -In defaults.config: - - include "conf/database.conf"; - *dbLayout = $dbLayouts{layoutName}; - -=head1 DESCRIPTION - -This file contains definitions for the commonly-used database layouts. Database -layouts consist of all the information necessary to describe how to access data -used by WeBWorK. For more information on the format of a database layout, -consult the documentation for the WeBWorK::DB module. - -A database layout is selected from the list of possible layouts by adding a -line like the one below to the F or F file. - - $dbLayoutName = "layoutName"; - *dbLayout = $dbLayouts{$dbLayoutName}; - -=head2 THE SQL_SINGLE DATABASE LAYOUT - -The C layout is similar to the C layout, except that it uses a -single database for all courses. This is accomplished by prefixing each table -name with the name of the course. The names and passwords of these accounts are -given as parameters to each table in the layout. - - username the username to use when connecting to the database - password the password to use when connecting to the database - -Be default, username is "webworkRead" and password is "". It is not recommended -that you use only a non-empty password to secure database access. Most RDBMSs -allow IP-based authorization as well. As the system administrator, IT IS YOUR -RESPONSIBILITY TO SECURE DATABASE ACCESS. - -Don't confuse the account information above with the accounts of the users of a -course. This is a system-wide account which allow WeBWorK to talk to the -database server. - -Other parameters that can be given are as follows: - - tableOverride an alternate name to use when referring to the table (used - when a table name is a reserved word) - debug if true, SQL statements are printed before being executed - -=cut - -# params common to all tables - -my %sqlParams = ( - username => $database_username, - password => $database_password, - debug => $database_debug, - # kinda hacky, but needed for table dumping - mysql_path => $externalPrograms{mysql}, - mysqldump_path => $externalPrograms{mysqldump}, -); - -if ($ce->{database_driver} =~ /^mysql$/i) { - # The extra UTF8 connection setting is ONLY needed for older DBD:mysql driver - # and forbidden by the newer DBD::MariaDB driver - if ($ENABLE_UTF8MB4) { - $sqlParams{mysql_enable_utf8mb4} = 1; # Full 4-bit UTF-8 - } else { - $sqlParams{mysql_enable_utf8} = 1; # Only the partial 3-bit mySQL UTF-8 - } -} - -%dbLayouts = (); # layouts are added to this hash below - -$dbLayouts{sql_single} = { - locations => { - record => "WeBWorK::DB::Record::Locations", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, non_native => 1 }, - }, - location_addresses => { - record => "WeBWorK::DB::Record::LocationAddresses", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, non_native => 1 }, - }, - depths => { - record => "WeBWorK::DB::Record::Depths", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - params => { %sqlParams, non_native => 1 }, - }, - password => { - record => "WeBWorK::DB::Record::Password", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_password" }, - }, - permission => { - record => "WeBWorK::DB::Record::PermissionLevel", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_permission" }, - }, - key => { - record => "WeBWorK::DB::Record::Key", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_key" }, - }, - user => { - record => "WeBWorK::DB::Record::User", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_user" }, - }, - set => { - record => "WeBWorK::DB::Record::Set", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_set" }, - }, - set_user => { - record => "WeBWorK::DB::Record::UserSet", - schema => "WeBWorK::DB::Schema::NewSQL::NonVersioned", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_set_user" }, - }, - set_merged => { - record => "WeBWorK::DB::Record::UserSet", - schema => "WeBWorK::DB::Schema::NewSQL::Merge", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - depend => [qw/set_user set/], - params => { - %sqlParams, - non_native => 1, - merge => [qw/set_user set/], - }, - }, - set_version => { - record => "WeBWorK::DB::Record::SetVersion", - schema => "WeBWorK::DB::Schema::NewSQL::Versioned", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - params => { - %sqlParams, - non_native => 1, - tableOverride => "${courseName}_set_user", - - }, - }, - set_version_merged => { - record => "WeBWorK::DB::Record::SetVersion", - schema => "WeBWorK::DB::Schema::NewSQL::Merge", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - depend => [qw/set_version set_user set/], - params => { - %sqlParams, - non_native => 1, - merge => [qw/set_version set_user set/], - }, - }, - set_locations => { - record => "WeBWorK::DB::Record::SetLocations", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_set_locations" }, - }, - set_locations_user => { - record => "WeBWorK::DB::Record::UserSetLocations", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_set_locations_user" }, - }, - problem => { - record => "WeBWorK::DB::Record::Problem", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_problem" }, - }, - problem_user => { - record => "WeBWorK::DB::Record::UserProblem", - schema => "WeBWorK::DB::Schema::NewSQL::NonVersioned", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_problem_user" }, - }, - problem_merged => { - record => "WeBWorK::DB::Record::UserProblem", - schema => "WeBWorK::DB::Schema::NewSQL::Merge", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - depend => [qw/problem_user problem/], - params => { - %sqlParams, - non_native => 1, - merge => [qw/problem_user problem/], - }, - }, - problem_version => { - record => "WeBWorK::DB::Record::ProblemVersion", - schema => "WeBWorK::DB::Schema::NewSQL::Versioned", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { - %sqlParams, - non_native => 1, - tableOverride => "${courseName}_problem_user", - }, - }, - problem_version_merged => { - record => "WeBWorK::DB::Record::ProblemVersion", - schema => "WeBWorK::DB::Schema::NewSQL::Merge", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - depend => [qw/problem_version problem_user problem/], - params => { - %sqlParams, - non_native => 1, - merge => [qw/problem_version problem_user problem/], - }, - }, - setting => { - record => "WeBWorK::DB::Record::Setting", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_setting" }, - }, - achievement => { - record => "WeBWorK::DB::Record::Achievement", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_achievement" }, - }, - past_answer => { - record => "WeBWorK::DB::Record::PastAnswer", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_past_answer" }, - }, - - achievement_user => { - record => "WeBWorK::DB::Record::UserAchievement", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_achievement_user" }, - }, - global_user_achievement => { - record => "WeBWorK::DB::Record::GlobalUserAchievement", - schema => "WeBWorK::DB::Schema::NewSQL::Std", - driver => "WeBWorK::DB::Driver::SQL", - source => $database_dsn, - engine => $database_storage_engine, - character_set => $database_character_set, - params => { %sqlParams, tableOverride => "${courseName}_global_user_achievement" }, - }, -}; - -# include ("conf/database.conf"); # uncomment to provide local overrides - -1; diff --git a/conf/defaults.config b/conf/defaults.config index 006cbe421a..28de568d91 100644 --- a/conf/defaults.config +++ b/conf/defaults.config @@ -24,17 +24,16 @@ # YOU SHOULD NOT NEED TO EDIT THIS FILE!! # All site-specific settings such as file locations and web addresses are -# configured in site.conf. If you want to override any settings in this +# configured in webwork2.mojolicious.yml. If you want to override any settings in this # file, you can put a directive in localOverrides.conf. -include("conf/site.conf"); include("VERSION"); # get WW version # The version of PG is now obtained from the file pg/VERSION # using code added to CourseEnvironment.pm # with this one exception include can only read files under the webwork2 directory ################################################################################ -# site.conf should contain basic information about directories and URLs on +# webwork2.mojolicious.yml should contain basic information about directories and URLs on # your server ################################################################################ @@ -125,6 +124,23 @@ $courseURLs{feedbackURL} = ""; #$courseURLs{feedbackFormURL} = "http://www.mathnerds.com/MathNerds/mmn/SDS/askQuestion.aspx"; #"http://www.tipjar.com/cgi-bin/test"; $courseURLs{feedbackFormURL} = ""; +################################################################################ +#Time Zone +################################################################################ + +# Set the default timezone of courses on this server. To get a list of valid +# timezones, run: +# +# perl -MDateTime::TimeZone -e 'print join "\n", DateTime::TimeZone::all_names' +# +# To get a list of valid timezone "links" (deprecated names), run: +# +# perl -MDateTime::TimeZone -e 'print join "\n", DateTime::TimeZone::links' +# +# This can be set per course either in course.conf or via the course configuration. +$siteDefaults{timezone} = "America/New_York"; + + ################################################################################ # Theme ################################################################################ @@ -266,75 +282,8 @@ $perProblemLangAndDirSettingMode = "force::ltr"; # 'datetime_format_full'. See https://metacpan.org/pod/DateTime::Locale::FromData. $studentDateDisplayFormat = 'datetime_format_long'; -################################################################################ -# System-wide locations (directories and URLs) -################################################################################ - -# The root directory, set by webwork_root variable in Apache configuration. -$webworkDirs{root} = "$webwork_dir"; -# Location of system-wide data files. -$webworkDirs{DATA} = "$webworkDirs{root}/DATA"; - -# Used for temporary storage of uploaded files. -$webworkDirs{uploadCache} = "$webworkDirs{DATA}/uploads"; - -# Location of utility programs. -$webworkDirs{bin} = "$webworkDirs{root}/bin"; - -# Location of configuration files. -$webworkDirs{conf} = "$webworkDirs{root}/conf"; - -# Location of assets (tex, pg, themes) -$webworkDirs{assets} = "$webworkDirs{root}/assets"; - -# Location of the distribution hardcopy themes. -$webworkDirs{hardcopyThemes} = "$webworkDirs{assets}/hardcopyThemes"; - -# Location of course directories. -$webworkDirs{courses} = "$webwork_courses_dir" || "$webworkDirs{root}/courses"; - -# Contains log files. -$webworkDirs{logs} = "$webworkDirs{root}/logs"; - -# Contains non-web-accessible temporary files, such as TeX working directories. -$webworkDirs{tmp} = "$webworkDirs{root}/tmp"; - -# The (absolute) destinations of symbolic links that are OK for the FileManager to follow. -# (any subdirectory of these is a valid target for a symbolic link.) -# For example: -# $webworkDirs{valid_symlinks} = ["$webworkDirs{courses}/modelCourse/templates","/ww2/common/sets"]; -$webworkDirs{valid_symlinks} = []; - -# Location of the webwork2.sty and its dependencies used for hardcopy generation. -$webworkDirs{assetsTex} = "$webworkDirs{assets}/tex"; - -################################################################################ -##### The following locations are web-accessible. -################################################################################ - -# The root URL (usually /webwork2), set by in Apache configuration. -$webworkURLs{root} = "$webwork_url"; - -# Location of system-wide web-accessible files, such as equation images, and -# help files. -$webworkDirs{htdocs} = "$webwork_htdocs_dir" || "$webworkDirs{root}/htdocs"; -$webworkURLs{htdocs} = "$webwork_htdocs_url"; - -# Location of web-accessible temporary files, such as equation images. -# These two should be set in localOverrides.conf -- not here since this can be overwritten by new versions. -$webworkDirs{htdocs_temp} = "$webworkDirs{htdocs}/tmp"; -$webworkURLs{htdocs_temp} = "$webworkURLs{htdocs}/tmp"; - -# Location of cached equation images. -$webworkDirs{equationCache} = "$webworkDirs{htdocs_temp}/equations"; -$webworkURLs{equationCache} = "$webworkURLs{htdocs_temp}/equations"; - -# Location of theme templates. -$webworkDirs{themes} = "$webworkDirs{htdocs}/themes"; - -# Location of localization directory. -$webworkDirs{localize} = "$webworkDirs{root}/lib/WeBWorK/Localize"; +# Set links within WeBWorK # URL of general WeBWorK documentation. $webworkURLs{docs} = "https://webwork.maa.org"; @@ -368,58 +317,7 @@ $webworkURLs{AuthorHelpURL} ='https://webwork.maa.org/wiki/Category:Au # It's better to refer directly to the .css file in the system.template # /css/math.css"/> -################################################################################ -# Defaults for course-specific locations (directories and URLs) -################################################################################ - -# The root directory of the current course. (The ID of the current course is -# available in $courseName.) -$courseDirs{root} = "$webworkDirs{courses}/$courseName"; - -# Location of course-specific data files. -$courseDirs{DATA} = "$courseDirs{root}/DATA"; - -# Location of course HTML files, passed to PG. -$courseDirs{html} = "$courseDirs{root}/html"; -$courseURLs{html} = "$webwork_courses_url/$courseName"; - -# Location of course image files, passed to PG. -$courseDirs{html_images} = "$courseDirs{html}/images"; - -# Location of web-accessible, course-specific temporary files, like static and -# dynamically-generated PG graphics. -$courseDirs{html_temp} = "$webworkDirs{htdocs_temp}/$courseName"; -$courseURLs{html_temp} = "$webworkURLs{htdocs_temp}/$courseName"; - -# Location of course-specific logs, like the transaction log. -$courseDirs{logs} = "$courseDirs{root}/logs"; - -# Location of scoring files. -$courseDirs{scoring} = "$courseDirs{root}/scoring"; - -# Location of PG templates and set definition files. -$courseDirs{templates} = "$courseDirs{root}/templates"; - -# Location of hardcopy theme files. -$courseDirs{hardcopyThemes} = "$courseDirs{templates}/hardcopyThemes"; - -# Location of course achievement files. -$courseDirs{achievements} = "$courseDirs{templates}/achievements"; -$courseDirs{achievement_notifications} = "$courseDirs{achievements}/notifications"; -$courseDirs{achievements_html} = "$courseDirs{html}/achievements"; #contains badge icons -$courseURLs{achievements} = "$courseURLs{html}/achievements"; - -# Location of course-specific macro files. -$courseDirs{macros} = "$courseDirs{templates}/macros"; - -# Location of mail-merge templates. -$courseDirs{email} = "$courseDirs{templates}/email"; -# Location of temporary editing files. -$courseDirs{tmpEditFileDir} = "$courseDirs{templates}/tmpEdit"; - -# mail merge status directory -$courseDirs{mailmerge} = "$courseDirs{DATA}/mailmerge"; ################################################################################ # System-wide files @@ -470,39 +368,11 @@ $hardcopyThemes = [ $hardcopyTheme = 'twoColumn.xml'; $hardcopyThemePGEditor = 'empty.xml'; -################################################################################ -# Hardcopy snippets are used in constructing a TeX file for hardcopy output. -# They should contain TeX code unless otherwise noted. -################################################################################ - -# The setHeader precedes each set in hardcopy output. It is a PG file. -# This is the default file which is used if a specific files is not selected -$webworkFiles{hardcopySnippets}{setHeader} = "$webworkDirs{assets}/pg/defaultSetHeader.pg"; - -################################################################################ -##### Screen snippets are used when displaying problem sets on the screen. -################################################################################ - -# The set header is displayed on the problem set page. It is a PG file. -# This is the default file which is used if a specific files is not selected -$webworkFiles{screenSnippets}{setHeader} = "$webworkDirs{assets}/pg/defaultSetHeader.pg"; - -# A PG template for creation of new problems. -$webworkFiles{screenSnippets}{blankProblem} = "$webworkDirs{assets}/pg/newProblem.pg"; - -# A site info "message of the day" file -$webworkFiles{site_info} = "$webworkDirs{htdocs}/site_info.txt"; ################################################################################ # Course-specific files ################################################################################ -# The course configuration file. -$courseFiles{environment} = "$courseDirs{root}/course.conf"; - -# The course simple configuration file (holds web-based configuration). -$courseFiles{simpleConfig} = "$courseDirs{root}/simple.conf"; - # File contents are displayed after login, on the problem sets page. Path given # here is relative to the templates directory. $courseFiles{course_info} = "course_info.txt"; @@ -586,38 +456,6 @@ $default_status = "Enrolled"; }, ); -################################################################################ -# Database options -################################################################################ - -# Database schemas are defined in the file conf/database.conf and stored in the -# hash %dbLayouts. The standard schema is called "sql_single"; - -include( "./conf/database.conf.dist"); # always include database.conf.dist - - # in the rare case where you want local overrides - # you can place include("conf/database.conf") in - # the database.conf.dist file -# this change is meant to help alleviate the common mistake of forgetting to update the -# database.conf file when changing WW versions. - -# Select the default database layout. This can be overridden in the course.conf -# file of a particular course. The only database layout supported in WW 2.1.4 -# and up is "sql_single". -$dbLayoutName = "sql_single"; - -# This sets the symbol "dbLayout" as an alias for the selected database layout. -*dbLayout = $dbLayouts{$dbLayoutName}; - -# This sets the max course id length. It might need to be changed depending -# on what database tables are present. Mysql allows a max table length of 64 -# characters. With the ${course_id}_global_user_achievement table that means -# the max ${course_id} is exactly 40 characters. - -$maxCourseIdLength = 40; - -# Reference: https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html - ################################################################################ # Problem library options ################################################################################ @@ -637,14 +475,6 @@ $contribLibrary{root} = "/opt/webwork/libraries/webwork-open-problem-libra $problemLibrary{version} = "2.5"; ########################################################### -# Problem Library SQL database connection information -$problemLibrary_db = { - dbsource => $database_dsn, - user => $database_username, - passwd => $database_password, - storage_engine => 'MYISAM', -}; - $problemLibrary{tree} = 'library-directory-tree.json'; # These flags control if statistics on opl problems are shown in the library @@ -654,41 +484,6 @@ $problemLibrary{showLibraryLocalStats} = 1; # This flag controls whether global statistics will be displayed $problemLibrary{showLibraryGlobalStats} = 1; -################################################################################ -# Logs -################################################################################ - - -# Logs data about how long it takes to process problems. (Do not confuse this -# with the /other/ timing log which can be set by WeBWorK::Timing and is used -# for benchmarking system performance in general. At some point, this timing -# mechanism will be deprecated in favor of the WeBWorK::Timing mechanism.) -$webworkFiles{logs}{timing} = "$webworkDirs{logs}/timing.log"; - -# Logs data about how long it takes to process problems. (Do not confuse this -# with the /other/ timing log which can be set by WeBWorK::Timing and is used -# for benchmarking system performance in general. At some point, this timing -# mechanism will be deprecated in favor of the WeBWorK::Timing mechanism.) -$webworkFiles{logs}{render_timing} = "$webworkDirs{logs}/render_timing.log"; - -# Logs courses created via the web-based Course Administration module. -$webworkFiles{logs}{hosted_courses} = "$webworkDirs{logs}/hosted_courses.log"; - -# The transaction log contains data from each recorded answer submission. This -# is useful if the database becomes corrupted. -$webworkFiles{logs}{transaction} = "$webworkDirs{logs}/${courseName}_transaction.log"; - -# The answer log stores a history of all users' submitted answers. -$courseFiles{logs}{answer_log} = "$courseDirs{logs}/answer.log"; - -# Log logins. -$courseFiles{logs}{login_log} = "$courseDirs{logs}/login.log"; - -# Log for almost every click. By default it is the empty string, which -# turns this log off. If you want it turned on, we suggest -# "$courseDirs{logs}/activity.log" -# When turned on, this log can get quite large. -$courseFiles{logs}{activity_log} = ''; ################################################################################ # Site defaults (Usually overridden in localOverrides.conf) @@ -1089,58 +884,16 @@ $pg{displayModeOptions}{images} = { # If dbsource is set to a nonempty value, then this database connection information will be used to store dvipng # depths. It is assumed that the 'depths' table exists in the database. + + # these are filled in CourseEnvironment. They can be overridden in localOverrides. dvipng_depth_db => { - dbsource => $database_dsn, - user => $database_username, - passwd => $database_password, + dbsource => undef, + user => undef, + passwd => undef, }, }; -##### Directories used by PG - -# The root of the PG directory tree (from pg_dir set in conf/webwork2.mojolicious.yml). -$pg{directories}{root} = "$pg_dir"; -$pg{directories}{lib} = "$pg{directories}{root}/lib"; -$pg{directories}{macros} = "$pg{directories}{root}/macros"; -$pg{directories}{assets} = "$pg{directories}{root}/assets"; -$pg{directories}{assetsTex} = "$pg{directories}{assets}/tex"; - -# -# The macro file search path. Each directory in this list is searched -# (in this order) by loadMacros() when it looks for a .pl file. -# -$pg{directories}{macrosPath} = [ - ".", # search the problem file's directory - $courseDirs{macros}, - $pg{directories}{macros}, - "$pg{directories}{macros}/answers", - "$pg{directories}{macros}/capa", - "$pg{directories}{macros}/contexts", - "$pg{directories}{macros}/core", - "$pg{directories}{macros}/graph", - "$pg{directories}{macros}/math", - "$pg{directories}{macros}/misc", - "$pg{directories}{macros}/parsers", - "$pg{directories}{macros}/ui", - "$pg{directories}{macros}/deprecated", -]; - -# Directories to search for auxiliary html files. -$pg{directories}{htmlPath} = [ - ".", - $courseDirs{html}, - $webworkDirs{htdocs}, -]; - -# Directories to search for image files. -$pg{directories}{imagesPath} = [ - ".", - "$courseDirs{html}/images", - "$webworkDirs{htdocs}/images", -]; -# Contains context-sensitive pg help files. -$pg{URLs}{localHelpURL} = "$pg_htdocs_url/helpFiles"; ##### "Special" PG environment variables. (Stuff that doesn't fit in anywhere else.) diff --git a/conf/localOverrides.conf.dist b/conf/localOverrides.conf.dist index 7a5ffae8df..2cc8d196e7 100644 --- a/conf/localOverrides.conf.dist +++ b/conf/localOverrides.conf.dist @@ -20,6 +20,16 @@ # If you wish to make changes to an individual course, copy the entry into the # course.conf file in the respective course directory. +# Since many server-related setting are now being set in webwor2.mojolicious.yml +# and loaded after this file runs, making changes to those configuration variables +# here will be overridden. For specific variables that are set, see that file +# in general these include +# - URL settings (for both webwork and pg) +# - directory settings +# - external programs +# - database settings +# - server mail settings + ################################################################################ # localOverrides.conf -- this file ################################################################################ @@ -560,8 +570,7 @@ $mail{feedbackRecipients} = [ # 'hebrewTwoCol.xml', #]; -# The Hebrew themes need to use xelatex. Uncomment the following for xelatex -#$externalPrograms{pdflatex} ="/usr/bin/xelatex --no-shell-escape"; +# The Hebrew themes need to use xelatex. This will need to be done in webwork2.mojolicious.yml # A course may have additional themes in $courseDirs{hardcopyThemes}. All such # "course" hardcopy themes are effectively enabled and offered for use when diff --git a/conf/webwork2.apache2.4.dist.conf b/conf/webwork2.apache2.4.dist.conf index 81ab34232d..e25886894d 100644 --- a/conf/webwork2.apache2.4.dist.conf +++ b/conf/webwork2.apache2.4.dist.conf @@ -14,7 +14,7 @@ #ScriptAliasMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) /opt/webwork/courses/$1/html/show-source.cgi/$2 #ProxyPassMatch /webwork2_course_files/([^/]*)/show-source.cgi/(.*) ! -# Note that if $webwork_url in site.conf is changed, then /webwork2 +# Note that if $webwork_url in webwork2.mojolicious.yml is changed, then /webwork2 # should be changed below to match. Require all granted @@ -32,7 +32,7 @@ ProxyPassReverse /webwork2/* http://localhost:8080/webwork2/ RequestHeader set X-Forwarded-Proto "https" -# Note that if $webwork_htdocs_url in site.conf is changed, then /webwork2_files +# Note that if $webwork_htdocs_url in webwork2.mojolicious.yml is changed, then /webwork2_files # should be changed below to match. Require all granted @@ -40,7 +40,7 @@ ProxyPassReverse /webwork2/* http://localhost:8080/webwork2/ ProxyRequests Off ProxyPass /webwork2_files http://localhost:8080/webwork2_files keepalive=On -# Note that if $pg_htdocs_url in site.conf is changed, then /pg_files +# Note that if $pg_htdocs_url in webwork2.mojolicious.yml is changed, then /pg_files # should be changed below to match. Require all granted @@ -48,7 +48,7 @@ ProxyPass /webwork2_files http://localhost:8080/webwork2_files keepalive=On ProxyRequests Off ProxyPass /pg_files http://localhost:8080/pg_files keepalive=On -# Note that if $webwork_courses_url in site.conf is changed, then /pg_files +# Note that if $webwork_courses_url in webwork2.mojolicious.yml is changed, then /pg_files # should be changed below to match. Require all granted diff --git a/conf/webwork2.mojolicious.dist.yml b/conf/webwork2.mojolicious.dist.yml index 988d233754..df206d492e 100644 --- a/conf/webwork2.mojolicious.dist.yml +++ b/conf/webwork2.mojolicious.dist.yml @@ -205,3 +205,516 @@ debug: hardcopy: # If 1, don't delete temporary files created when a hardcopy is generated. preserve_temp_files: 0 + + +# Seed/Server variables +environment: + + # Set these variables to correspond to your configuration. It is not + # recommended to change any of the settings in this file once your + # web server has been initially configured. + + # URL of WeBWorK handler. If WeBWorK is to be on the web server root, use "". Note + # that using "" may not work so we suggest sticking with "/webwork2". + webwork_url: /webwork2 + + # The server protocol and domain name, e.g., 'https://webwork.yourschool.edu' or 'http://localhost' + # Note, if running a secure (ssl) server, you probably need 'https://...'. + # Also note that if you use a non-standard port, then that should also be included, + # e.g., 'http://localhost:8080'. + server_root_url: '' + + # WeBWorK path variables. + + # These variables describe the locations of various components of WeBWorK on your + # server. You may use the defaults unless you have things in different places. + + # This is the directory inside of webwork where web accessible files are. + # This will be available below as $webwork_htdocs_dir + webwork_htdocs_dir: /opt/webwork/webwork2/htdocs + + # The main courses directory. This is avaiable below as $courses_dir + webwork_courses_dir: /opt/webwork/courses + + # URL of the courses and htdocs directory + webwork_courses_url: /webwork2_course_files + webwork_htdocs_url: /webwork_htdocs_url + + # URL for the pg htdocs directory. + pg_htdocs_url: /pg_files + + # The following variable is the address that will be listed in server error messages that come from WeBWorK: + # "An error occurred while processing your request. + # For help, please send mail to this site's webmaster + # (mail link to ), including all of the following + # information as well as what what you were doing when the error occurred... etc..." + # If webwork_server_admin_email is not defined then the + # ServerAdmin address defined in httpd.conf is used. + webwork_server_admin_email: '' + + # The following is the name of the admin course where admin level users can create + # courses, delete courses, and more. It is named 'admin' by default but for security, + # you may want to change to something that cannot be guessed. While installing WeBWorK, + # leave this as 'admin'. Once everything is running well, use the 'admin' course to + # create a new course to serve as the admin course. You may need to copy all archives + # from the 'admin' course into this new course. Then change $admin_course_id to the ID + # of the new course and restart webwork2. You may then also want to archive and delete + # the original 'admin' course. + admin_course_id: admin + + # When new courses are created using the admin course, this setting controls + # whether or not they will be hidden. Setting this to anything other than + # "hidden" or "visible" (or leaving it unset) means that courses created using + # "Add Courses" are not hidden, and all unarchived courses have whatever hidden + # status they had when archived. + # Setting this to "hidden" means that courses created using "Add Courses" and + # courses created using "Unarchive Courses" with a new course ID will be hidden. + # Unarchived courses that keep their original name will keep their hidden + # status. + # Setting this to "visible" means that courses created using "Add Courses" and + # courses created using "Unarchive Courses" with a new course ID will be visible. + # Unarchived courses that keep their original name will keep their hidden status. + # new_courses_hidden_status: hidden + + # courseName + courseName: $course_name + + webworkDirs: + root: $webwork_dir + htdocs: $webwork_htdocs_dir + + # Location of system-wide data files. + DATA: $webwork_dir/DATA + + # Used for temporary storage of uploaded files. + uploadCache: $webwork_dir/DATA/uploads + + # Location of utility programs. + bin: $webwork_dir/bin + + # Location of configuration/settings. + conf: $webwork_dir/conf + + # Location of assets (tex, pg, themes) + assets: $webwork_dir/assets + + # Location of the distribution hardcopy themes. + hardcopyThemes: $webwork_dir/assets/hardcopyThemes + + # Location of the root directory for courses + courses: $webwork_courses_dir + + # Location of log files. + logs: $webwork_dir/logs + + # Contains non-web-accessible temporary files, such as TeX working directories. + tmp: $webwork_dir/tmp + + # Location of web-accessible temporary files, such as equation images. + # This should be set in localOverrides.conf -- not here since this can be overwritten by new versions. + htdocs_temp: $webwork_htdocs_dir/tmp + + # Location of cached equation images. + equationCache: $webwork_htdocs_dir/tmp/equations + + # The (absolute) destinations of symbolic links that are OK for the FileManager to follow. + # (any subdirectory of these is a valid target for a symbolic link.) + # For example: ["$courses_dir/modelCourse/templates","/opt/webwork/common/sets"] + valid_symlinks: [] + + # Location of the webwork2.sty and its dependencies used for hardcopy generation. + assetsTex: $webwork_dir/assets/tex + + # Location of theme templates. + themes: $webwork_dir/htdocs/themes + + # Location of localization directory. + localize: $webwork_dir/lib/WeBWorK/Localize + + # Set URLs for WeBWorK. The variable $webwork_url, defined toward the top of this can be used. + webworkURLs: + # The root URL (usually /webwork2), set by in Apache configuration. + root: $webwork_url + + # The URL for the htdocs directory. + htdocs: $webwork_htdocs_url + + # The web-accesible tmp directory and related for equations + htdocs_temp: $webwork_htdocs_url/tmp + equationCache: $webwork_htdocs_url/tmp/equations + + webworkFiles: + + # Logs + + logs: + + # Logs data about how long it takes to process problems. (Do not confuse this with the /other/ timing + # log which can be set by WeBWorK::Timing and is used for benchmarking system performance in general. + # At some point, this timing mechanism will be deprecated in favor of the WeBWorK::Timing mechanism.) + + timing: $webwork_dir/logs/timing.log + + # Logs data about how long it takes to process problems. (Do not confuse this with the /other/ timing + # log which can be set by WeBWorK::Timing and is used for benchmarking system performance in general. + # At some point, this timing mechanism will be deprecated in favor of the WeBWorK::Timing mechanism.) + render_timing: $webwork_dir/logs/render_timing.log + + # Logs courses created via the web-based Course Administration module. + hosted_courses: $webwork_dir/logs/hosted_courses.log + + # The transaction log contains data from each recorded answer submission. This + # is useful if the database becomes corrupted. + transaction: $webwork_dir/logs/${courseName}_transaction.log + + ################################################################################ + # Hardcopy snippets are used in constructing a TeX file for hardcopy output. + # They should contain TeX code unless otherwise noted. + ################################################################################ + + # The setHeader precedes each set in hardcopy output. It is a PG file. + # This is the default file which is used if a specific files is not selected + hardcopySnippets: + setHeader: $webwork_dir/assets/pg/defaultSetHeader.pg + + # The set header is displayed on the problem set page. It is a PG file. + # This is the default file which is used if a specific files is not selected + screenSnippets: + setHeader: $webwork_dir/assets/pg/defaultSetHeader.pg + + # A PG template for creation of new problems. + blankProblem: $webwork_dir/assets/pg/newProblem.pg + + # A site info "message of the day" file + site_info: $webwork_htdocs_dir/site_info.txt + + courseFiles: + # The course configuration file. + environment: $courses_dir/$course_name/course.conf + + # The course simple configuration file (holds web-based configuration). + simpleConfig: $courses_dir/$course_name/simple.conf + + + logs: + # The answer log stores a history of all users' submitted answers. + answer_log: $courses_dir/$course_name/logs/answer.log + + # Log logins. + login_log: $courses_dir/$course_name/logs/login.log + + # Log for almost every click. By default it is the empty string, which turns this log off. + # If you want it turned on, we suggest $courses_dir/$course_name/logs/activity.log" + # When turned on, this log can get quite large. + # activity_log: $courses_dir/$course_name/logs/activity.log + activity_log: '' + + # Set Course Directories. $courses_dir is available as the root of the courses directory + # and $course_name is the name of the current course. + + courseDirs: + root: $courses_dir/$course_name + + # Location of course-specific data files. + DATA: $courses_dir/$course_name/DATA + + # Location of course HTML files, passed to PG. + html: $courses_dir/$course_name/html + + + # Location of course image files, passed to PG. + html_images: $courses_dir/$course_name/html/images + + # Location of web-accessible, course-specific temporary files, like static and dynamically-generated PG graphics. + html_temp: $webwork_htdocs_dir/tmp/$course_name + + + # Location of course-specific logs, like the transaction log. + logs: $courses_dir/$course_name/logs + + # Location of scoring files. + scoring: $courses_dir/$course_name/scoring + + # Location of PG templates and set definition files. + templates: $courses_dir/$course_name/templates + + # Location of hardcopy theme files. + hardcopyThemes: $courses_dir/$course_name/templates/hardcopyThemes + + # Location of course-specific macro files. + macros: $courses_dir/$course_name/templates/macros + + # Location of course achievement files. + achievements: $courses_dir/$course_name/templates/achievements + achievement_notifications: $courses_dir/$course_name/templates/achievement/notifications + achievements_html: $courses_dir/$course_name/html/achievements #contains badge icons + + # Location of mail-merge templates. + email: $courses_dir/$course_name/templates/email + + # Location of temporary editing files. + tmpEditFileDir: $courses_dir/$course_name/templates/tmpEdit + + # mail merge status directory + mailmerge: $courses_dir/$course_name/DATA/mailmerge + + courseURLs: + html: $webwork_courses_dir/$course_name + + # Location of web-accessible, course-specific temporary files, like static and dynamically-generated PG graphics. + html_temp: $webwork_htdocs_url/tmp/$course_name + + # CHECK: The achievements URL should be inside of templates. (PS) + achievements: $webwork_url/$course_name/templates/achievements + + # Define some configuration variables for pg + + pg: + directories: + root: $pg_root + lib: $pg_root/lib + macros: $pg_root/macros + assets: $pg_root/assets + assetsTex: $pg_root/assets/tex + + # The macro file search path. Each directory in this list is searched + # (in this order) by loadMacros when it looks for a .pl macro file. + macrosPath: + - . + - $pg_root/macros + - $pg_root/macros/answers + - $pg_root/macros/capa + - $pg_root/macros/contexts + - $pg_root/macros/core + - $pg_root/macros/graph + - $pg_root/macros/math + - $pg_root/macros/misc + - $pg_root/macros/parsers + - $pg_root/macros/ui + - $pg_root/macros/deprecated + + # Directories to search for auxiliary html files. + htmlPath: + - . + - $courses_dir/$course_name/html + - $webwork_htdocs_dir + + # Directories to search for image files. + imagesPath: + - . + - $courses_dir/$course_name/html/images + - $webwork_htdocs_dir/images + + URLs: + # The public URL of the html directory above. This is stored as $pg_root_url + html: /pg_files + + # The public URL of the html_temp directory above. + tempURL: $pg_root_url/tmp + + # The public URL of the PG help files. + localHelpURL: $pg_root_url/helpFiles + + # URL of cached equation images. + equationCache: $pg_root_url/tmp/equations + + # Paths to search for auxiliary html files (requires full url). + htmlPath: + - . + - $courses_dir/$course_name + - $webwork_htdocs_dir + + # Paths to search for image files (requires full url). + imagesPath: + - . + - $courses_dir/$course_name/html + - $webwork_htdocs_dir/images + +# Mail settings + mail: + # The following directives need to be configured in order for your webwork + # server to be able to send mail. + + # Mail sent by the PG system and the mail merge and feedback modules will be sent via this SMTP server. + # localhost may work if your server is capable of sending email, otherwise type the name of your School's + # outgoing email server. + # e.g. 'mail.yourschool.edu' or 'localhost' + smtpServer: + + # When connecting to the above server, WeBWorK will send this address in the MAIL FROM command. This has + # nothing to do with the "From" address on the mail message. It can really be anything, but some mail + # servers require it containa valid mail domain, or at least be well-formed. + # e.g. 'webwork@yourserver.yourschool.edu' + smtpSender: + + # Set the return_path to the From: field (sender's email address) + set_return_path: "" + + # The return path is used to send error messages about bounced emails "noreply\@$mail{smtpServer}" + # discards error messages, using $mail{smtpSender} would deliver error messages to that address. + # The default setting should be adjusted for local domain. Leaving the return path blank triggers + # the default which results in Return-Path being set to the email of the sender. + + # Seconds to wait before timing out when connecting to the SMTP server. The default is 120 seconds. + # Change it by uncommenting the following line set it to 5 for testing, 30 or larger for production. + # smtpTimeout: 30 + + # TLS is a method for providing secure connections to the smtp server. + # https://en.wikipedia.org/wiki/Transport_Layer_Security + # At some sites coordinating the certificates properly is tricky. + # Set this value to 0 to avoid checking certificates. + # Set it to 0 to trouble shoot an inability to verify certificates with the smtp server + tls_allowed: 0 + + + # Errors of the form unable to establish SMTP connection to smtp-gw.rochester.edu port 465 + # indicate that there is a mismatch between the port number and the use of ssl + # use port 25 when ssl is off and use port 465 when ssl is on (tls_allowed=1) + + + # Set the SMTP port manually. Typically this does not need to be done it will use + # port 25 if no SSL is on and 465 if ssl is on + + #smtpPort: 25 + + # Debugging tutorial for sending email using ssl/tls https://maulwuff.de/research/ssl-debugging.html + + # Set maxAttachmentSize to the maximum number of megabytes to allow for the size of + # files attached to feedback emails. Note that this should be set to match the + # limitations of the email server chosen above, and should be set to a value greater + # than zero or no attatchments will work. This is not intended to be a configuration + # option to disable attachments. + maxAttachmentSize: 10 + + ################################################################################ + # Search Engine Indexing Enable/Disable + ################################################################################ + # sets the default meta robots content for individual course pages + # this will not stop your main course listing page from being indexed + # valid contents: index, noindex, follow, nofollow, noarchive, and + # unavailable_after (example: "index, unavailable_after: 23-Jul-2007 18:00:00 EST") + options: + metaRobotsContent: 'noindex, nofolow' + + + ################################################################################ + # Third Party Assets CDN/Local + ################################################################################ + # Set to 1 to serve third party assets files from a CDN. Otherwise these + # asset files are served from the local node_modules directories. + thirdPartyAssetsUseCDN: 0 + + + # External Programs + + # These applications are often found in /bin, but sometimes in /usr/bin + # or even in /opt/local/bin. + # You can use "which tar" for example to find out where the "tar" program is located + + externalPrograms: + tar: /bin/tar + git: /bin/git + curl: /usr/bin/curl + mysql: /usr/bin/mysql + mysqldump: /usr/bin/mysqldump + + # latex and related utilities + latex: /usr/bin/latex --no-shell-escape + pdflatex: /usr/bin/pdflatex --no-shell-escape + + # Note that --no-shell-escape is important for security reasons. + # Consider using xelatex instead of pdflatex for multilingual use, and + # use polyglossia and fontspec packages (which require xelatex or lualatex). + #pdflatex: /usr/bin/xelatex --no-shell-escape + + dvipng: /usr/bin/dvipng + convert: /usr/bin/convert + dvisvgm: /usr/bin/dvisvgm + pdf2svg: /usr/bin/pdf2svg + + giftopnm: /usr/bin/giftopnm + ppmtopgm: /usr/bin/ppmtopgm + pnmtops: /usr/bin/pnmtops + pnmtopng: /usr/bin/pnmtopng + pnmtopnm: /usr/bin/pnmtopnm + +# Database options + +database: + + # uncomment to allow database debug information + # debug: 1 + + # One thing on which it depends is the driver name, which you may want to modify. + # It also depends on the database name, which may be non-standard in some settings, + # as may be the hostname and port of the database server. + + # driver should be one of: "mysql" or "MariaDB" + + # Select the desired DB driver: + #database_driver: mysql + driver: MariaDB + + host: localhost + port: 3306 + name: webwork + + # Standard permissions command used to initialize the webwork database + # GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, INDEX, LOCK TABLES ON webwork.* TO webworkWrite@localhost IDENTIFIED BY 'passwordRW'; + # where webworkWrite and passwordRW must match the corresponding variables in the next section. + username: '' + password: '' + + + # For a DB on localhost - default to using Unix socket. Change to 0 to use a TCP connection to 127.0.0.1. + use_socket_if_localhost: 1 + + # Need to add the code in lines 209-217 to a perl file + # Add line 234 to same file + + # The default storange engine to use is set here: + storage_engine: myisam + + # MYSQL compatibility settings for handling international Unicode characters (utf8 and utf8mb) + + # These set the way characters are encoded in mysql and will depend on the version of mysqld being used. + # the default is to use latin1. With version 2.15 we will move to encoding utf8mb4 which allows + # the encoding of characters from many languages including chinese, arabic and hebrew. + + # setting this to 1 enables utf8mb4 encoding, setting this to 0 sets this for older + # mysql (pre 5.3) which cannot handle utf8mb4 characters. + + ENABLE_UTF8MB4: 1 + + # This sets the max course id length. It might need to be changed depending + # on what database tables are present. Mysql allows a max table length of 64 + # characters. With the ${course_id}_global_user_achievement table that means + # the max ${course_id} is exactly 40 characters. + + # Reference: https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html + maxCourseIdLength: 40 + + + + +# Minion job queue options +job_queue: + + # This is the Minion backend that will be used by the job queue. + # The corresponding perl package for this backend must be installed. + # Some availabled backends are: + # Minion::Backend::Pg (use 'Pg' below) + # Minion::Backend::mysql (use 'mysql' below) + # Minion::Backend::SQLite (use 'SQLite' below) + # The simplest to use is the SQLite backend as it requires no additional setup. + backend: SQLite + + # Database dsn for the Minion job queue. Some examples of settings for the + # respective backends follow. The postgres and mysql examples will need to be + # modified to work. The default sqlite setting will work as is. + #database_dsn: "postgresql://dbuser@/webwork2_job_queue" + #database_dsn: "mysql://dbuser:dbpasswd@localhost/webwork2_job_queue" + database_dsn: "sqlite:/opt/webwork/webwork2/DATA/webwork2_job_queue.db" + +# Question: Problem Library on lines 351 -- 369. Should we include this option +# or in localOverrides? diff --git a/conf/webwork2.nginx.dist.conf b/conf/webwork2.nginx.dist.conf index f546af7ed2..5d59ea45ac 100644 --- a/conf/webwork2.nginx.dist.conf +++ b/conf/webwork2.nginx.dist.conf @@ -1,4 +1,4 @@ -# Note that if $webwork_url in site.conf is changed, then /webwork2 +# Note that if $webwork_url in webwork2.mojolicious.yml is changed, then /webwork2 # should be changed below to match. location /webwork2/ { proxy_pass http://127.0.0.1:8080; @@ -10,19 +10,19 @@ location /webwork2/ { proxy_set_header X-Forwarded-Proto $scheme; } -# Note that if $webwork_htdocs_url in site.conf is changed, then /webwork2_files +# Note that if $webwork_htdocs_url in webwork2.mojolicious.yml is changed, then /webwork2_files # should be changed below to match. location /webwork2_files/ { proxy_pass http://127.0.0.1:8080; } -# Note that if $pg_htdocs_url in site.conf is changed, then /pg_files +# Note that if $pg_htdocs_url in webwork2.mojolicious.yml is changed, then /pg_files # should be changed below to match. location /pg_files/ { proxy_pass http://127.0.0.1:8080; } -# Note that if $webwork_courses_url in site.conf is changed, then /pg_files +# Note that if $webwork_courses_url in webwork2.mojolicious.yml is changed, then /pg_files # should be changed below to match. location /webwork2_course_files/ { proxy_pass http://127.0.0.1:8080; diff --git a/docker-config/docker-compose.dist.yml b/docker-config/docker-compose.dist.yml index bbd0256ff4..db134463be 100644 --- a/docker-config/docker-compose.dist.yml +++ b/docker-config/docker-compose.dist.yml @@ -132,7 +132,6 @@ services: # so the main contents of webwork2 can be shared by several hosts (ex. NFS) #- "/per_host_conf_path/conf/authen_LTI.conf:/opt/webwork/webwork2/conf/authen_LTI.conf" #- "/per_host_conf_path/conf/localOverrides.conf:/opt/webwork/webwork2/conf/localOverrides.conf" - #- "/per_host_conf_path/conf/site.conf:/opt/webwork/webwork2/conf/site.conf" # webwork2 misc LOCAL files - mount live (per host) so NOT in the main webwork2 location #- "/per_host_conf_path/htdocs/my_site_info.txt:/opt/webwork/webwork2/htdocs/my_site_info.txt" diff --git a/lib/HardcopyRenderedProblem.pm b/lib/HardcopyRenderedProblem.pm index 524fbb3af0..ca33271e73 100644 --- a/lib/HardcopyRenderedProblem.pm +++ b/lib/HardcopyRenderedProblem.pm @@ -192,7 +192,7 @@ sub generate_hardcopy_pdf { 'TEXINPUTS=.:' . shell_quote($ws->c->ce->{webworkDirs}{assetsTex}) . ':' . shell_quote($ws->c->ce->{pg}{directories}{assetsTex}) . ': ' - . $ws->c->ce->{externalPrograms}{pdflatex} + . $ws->c->externalPrograms->{pdflatex} . ' > pdflatex.stdout 2> pdflatex.stderr hardcopy'; if (my $rawexit = system $pdflatex_cmd) { diff --git a/lib/Mojolicious/WeBWorK.pm b/lib/Mojolicious/WeBWorK.pm index 7db3a0cade..1f6e428b39 100644 --- a/lib/Mojolicious/WeBWorK.pm +++ b/lib/Mojolicious/WeBWorK.pm @@ -56,14 +56,15 @@ sub startup ($app) { # Load a minimal course environment my $ce = WeBWorK::CourseEnvironment->new; - # Set important configuration variables - my $webwork_url = $ce->{webwork_url}; - my $webwork_htdocs_url = $ce->{webwork_htdocs_url}; - my $pg_htdocs_url = $ce->{pg_htdocs_url} // '/pg_files'; - my $webwork_htdocs_dir = $ce->{webwork_htdocs_dir}; - my $webwork_courses_url = $ce->{webwork_courses_url}; - my $webwork_courses_dir = $ce->{webwork_courses_dir}; - my $server_root_url = $ce->{server_root_url}; + # Set important server configuration variables + my $webwork_url = $config->{environment}{webwork_url}; + my $webwork_htdocs_url = $config->{environment}{webwork_htdocs_url}; + my $pg_htdocs_url = $config->{environment}{pg_htdocs_url} // '/pg_files'; + my $webwork_htdocs_dir = $config->{environment}{webwork_htdocs_dir}; + my $webwork_courses_url = $config->{environment}{webwork_courses_url}; + my $webwork_courses_dir = $config->{environment}{webwork_courses_dir}; + my $server_root_url = $config->{environment}{server_root_url}; + my $externalPrograms = $config->{environment}{externalPrograms}; $app->log->info('WeBWorK server is starting'); $app->log->info("WeBWorK root directory set to $ENV{WEBWORK_ROOT}"); @@ -72,8 +73,8 @@ sub startup ($app) { $WEBWORK_SERVER_ADMIN = $ce->{webwork_server_admin_email}; if ($WEBWORK_SERVER_ADMIN) { - $app->log->info( - "webwork_server_admin_email for reporting bugs has been set to $WEBWORK_SERVER_ADMIN in site.conf"); + $app->log->info("webwork_server_admin_email for reporting bugs has been set to $WEBWORK_SERVER_ADMIN " + . "in webwork2.mojolicious.yml"); } # Make the htdocs directory the first place to search for static files. At this point this is only used by the @@ -86,7 +87,7 @@ sub startup ($app) { # Setup the Minion job queue. Make sure that any task added here is represented in the TASK_NAMES hash in # WeBWorK::ContentGenerator::Instructor::JobManager. - $app->plugin(Minion => { $ce->{job_queue}{backend} => $ce->{job_queue}{database_dsn} }); + $app->plugin(Minion => { $config->{job_queue}{backend} => $config->{job_queue}{database_dsn} }); $app->minion->add_task(lti_mass_update => 'Mojolicious::WeBWorK::Tasks::LTIMassUpdate'); $app->minion->add_task(send_instructor_email => 'Mojolicious::WeBWorK::Tasks::SendInstructorEmail'); $app->minion->add_task(send_achievement_email => 'Mojolicious::WeBWorK::Tasks::AchievementNotification'); @@ -100,8 +101,9 @@ sub startup ($app) { # the WeBWorK::Request module to return the empty string for '/'. $app->helper(location => sub ($) { return $webwork_url eq '/' ? '' : $webwork_url }); - $app->helper(server_root_url => sub ($) { return $server_root_url; }); - $app->helper(webwork_url => sub ($) { return $webwork_url; }); + $app->helper(server_root_url => sub ($) { return $server_root_url; }); + $app->helper(webwork_url => sub ($) { return $webwork_url; }); + $app->helper(externalPrograms => sub ($) { return $externalPrograms; }); $app->helper( maketext => sub ($c, @args) { @@ -249,8 +251,8 @@ sub startup ($app) { $cg_r->get('/')->to('Home#go')->name('root'); # The course admin route is set up here because of its special stash value. - $cg_r->any("/$ce->{admin_course_id}")->to('CourseAdmin#go', courseID => $ce->{admin_course_id}) - ->name('course_admin'); + $cg_r->any("/$config->{environment}{admin_course_id}") + ->to('CourseAdmin#go', courseID => $config->{environment}{admin_course_id})->name('course_admin'); setup_content_generator_routes($cg_r); diff --git a/lib/WeBWorK/Authen/LTIAdvanced.pm b/lib/WeBWorK/Authen/LTIAdvanced.pm index e06280b3be..0adb08982d 100644 --- a/lib/WeBWorK/Authen/LTIAdvanced.pm +++ b/lib/WeBWorK/Authen/LTIAdvanced.pm @@ -508,11 +508,13 @@ sub authenticate { $self->{error} .= $c->maketext( "There was an error during the login process. Please speak to your instructor or system administrator."); $self->{log_error} .= - "OAuth verification failed. Check the Consumer Secret and that the URL in the LMS exactly matches the WeBWorK URL."; + "OAuth verification failed. Check the Consumer Secret and that the URL in the LMS exactly " + . "matches the WeBWorK URL."; if ($ce->{debug_lti_parameters}) { warn( - "OAuth verification failed. Check the Consumer Secret and that the URL in the LMS exactly matches the WeBWorK URL as defined in site.conf. E.G. Check that if you have https in the LMS url then you have https in \$server_root_url in site.conf" - ); + "OAuth verification failed. Check the Consumer Secret and that the URL in the LMS exactly matches " + . "the WeBWorK URL as defined in webwork2.mojolicious.yml. E.G. Check that if you have https in the " + . "LMS url then you have https in \$server_root_url in webwork2.mojolicious.yml"); } return 0; } else { diff --git a/lib/WeBWorK/ContentGenerator.pm b/lib/WeBWorK/ContentGenerator.pm index 6d5b3be00e..ffd02f7c84 100644 --- a/lib/WeBWorK/ContentGenerator.pm +++ b/lib/WeBWorK/ContentGenerator.pm @@ -725,7 +725,7 @@ sub page_title ($c) { Defined in this package. -Outputs the $webwork_url defined in site.conf, unless $webwork_url is equal to +Outputs the $webwork_url defined in webwork2.mojolicious.yml, unless $webwork_url is equal to "/", in which case this outputs the empty string. This is used to set a value in a global webworkConfig javascript variable, diff --git a/lib/WeBWorK/ContentGenerator/EquationDisplay.pm b/lib/WeBWorK/ContentGenerator/EquationDisplay.pm index 2ad0b7c6e9..829f16963e 100644 --- a/lib/WeBWorK/ContentGenerator/EquationDisplay.pm +++ b/lib/WeBWorK/ContentGenerator/EquationDisplay.pm @@ -29,8 +29,8 @@ sub display_equation ($c, $str) { my $image_gen = WeBWorK::PG::ImageGenerator->new( tempDir => $ce->{webworkDirs}{tmp}, - latex => $ce->{externalPrograms}{latex}, - dvipng => $ce->{externalPrograms}{dvipng}, + latex => $c->externalPrograms->{latex}, + dvipng => $c->externalPrograms->{dvipng}, useCache => 1, cacheDir => $ce->{webworkDirs}{equationCache}, cacheURL => $ce->{webworkURLs}{equationCache}, diff --git a/lib/WeBWorK/ContentGenerator/Hardcopy.pm b/lib/WeBWorK/ContentGenerator/Hardcopy.pm index 4456ca0a8c..f785e3daf8 100644 --- a/lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ b/lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -765,7 +765,7 @@ sub generate_hardcopy_pdf ($c, $temp_dir_path, $final_file_basename) { . "TEXINPUTS=.:" . shell_quote($c->ce->{webworkDirs}{assetsTex}) . ':' . shell_quote($c->ce->{pg}{directories}{assetsTex}) . ': ' - . $c->ce->{externalPrograms}{pdflatex} + . $c->externalPrograms->{pdflatex} . " >pdflatex.stdout 2>pdflatex.stderr hardcopy"; if (my $rawexit = system $pdflatex_cmd) { my $exit = $rawexit >> 8; diff --git a/lib/WeBWorK/CourseEnvironment.pm b/lib/WeBWorK/CourseEnvironment.pm index 98d977ddb9..4e0af00234 100644 --- a/lib/WeBWorK/CourseEnvironment.pm +++ b/lib/WeBWorK/CourseEnvironment.pm @@ -54,9 +54,11 @@ use warnings; use Carp; use Opcode qw(empty_opset); +use YAML::XS qw(LoadFile); use WeBWorK::WWSafe; use WeBWorK::Utils qw(readFile); +use WeBWorK::DB::Utils qw(databaseParams); use WeBWorK::Debug; =head1 CONSTRUCTION @@ -92,9 +94,11 @@ sub new { # Get the webwork_dir and pg_dir from the SeedCE or the environment if not set. $seedVars->{webwork_dir} //= $WeBWorK::SeedCE{webwork_dir} // $ENV{WEBWORK_ROOT}; $seedVars->{pg_dir} //= $WeBWorK::SeedCE{pg_dir} // $ENV{PG_ROOT}; - $seedVars->{courseName} ||= '___'; # prevents extraneous error messages + # Load the webwork2.mojolcious.yml file which contains important configuration settings. + my $config = loadConfiguration($seedVars); + # The following line is a work around for a bug that occurs on some systems. See # https://rt.cpan.org/Public/Bug/Display.html?id=77916 and # https://github.com/openwebwork/webwork2/pull/2098#issuecomment-1619812699. @@ -157,9 +161,8 @@ sub new { # pull it out of $safe's symbol table ad hoc # (we don't want to do the hash conversion yet) no strict 'refs'; - my $courseEnvironmentFile = ${ *{ ${ $safe->root . "::" }{courseFiles} } }{environment}; - my $courseWebConfigFile = $seedVars->{web_config_filename} - || ${ *{ ${ $safe->root . "::" }{courseFiles} } }{simpleConfig}; + my $courseEnvironmentFile = $config->{environment}{courseFiles}{environment}; + my $courseWebConfigFile = $seedVars->{web_config_filename} || $config->{environment}{courseFiles}{simpleConfig}; use strict 'refs'; # make sure the course environment file actually exists (it might not if we don't have a real course) @@ -222,6 +225,11 @@ sub new { warn "Cannot read PG version file $PG_version_file"; } + # Load server settings from webwork2.mojolicious.yml + # This is done afterward loading defaults.config, localOverrides and course.conf + # in order to ensure that these aren't overridden. + set_server_settings($self, $config); + bless $self, $class; # here is where we can do evil things to the course environment *sigh* @@ -237,15 +245,6 @@ sub new { keys %{ $self->{statuses} } }; - # Make sure that this is set in case it is not defined in site.conf. - $self->{pg_htdocs_url} //= '/pg_files'; - - # Fixup for courses that still have an underscore, 'heb', 'zh_hk', or 'en_us' saved in their settings files. - $self->{language} =~ s/_/-/g; - $self->{language} = 'he-IL' if $self->{language} eq 'heb'; - $self->{language} = 'zh-HK' if $self->{language} eq 'zh-hk'; - $self->{language} = 'en' if $self->{language} eq 'en-us'; - # now that we're done, we can go ahead and return... return $self; } @@ -254,7 +253,7 @@ sub new { =head1 ACCESS -There are no formal accessor methods. However, since the course environemnt is +There are no formal accessor methods. However, since the course environment is a hash of hashes and arrays, is exists as the self hash of an instance variable: @@ -365,9 +364,125 @@ sub status_abbrev_has_behavior { } } -=back +# This loads the configuration file (both defaults and overrides) and returns the +# resulting hash to be included in the course environment. + +sub loadConfiguration { + my ($seedVars) = @_; + + my $defaults_file = "$seedVars->{webwork_dir}/conf/webwork2.mojolicious.dist.yml"; + die "Cannot read the mojolicous defaults file: $defaults_file" unless -r $defaults_file; + + # If this exists, load the overrides file (replacement for local overrides): + my $config_file = "$seedVars->{webwork_dir}/conf/webwork2.mojolicious.yml"; + my $config = -r $config_file ? LoadFile($config_file) : LoadFile($defaults_file); + + # define some variables from the config file: + replacePlaceholders( + $config->{environment}, + { + webwork_dir => $seedVars->{webwork_dir}, + webwork_url => $config->{environment}->{webwork_url}, + webwork_htdocs_dir => $config->{environment}->{webwork_htdocs_dir}, + webwork_htdocs_url => $config->{environment}->{webwork_htdocs_url}, + webwork_courses_dir => $config->{environment}->{webwork_courses_dir}, + course_name => $seedVars->{courseName}, + courses_dir => $config->{environment}->{webwork_courses_dir}, + pg_root => $seedVars->{pg_dir}, + pg_root_url => $config->{environment}->{pg}{URLs}{html} + } + ); -=cut + return $config; +} + +# This sets the directories in the course environment. It is called after defaults.config +# and course.conf are read to prevent being overridden in those files. + +# Note: these were set in the defaults.config before. + +sub set_server_settings { + my ($ce, $config) = @_; + + # Copy everything from the environment section of webwork2.mojolicious.yml file into the CourseEnvironment + deepCopy($ce, $config->{environment}); + + # set the database settings: + $ce->{database_name} = $config->{database}{name}; + $ce->{database_host} = $config->{database}{host}; + $ce->{database_username} = $config->{database}{username}; + $ce->{database_password} = $config->{database}{password}; + if ($config->{database}{host} eq "localhost") { + if ($config->{database}{use_socket_if_localhost}) { + $ce->{database_dsn} = "DBI:$config->{database}{driver}:database=$config->{database}{name}"; + } else { + $ce->{database_dsn} = + "DBI:$config->{database}{driver}:database=$config->{database}{name};" + . "host=127.0.0.1;port=$config->{database}{port}"; + } + } else { + $ce->{database_dsn} = + "DBI:$config->{database}{driver}:database=$config->{database}{name};" + . "host=$config->{database}{host};port=$config->{database}{port}"; + } + $ce->{dbLayoutName} = 'sql_single'; + $config->{database}{dsn} = $ce->{database_dsn}; + $config->{database}{character_set} = $config->{database}{ENABLE_UTF8MB4} ? 'utf8mb4' : 'utf8'; + $ce->{dbLayout} = databaseParams($ce->{courseName}, $config->{database}, $config->{externalPrograms}); + + $ce->{maxCourseIdLength} = $config->{database}{maxCourseIdLength}; + + # ensure that the dvipng_depth_db information is defined: + $ce->{pg}{displayModeOptions}{images}{dvipng_depth_db}{user} //= $config->{database}{username}; + $ce->{pg}{displayModeOptions}{images}{dvipng_depth_db}{passwd} //= $config->{database}{password}; + $ce->{pg}{displayModeOptions}{images}{dvipng_depth_db}{dbsource} //= $ce->{database_dsn}; + + # Problem Library SQL database connection information + $ce->{problemLibrary_db} = { + dbsource => $ce->{database_dsn}, + user => $ce->{database_username}, + passwd => $ce->{database_password}, + storage_engine => 'MYISAM', + }; + + # Fixup for courses that still have an underscore, 'heb', 'zh_hk', or 'en_us' saved in their settings files. + $ce->{language} =~ s/_/-/g; + $ce->{language} = 'he-IL' if $ce->{language} eq 'heb'; + $ce->{language} = 'zh-HK' if $ce->{language} eq 'zh-hk'; + $ce->{language} = 'en' if $ce->{language} eq 'en-us'; + + return; +} + +# Recursively deplace variable placeholders in the $input object. +sub replacePlaceholders { + my ($input, $values) = @_; + if (ref $input eq 'HASH') { + $input->{$_} = replacePlaceholders($input->{$_}, $values) for (keys %$input); + } elsif (ref $input eq 'ARRAY') { + $input->[$_] = replacePlaceholders($input->[$_], $values) for (0 .. $#$input); + } else { + $input =~ s/\$(\w+)/defined $values->{$1} ? $values->{$1} : ''/gex; + } + + return $input; +} + +# Recursively copy the source hash into the target hash, overriding key values in the target. If a value in the source +# has a ref that does not match that of the corresponding target value, then it is skipped and a warning is issued. +# Anything not in the target is copied in. +sub deepCopy { + my ($target, $source) = @_; + if (ref $target eq 'HASH' && ref $source eq 'HASH') { + $target->{$_} = deepCopy($target->{$_}, $source->{$_}) for (keys %$source); + } elsif (ref $target eq ref $source || !defined $target) { + $target = $source; + } else { + warn 'invalid source field detected -- skipping'; + } + + return $target; +} 1; diff --git a/lib/WeBWorK/DB/Utils.pm b/lib/WeBWorK/DB/Utils.pm index 2a6476c0c7..875c7e0a73 100644 --- a/lib/WeBWorK/DB/Utils.pm +++ b/lib/WeBWorK/DB/Utils.pm @@ -35,6 +35,7 @@ our @EXPORT_OK = qw( grok_vsetID grok_setID_from_vsetID_sql grok_versionID_from_vsetID_sql + databaseParams ); sub global2user($$) { @@ -108,4 +109,279 @@ sub grok_versionID_from_vsetID_sql($) { return "(SUBSTRING($field,INSTR($field,',v')+2)+0)"; } +# This function fills database fields of the CourseEnvironment + +sub databaseParams { + my ($courseName, $db_params, $externalPrograms) = @_; + + my %sqlParams = ( + username => $db_params->{username}, + password => $db_params->{password}, + debug => $db_params->{database_debug} // 0, + # kinda hacky, but needed for table dumping + mysql_path => $externalPrograms->{mysql}, + mysqldump_path => $externalPrograms->{mysqldump}, + ); + + if ($db_params->{driver} =~ /^mysql$/i) { + # The extra UTF8 connection setting is ONLY needed for older DBD:mysql driver + # and forbidden by the newer DBD::MariaDB driver + if ($db_params->{ENABLE_UTF8MB4}) { + $sqlParams{mysql_enable_utf8mb4} = 1; # Full 4-bit UTF-8 + } else { + $sqlParams{mysql_enable_utf8} = 1; # Only the partial 3-bit mySQL UTF-8 + } + } + return { + locations => { + record => "WeBWorK::DB::Record::Locations", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, non_native => 1, }, + }, + location_addresses => { + record => "WeBWorK::DB::Record::LocationAddresses", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, non_native => 1, }, + }, + depths => { + record => "WeBWorK::DB::Record::Depths", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + params => { %sqlParams, non_native => 1, }, + }, + password => { + record => "WeBWorK::DB::Record::Password", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_password", }, + }, + permission => { + record => "WeBWorK::DB::Record::PermissionLevel", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_permission", }, + }, + key => { + record => "WeBWorK::DB::Record::Key", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_key" }, + }, + user => { + record => "WeBWorK::DB::Record::User", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_user", }, + }, + set => { + record => "WeBWorK::DB::Record::Set", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_set", }, + }, + set_user => { + record => "WeBWorK::DB::Record::UserSet", + schema => "WeBWorK::DB::Schema::NewSQL::NonVersioned", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { + %sqlParams, + tableOverride => "${courseName}_set_user", + #fieldOverride => { visible => "published" }, # for compatibility -- visible was originally called published + }, + }, + set_merged => { + record => "WeBWorK::DB::Record::UserSet", + schema => "WeBWorK::DB::Schema::NewSQL::Merge", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + depend => [qw/set_user set/], + params => { + %sqlParams, + non_native => 1, + merge => [qw/set_user set/], + }, + }, + set_version => { + record => "WeBWorK::DB::Record::SetVersion", + schema => "WeBWorK::DB::Schema::NewSQL::Versioned", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + params => { + %sqlParams, + non_native => 1, + tableOverride => "${courseName}_set_user", + }, + }, + set_version_merged => { + record => "WeBWorK::DB::Record::SetVersion", + schema => "WeBWorK::DB::Schema::NewSQL::Merge", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + depend => [qw/set_version set_user set/], + params => { + %sqlParams, + non_native => 1, + merge => [qw/set_version set_user set/], + }, + }, + set_locations => { + record => "WeBWorK::DB::Record::SetLocations", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_set_locations" }, + }, + set_locations_user => { + record => "WeBWorK::DB::Record::UserSetLocations", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_set_locations_user" }, + }, + problem => { + record => "WeBWorK::DB::Record::Problem", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_problem" }, + }, + problem_user => { + record => "WeBWorK::DB::Record::UserProblem", + schema => "WeBWorK::DB::Schema::NewSQL::NonVersioned", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_problem_user" }, + }, + problem_merged => { + record => "WeBWorK::DB::Record::UserProblem", + schema => "WeBWorK::DB::Schema::NewSQL::Merge", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + depend => [qw/problem_user problem/], + params => { + %sqlParams, + non_native => 1, + merge => [qw/problem_user problem/], + }, + }, + problem_version => { + record => "WeBWorK::DB::Record::ProblemVersion", + schema => "WeBWorK::DB::Schema::NewSQL::Versioned", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { + %sqlParams, + non_native => 1, + tableOverride => "${courseName}_problem_user", + }, + }, + problem_version_merged => { + record => "WeBWorK::DB::Record::ProblemVersion", + schema => "WeBWorK::DB::Schema::NewSQL::Merge", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + depend => [qw/problem_version problem_user problem/], + params => { + %sqlParams, + non_native => 1, + merge => [qw/problem_version problem_user problem/], + }, + }, + setting => { + record => "WeBWorK::DB::Record::Setting", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_setting" }, + }, + achievement => { + record => "WeBWorK::DB::Record::Achievement", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_achievement" }, + }, + past_answer => { + record => "WeBWorK::DB::Record::PastAnswer", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_past_answer" }, + }, + + achievement_user => { + record => "WeBWorK::DB::Record::UserAchievement", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_achievement_user" }, + }, + global_user_achievement => { + record => "WeBWorK::DB::Record::GlobalUserAchievement", + schema => "WeBWorK::DB::Schema::NewSQL::Std", + driver => "WeBWorK::DB::Driver::SQL", + source => $db_params->{dsn}, + engine => $db_params->{storage_engine}, + character_set => $db_params->{character_set}, + params => { %sqlParams, tableOverride => "${courseName}_global_user_achievement" }, + }, + }; + +} + 1; diff --git a/templates/ContentGenerator/Instructor/SetMaker/browse_library_panel.html.ep b/templates/ContentGenerator/Instructor/SetMaker/browse_library_panel.html.ep index 7df4fb0bac..3b93968be0 100644 --- a/templates/ContentGenerator/Instructor/SetMaker/browse_library_panel.html.ep +++ b/templates/ContentGenerator/Instructor/SetMaker/browse_library_panel.html.ep @@ -10,9 +10,9 @@ % { % my $msg = begin You are missing the directory templates/Library, which is needed for the Problem Library to function. - It should be a link pointing to <%= $libraryRoot %>, which you set in conf/site.conf. An - attempt was made to create the link, but that failed. Check the permissions in your templates - directory. + It should be a link pointing to <%= $libraryRoot %>, which you set in + conf/webwork2.mojolicious.yml. An attempt was made to create the link, but that failed. + Check the permissions in your templates directory. % end % $c->addbadmessage($msg->()); % } diff --git a/templates/exception_default.html.ep b/templates/exception_default.html.ep index b20cd062c1..7fccc228a9 100644 --- a/templates/exception_default.html.ep +++ b/templates/exception_default.html.ep @@ -15,7 +15,7 @@

An error occurred while processing your request.

For help, please send mail to this site's webmaster\ - % # $ENV{WEBWORK_SERVER_ADMIN} is set from $webwork_server_admin_email in site.conf. + % # $ENV{WEBWORK_SERVER_ADMIN} is set from $webwork_server_admin_email in webwork2.mojolicious.yml. <% if ($ENV{WEBWORK_SERVER_ADMIN}) { =%> <%= link_to $ENV{WEBWORK_SERVER_ADMIN} => "mailto:$ENV{WEBWORK_SERVER_ADMIN}" %>\ <% } =%>\ diff --git a/templates/exception_min.html.ep b/templates/exception_min.html.ep index a4d370f0f0..5068c419cf 100644 --- a/templates/exception_min.html.ep +++ b/templates/exception_min.html.ep @@ -15,7 +15,7 @@

An error occurred while processing your request.

For help, please send mail to this site's webmaster\ - % # $ENV{WEBWORK_SERVER_ADMIN} is set from $webwork_server_admin_email in site.conf. + % # $ENV{WEBWORK_SERVER_ADMIN} is set from $webwork_server_admin_email in webwork2.mojolicious.yml. <% if ($ENV{WEBWORK_SERVER_ADMIN}) { =%> <%= link_to $ENV{WEBWORK_SERVER_ADMIN} => "mailto:$ENV{WEBWORK_SERVER_ADMIN}" %>\ <% } =%>\