$file) { $files[$index] = str_replace('.sm.inc', '', basename($file)); } return $files; } function _drush_sm_service_strings() { return '[' . implode( "|" , _drush_sm_services()) . ']'; } function _drush_sm_command() { return array( 'list', 'export', 'report', 'import'); } function drush_sm_command_list() { $commands = array(); foreach (_drush_sm_services() as $service) { require_once dirname(__FILE__) . '/inc/' . $service . '.sm.inc'; $option_set = call_user_func($service . '_sm_options'); $argument_set= call_user_func($service . '_sm_arguments'); foreach (_drush_sm_command() as $command) { $function = $service . '_sm_' . $command; if (function_exists($function)) { $options= isset($option_set[$command]) ? $option_set[$command] : array(); $arguments = $argument_set[$command]; $commands['sm-' . $command . '-' . $service] = array( 'callback' => $service . '_sm_' . $command, 'description' => "$command from $service", 'options' => $options, 'arguments' => $arguments, ); } } } return $commands; } /** * // http://usr:pwd@www.test.com:81/dir/dir.2/index.htm?q1=value&q2=test#top // @see http://stevenlevithan.com/demo/parseuri/cf/ * @param uri function drush_sm_create_db() { $args = func_get_args(); $uri = $args[0]; // parse_url() # $url = 'mysql://drush_mm:drush_mm@localhost/drush_mm'; $HOSTNAME = 'test'; $protocol = 'mysql'; $user = $HOSTNAME; $password = $HOSTNAME; $host = 'localhost'; $resource = $HOSTNAME; $template = "create database $resource; \n"; $template.= "grant all on $resource.* to '$user'@'$host' identified by '$password'; \n"; db_query( $template); } */