function drush_op

8.0.x drush_op($callable)
6.x drush_op($function)
7.x drush_op($callable)
3.x drush_op($function)
4.x drush_op($function)
5.x drush_op($function)
master drush_op($callable)

Calls a given function, passing through all arguments unchanged.

This should be used when calling possibly mutative or destructive functions (e.g. unlink() and other file system functions) so that can be suppressed if the simulation mode is enabled.


$function: The name of the function.

Return value

The return value of the function, or TRUE if simulation mode is enabled.

20 calls to drush_op()
drush_core_cache_clear in commands/core/
Command callback for drush cache-clear.
drush_core_call_rsync in commands/core/
Make a direct call to rsync after the source and destination paths have been evaluated.
drush_core_cli in commands/core/
drush_core_pre_site_install in commands/core/
drush_core_search_index in commands/core/

... See full list


includes/, line 584
The drush API implementation and helpers.


function drush_op($function) {
  $args = func_get_args();
  array_shift($args); // Skip function name

  if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) {
    drush_print("Calling $function(" . implode(", ", $args) . ')');

  if (drush_get_context('DRUSH_SIMULATE')) {
    return TRUE;

  return call_user_func_array($function, $args);