Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iena-course-format
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iena
iena-course-format
Commits
828f3ae6
Commit
828f3ae6
authored
3 years ago
by
Myriam Delaruelle
Browse files
Options
Downloads
Patches
Plain Diff
Script upgrade db from old version
parent
eb178941
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
db/install.xml
+2
-2
2 additions, 2 deletions
db/install.xml
db/upgrade.php
+73
-0
73 additions, 0 deletions
db/upgrade.php
version.php
+1
-1
1 addition, 1 deletion
version.php
with
76 additions
and
3 deletions
db/install.xml
+
2
−
2
View file @
828f3ae6
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"../../../../lib/xmldb/xmldb.xsd"
xsi:noNamespaceSchemaLocation=
"../../../../lib/xmldb/xmldb.xsd"
>
>
<TABLES>
<!--
<TABLES>
<TABLE NAME="format_iena" COMMENT="Default comment for format_iena, please edit me">
<TABLE NAME="format_iena" COMMENT="Default comment for format_iena, please edit me">
<FIELDS>
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
...
@@ -21,5 +21,5 @@
...
@@ -21,5 +21,5 @@
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</KEYS>
</TABLE>
</TABLE>
</TABLES>
</TABLES>
-->
</XMLDB>
</XMLDB>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
db/upgrade.php
0 → 100644
+
73
−
0
View file @
828f3ae6
<?php
function
xmldb_format_iena_upgrade
(
$oldversion
)
{
global
$CFG
,
$DB
;
$dbman
=
$DB
->
get_manager
();
$result
=
TRUE
;
if
(
$oldversion
<
2021220900
)
{
//Support for old versions: we copy format options to the course_format_options table
try
{
$sections
=
$DB
->
get_records_sql
(
'select * FROM {format_iena}'
);
}
catch
(
dml_exception
$e
)
{
echo
"Aucun cours avec le format hybride dans la base"
;
}
if
(
count
(
$sections
)
>
0
){
foreach
(
$sections
as
$section
)
{
try
{
$courseid
=
$DB
->
get_record_sql
(
'select course FROM {course_sections} WHERE id=?'
,
array
(
$section
->
id_section
));
$section_data
=
new
stdClass
();
$section_data
->
courseid
=
$courseid
->
course
;
$section_data
->
format
=
"iena"
;
$section_data
->
sectionid
=
$section
->
id_section
;
//On va faire pour présence, daterendu et daysnotif
$section_data
->
name
=
"presence"
;
$section_data
->
value
=
$section
->
presence
;
$exists
=
$DB
->
get_record_sql
(
'select * FROM {course_format_options} WHERE sectionid=? AND name="presence"'
,
array
(
$section
->
id_section
));
if
(
!
$exists
){
$resultat
=
$DB
->
insert_record
(
'course_format_options'
,
$section_data
,
true
);
}
$exists
=
$DB
->
get_record_sql
(
'select * FROM {course_format_options} WHERE sectionid=? AND name="daterendu"'
,
array
(
$section
->
id_section
));
if
(
!
$exists
){
if
(
isset
(
$section
->
date_rendu
)){
$section_data
->
name
=
"daterendu"
;
$section_data
->
value
=
strtotime
(
$section
->
date_rendu
);
$resultat
=
$DB
->
insert_record
(
'course_format_options'
,
$section_data
,
true
);
}
}
$exists
=
$DB
->
get_record_sql
(
'select * FROM {course_format_options} WHERE sectionid=? AND name="daysnotif"'
,
array
(
$section
->
id_section
));
if
(
!
$exists
){
if
(
!
empty
(
$section
->
day_before
)){
$section_data
->
name
=
"daysnotif"
;
$section_data
->
value
=
$section
->
nb_days_before
;
$resultat
=
$DB
->
insert_record
(
'course_format_options'
,
$section_data
,
true
);
}
}
}
catch
(
dml_exception
$e
)
{
}
}
}
// Format_iena savepoint reached.
upgrade_plugin_savepoint
(
true
,
2021070600
,
'format'
,
'iena'
);
}
return
$result
;
}
?>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
828f3ae6
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
version
=
20
190722
00
;
$plugin
->
version
=
20
212209
00
;
$plugin
->
requires
=
2014111000
;
$plugin
->
requires
=
2014111000
;
$plugin
->
component
=
'format_iena'
;
$plugin
->
component
=
'format_iena'
;
$plugin
->
release
=
"1.0"
;
$plugin
->
release
=
"1.0"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment