MDL-40097 completion: Update of code to meet guidlines.
authorAdrian Greeve <adrian@moodle.com>
Mon, 8 Dec 2014 07:22:50 +0000 (15:22 +0800)
committerAdrian Greeve <adrian@moodle.com>
Mon, 5 Jan 2015 02:14:03 +0000 (10:14 +0800)
backup/moodle2/backup_stepslib.php

index 85c1e6b..78507d2 100644 (file)
@@ -2447,31 +2447,15 @@ class backup_course_completion_structure_step extends backup_structure_step {
         $cc->add_child($coursecompletions);
         $cc->add_child($aggregatemethod);
 
-        /*
-         We need some extra data for the restore
-          - courseinstances shortname rather than an ID
-          - roleshortname in case restoring on a different site
-        /
-        $criteria->set_source_sql(
-            "
-                SELECT
-                    ccc.*,
-                    c.shortname AS courseinstanceshortname,
-                    r.shortname AS roleshortname
-                FROM
-                    {course_completion_criteria} ccc
-                LEFT JOIN
-                    {course} c
-                ON c.id = ccc.courseinstance
-                LEFT JOIN
-                    {role} r
-                ON r.id = ccc.role
-                WHERE
-                    ccc.course = ?
-            ",
-             array(backup::VAR_COURSEID)
-        );
-
+        // We need some extra data for the restore.
+        // - courseinstances shortname rather than an ID.
+        // - roleshortname in case restoring on a different site.
+        $sourcesql = "SELECT ccc.*, c.shortname AS courseinstanceshortname, r.shortname AS roleshortname
+                        FROM {course_completion_criteria} ccc
+                   LEFT JOIN {course} c ON c.id = ccc.courseinstance
+                   LEFT JOIN {role} r ON r.id = ccc.role
+                       WHERE ccc.course = ?";
+        $criteria->set_source_sql($sourcesql, array(backup::VAR_COURSEID));
 
         $aggregatemethod->set_source_table('course_completion_aggr_methd', array('course' => backup::VAR_COURSEID));