Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-31561: Implemented fix for honoring correct number of course

sections
  • Loading branch information...
commit 3a9104cb549d1451563cf7e30a12762fb3f6e2c6 1 parent 9f260ad
Darko Miletic authored stronk7 committed
View
11 backup/cc/cc_lib/cc_convert_moodle2.php
@@ -80,9 +80,17 @@ public static function convert($packagedir, $outdir) {
if ($docp->load($moodle_backup)) {
//sections
$sections = array();
+ $coursef = new XMLGenericDocument();
+ $course_file = $dir . DIRECTORY_SEPARATOR .'course' . DIRECTORY_SEPARATOR . 'course.xml';
+ $coursef->load($course_file);
+ $numsections = (int)$coursef->nodeValue('/course/numsections');
$section_list = $docp->nodeList('/moodle_backup/information/contents/sections/section');
if (!empty($section_list)) {
+ $count = 0;
foreach ($section_list as $node) {
+ if ($count > $numsections) {
+ break;
+ }
$sectionid = $docp->nodeValue('sectionid', $node);
$sectiontitle = $docp->nodeValue('title' , $node);
$sectionpath = $docp->nodeValue('directory', $node);
@@ -92,7 +100,7 @@ public static function convert($packagedir, $outdir) {
DIRECTORY_SEPARATOR .
$sectionpath .
DIRECTORY_SEPARATOR .
- 'section.xml';
+ 'section.xml';
if ($secp->load($section_file)) {
$rawvalue = $secp->nodeValue('/section/sequence');
if ($rawvalue != '$@NULL@$') {
@@ -100,6 +108,7 @@ public static function convert($packagedir, $outdir) {
}
}
$sections[$sectionid] = array($sectiontitle, $sequence);
+ $count++;
}
}
//organization title
View
22 backup/cc/cc_lib/cc_resources.php
@@ -183,20 +183,14 @@ public function process_resource($manifestroot, &$fname, $folder) {
throw new Exception('The file doesnt exist!');
}
- //TODO: ver el tema de fpatch con el tema de unix y windows
- //$fpathtocheck = $this->adjust_path($manifestroot,$fname);
- //!empty($fpathtocheck) &&
- if (GetDepFiles($manifestroot, $fname, $this->folder, $this->files)) {
- array_unshift($this->files,$folder.$fname);
- $this->init_empty_new();
- $this->href = $folder.$fname;
- $this->identifierref = $folder.$fname;
- $this->filename = $fname;
- $this->isempty = false;
- $this->folder = $folder;
- } else {
- $this->init_clean();
- }
+ GetDepFiles($manifestroot, $fname, $this->folder, $this->files);
+ array_unshift($this->files,$folder.$fname);
+ $this->init_empty_new();
+ $this->href = $folder.$fname;
+ $this->identifierref = $folder.$fname;
+ $this->filename = $fname;
+ $this->isempty = false;
+ $this->folder = $folder;
}
public function adjust_path($mroot, $fname) {
Please sign in to comment.
Something went wrong with that request. Please try again.