public static function import_skydrive_files() {
        global $DB;

        if (!self::can_import_skydrive_files()) {
            return false;
        }
        // Should only be one of each.
        $skydrivetype = repository::get_type_by_typename('skydrive');

        $skydriveinstances = repository::get_instances(['type' => 'skydrive']);
        $skydriveinstance = reset($skydriveinstances);
        $onedriveinstances = repository::get_instances(['type' => 'onedrive']);
        $onedriveinstance = reset($onedriveinstances);

        // Update all file references.
        $DB->set_field('files_reference', 'repositoryid', $onedriveinstance->id, ['repositoryid' => $skydriveinstance->id]);

        // Delete and disable the skydrive repo.
        $skydrivetype->delete();
        core_plugin_manager::reset_caches();

        $sql = "SELECT count('x')
                  FROM {repository_instances} i, {repository} r
                 WHERE r.type=:plugin AND r.id=i.typeid";
        $params = array('plugin' => 'skydrive');
        return $DB->count_records_sql($sql, $params) == 0;
    }