original_string: public static function restore_get_question_banks($restoreid, $contextlevel = null) {
          global $DB;
  
          $results = array();
          $qcats = $DB->get_recordset_sql("SELECT itemid, parentitemid AS contextid, info
                                           FROM {backup_ids_temp}
                                         WHERE backupid = ?
                                           AND itemname = 'question_category'", array($restoreid));
          foreach ($qcats as $qcat) {
              // If this qcat context haven't been acummulated yet, do that
              if (!isset($results[$qcat->contextid])) {
                  $info = backup_controller_dbops::decode_backup_temp_info($qcat->info);
                  // Filter by contextlevel if necessary
                  if (is_null($contextlevel) || $contextlevel == $info->contextlevel) {
                      $results[$qcat->contextid] = $info->contextlevel;
                  }
              }
          }
          $qcats->close();
          // Sort by value (contextlevel from CONTEXT_SYSTEM downto CONTEXT_MODULE)
          asort($results);
          return $results;
      }
code: public static function restore_get_question_banks($restoreid, $contextlevel = null) {
          global $DB;
  
          $results = array();
          $qcats = $DB->get_recordset_sql("SELECT itemid, parentitemid AS contextid, info
                                           FROM {backup_ids_temp}
                                         WHERE backupid = ?
                                           AND itemname = 'question_category'", array($restoreid));
          foreach ($qcats as $qcat) {
              // If this qcat context haven't been acummulated yet, do that
              if (!isset($results[$qcat->contextid])) {
                  $info = backup_controller_dbops::decode_backup_temp_info($qcat->info);
                  // Filter by contextlevel if necessary
                  if (is_null($contextlevel) || $contextlevel == $info->contextlevel) {
                      $results[$qcat->contextid] = $info->contextlevel;
                  }
              }
          }
          $qcats->close();
          // Sort by value (contextlevel from CONTEXT_SYSTEM downto CONTEXT_MODULE)
          asort($results);
          return $results;
      }
code_tokens: public static function restore_get_question_banks ( $ restoreid , $ contextlevel = null ) { global $ DB ; $ results = array ( ) ; $ qcats = $ DB -> get_recordset_sql ( "SELECT itemid, parentitemid AS contextid, info
                                           FROM {backup_ids_temp}
                                         WHERE backupid = ?
                                           AND itemname = 'question_category'" , array ( $ restoreid ) ) ; foreach ( $ qcats as $ qcat ) { // If this qcat context haven't been acummulated yet, do that if ( ! isset ( $ results [ $ qcat -> contextid ] ) ) { $ info = backup_controller_dbops :: decode_backup_temp_info ( $ qcat -> info ) ; // Filter by contextlevel if necessary if ( is_null ( $ contextlevel ) || $ contextlevel == $ info -> contextlevel ) { $ results [ $ qcat -> contextid ] = $ info -> contextlevel ; } } } $ qcats -> close ( ) ; // Sort by value (contextlevel from CONTEXT_SYSTEM downto CONTEXT_MODULE) asort ( $ results ) ; return $ results ; }
docstring: Return one array of contextid => contextlevel pairs
  of question banks to be checked for one given restore operation
  ordered from CONTEXT_SYSTEM downto CONTEXT_MODULE
  If contextlevel is specified, then only banks corresponding to
  that level are returned
docstring_tokens: Return one array of contextid = > contextlevel pairs of question banks to be checked for one given restore operation ordered from CONTEXT_SYSTEM downto CONTEXT_MODULE If contextlevel is specified then only banks corresponding to that level are returned