public function listTables() { $return = $this->query(PSQL_SHOW_TABLES); $tables = drush_shell_exec_output(); if (!empty($tables)) { return $tables; } return array(); }
public function listTables() { $current = drush_get_context('DRUSH_SIMULATE'); drush_set_context('DRUSH_SIMULATE', FALSE); $return = $this->query('SHOW TABLES;'); $tables = drush_shell_exec_output(); drush_set_context('DRUSH_SIMULATE', $current); return $tables; }
public function listTables() { $return = $this->query('SELECT TABLE_NAME FROM information_schema.tables'); $tables = drush_shell_exec_output(); if (!empty($tables)) { // Shift off the header of the column of data returned. array_shift($tables); return $tables; } }
public function listTables() { $return = $this->query("SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME NOT IN ('BLOBS','LONG_IDENTIFIERS')"); $tables = drush_shell_exec_output(); if (!empty($tables)) { // Shift off the header of the column of data returned. array_shift($tables); return $tables; } }
public function listTables() { $return = $this->query(PSQL_SHOW_TABLES); $tables = drush_shell_exec_output(); if (!empty($tables)) { // Shift off the header of the column of data returned. array_shift($tables); return $tables; } return array(); }
public function listTables() { $return = $this->query('.tables', NULL, TRUE); $tables_raw = drush_shell_exec_output(); // SQLite's '.tables' command always outputs the table names in a column // format, like this: // table_alpha table_charlie table_echo // table_bravo table_delta table_foxtrot // …and there doesn't seem to be a way to fix that. So we need to do some // clean-up. foreach ($tables_raw as $line) { preg_match_all('/[^\\s]+/', $line, $matches); if (!empty($matches[0])) { foreach ($matches[0] as $match) { $tables[] = $match; } } } return $tables; }
// Load a drushrc.php file from the 'drush' folder at the root of the current // git repository. Customize as desired. // (Script by grayside; @see: http://grayside.org/node/93) $repo_dir = drush_get_option('root') ? drush_get_option('root') : getcwd(); $success = drush_shell_exec('cd %s && git rev-parse --show-toplevel 2> ' . drush_bit_bucket(), $repo_dir); if ($success) { $output = drush_shell_exec_output(); $repo = $output[0]; // If drush directory is not found, look for a parent git repo which might contain the drush folder if (!is_dir($repo . '/drush')) { $success = drush_shell_exec('cd %s && cd .. && git rev-parse --show-toplevel 2> ' . drush_bit_bucket(), $repo); if ($success) { $output = drush_shell_exec_output(); $repo = $output[0]; if (!is_dir($repo . '/drush')) { $success = drush_shell_exec('cd %s && cd .. && git rev-parse --show-toplevel 2> ' . drush_bit_bucket(), $repo); if ($success) { $output = drush_shell_exec_output(); $repo = $output[0]; } } } } if (is_dir($repo . '/drush')) { $options['config'] = $repo . '/drush/drushrc.php'; $options['include'] = $repo . '/drush/commands'; $options['alias-path'] = $repo . '/drush/aliases'; //print_r($options); // can be used to debug which directories it finds. } } $override = array('language_default' => (object) array('language' => 'en'));
public static function execute($directory, $command) { $args = func_get_args(); $result = call_user_func_array('drush_shell_cd_and_exec', $args); if (drush_get_context('DRUSH_DEBUG') && ($output = drush_shell_exec_output())) { // Log any command output, visible only in --debug mode. //drush_print(implode("\n", $output)); } if (drush_get_context('DRUSH_VERBOSE') || drush_get_context('DRUSH_SIMULATE')) { drush_print('Result: ' . var_export($result, TRUE), 0, STDERR); } return $result; }
public function listTables() { $return = $this->query('SHOW TABLES;', NULL, TRUE); $tables = drush_shell_exec_output(); return $tables; }
/** * Find the path to command. * * @param string $command * The command to find. * * @return string * The system path to run the command or empty if not found. */ private static function getCommand($command) { drush_shell_exec("which {$command}"); $stdout = (array) drush_shell_exec_output(); return reset($stdout); }