Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'm22_MDL-34233' of git://github.com/danmarsden/moodle in…

…to MOODLE_22_STABLE
  • Loading branch information...
commit 5e202b6cb4991990381f33cc85d2b107780b0c16 2 parents 5f6c20b + 03cafd9
Sam Hemelryk samhemelryk authored

Showing 1 changed file with 63 additions and 16 deletions. Show diff stats Hide diff stats

  1. +63 16 mod/scorm/backup/moodle2/backup_scorm_stepslib.php
79 mod/scorm/backup/moodle2/backup_scorm_stepslib.php
@@ -126,25 +126,72 @@ protected function define_structure() {
126 126 // Define sources
127 127 $scorm->set_source_table('scorm', array('id' => backup::VAR_ACTIVITYID));
128 128
129   - $sco->set_source_table('scorm_scoes', array('scorm' => backup::VAR_PARENTID));
130   -
131   - $scodata->set_source_table('scorm_scoes_data', array('scoid' => backup::VAR_PARENTID));
132   -
133   - $seqrulecond->set_source_table('scorm_seq_ruleconds', array('scoid' => backup::VAR_PARENTID));
134   -
135   - $seqrulecondsdata->set_source_table('scorm_seq_rulecond', array('ruleconditionsid' => backup::VAR_PARENTID));
136   -
137   - $seqrolluprule->set_source_table('scorm_seq_rolluprule', array('scoid' => backup::VAR_PARENTID));
138   -
139   - $seqrolluprulecond->set_source_table('scorm_seq_rolluprulecond', array('rollupruleid' => backup::VAR_PARENTID));
140   -
141   - $seqobjective->set_source_table('scorm_seq_objective', array('scoid' => backup::VAR_PARENTID));
142   -
143   - $seqmapinfo->set_source_table('scorm_seq_mapinfo', array('objectiveid' => backup::VAR_PARENTID));
  129 + // Use set_source_sql for other calls as set_source_table returns records in reverse order
  130 + // and order is important for several SCORM fields - esp scorm_scoes.
  131 + $sco->set_source_sql('
  132 + SELECT *
  133 + FROM {scorm_scoes}
  134 + WHERE scorm = :scorm
  135 + ORDER BY id',
  136 + array('scorm' => backup::VAR_PARENTID));
  137 +
  138 + $scodata->set_source_sql('
  139 + SELECT *
  140 + FROM {scorm_scoes_data}
  141 + WHERE scoid = :scoid
  142 + ORDER BY id',
  143 + array('scoid' => backup::VAR_PARENTID));
  144 +
  145 + $seqrulecond->set_source_sql('
  146 + SELECT *
  147 + FROM {scorm_seq_ruleconds}
  148 + WHERE scoid = :scoid
  149 + ORDER BY id',
  150 + array('scoid' => backup::VAR_PARENTID));
  151 +
  152 + $seqrulecondsdata->set_source_sql('
  153 + SELECT *
  154 + FROM {scorm_seq_rulecond}
  155 + WHERE ruleconditionsid = :ruleconditionsid
  156 + ORDER BY id',
  157 + array('ruleconditionsid' => backup::VAR_PARENTID));
  158 +
  159 + $seqrolluprule->set_source_sql('
  160 + SELECT *
  161 + FROM {scorm_seq_rolluprule}
  162 + WHERE scoid = :scoid
  163 + ORDER BY id',
  164 + array('scoid' => backup::VAR_PARENTID));
  165 +
  166 + $seqrolluprulecond->set_source_sql('
  167 + SELECT *
  168 + FROM {scorm_seq_rolluprulecond}
  169 + WHERE rollupruleid = :rollupruleid
  170 + ORDER BY id',
  171 + array('rollupruleid' => backup::VAR_PARENTID));
  172 +
  173 + $seqobjective->set_source_sql('
  174 + SELECT *
  175 + FROM {scorm_seq_objective}
  176 + WHERE scoid = :scoid
  177 + ORDER BY id',
  178 + array('scoid' => backup::VAR_PARENTID));
  179 +
  180 + $seqmapinfo->set_source_sql('
  181 + SELECT *
  182 + FROM {scorm_seq_mapinfo}
  183 + WHERE objectiveid = :objectiveid
  184 + ORDER BY id',
  185 + array('objectiveid' => backup::VAR_PARENTID));
144 186
145 187 // All the rest of elements only happen if we are including user info
146 188 if ($userinfo) {
147   - $scotrack->set_source_table('scorm_scoes_track', array('scoid' => backup::VAR_PARENTID));
  189 + $scotrack->set_source_sql('
  190 + SELECT *
  191 + FROM {scorm_scoes_track}
  192 + WHERE scoid = :scoid
  193 + ORDER BY id',
  194 + array('scoid' => backup::VAR_PARENTID));
148 195 }
149 196
150 197 // Define id annotations

0 comments on commit 5e202b6

Please sign in to comment.
Something went wrong with that request. Please try again.