Skip to content

Commit

Permalink
realigns table name with plugin name.
Browse files Browse the repository at this point in the history
  • Loading branch information
stopfstedt committed Jun 4, 2024
1 parent 36614be commit 6b4a54a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
10 changes: 5 additions & 5 deletions classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static function set_config($name, $value): void {
public static function get_sync_jobs(array $filters = []): array {
global $DB;
$jobs = [];
$jobrecs = $DB->get_records('tool_ilioscatassignment', $filters);
$jobrecs = $DB->get_records('tool_ilioscategoryassignment', $filters);
foreach ($jobrecs as $jobrec) {
$jobs[] = new sync_job($jobrec->id, $jobrec->title, $jobrec->roleid, $jobrec->coursecatid,
(boolean) $jobrec->enabled, $jobrec->schoolid);
Expand All @@ -145,7 +145,7 @@ public static function get_sync_jobs(array $filters = []): array {
*/
public static function disable_job($jobid): void {
global $DB;
$tablename = 'tool_ilioscatassignment';
$tablename = 'tool_ilioscategoryassignment';
$job = $DB->get_record($tablename, ['id' => $jobid]);
if (!empty($job)) {
$job->enabled = false;
Expand All @@ -162,7 +162,7 @@ public static function disable_job($jobid): void {
*/
public static function enable_job($jobid): void {
global $DB;
$tablename = 'tool_ilioscatassignment';
$tablename = 'tool_ilioscategoryassignment';
$job = $DB->get_record($tablename, ['id' => $jobid]);
if (!empty($job)) {
$job->enabled = true;
Expand All @@ -186,7 +186,7 @@ public static function create_job(sync_job $job) {
$dto->enabled = $job->is_enabled();
$dto->schoolid = $job->get_school_id();

$jobid = $DB->insert_record('tool_ilioscatassignment', $dto);
$jobid = $DB->insert_record('tool_ilioscategoryassignment', $dto);
return self::get_sync_job($jobid);
}

Expand All @@ -207,7 +207,7 @@ public static function delete_job($jobid): void {
}

// Delete the given job.
$DB->delete_records('tool_ilioscatassignment', ['id' => $jobid]);
$DB->delete_records('tool_ilioscategoryassignment', ['id' => $jobid]);

// Remove any course category role assignments that were managed by the given job.
$category = core_course_category::get($job->get_course_category_id(), IGNORE_MISSING);
Expand Down
2 changes: 1 addition & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="tool_ilioscatassignment" COMMENT="Scheduled Ilios/Moodle course category sync jobs.">
<TABLE NAME="tool_ilioscategoryassignment" COMMENT="Scheduled Ilios/Moodle course category sync jobs.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Title of the sync job." />
Expand Down
6 changes: 6 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,11 @@ function xmldb_tool_ilioscategoryassignment_upgrade($oldversion): bool {
upgrade_plugin_savepoint(true, 2018041100, 'tool', 'ilioscategoryassignment');
}

if ($oldversion < 2024060400) {
$table = new xmldb_table('tool_ilioscatassignment');
$dbman->rename_table($table, 'tool_ilioscategoryassignment');
upgrade_plugin_savepoint(true, 2024060400, 'tool', 'ilioscategoryassignment');
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

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

$plugin->version = 2024052300; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024060400; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2023100400; // Requires this Moodle version.
$plugin->component = 'tool_ilioscategoryassignment'; // Full name of the plugin (used for diagnostics).
$plugin->release = 'v4.3';
Expand Down

0 comments on commit 6b4a54a

Please sign in to comment.