<commit_before><?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Blackboard question importer.
 *
 * @package qformat_blackboard
 * @copyright  2003 <NAME>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */


defined('MOODLE_INTERNAL') || die();

require_once($CFG->libdir . '/xmlize.php');


/**
 * Blackboard question importer.
 *
 * @copyright  2003 <NAME>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class qformat_blackboard extends qformat_based_on_xml {
    // Is the current question's question text escaped HTML (true for most if not all Blackboard files).
    public $ishtml = true;


    public function provide_import() {
        return true;
    }
<commit_msg>MDL-34738 fix for the problem found during testing : dat files not accepted on some servers<commit_after><?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * Blackboard question importer.
 *
 * @package qformat_blackboard
 * @copyright  2003 <NAME>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */


defined('MOODLE_INTERNAL') || die();

require_once($CFG->libdir . '/xmlize.php');


/**
 * Blackboard question importer.
 *
 * @copyright  2003 <NAME>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class qformat_blackboard extends qformat_based_on_xml {
    // Is the current question's question text escaped HTML (true for most if not all Blackboard files).
    public $ishtml = true;


    public function provide_import() {
        return true;
    }

    /**
     * Check if the given file is capable of being imported by this plugin.
     * As {@link file_storage::mimetype()} now uses finfo PHP extension if available,
     * the value returned by $file->get_mimetype for a .dat file is not the same on all servers.
     * So if the parent method fails we must use mimeinfo on the filename.
     * @param stored_file $file the file to check
     * @return bool whether this plugin can import the file
     */
    public function can_import_file($file) {
        return parent::can_import_file($file) || mimeinfo('type', $file->get_filename()) == $this->mime_type();
    }

{'fraction_non_alphanumeric': 0.10046323103647944, 'fraction_numerical': 0.00781702374059062, 'mean_word_length': 3.2237163814180927, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '915093', 'n_tokens_mistral': 1008, 'n_tokens_neox': 963, 'n_words': 418}