Skip to content

Commit

Permalink
replace Horde/Support/Uuid with \core\uuid (horde is not available an…
Browse files Browse the repository at this point in the history
…ymore starting with moodle 4.4 and core uuid is a way better solution)
  • Loading branch information
Glutamat42 committed May 14, 2024
1 parent bc10548 commit d4cab8c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion classes/external/upload_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
global $CFG;
require_once($CFG->dirroot . '/lib/externallib.php');
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
require_once($CFG->dirroot . '/lib/horde/framework/Horde/Support/Uuid.php'); # required on some installs (bitnami moodle on phils pc), unknown why

use backup;
use context_coursecat;
Expand Down
5 changes: 3 additions & 2 deletions dev_utils/seed/course.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
*/


use core\uuid;

define('CLI_SCRIPT', true);

require(__DIR__ . '/../../../../config.php');
require_once($CFG->libdir . "/clilib.php");
require_once($CFG->dirroot . '/lib/horde/framework/Horde/Support/Uuid.php'); # required on some installs (bitnami moodle on phils pc), unknown why

$help = "Command line tool to uninstall plugins.
Expand Down Expand Up @@ -51,7 +52,7 @@ function seed(int $course_id) {
$DB->insert_record('local_adler_course',
array(
'course_id' => $course_id,
'uuid' => (string) new Horde_support_Uuid
'uuid' => uuid::generate()
),
$returnid = true,
$bulk = false
Expand Down
9 changes: 3 additions & 6 deletions dev_utils/seed/course_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
* This script seeds the local_adler_course_modules table with random scores for all modules of a given course.
*/

use core\uuid;
use local_adler\helpers;


define('CLI_SCRIPT', true);


require(__DIR__ . '/../../../../config.php');
require_once($CFG->libdir . "/clilib.php");
require_once($CFG->libdir . '/completionlib.php');
require_once($CFG->dirroot . '/lib/horde/framework/Horde/Support/Uuid.php'); # required on some installs (bitnami moodle on phils pc), unknown why

$help = "Command line tool to uninstall plugins.
Expand Down Expand Up @@ -65,7 +66,7 @@ function seed(int $course_id) {
'local_adler_course_modules',
array('type' => 'score',
'cmid' => $module->id,
'uuid' => (string) new Horde_support_Uuid,
'uuid' => uuid::generate(),
'score_min' => 0,
'score_max' => random_int(0, 20)),
$returnid = true,
Expand All @@ -79,7 +80,3 @@ function seed(int $course_id) {
foreach ($course_ids as $course_id) {
seed((int) $course_id);
}

//seed_scores(142);
//seed_scores(46);
//seed_scores(49);
4 changes: 2 additions & 2 deletions dev_utils/seed/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* This script seeds the local_adler_sections table for a given course.
*/

use core\uuid;
use local_adler\adler_score_helpers;
use local_adler\local\section\db as section_db;

Expand All @@ -11,7 +12,6 @@

require(__DIR__ . '/../../../../config.php');
require_once($CFG->libdir . "/clilib.php");
require_once($CFG->dirroot . '/lib/horde/framework/Horde/Support/Uuid.php'); # required on some installs (bitnami moodle on phils pc), unknown why


$help = "Command line tool to uninstall plugins.
Expand Down Expand Up @@ -78,7 +78,7 @@ function seed(int $course_id) {
$DB->insert_record('local_adler_sections',
array(
'section_id' => $section_id,
'uuid' => (string) new Horde_support_Uuid,
'uuid' => uuid::generate(),
'required_points_to_complete' => round($max_possible_score * .9),
'timecreated' => time(),
'timemodified' => time()
Expand Down
10 changes: 6 additions & 4 deletions tests/generator/lib.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

global $CFG;
require_once($CFG->dirroot . '/lib/horde/framework/Horde/Support/Uuid.php'); # required on some installs (bitnami moodle on phils pc), unknown why

use core\uuid;


class local_adler_generator extends component_generator_base {
/**
Expand All @@ -18,7 +20,7 @@ public function create_adler_course_module(int $module_id, array $params = array
$default_params = [
'cmid' => $module_id,
'score_max' => 100.0,
'uuid' => (string) new Horde_Support_Uuid,
'uuid' => uuid::generate(),
'timecreated' => 0,
'timemodified' => 0
];
Expand All @@ -44,7 +46,7 @@ public function create_adler_course_object(int $course_id, array $params = array
global $DB;
$default_params = [
'course_id' => $course_id,
'uuid' => (string) new Horde_Support_Uuid,
'uuid' => uuid::generate(),
'timecreated' => 0,
'timemodified' => 0
];
Expand All @@ -62,7 +64,7 @@ public function create_adler_section_object(int $section_id, array $params = arr
$default_params = [
'section_id' => $section_id,
'required_points_to_complete' => 100,
'uuid' => (string) new Horde_support_Uuid,
'uuid' => uuid::generate(),
'timecreated' => 0,
'timemodified' => 0
];
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
$plugin->version = 2024030800;
$plugin->requires = 2022112800; // Moodle version
$plugin->component = 'local_adler';
$plugin->release = '3.1.0';
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '3.1.0-dev';
$plugin->maturity = MATURITY_ALPHA;
$plugin->dependencies = array(
'local_logging' => ANY_VERSION,
);

0 comments on commit d4cab8c

Please sign in to comment.