Parent Directory
|
Revision Log
use correct $moodle_table_prefix variable from global.conf (was $moodle_prefix). include moodlekey table for now.
1 #!perl 2 ################################################################################ 3 # WeBWorK Online Homework Delivery System 4 # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ 5 # $CVSHeader: webwork2/conf/database.conf.dist,v 1.22 2006/05/25 03:12:57 gage Exp $ 6 # 7 # This program is free software; you can redistribute it and/or modify it under 8 # the terms of either: (a) the GNU General Public License as published by the 9 # Free Software Foundation; either version 2, or (at your option) any later 10 # version, or (b) the "Artistic License" which comes with this package. 11 # 12 # This program is distributed in the hope that it will be useful, but WITHOUT 13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the 15 # Artistic License for more details. 16 ################################################################################ 17 18 =head1 NAME 19 20 database.conf - define stantad database layouts 21 22 =head1 SYNOPSIS 23 24 In global.conf: 25 26 include "conf/database.conf"; 27 *dbLayout = $dbLayouts{layoutName}; 28 29 =head1 DESCRIPTION 30 31 This file contains definitions for the commonly-used database layouts. Database 32 layouts consist of all the information necessary to describe how to access data 33 used by WeBWorK. For more information on the format of a database layout, 34 consult the documentation for the WeBWorK::DB module. 35 36 A database layout is selected from the list of possible layouts by adding a 37 line like the one below to the F<global.conf> or F<course.conf> file. 38 39 $dbLayoutName = "layoutName"; 40 *dbLayout = $dbLayouts{$dbLayoutName}; 41 42 =cut 43 44 %dbLayouts = (); # layouts are added to this hash below 45 46 =head2 THE SQL_SINGLE DATABASE LAYOUT 47 48 The C<sql_single> layout is similar to the C<sql> layout, excpet that it uses a 49 single database for all courses. This is accomplised by prefixing each table 50 name with the name of the course. The names and passwords of these accounts are 51 given as parameters to each table in the layout. 52 53 usernameRO the name of the read-only account 54 usernameRW the name of the read-write account 55 passwordRO the password for the read-only account 56 passwordRW the password for the read-write account 57 58 Be default, the name of the read-only account is "webworkRead", and the name of 59 the read-write account is "webworkWrite". There are no passwords by default. 60 It is not recommended that you use only passwords to secure database access. 61 Most RDBMSs allow IP-based authorization as well. As the system administrator, 62 IT IS YOUR RESPONSIBILITY TO SECURE DATABASE ACCESS. 63 64 Don't confuse the accounts above with the accounts of the users of a course. 65 These are system-wide accounts which allow WeBWorK to talk to the database 66 server. 67 68 Other parameters that can be given are as follows: 69 70 tableOverride an alternate name to use when referrring to the table (used 71 when a table name is a resereved word) 72 fieldOverride a hash mapping WeBWorK field names to alternate names to use 73 when referring to those fields (used when one or more field 74 names are reserved words) 75 debug if true, SQL statments are printed before being executed 76 77 =cut 78 79 # params common to all tables 80 my %sqlParams = ( 81 usernameRO => $database_username, 82 passwordRO => $database_password, 83 usernameRW => $database_username, 84 passwordRW => $database_password, 85 debug => $database_debug, 86 ); 87 88 $dbLayouts{sql_single} = { 89 password => { 90 record => "WeBWorK::DB::Record::Password", 91 schema => "WeBWorK::DB::Schema::SQL", 92 driver => "WeBWorK::DB::Driver::SQL", 93 source => $database_dsn, 94 params => { %sqlParams, 95 tableOverride => "${courseName}_password", 96 }, 97 }, 98 permission => { 99 record => "WeBWorK::DB::Record::PermissionLevel", 100 schema => "WeBWorK::DB::Schema::SQL", 101 driver => "WeBWorK::DB::Driver::SQL", 102 source => $database_dsn, 103 params => { %sqlParams, 104 tableOverride => "${courseName}_permission", 105 }, 106 }, 107 key => { 108 record => "WeBWorK::DB::Record::Key", 109 schema => "WeBWorK::DB::Schema::SQL", 110 driver => "WeBWorK::DB::Driver::SQL", 111 source => $database_dsn, 112 params => { %sqlParams, 113 tableOverride => "${courseName}_key", 114 fieldOverride => { key => "key_not_a_keyword" }, 115 }, 116 }, 117 user => { 118 record => "WeBWorK::DB::Record::User", 119 schema => "WeBWorK::DB::Schema::SQL", 120 driver => "WeBWorK::DB::Driver::SQL", 121 source => $database_dsn, 122 params => { %sqlParams, 123 tableOverride => "${courseName}_user", 124 }, 125 }, 126 set => { 127 record => "WeBWorK::DB::Record::Set", 128 schema => "WeBWorK::DB::Schema::SQL", 129 driver => "WeBWorK::DB::Driver::SQL", 130 source => $database_dsn, 131 params => { %sqlParams, 132 tableOverride => "${courseName}_set" 133 }, 134 }, 135 set_user => { 136 record => "WeBWorK::DB::Record::UserSet", 137 schema => "WeBWorK::DB::Schema::SQL", 138 driver => "WeBWorK::DB::Driver::SQL", 139 source => $database_dsn, 140 params => { %sqlParams, 141 tableOverride => "${courseName}_set_user" 142 }, 143 }, 144 problem => { 145 record => "WeBWorK::DB::Record::Problem", 146 schema => "WeBWorK::DB::Schema::SQL", 147 driver => "WeBWorK::DB::Driver::SQL", 148 source => $database_dsn, 149 params => { %sqlParams, 150 tableOverride => "${courseName}_problem" 151 }, 152 }, 153 problem_user => { 154 record => "WeBWorK::DB::Record::UserProblem", 155 schema => "WeBWorK::DB::Schema::SQL", 156 driver => "WeBWorK::DB::Driver::SQL", 157 source => $database_dsn, 158 params => { %sqlParams, 159 tableOverride => "${courseName}_problem_user" 160 }, 161 }, 162 }; 163 164 =head2 THE SQL_MOODLE DATABASE LAYOUT 165 166 The C<sql_moodle> layout is similar to the C<sql_single> layout, except it uses 167 a Moodle database for user information and authentication. 168 169 =cut 170 171 # params used by moodle-backed tables 172 my %moodleParams = ( 173 non_native => 1, 174 usernameRO => $moodle_username, 175 passwordRO => $moodle_password, 176 usernameRW => $moodle_username, 177 passwordRW => $moodle_password, 178 debug => $database_debug, 179 tablePrefix => $mooble_table_prefix, 180 courseName => $courseName, 181 ); 182 183 $dbLayouts{sql_moodle} = { 184 # start with sql_single table definitions 185 %{$dbLayouts{sql_single}}, 186 187 # then override user, password, and permission tables 188 # use the same record classes as sql_single 189 user => { 190 record => "WeBWorK::DB::Record::User", 191 schema => "WeBWorK::DB::Schema::Moodle::User", 192 driver => "WeBWorK::DB::Driver::SQL", 193 source => $moodle_dsn, 194 params => { %moodleParams }, 195 }, 196 password => { 197 record => "WeBWorK::DB::Record::Password", 198 schema => "WeBWorK::DB::Schema::Moodle::Password", 199 driver => "WeBWorK::DB::Driver::SQL", 200 source => $moodle_dsn, 201 params => { %moodleParams }, 202 }, 203 permission => { 204 record => "WeBWorK::DB::Record::PermissionLevel", 205 schema => "WeBWorK::DB::Schema::Moodle::Permission", 206 driver => "WeBWorK::DB::Driver::SQL", 207 source => $moodle_dsn, 208 params => { %moodleParams }, 209 }, 210 moodlekey => { 211 record => "WeBWorK::DB::Record::Key", # never used :-( 212 schema => "WeBWorK::DB::Schema::Moodle::Key", 213 driver => "WeBWorK::DB::Driver::SQL", 214 source => $moodle_dsn, 215 params => { %moodleParams }, 216 }, 217 }; 218 219 =head1 DATABASE LAYOUT METADATA 220 221 =over 222 223 =item @dbLayout_order 224 225 Database layouts listed in this array will be displayed first, in the order 226 specified, wherever database layouts are listed. (For example, in the "Add 227 Course" tool.) Other layouts are listed after these. 228 229 =cut 230 231 @dbLayout_order = qw/sql_single sql_moodle/; 232 233 =item %dbLayout_descr 234 235 Hash mapping database layout names to textual descriptions. 236 237 =cut 238 239 %dbLayout_descr = ( 240 sql_single => "Uses a single SQL database to record WeBWorK data for all courses using this layout. This is the recommended layout for new courses.", 241 sql_moodle => "Simiar to sql_single, but uses a Moodle database for user, password, and permission information. This layout should be used for courses used with wwmoodle.", 242 ); 243 244 =back 245 246 =cut
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |