function drush_op

8.0.x drush.inc drush_op($callable)
6.x drush.inc drush_op($function)
7.x drush.inc drush_op($callable)
3.x drush.inc drush_op($function)
4.x drush.inc drush_op($function)
5.x drush.inc drush_op($function)
master drush.inc 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.

Parameters

$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/clear.cache.inc
Command callback for drush cache-clear.
drush_core_call_rsync in commands/core/rsync.core.inc
Make a direct call to rsync after the source and destination paths have been evaluated.
drush_core_cli in commands/core/core.drush.inc
drush_core_pre_site_install in commands/core/site_install.drush.inc
drush_core_search_index in commands/core/search.drush.inc

... See full list

File

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

Code

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);
}