MDL-63666 logging: Rename delete_data_for_all_users() function
authorMihail Geshoski <mihail@moodle.com>
Fri, 2 Nov 2018 01:17:24 +0000 (09:17 +0800)
committerMihail Geshoski <mihail@moodle.com>
Fri, 2 Nov 2018 01:17:24 +0000 (09:17 +0800)
admin/tool/log/classes/local/privacy/logstore_userlist_provider.php
admin/tool/log/classes/local/privacy/moodle_database_export_and_delete.php
admin/tool/log/classes/privacy/provider.php
admin/tool/log/store/database/tests/privacy_test.php
admin/tool/log/store/legacy/classes/privacy/provider.php
admin/tool/log/store/legacy/tests/privacy_test.php
admin/tool/log/store/standard/tests/privacy_test.php

index c650678..44ace57 100644 (file)
@@ -48,10 +48,10 @@ interface logstore_userlist_provider extends \core_privacy\local\request\plugin\
 
 
     /**
-     * Delete all data for all users in the specified context.
+     * Delete all data for a list of users in the specified context.
      *
      * @param \core_privacy\local\request\approved_userlist $userlist The specific context and users to delete data for.
      * @return void
      */
-    public static function delete_data_for_all_users(\core_privacy\local\request\approved_userlist $userlist);
+    public static function delete_data_for_userlist(\core_privacy\local\request\approved_userlist $userlist);
 }
index 24f4698..27a3ee5 100644 (file)
@@ -125,7 +125,7 @@ trait moodle_database_export_and_delete {
      *
      * @param \core_privacy\local\request\approved_userlist $contextlist The approved contexts and user information to delete information for.
      */
-    public static function delete_data_for_all_users(\core_privacy\local\request\approved_userlist $userlist) {
+    public static function delete_data_for_userlist(\core_privacy\local\request\approved_userlist $userlist) {
         list($db, $table) = static::get_database_and_table();
         if (!$db || !$table) {
             return;
index 1c1c77d..9968e44 100644 (file)
@@ -117,7 +117,7 @@ class provider implements
      */
     public static function delete_data_for_users(\core_privacy\local\request\approved_userlist $userlist) {
         $interface = \tool_log\local\privacy\logstore_userlist_provider::class;
-        static::call_subplugins_method_with_args('delete_data_for_all_users', [$userlist], $interface);
+        static::call_subplugins_method_with_args('delete_data_for_userlist', [$userlist], $interface);
     }
 
     /**
index a2c0565..085ce1b 100644 (file)
@@ -285,7 +285,7 @@ class logstore_database_privacy_testcase extends provider_testcase {
     /**
      * Check that data is removed for the listed users in a given context.
      */
-    public function test_delete_data_for_all_users() {
+    public function test_delete_data_for_userlist() {
         global $DB;
 
         $u1 = $this->getDataGenerator()->create_user();
@@ -317,7 +317,7 @@ class logstore_database_privacy_testcase extends provider_testcase {
         $this->assertEquals(4, $DB->count_records('logstore_standard_log'));
 
         $userlist = new \core_privacy\local\request\approved_userlist($sysctx, 'logstore_database', [$u1->id, $u3->id]);
-        provider::delete_data_for_all_users($userlist);
+        provider::delete_data_for_userlist($userlist);
         // We should have a record for u2 and u4.
         $this->assertEquals(2, $DB->count_records('logstore_standard_log'));
 
index ebaacb3..271f7ac 100644 (file)
@@ -187,12 +187,12 @@ class provider implements
 
 
     /**
-     * Delete all data for all users in the specified context.
+     * Delete all data for a list of users in the specified context.
      *
      * @param \core_privacy\local\request\approved_userlist $userlist The specific context and users to delete data for.
      * @return void
      */
-    public static function delete_data_for_all_users(\core_privacy\local\request\approved_userlist $userlist) {
+    public static function delete_data_for_userlist(\core_privacy\local\request\approved_userlist $userlist) {
         global $DB;
         list($sql, $params) = static::get_sql_where_from_contexts([$userlist->get_context()]);
         if (empty($sql)) {
index 9c7dfc7..d6d2a6c 100644 (file)
@@ -307,9 +307,9 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
     }
 
     /**
-     * Test the deletion of data for users in a context.
+     * Test the deletion of data for a list of users in a context.
      */
-    public function test_delete_data_for_all_users() {
+    public function test_delete_data_for_userlist() {
         global $DB;
 
         $u1 = $this->getDataGenerator()->create_user();
@@ -352,19 +352,19 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
         // System context deleting one user.
         $this->assertEquals(3, $DB->count_records('log', ['cmid' => 0, 'course' => 0]));
         $userlist = new \core_privacy\local\request\approved_userlist($sysctx, 'logstore_legacy', [$u2->id]);
-        provider::delete_data_for_all_users($userlist);
+        provider::delete_data_for_userlist($userlist);
         $this->assertEquals(1, $DB->count_records('log', ['cmid' => 0, 'course' => 0]));
 
         // Course context deleting one user.
         $this->assertEquals(2, $DB->count_records('log', ['cmid' => 0, 'course' => $course->id]));
         $userlist = new \core_privacy\local\request\approved_userlist($c1ctx, 'logstore_legacy', [$u1->id]);
-        provider::delete_data_for_all_users($userlist);
+        provider::delete_data_for_userlist($userlist);
         $this->assertEquals(1, $DB->count_records('log', ['cmid' => 0, 'course' => $course->id]));
 
         // Module context deleting two users.
         $this->assertEquals(3, $DB->count_records('log', ['cmid' => $module->cmid, 'course' => $course->id]));
         $userlist = new \core_privacy\local\request\approved_userlist($cm1ctx, 'logstore_legacy', [$u1->id, $u3->id]);
-        provider::delete_data_for_all_users($userlist);
+        provider::delete_data_for_userlist($userlist);
         $this->assertEquals(1, $DB->count_records('log', ['cmid' => $module->cmid, 'course' => $course->id]));
     }
 
index d54f5f5..1e23599 100644 (file)
@@ -237,7 +237,7 @@ class logstore_standard_privacy_testcase extends provider_testcase {
         $this->assertEquals(1, $DB->count_records('logstore_standard_log', ['userid' => $u2->id]));
     }
 
-    public function test_delete_data_for_all_users() {
+    public function test_delete_data_for_userlist() {
         global $DB;
 
         $u1 = $this->getDataGenerator()->create_user();
@@ -269,7 +269,7 @@ class logstore_standard_privacy_testcase extends provider_testcase {
         $this->assertEquals(4, $DB->count_records('logstore_standard_log'));
 
         $userlist = new \core_privacy\local\request\approved_userlist($sysctx, 'logstore_standard_log', [$u1->id, $u3->id]);
-        provider::delete_data_for_all_users($userlist);
+        provider::delete_data_for_userlist($userlist);
         // We should have a record for u2 and u4.
         $this->assertEquals(2, $DB->count_records('logstore_standard_log'));