├── lang └── en │ └── tool_testcallback.php ├── lib.php ├── version.php └── README.md /lang/en/tool_testcallback.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * English language pack for Testcallback 19 | * 20 | * @package tool_testcallback 21 | * @category string 22 | * @copyright Marina Glancy 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 | */ 25 | 26 | defined('MOODLE_INTERNAL') || die(); 27 | 28 | $string['pluginname'] = 'Testcallback'; 29 | -------------------------------------------------------------------------------- /lib.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Callback implementations for testcallback 19 | * 20 | * @package tool_testcallback 21 | * @copyright Marina Glancy 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | function tool_testcallback_tool_vault_restore($logger, $stage) { 26 | $logger->add_to_log("!!!! Callback ".__FUNCTION__." in the stage '$stage'"); 27 | } 28 | -------------------------------------------------------------------------------- /version.php: -------------------------------------------------------------------------------- 1 | . 16 | 17 | /** 18 | * Version information for Testcallback 19 | * 20 | * @package tool_testcallback 21 | * @copyright Marina Glancy 22 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 | */ 24 | 25 | defined('MOODLE_INTERNAL') || die(); 26 | 27 | $plugin->component = 'tool_testcallback'; 28 | $plugin->release = '1.0'; 29 | $plugin->version = 2024101000; 30 | $plugin->requires = 2020061500; 31 | $plugin->supported = [39, 405]; 32 | $plugin->maturity = MATURITY_STABLE; 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Test plugin for https://github.com/lmscloud-io/moodle-tool_vault/compare/newcallback suggestion 2 | 3 | What I did: 4 | - backed up a site that does not have a tool_testcallback installed 5 | - restored on a site that has tool_testcallback 6 | - the callback was executed on each stage: 7 | 8 | 9 | ``` 10 | [10/10/24, 23:03:22] [info] Restore scheduled 11 | [10/10/24, 23:03:24] [info] [pid 1049915] Preparing to restore 12 | [10/10/24, 23:03:25] [info] [pid 1049915] Downloading file dbstructure.zip ... 13 | [10/10/24, 23:03:25] [info] [pid 1049915] ...done 14 | [10/10/24, 23:03:25] [info] [pid 1049915] Restore pre-check: Moodle version... 15 | [10/10/24, 23:03:25] [info] [pid 1049915] ...OK 16 | [10/10/24, 23:03:25] [info] [pid 1049915] Restore pre-check: Add-on plugins... 17 | [10/10/24, 23:03:26] [info] [pid 1049915] ...OK 18 | [10/10/24, 23:03:26] [info] [pid 1049915] Restore pre-check: Disk space... 19 | [10/10/24, 23:03:26] [info] [pid 1049915] ...OK 20 | [10/10/24, 23:03:26] [info] [pid 1049915] Restore pre-check: Environment check... 21 | [10/10/24, 23:03:26] [info] [pid 1049915] ...OK 22 | [10/10/24, 23:03:45] [info] [pid 1049915] Restore started 23 | [10/10/24, 23:03:45] [info] [pid 1049915] !!!! Callback tool_testcallback_tool_vault_restore in the stage 'before' 24 | [10/10/24, 23:03:45] [info] [pid 1049915] Purging caches... 25 | [10/10/24, 23:03:45] [info] [pid 1049915] ...done 26 | [10/10/24, 23:03:45] [info] [pid 1049915] Making list of the old files... 27 | [10/10/24, 23:03:45] [info] [pid 1049915] ...done 28 | [10/10/24, 23:03:45] [info] [pid 1049915] Starting database restore (443 tables)... 29 | [10/10/24, 23:03:45] [info] [pid 1049915] Downloading file dbdump.zip ... 30 | [10/10/24, 23:03:46] [info] [pid 1049915] ...done 31 | [10/10/24, 23:04:01] [info] [pid 1049915] Restored 358/443 tables, 2.9MB/3MB ( 97)% 32 | [10/10/24, 23:04:04] [info] [pid 1049915] Restored 443/443 tables, 3MB/3MB (100)% 33 | [10/10/24, 23:04:04] [info] [pid 1049915] Finished database restore 34 | [10/10/24, 23:04:04] [info] [pid 1049915] !!!! Callback tool_testcallback_tool_vault_restore in the stage 'afterdb' 35 | [10/10/24, 23:04:04] [info] [pid 1049915] Killing all sessions... 36 | [10/10/24, 23:04:04] [info] [pid 1049915] ...done 37 | [10/10/24, 23:04:04] [info] [pid 1049915] Purging caches... 38 | [10/10/24, 23:04:04] [info] [pid 1049915] ...done 39 | [10/10/24, 23:04:04] [info] [pid 1049915] Rebuilding $CFG... 40 | [10/10/24, 23:04:04] [info] [pid 1049915] ...done 41 | [10/10/24, 23:04:04] [info] [pid 1049915] Recalculating all versions hash... 42 | [10/10/24, 23:04:04] [info] [pid 1049915] ...done 43 | [10/10/24, 23:04:04] [info] [pid 1049915] Starting dataroot restore 44 | [10/10/24, 23:04:04] [info] [pid 1049915] Finished dataroot restore 45 | [10/10/24, 23:04:04] [info] [pid 1049915] !!!! Callback tool_testcallback_tool_vault_restore in the stage 'afterdata' 46 | [10/10/24, 23:04:04] [info] [pid 1049915] Starting files restore 47 | [10/10/24, 23:04:04] [info] [pid 1049915] Downloading file filedir.zip ... 48 | [10/10/24, 23:04:06] [info] [pid 1049915] ...done 49 | [10/10/24, 23:04:08] [info] [pid 1049915] Finished files restore 50 | [10/10/24, 23:04:08] [info] [pid 1049915] !!!! Callback tool_testcallback_tool_vault_restore in the stage 'afterall' 51 | [10/10/24, 23:04:08] [info] [pid 1049915] Removing old files... 52 | [10/10/24, 23:04:08] [info] [pid 1049915] ...done 53 | [10/10/24, 23:04:08] [info] [pid 1049915] Restore finished 54 | ``` --------------------------------------------------------------------------------