Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deprecated download_as_dataformat #187

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dbexport.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
// Require libs.
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/dataformatlib.php');
require_once( __DIR__ . '/utilities/handle_deprecation.php' );

// Restrict access to admins only.
Expand Down Expand Up @@ -68,7 +67,7 @@
$data = $DB->get_records($table, null, 'id ASC');

// Use Moodle's dataformatting functions to output the data in the desired format.
handle_deprecation::download_data($exportfile, $dataformat, array_keys($DB->get_columns($table)), $data);
\core\dataformat::download_data($exportfile, $dataformat, array_keys($DB->get_columns($table)), $data);

exit;

Expand Down
16 changes: 0 additions & 16 deletions utilities/handle_deprecation.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,6 @@ public static function get_plugin_enabled() {
: get_config('plagiarism_turnitinsim', 'enabled');
}

/**
* In Moodle 3.9, download_as_dataformat() was deprecated and \core\dataformat::download_data() was introduced.
* This method handles our support for multiple Moodle versions.
*
* @param string $exportfile The name of the file to download.
* @param string $dataformat The format of the file.
* @param array $columns The names of the columns.
* @param string $data The data to download.
*/
public static function download_data($exportfile, $dataformat, $columns, $data) {
global $CFG;

$CFG->branch >= 39 ? \core\dataformat::download_data($exportfile, $dataformat, $columns, $data)
: download_as_dataformat($exportfile, $dataformat, $columns, $data);
}

/**
* In Moodle 3.10, Moodle switched to use PHPUnit 8.5 which contains deprecations for some assertions.
* assertContains was deprecated in favour of the newer assertStringContainsString. (PHPUnit 7.5)
Expand Down