Skip to content

Commit

Permalink
fix: broken reader_sftp_directory_file_list
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriim committed Aug 23, 2023
1 parent 3ad7f30 commit f06885e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
22 changes: 21 additions & 1 deletion classes/local/step/reader_sftp_directory_file_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;
}
}
4 changes: 3 additions & 1 deletion classes/local/step/sftp_trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lang/en/tool_dataflows.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 1 addition & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f06885e

Please sign in to comment.