Closed alexandru-elisei closed 8 years ago
I suggest changing the boilerplate template. There is a fourth option, a file might be a cli script (define('CLI_SCRIPT', true)).
So instead of a file either being moodle internal or requiring the config.php file, we can have something like:
{{# is_moodle_internal }}defined('MOODLE_INTERNAL') || die();{{/ is_moodle_internal }}
{{# requires_config_php }}require({{$ path_to_config }}__DIR__.'/../../config.php'{{/ path_to_config}});{{/ requires_config_php }}
{{# is_cli_script }}defined('MOODLE_INTERNAL') || die();{{/ is_cli_script }}
And we can have different skel classes (like php_internal_file, php_regular_file, php_requires_config_file, php_cli_script_file) as base classes.
Closing the issue, issue solved by pull request #31
db/install.php and db/uninstall.php are not defined as Moodle internal, but they are not text files either.
Similar to the class hierarchy that we have now (and the way you have created the txt_file class), I propose that we create the class php_file which will extends base.
All other skeleton types that need to create a php file that is not Moodle internal will extend php_file.