diff --git a/classes/local/step/reader_sftp_directory_file_list.php b/classes/local/step/reader_sftp_directory_file_list.php index 1e5e8b91..41df9cd4 100644 --- a/classes/local/step/reader_sftp_directory_file_list.php +++ b/classes/local/step/reader_sftp_directory_file_list.php @@ -27,7 +27,7 @@ * @copyright Catalyst IT, 2023 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class sftp_reader_directory_file_list extends reader_step { +class reader_sftp_directory_file_list extends reader_step { use sftp_directory_file_list_trait; /** @@ -51,4 +51,24 @@ public function list_generator(): \Generator { yield (object) ['filename' => $filename]; } } + + /** + * Step callback handler + * + * @param mixed|null $input + * @return mixed The altered value to be passed to the next step(s) in the flow, or false to skip the rest of this iteration. + */ + public function execute($input = null) { + return $input; + } + + /** + * Returns whether or not the step configured, has a side effect. + * + * @return bool whether or not this step has a side effect + * @link https://en.wikipedia.org/wiki/Side_effect_(computer_science) + */ + public function has_side_effect(): bool { + return false; + } } diff --git a/classes/local/step/sftp_trait.php b/classes/local/step/sftp_trait.php index 325c0241..aface624 100644 --- a/classes/local/step/sftp_trait.php +++ b/classes/local/step/sftp_trait.php @@ -49,7 +49,9 @@ trait sftp_trait { public function has_side_effect(): bool { if (isset($this->stepdef)) { $config = $this->get_variables()->get('config'); - return !helper::path_is_relative($config->target); + if (isset($config->target)) { + return !helper::path_is_relative($config->target); + } } return true; } diff --git a/lang/en/tool_dataflows.php b/lang/en/tool_dataflows.php index ccfe7b68..e6d73b2e 100644 --- a/lang/en/tool_dataflows.php +++ b/lang/en/tool_dataflows.php @@ -168,6 +168,7 @@ $string['step_name_reader_directory_file_list'] = 'Directory file list reader'; $string['step_name_reader_json'] = 'JSON reader'; $string['step_name_reader_sql'] = 'SQL reader'; +$string['step_name_reader_sftp_directory_file_list'] = 'SFTP directory file list reader'; $string['step_name_trigger_cron'] = 'Cron'; $string['step_name_trigger_webservice'] = 'Webservice'; $string['step_name_writer_debugging'] = 'Debugging writer'; diff --git a/lib.php b/lib.php index be16d813..546208a7 100644 --- a/lib.php +++ b/lib.php @@ -91,6 +91,7 @@ function tool_dataflows_step_types() { new step\flow_web_service, new step\reader_csv, new step\reader_directory_file_list, + new step\reader_sftp_directory_file_list, new step\reader_json, new step\reader_sql, new step\trigger_cron, diff --git a/version.php b/version.php index b05d18eb..1201551c 100644 --- a/version.php +++ b/version.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023072601; -$plugin->release = 2023072601; +$plugin->version = 2023081100; +$plugin->release = 2023081100; $plugin->requires = 2017051500; // Our lowest supported Moodle (3.3.0). $plugin->supported = [35, 401]; // Available as of Moodle 3.9.0 or later. // TODO $plugin->incompatible = ; // Available as of Moodle 3.9.0 or later.