-
Notifications
You must be signed in to change notification settings - Fork 29
[RFC] Added --apply-closure
option
#71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I am not sure. seems like this opens up a lot of power to the CLI. usually anyone with CLI access can add code but still I don't feel comfortable with this. |
What about making it optional? The command code would have to configure itself i guess, as commands are not Services... ----- Reply message ----- — |
if it needs to be enabled by code i am not sure i see the sense in it. |
what i meant: we can have it as a config option and DI can put a parameter into the container, but the command will need to do this->getContainer->hasParameter('cmf_menu.command.update_closure') or something like that. from a user point of view there is no difference, i was just thinking about the implementation already. |
not even sure that i like it as a config option. as soon as you allow injecting code via the CLI, there are almost no more limits to what can be done with a CLI command. |
if we default the option to false, people can chose if they want this the alternative would be some sort of separate git repo for this |
Although this is very practical, I agree with @lsmith77 on the concerns about this. Just look at all the apps that offer some sort of "eval" and see the consequences. |
Yeah, maybe another repo or alternatively sandbox it by embedding a scripting language, don't know how feasable that would be. Pablo Godel notifications@github.com a écrit :
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté. |
+1 ... i like this one
|
can we use the "migrator" feature for code-requiring migrations or is |
Well, would using Alternatively we could use the V8Js extension: And pass in an array to the javascript function representing the node. Then remap the array back to the node in PHP. We could also sandbox the session object in a JS object. We could also use this (closure) method as an additional way of filtering queries. |
|
I cannot see any security problems in here.
This is a very powerful and flexible tool and migrations are only one use case. |
this is like awk for CMF 💯 |
@lsmith77 what are your concerns with If create_function is not good enough then what do people think about writing the closures in Javascript as I mentioned earlier? |
i would prefer not to bring in js, thats too complicated. if lukas |
But if its in another repo, the use cases for this Command is to help But I guess at least having to manually enable it makes people more The only security problem I can think of is that some people like to What is a worst-case scenario? On Wed, Jun 26, 2013 at 11:12:40PM -0700, David Buchmann wrote:
|
create_function I guess is a compromise I can live with |
- Also polished up documentation etc.
Rebased and updated. It now uses create_function which also makes the syntax better:
Are people now happy to merge this? |
+1 |
👍 output should be in |
foreach ($options['applyClosures'] as $closureString) { | ||
$closure = create_function('$session, $node', $closureString); | ||
$output->writeln(sprintf( | ||
'<comment> > Applying closure: %s</comment>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cryptocompress output is already in comment tags?
[RFC] Added `--apply-closure` option
thanks a lot dan. is there a good place to document this? but then again, commands are kind of self-documenting |
@@ -78,5 +78,9 @@ public function configureNodeManipulationInput() | |||
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, | |||
'Remove mixin from the nodes' | |||
); | |||
$this->addOption('apply-closure', null, | |||
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
erm, why is a closure required? does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value is required, i.e. you can ommit the option but if you specify it you have to specify a value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. learning something new every day. today i learned (well, got reminded, rather) that i should read closely before asking dumb questions ;-)
This option gives us a very quick and flexible solution for migrations:
What do people think?