Skip to main content
added 34 characters in body
Source Link
pbonnefoi
  • 1.9k
  • 3
  • 21
  • 37

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I also have another drush command that synchronise content and does some other stuff and goes through those same hooks.

I want to do some specific things in those hooks wether it's called by a back-office action or drush migrate:import or drush command1. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I also have another drush command that synchronise content and does some other stuff.

I want to do some specific things in those hooks wether it's called by a back-office action or drush migrate:import or drush command1. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I also have another drush command that synchronise content and does some other stuff and goes through those same hooks.

I want to do some specific things in those hooks wether it's called by a back-office action or drush migrate:import or drush command1. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

added 89 characters in body
Source Link
pbonnefoi
  • 1.9k
  • 3
  • 21
  • 37

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I also have another drush command that synchronise content and does some other stuff.

I want to do some specific things during that migration in those hooks wether it's called by a back-office action or drush command1drush migrate:import or drush command2drush command1. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

The drush command I execute is like this : drush migrate:import my_custom_migration or drush command1

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I want to do some specific things during that migration in those hooks wether it's called by a back-office action or drush command1 or drush command2. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

The drush command I execute is like this : drush migrate:import my_custom_migration or drush command1

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I also have another drush command that synchronise content and does some other stuff.

I want to do some specific things in those hooks wether it's called by a back-office action or drush migrate:import or drush command1. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

added 244 characters in body; edited title
Source Link
pbonnefoi
  • 1.9k
  • 3
  • 21
  • 37

Is there a way to know which Drush command is executingexecuted from within a hook implementation?

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I want to do some specific things during that migration in those hooks wether it's called by a back-office action or drush command1 or drush command2. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

The drush command I execute is like this : drush migrate:import my_custom_migration or drush command1

Is there a way to know which Drush command is executing from within a hook implementation?

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I want to do some specific things during that migration in those hooks. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ?

I looked there and there but it was not satisfying.

The drush command I execute is like this : drush migrate:import my_custom_migration

Is there a way to know which Drush command is executed from within a hook implementation?

Here is my use case.

I'm importing nodes with the classic migration API and goes through some hooks (like hook_node_presave, hook_node_delete...).

I want to do some specific things during that migration in those hooks wether it's called by a back-office action or drush command1 or drush command2. Is there a way to pass a context of some sort on the drush command that would be retrievable in my hooks ? Or at least to know the hook is executed by a back-office action ?

I looked there and there but it was not satisfying. Knowing it's executed by PHP_CLI is not precise enough for me in my use case.

The drush command I execute is like this : drush migrate:import my_custom_migration or drush command1

edited title
Link
mona lisa
  • 6.3k
  • 2
  • 20
  • 26
Loading
Source Link
pbonnefoi
  • 1.9k
  • 3
  • 21
  • 37
Loading