-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26cbe5a
commit 9fcbb2d
Showing
8 changed files
with
44 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,20 +18,20 @@ | |
* Scheduled task for managing student accounts lifecycle. | ||
* | ||
* This task handles the automated process of disabling and/or deleting student accounts | ||
* based on configured criteria within the tool_disable_delete_students plugin. | ||
* based on configured criteria within the disable_delete_students plugin. | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @author Waleed ul hassan <[email protected]> | ||
*/ | ||
|
||
namespace tool_disable_delete_students\task; | ||
namespace disable_delete_students\task; | ||
|
||
/** | ||
* Scheduled task class for cleaning up student accounts. | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
*/ | ||
class cleanup_students extends \core\task\scheduled_task { | ||
|
||
|
@@ -42,7 +42,7 @@ class cleanup_students extends \core\task\scheduled_task { | |
* @throws \coding_exception | ||
*/ | ||
public function get_name() { | ||
return get_string('taskname', 'tool_disable_delete_students'); | ||
return get_string('taskname', 'disable_delete_students'); | ||
} | ||
|
||
/** | ||
|
@@ -54,6 +54,6 @@ public function get_name() { | |
* @return void | ||
*/ | ||
public function execute() { | ||
\tool_disable_delete_students\util::process_student_accounts(); | ||
\disable_delete_students\util::process_student_accounts(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,13 @@ | |
* - Processing account disabling and deletion based on configured rules | ||
* - Handling role-based exclusions | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @author Waleed ul hassan <[email protected]> | ||
*/ | ||
|
||
namespace tool_disable_delete_students; | ||
namespace disable_delete_students; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
|
@@ -82,9 +82,9 @@ public static function has_excluded_roles(int $userid): bool { | |
public static function process_student_accounts() { | ||
global $DB, $CFG; | ||
|
||
$disableaftercourseend = get_config('tool_disable_delete_students', 'disable_after_course_end'); | ||
$disableaftercreation = get_config('tool_disable_delete_students', 'disable_after_creation'); | ||
$deleteaftermonths = get_config('tool_disable_delete_students', 'delete_after_months'); | ||
$disableaftercourseend = get_config('disable_delete_students', 'disable_after_course_end'); | ||
$disableaftercreation = get_config('disable_delete_students', 'disable_after_creation'); | ||
$deleteaftermonths = get_config('disable_delete_students', 'delete_after_months'); | ||
|
||
// Get all active student accounts. | ||
$sql = "SELECT DISTINCT u.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,24 +15,24 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Scheduled task definitions for the tool_disable_delete_students plugin. | ||
* Scheduled task definitions for the disable_delete_students plugin. | ||
* | ||
* This file contains the configuration for scheduled tasks related to | ||
* the management of student accounts, specifically for disabling accounts | ||
* based on defined criteria. | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @author Waleed ul hassan <[email protected]> | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
// Define the scheduled tasks for the tool_disable_delete_students plugin. | ||
// Define the scheduled tasks for the disable_delete_students plugin. | ||
$tasks = [ | ||
[ | ||
'classname' => 'tool_disable_delete_students\task\cleanup_students', | ||
'classname' => 'disable_delete_students\task\cleanup_students', | ||
'blocking' => 0, | ||
'minute' => '0', | ||
'hour' => '0', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,13 +15,13 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Language strings for the tool_disable_delete_students plugin. | ||
* Language strings for the disable_delete_students plugin. | ||
* | ||
* This file contains the language strings used in the plugin for managing | ||
* student account lifecycle operations, including disabling and deleting | ||
* accounts based on defined criteria. | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @author Waleed ul hassan <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,9 +15,9 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Settings for the tool_disable_delete_students plugin. | ||
* Settings for the disable_delete_students plugin. | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @author Waleed ul hassan <[email protected]> | ||
|
@@ -26,32 +26,32 @@ | |
defined('MOODLE_INTERNAL') || die; | ||
|
||
if ($hassiteconfig) { | ||
$settings = new admin_settingpage('tool_disable_delete_students', get_string('pluginname', 'tool_disable_delete_students')); | ||
$settings = new admin_settingpage('disable_delete_students', get_string('pluginname', 'disable_delete_students')); | ||
$ADMIN->add('tools', $settings); | ||
|
||
// Days after course end to disable account. | ||
$settings->add(new admin_setting_configtext( | ||
'tool_disable_delete_students/disable_after_course_end', | ||
get_string('disable_after_course_end', 'tool_disable_delete_students'), | ||
get_string('disable_after_course_end_desc', 'tool_disable_delete_students'), | ||
'disable_delete_students/disable_after_course_end', | ||
get_string('disable_after_course_end', 'disable_delete_students'), | ||
get_string('disable_after_course_end_desc', 'disable_delete_students'), | ||
21, | ||
PARAM_INT | ||
)); | ||
|
||
// Days after creation to disable account. | ||
$settings->add(new admin_setting_configtext( | ||
'tool_disable_delete_students/disable_after_creation', | ||
get_string('disable_after_creation', 'tool_disable_delete_students'), | ||
get_string('disable_after_creation_desc', 'tool_disable_delete_students'), | ||
'disable_delete_students/disable_after_creation', | ||
get_string('disable_after_creation', 'disable_delete_students'), | ||
get_string('disable_after_creation_desc', 'disable_delete_students'), | ||
45, | ||
PARAM_INT | ||
)); | ||
|
||
// Months after course end to delete account. | ||
$settings->add(new admin_setting_configtext( | ||
'tool_disable_delete_students/delete_after_months', | ||
get_string('delete_after_months', 'tool_disable_delete_students'), | ||
get_string('delete_after_months_desc', 'tool_disable_delete_students'), | ||
'disable_delete_students/delete_after_months', | ||
get_string('delete_after_months', 'disable_delete_students'), | ||
get_string('delete_after_months_desc', 'disable_delete_students'), | ||
6, | ||
PARAM_INT | ||
)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,12 +15,12 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Generator for the tool_disable_delete_students plugin. | ||
* Generator for the disable_delete_students plugin. | ||
* | ||
* This class provides methods for creating test courses and users | ||
* with specific roles for testing purposes. | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @author Waleed ul hassan <[email protected]> | ||
|
@@ -29,10 +29,10 @@ | |
/** | ||
* Tool disable_delete_students generator | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @category test | ||
*/ | ||
class tool_disable_delete_students_generator extends testing_module_generator { | ||
class disable_delete_students_generator extends testing_module_generator { | ||
/** | ||
* Create a test course with specific settings. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,10 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Version information for the tool_disable_delete_students plugin. | ||
* Version information for the disable_delete_students plugin. | ||
* | ||
* @package tool_disable_delete_students | ||
* @package disable_delete_students | ||
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/} | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @author Waleed ul hassan <[email protected]> | ||
|
@@ -28,6 +28,6 @@ | |
|
||
$plugin->version = 2024021500; | ||
$plugin->requires = 2022112800; // Moodle 4.1 | ||
$plugin->component = 'tool_disable_delete_students'; | ||
$plugin->component = 'disable_delete_students'; | ||
$plugin->maturity = MATURITY_STABLE; | ||
$plugin->release = '1.0'; |