|
1
|
|
|
<?php |
|
2
|
|
|
/* For licensing terms, see /license.txt */ |
|
3
|
|
|
|
|
4
|
|
|
namespace Chamilo\CoreBundle\Migrations\Schema\V110; |
|
5
|
|
|
|
|
6
|
|
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
|
7
|
|
|
use Doctrine\DBAL\Schema\Schema; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class Version20150507152600 |
|
11
|
|
|
* |
|
12
|
|
|
* @package Chamilo\CoreBundle\Migrations\Schema\V110 |
|
13
|
|
|
*/ |
|
14
|
|
|
class Version20150507152600 extends AbstractMigrationChamilo |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @param Schema $schema |
|
18
|
|
|
* |
|
19
|
|
|
* @throws \Doctrine\DBAL\Schema\SchemaException |
|
20
|
|
|
*/ |
|
21
|
|
|
public function up(Schema $schema) |
|
22
|
|
|
{ |
|
23
|
|
|
// Move some settings from configuration.php to the database |
|
24
|
|
|
// Current settings categories are: |
|
25
|
|
|
// Platform, Course, Session, Languages, User, Tools, Editor, Security, |
|
26
|
|
|
// Tuning, Gradebook, Timezones, Tracking, Search, stylesheets (lowercase), |
|
27
|
|
|
// LDAP, CAS, Shibboleth, Facebook |
|
28
|
|
|
|
|
29
|
|
|
// Setting $_configuration['hide_home_top_when_connected'] = true; |
|
30
|
|
|
$value = $this->getConfigurationValue('hide_home_top_when_connected'); |
|
31
|
|
|
|
|
32
|
|
|
$this->addSettingCurrent( |
|
33
|
|
|
'hide_home_top_when_connected', |
|
34
|
|
|
'', |
|
35
|
|
|
'radio', |
|
36
|
|
|
'Platform', |
|
37
|
|
|
($value ? 'true' : 'false'), |
|
38
|
|
|
'HideHomeTopContentWhenLoggedInText', |
|
39
|
|
|
'HideHomeTopContentWhenLoggedInComment', |
|
40
|
|
|
null, |
|
41
|
|
|
'', |
|
42
|
|
|
1, |
|
43
|
|
|
true, |
|
44
|
|
|
false, |
|
45
|
|
|
[ |
|
46
|
|
|
0 => ['value' => 'true', 'text' => 'Yes'], |
|
47
|
|
|
1 => ['value' => 'false', 'text' => 'No'], |
|
48
|
|
|
] |
|
49
|
|
|
); |
|
50
|
|
|
|
|
51
|
|
|
// Hide the global announcements for non-connected users |
|
52
|
|
|
//$_configuration['hide_global_announcements_when_not_connected'] = true; |
|
53
|
|
|
$value = $this->getConfigurationValue('hide_global_announcements_when_not_connected'); |
|
54
|
|
|
$this->addSettingCurrent( |
|
55
|
|
|
'hide_global_announcements_when_not_connected', |
|
56
|
|
|
'', |
|
57
|
|
|
'radio', |
|
58
|
|
|
'Platform', |
|
59
|
|
|
($value?'true':'false'), |
|
60
|
|
|
'HideGlobalAnnouncementsWhenNotLoggedInText', |
|
61
|
|
|
'HideGlobalAnnouncementsWhenNotLoggedInComment', |
|
62
|
|
|
null, |
|
63
|
|
|
'', |
|
64
|
|
|
1, |
|
65
|
|
|
true, |
|
66
|
|
|
false, |
|
67
|
|
|
[ |
|
68
|
|
|
0 => ['value' => 'true', 'text' => 'Yes'], |
|
69
|
|
|
1 => ['value' => 'false', 'text' => 'No'], |
|
70
|
|
|
] |
|
71
|
|
|
); |
|
72
|
|
|
|
|
73
|
|
|
// Use this course as template for all new courses (define course real ID as value) |
|
74
|
|
|
//$_configuration['course_creation_use_template'] = 14; |
|
75
|
|
|
$value = $this->getConfigurationValue('course_creation_use_template'); |
|
76
|
|
|
$this->addSettingCurrent( |
|
77
|
|
|
'course_creation_use_template', |
|
78
|
|
|
'', |
|
79
|
|
|
'textfield', |
|
80
|
|
|
'Course', |
|
81
|
|
|
($value?$value:''), |
|
82
|
|
|
'CourseCreationUsesTemplateText', |
|
83
|
|
|
'CourseCreationUsesTemplateComment', |
|
84
|
|
|
null, |
|
85
|
|
|
'', |
|
86
|
|
|
1, |
|
87
|
|
|
true, |
|
88
|
|
|
false, |
|
89
|
|
|
[ |
|
90
|
|
|
0 => ['value' => 'true', 'text' => 'Yes'], |
|
91
|
|
|
1 => ['value' => 'false', 'text' => 'No'], |
|
92
|
|
|
] |
|
93
|
|
|
); |
|
94
|
|
|
|
|
95
|
|
|
// Add password strength checker |
|
96
|
|
|
//$_configuration['allow_strength_pass_checker'] = true; |
|
97
|
|
|
$value = $this->getConfigurationValue('allow_strength_pass_checker'); |
|
98
|
|
|
$this->addSettingCurrent( |
|
99
|
|
|
'allow_strength_pass_checker', |
|
100
|
|
|
'', |
|
101
|
|
|
'radio', |
|
102
|
|
|
'Security', |
|
103
|
|
|
($value?'true':'false'), |
|
104
|
|
|
'EnablePasswordStrengthCheckerText', |
|
105
|
|
|
'EnablePasswordStrengthCheckerComment', |
|
106
|
|
|
null, |
|
107
|
|
|
'', |
|
108
|
|
|
1, |
|
109
|
|
|
true, |
|
110
|
|
|
false, |
|
111
|
|
|
[ |
|
112
|
|
|
0 => ['value' => 'true', 'text' => 'Yes'], |
|
113
|
|
|
1 => ['value' => 'false', 'text' => 'No'], |
|
114
|
|
|
] |
|
115
|
|
|
); |
|
116
|
|
|
|
|
117
|
|
|
// Enable captcha |
|
118
|
|
|
// $_configuration['allow_captcha'] = true; |
|
119
|
|
|
$value = $this->getConfigurationValue('allow_captcha'); |
|
120
|
|
|
$this->addSettingCurrent( |
|
121
|
|
|
'allow_captcha', |
|
122
|
|
|
'', |
|
123
|
|
|
'radio', |
|
124
|
|
|
'Security', |
|
125
|
|
|
($value?'true':'false'), |
|
126
|
|
|
'EnableCaptchaText', |
|
127
|
|
|
'EnableCaptchaComment', |
|
128
|
|
|
null, |
|
129
|
|
|
'', |
|
130
|
|
|
1, |
|
131
|
|
|
true, |
|
132
|
|
|
false, |
|
133
|
|
|
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] |
|
134
|
|
|
); |
|
135
|
|
|
// Prevent account from logging in for a certain amount of time |
|
136
|
|
|
// if captcha is wrong for the specified number of times |
|
137
|
|
|
//$_configuration['captcha_number_mistakes_to_block_account'] = 5; |
|
138
|
|
|
$value = $this->getConfigurationValue('captcha_number_mistakes_to_block_account'); |
|
139
|
|
|
$this->addSettingCurrent( |
|
140
|
|
|
'captcha_number_mistakes_to_block_account', |
|
141
|
|
|
'', |
|
142
|
|
|
'textfield', |
|
143
|
|
|
'Security', |
|
144
|
|
|
($value?$value:5), |
|
145
|
|
|
'CaptchaNumberOfMistakesBeforeBlockingAccountText', |
|
146
|
|
|
'CaptchaNumberOfMistakesBeforeBlockingAccountComment', |
|
147
|
|
|
null, |
|
148
|
|
|
'', |
|
149
|
|
|
1, |
|
150
|
|
|
true, |
|
151
|
|
|
false |
|
152
|
|
|
); |
|
153
|
|
|
// Prevent account from logging in for the specified number of minutes |
|
154
|
|
|
//$_configuration['captcha_time_to_block'] = 5;//minutes |
|
155
|
|
|
$value = $this->getConfigurationValue('captcha_time_to_block'); |
|
156
|
|
|
$this->addSettingCurrent( |
|
157
|
|
|
'captcha_time_to_block', |
|
158
|
|
|
'', |
|
159
|
|
|
'textfield', |
|
160
|
|
|
'Security', |
|
161
|
|
|
($value?$value:5), |
|
162
|
|
|
'CaptchaTimeAccountIsLockedText', |
|
163
|
|
|
'CaptchaTimeAccountIsLockedComment', |
|
164
|
|
|
null, |
|
165
|
|
|
'', |
|
166
|
|
|
1, |
|
167
|
|
|
true, |
|
168
|
|
|
false |
|
169
|
|
|
); |
|
170
|
|
|
|
|
171
|
|
|
// Allow DRH role to access all content and users from the sessions he follows |
|
172
|
|
|
//$_configuration['drh_can_access_all_session_content'] = true; |
|
173
|
|
|
$value = $this->getConfigurationValue('drh_can_access_all_session_content'); |
|
174
|
|
|
$this->addSettingCurrent( |
|
175
|
|
|
'drh_can_access_all_session_content', |
|
176
|
|
|
'', |
|
177
|
|
|
'radio', |
|
178
|
|
|
'Session', |
|
179
|
|
|
($value?'true':'false'), |
|
180
|
|
|
'DRHAccessToAllSessionContentText', |
|
181
|
|
|
'DRHAccessToAllSessionContentComment', |
|
182
|
|
|
null, |
|
183
|
|
|
'', |
|
184
|
|
|
1, |
|
185
|
|
|
true, |
|
186
|
|
|
false, |
|
187
|
|
|
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] |
|
188
|
|
|
); |
|
189
|
|
|
|
|
190
|
|
|
// Display group's forum in general forum tool |
|
191
|
|
|
//$_configuration['display_groups_forum_in_general_tool'] = true; |
|
192
|
|
|
$value = $this->getConfigurationValue('display_groups_forum_in_general_tool'); |
|
193
|
|
|
$this->addSettingCurrent( |
|
194
|
|
|
'display_groups_forum_in_general_tool', |
|
195
|
|
|
'', |
|
196
|
|
|
'radio', |
|
197
|
|
|
'Tools', |
|
198
|
|
|
($value?'true':'false'), |
|
199
|
|
|
'ShowGroupForaInGeneralToolText', |
|
200
|
|
|
'ShowGroupForaInGeneralToolComment', |
|
201
|
|
|
null, |
|
202
|
|
|
'', |
|
203
|
|
|
1, |
|
204
|
|
|
true, |
|
205
|
|
|
false, |
|
206
|
|
|
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] |
|
207
|
|
|
); |
|
208
|
|
|
|
|
209
|
|
|
// Allow course tutors in sessions to add existing students to their session |
|
210
|
|
|
//$_configuration['allow_tutors_to_assign_students_to_session'] = 'false'; |
|
211
|
|
|
$value = $this->getConfigurationValue('allow_tutors_to_assign_students_to_session'); |
|
212
|
|
|
$this->addSettingCurrent( |
|
213
|
|
|
'allow_tutors_to_assign_students_to_session', |
|
214
|
|
|
'', |
|
215
|
|
|
'radio', |
|
216
|
|
|
'Session', |
|
217
|
|
|
($value?'true':'false'), |
|
218
|
|
|
'TutorsCanAssignStudentsToSessionsText', |
|
219
|
|
|
'TutorsCanAssignStudentsToSessionsComment', |
|
220
|
|
|
null, |
|
221
|
|
|
'', |
|
222
|
|
|
1, |
|
223
|
|
|
true, |
|
224
|
|
|
false, |
|
225
|
|
|
[0 => ['value' => 'true', 'text' => 'Yes'], 1 => ['value' => 'false', 'text' => 'No']] |
|
226
|
|
|
); |
|
227
|
|
|
} |
|
228
|
|
|
|
|
229
|
|
|
/** |
|
230
|
|
|
* We don't allow downgrades yet |
|
231
|
|
|
* @param Schema $schema |
|
232
|
|
|
*/ |
|
233
|
|
|
public function down(Schema $schema) |
|
234
|
|
|
{ |
|
235
|
|
|
$this->addSql(" |
|
236
|
|
|
DELETE FROM settings_options WHERE variable IN ('hide_home_top_when_connected', 'hide_global_announcements_when_not_connected', 'course_creation_use_template', 'allow_strength_pass_checker', 'allow_captcha', 'captcha_number_mistakes_to_block_account', 'captcha_time_to_block', 'drh_can_access_all_session_content', 'display_groups_forum_in_general_tool', 'allow_tutors_to_assign_students_to_session') |
|
237
|
|
|
"); |
|
238
|
|
|
$this->addSql(" |
|
239
|
|
|
DELETE FROM settings_current WHERE variable IN ('hide_home_top_when_connected', 'hide_global_announcements_when_not_connected', 'course_creation_use_template', 'allow_strength_pass_checker', 'allow_captcha', 'captcha_number_mistakes_to_block_account', 'captcha_time_to_block', 'drh_can_access_all_session_content', 'display_groups_forum_in_general_tool', 'allow_tutors_to_assign_students_to_session') |
|
240
|
|
|
"); |
|
241
|
|
|
} |
|
242
|
|
|
} |
|
243
|
|
|
|