/** * Implements \SiteAudit\Check\Abstract\getResultWarn(). */ public function getResultWarn() { $ret_val = dt('The following duplicate extensions were found:'); if (drush_get_option('html')) { $ret_val = '<p>' . $ret_val . '</p>'; $ret_val .= '<table class="table table-condensed">'; $ret_val .= '<thead><tr><th>Name</th><th>Paths</th></thead>'; $ret_val .= '<tbody>'; foreach ($this->registry['extensions_dupe'] as $name => $paths) { $ret_val .= '<tr><td>' . $name . '</td>'; $ret_val .= '<td>' . implode('<br/>', $paths) . '</td></tr>'; } $ret_val .= '</tbody>'; $ret_val .= '</table>'; } else { foreach ($this->registry['extensions_dupe'] as $name => $paths) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 6); } $ret_val .= $name . PHP_EOL; $extension_list = ''; foreach ($paths as $path) { $extension_list .= str_repeat(' ', 8) . $path . PHP_EOL; } $ret_val .= rtrim($extension_list); } } return $ret_val; }
/** * Get the hooks directory. * * On Drush, this can come from several places, in the following order of * preference: * - The Drush --data option. This allows use of a central store of hook data * that needs only be downloaded once for all Drupal sites. Subdirectories * are made for each major version. * - The Module Builder UI's variable. This will only be set if module * builder has been installed as a Drupal module on the current site. */ private function getHooksDirectorySetting() { // Set the module folder based on variable. // First try the drush 'data' option. if (drush_get_option('data')) { $directory = drush_get_option('data'); if ($directory) { // In pure Drush, the hooks folder contains subfolder for hooks for // each major version of Drupal. if (substr($directory, -1, 1) != '/') { $directory .= '/'; } $directory .= $this->major_version; return $directory; } } // Second, check if we're in mixed drush. if (function_exists('variable_get')) { // We're in a loaded Drupal, but MB might not be installed here. $directory = variable_get('module_builder_hooks_directory', 'hooks'); return $directory; } // If we get here then argh. Set to the default and hope... $directory = 'hooks'; return $directory; }
/** * Implements \SiteAudit\Check\Abstract\getResultInfo(). */ public function getResultInfo() { if (drush_get_option('html')) { $ret_val = '<table class="table table-condensed">'; $ret_val .= '<thead><tr><th>Table Name</th><th>Collation</th></tr></thead>'; $ret_val .= '<tbody>'; foreach ($this->registry['collation_tables'] as $name => $collation) { $ret_val .= '<tr>'; $ret_val .= '<td>' . $name . '</td>'; $ret_val .= '<td>' . $collation . '</td>'; $ret_val .= '</tr>'; } $ret_val .= '</tbody>'; $ret_val .= '</table>'; } else { $ret_val = 'Table Name: Collation' . PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= '---------------------'; foreach ($this->registry['collation_tables'] as $name => $collation) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= "{$name}: {$collation}"; } } return $ret_val; }
/** * The main Drush function. * * - Runs "early" option code, if set (see global options). * - Parses the command line arguments, configuration files and environment. * - Prepares and executes a Drupal bootstrap, if possible, * - Dispatches the given command. * * function_exists('drush_main') may be used by modules to detect whether * they are being called from Drush. See http://drupal.org/node/1181308 * and http://drupal.org/node/827478 * * @return mixed * Whatever the given command returns. */ function drush_main() { // Load Drush core include files, and parse command line arguments. require dirname(__FILE__) . '/includes/preflight.inc'; if (drush_preflight_prepare() === FALSE) { return 1; } // Start code coverage collection. if ($coverage_file = drush_get_option('drush-coverage', FALSE)) { drush_set_context('DRUSH_CODE_COVERAGE', $coverage_file); xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); register_shutdown_function('drush_coverage_shutdown'); } // Load the global Drush configuration files, and global Drush commands. // Find the selected site based on --root, --uri or cwd // Preflight the selected site, and load any configuration and commandfiles associated with it. // Select and return the bootstrap class. $bootstrap = drush_preflight(); // Reset our bootstrap phase to the beginning drush_set_context('DRUSH_BOOTSTRAP_PHASE', DRUSH_BOOTSTRAP_NONE); $return = ''; if (!drush_get_error()) { if ($file = drush_get_option('early', FALSE)) { require_once $file; $function = 'drush_early_' . basename($file, '.inc'); if (function_exists($function)) { if ($return = $function()) { // If the function returns FALSE, we continue and attempt to bootstrap // as normal. Otherwise, we exit early with the returned output. if ($return === TRUE) { $return = ''; } } } } else { // Do any necessary preprocessing operations on the command, // perhaps handling immediately. $command_handled = drush_preflight_command_dispatch(); if (!$command_handled) { $return = $bootstrap->bootstrap_and_dispatch(); } } } // TODO: Get rid of global variable access here, and just trust // the bootstrap object returned from drush_preflight(). This will // require some adjustments to Drush bootstrapping. // See: https://github.com/drush-ops/drush/pull/1303 if ($bootstrap = drush_get_bootstrap_object()) { $bootstrap->terminate(); } drush_postflight(); // How strict are we? If we are very strict, turn 'ok' into 'error' // if there are any warnings in the log. if ($return == 0 && drush_get_option('strict') > 1 && drush_log_has_errors()) { $return = 1; } // After this point the drush_shutdown function will run, // exiting with the correct exit code. return $return; }
/** * Implements \SiteAudit\Check\Abstract\getResultFail(). */ public function getResultFail() { if (drush_get_option('html')) { $ret_val = '<table class="table table-condensed">'; $ret_val .= '<thead><tr><th>Table Name</th><th>Engine</th></tr></thead>'; $ret_val .= '<tbody>'; foreach ($this->registry['engine_tables'] as $name => $engine) { $ret_val .= '<tr>'; $ret_val .= '<td>' . $name . '</td>'; $ret_val .= '<td>' . $engine . '</td>'; $ret_val .= '</tr>'; } $ret_val .= '</tbody>'; $ret_val .= '</table>'; } else { $ret_val = 'Table Name: Engine' . PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= '---------------------'; foreach ($this->registry['engine_tables'] as $name => $engine) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= "{$name}: {$engine}"; } } return $ret_val; }
/** * Implements \SiteAudit\Check\Abstract\getResultWarn(). */ public function getResultWarn() { if (!drush_get_option('detail')) { return dt('There are @count duplicate titles in the following types: @types', array('@count' => $this->registry['nodes_duplicate_title_count'], '@types' => implode(', ', array_keys($this->registry['nodes_duplicate_titles'])))); } $ret_val = ''; if (drush_get_option('html') == TRUE) { $ret_val .= '<table class="table table-condensed">'; $ret_val .= "<thead><tr><th>Content Type</th><th>Title</th><th>Count</th></tr></thead>"; foreach ($this->registry['nodes_duplicate_titles'] as $content_type => $title_counts) { foreach ($title_counts as $title => $count) { $ret_val .= "<tr><td>{$content_type}</td><td>{$title}</td><td>{$count}</td></tr>"; } } $ret_val .= '</table>'; } else { $ret_val = 'Content Type: "Title" (Count)' . PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= '-----------------------------'; foreach ($this->registry['nodes_duplicate_titles'] as $content_type => $title_counts) { foreach ($title_counts as $title => $count) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= "{$content_type}: \"{$title}\" ({$count})"; } } } return $ret_val; }
public static function getPatch(array $patch) { static $cache = array(); if (!isset($cache[$patch['url']])) { if (!empty($patch['local'])) { if (is_file($patch['url']) && filesize($patch['url'])) { $cache[$patch['url']] = $patch['url']; } else { throw new Exception("Unable to read patch from local path {$patch['url']}."); } } elseif (drush_get_option('no-cache')) { $temp_file = drush_tempnam('drush_patchfile_', NULL, '.patch'); $cache[$patch['url']] = static::downloadPatch($patch['url'], $temp_file); } else { $cache_file = drush_directory_cache('patchfile') . '/' . md5($patch['url']) . '.patch'; if (is_file($cache_file) && filectime($cache_file) > $_SERVER['REQUEST_TIME'] - DRUSH_CACHE_LIFETIME_DEFAULT) { drush_log(dt('Remote patch URL @url fetched from cache file @cache.', array('@url' => $patch['url'], '@cache' => $cache_file))); $cache[$patch['url']] = $cache_file; } else { $cache[$patch['url']] = static::downloadPatch($patch['url'], $cache_file); } } } return $cache[$patch['url']]; }
/** * {@inheritdoc} */ public function execute($name = NULL) { if (empty($this->assets)) { return; } $options = array_keys($this->assets); $options[] = dt('All'); $choice = 'all'; if ($this->count > 2 && !drush_get_option('all')) { $choice = drush_choice($options, dt('Choose which asset from @name to view:', array('@name' => $this->project->getInfo('name')))); } else { drush_print(dt("Number of @name asset(s): @count\n", array('@name' => $this->project->getInfo('name'), '@count' => $this->count))); } if ($choice === FALSE) { return; } elseif ($choice === $this->count) { $this->clearScreen(); $choice = 'all'; } if ($choice !== FALSE && $choice !== 'all') { $this->clearScreen(); $this->printAsset($options[$choice]); $this->execute($name); } elseif ($this->count || $choice === 'all') { foreach ($this->notice as $key => $asset) { $this->printAsset($key); } return; } }
/** * Implements \SiteAudit\Check\Abstract\getAction(). */ public function getAction() { if ($this->score != SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS) { $ret_val = dt('Consider the following options:') . PHP_EOL; $options = array(); $options[] = dt('Disable unneeded or unnecessary extensions.'); $options[] = dt('Consolidate functionality if possible, or custom develop a solution specific to your needs.'); $options[] = dt('Avoid using modules that serve only one small purpose that is not mission critical.'); if (drush_get_option('html')) { $ret_val .= '<ul>'; foreach ($options as $option) { $ret_val .= '<li>' . $option . '</li>'; } $ret_val .= '</ul>'; } else { foreach ($options as $option) { if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 6); } $ret_val .= '- ' . $option . PHP_EOL; } if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 6); } } $ret_val .= dt('A lightweight site is a fast and happy site!'); return $ret_val; } }
/** * Implements \SiteAudit\Check\Abstract\getResultInfo(). */ public function getResultInfo() { $ret_val = dt('There are @count total fields.', array('@count' => count($this->registry['field_api_map']))); if (drush_get_option('detail')) { if (drush_get_option('html')) { $ret_val .= '<p>' . $ret_val . '</p>'; $ret_val .= '<table class="table table-condensed">'; $ret_val .= '<tr><th>Name</th><th>Type</th></tr>'; foreach ($this->registry['field_api_map'] as $field_name => $field_data) { $ret_val .= "<tr><td>{$field_name}</td><td>{$field_data['type']}</td></tr>"; } $ret_val .= '</table>'; } else { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= 'Name: Type' . PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= '----------'; foreach ($this->registry['field_api_map'] as $field_name => $field_data) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= $field_name . ': ' . $field_data['type']; } } } return $ret_val; }
/** * The main Drush function. * * - Runs "early" option code, if set (see global options). * - Parses the command line arguments, configuration files and environment. * - Prepares and executes a Drupal bootstrap, if possible, * - Dispatches the given command. * * function_exists('drush_main') may be used by modules to detect whether * they are being called from drush. See http://drupal.org/node/1181308 * and http://drupal.org/node/827478 * * @return * Whatever the given command returns. */ function drush_main() { $return = ''; if ($file = drush_get_option('early', FALSE)) { require_once $file; $function = 'drush_early_' . basename($file, '.inc'); if (function_exists($function)) { if ($return = $function()) { // If the function returns FALSE, we continue and attempt to bootstrap // as normal. Otherwise, we exit early with the returned output. if ($return === TRUE) { $return = ''; } drush_bootstrap_finish(); return $return; } } } // Process initial global options such as --debug. _drush_bootstrap_global_options(); $return = ''; drush_bootstrap_to_phase(DRUSH_BOOTSTRAP_DRUSH); if (!drush_get_error()) { // Do any necessary preprocessing operations on the command, // perhaps handling immediately. $command_handled = drush_preflight_command_dispatch(); if (!$command_handled) { $return = _drush_bootstrap_and_dispatch(); } } drush_bootstrap_finish(); // After this point the drush_shutdown function will run, // exiting with the correct exit code. return $return; }
/** * Implements \SiteAudit\Check\Abstract\calculateScore(). */ public function calculateScore() { $drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT'); $handle = opendir($drupal_root . '/sites/'); $this->registry['superfluous'] = array(); while (FALSE !== ($entry = readdir($handle))) { if (!in_array($entry, array( '.', '..', 'default', 'all', 'example.sites.php', 'README.txt', ))) { if (is_file($drupal_root . '/sites/' . $entry)) { // Support multi-site directory aliasing for non-Pantheon sites. if ($entry != 'sites.php' || drush_get_option('vendor') == 'pantheon') { $this->registry['superfluous'][] = $entry; } } } } closedir($handle); if (!empty($this->registry['superfluous'])) { return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN; } return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS; }
/** * Protected constructor; use getInstance. */ protected function __construct() { // Ensure implementing classes have necessary properties. if (!$this->name) { throw new \Exception('Missing name from ' . __CLASS__); } if (!$this->label) { throw new \Exception('Missing label from ' . __CLASS__); } if (!filter_var($this->homepage, FILTER_VALIDATE_URL)) { throw new \Exception('Missing valid homepage from ' . __CLASS__); } if (!filter_var($this->endpoint, FILTER_VALIDATE_URL)) { throw new \Exception('Missing valid endpoint from ' . __CLASS__); } if (drush_get_option('refresh')) { $this->apiGetSites(); } $sites = SiteQuery::create()->filterByProvider($this->name)->find(); if (!empty($sites)) { foreach ($sites as $site) { $this->sites[$site->getName()] = $site; } } }
/** * Implements \SiteAudit\Check\Abstract\getResultInfo(). */ public function getResultInfo() { if (!empty($this->registry['cache_bins'])) { if (drush_get_option('html')) { $ret_val = '<table class="table table-condensed">'; $ret_val .= '<thead><tr><th>Bin</th><th>Class</th></tr></thead>'; $ret_val .= '<tbody>'; foreach ($this->registry['cache_bins'] as $bin => $class) { $ret_val .= "<tr><td>{$bin}</td><td>{$class}</td></tr>"; } $ret_val .= '</tbody>'; $ret_val .= '</table>'; } else { $ret_val = 'Bin: Class' . PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= '----------'; foreach ($this->registry['cache_bins'] as $bin => $class) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= "{$bin}: {$class}"; } } return $ret_val; } else { return dt('No cache bins defined.'); } }
/** * Class constructor. * * @param CommandBase $command * The current instance of the command. */ public function __construct(CommandBase $command) { $this->command = $command; // Determine if the "path" option has been set. $this->path = drush_get_option('path'); if ($this->path && !file_exists($this->path)) { return drush_set_error('DRUSH_LWG_INVALID_PATH', dt("The specified project path does not exist:\n!path", array('!path' => $this->path))); } else { if (!$this->path) { $this->path = drush_cwd(); } } // Ensure the path is writable. if (!is_writable($this->path)) { return drush_set_error('DRUSH_LWG_PATH_NOT_WRITABLE', dt("The specified project path is not writable:\n!path", array('!path' => $this->path))); } foreach (drush_scan_directory($this->path, '/\\.info(\\.yml)?/') as $file) { if ($this->info = drush_drupal_parse_info_file($file->filename)) { $this->name = $file->name; break; } } if (!$this->getInfo('name')) { return drush_set_error('DRUSH_LWG_NOT_PROJECT', dt('Project info not found. Please navigate to a valid project directory or specify one with the --path option.')); } // Indicate that this is a valid project. $this->valid = TRUE; }
/** * Implements \SiteAudit\Check\Abstract\getResultInfo(). */ public function getResultInfo() { if (drush_get_option('html')) { $ret_val = '<table class="table table-condensed">'; $ret_val .= '<thead><tr><th>Module</th><th>Block</th><th>State</th></tr></thead>'; $ret_val .= '<tbody>'; foreach ($this->registry['blocks'] as $block) { $ret_val .= '<tr>'; $ret_val .= '<td>' . $block['module'] . '</td>'; $ret_val .= '<td>' . $block['info'] . '</td>'; $ret_val .= '<td>' . $block['state'] . '</td>'; $ret_val .= '</tr>'; } $ret_val .= '</tbody>'; $ret_val .= '</table>'; } else { $ret_val = dt('Module - Info: State') . PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= '--------------------'; foreach ($this->registry['blocks'] as $block) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 4); } $ret_val .= "{$block['module']} - {$block['info']}: {$block['state']}"; } } return $ret_val; }
/** * Implements \SiteAudit\Check\Abstract\getResultWarn(). */ public function getResultWarn() { $ret_val = dt('The following development modules(s) are currently enabled: @list', array('@list' => implode(', ', array_keys($this->registry['extensions_dev'])))); $show_table = TRUE; if (site_audit_env_is_dev()) { $show_table = FALSE; } if (drush_get_option('detail')) { if (drush_get_option('html')) { if ($show_table) { $ret_val .= '<br/>'; $ret_val .= '<table class="table table-condensed">'; $ret_val .= '<thead><tr><th>Name</th><th>Reason</th></thead>'; $ret_val .= '<tbody>'; foreach ($this->registry['extensions_dev'] as $row) { $ret_val .= '<tr><td>' . implode('</td><td>', $row) . '</td></tr>'; } $ret_val .= '</tbody>'; $ret_val .= '</table>'; } } elseif ($show_table) { foreach ($this->registry['extensions_dev'] as $row) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 6); } $ret_val .= '- ' . $row[0] . ': ' . $row[1]; } } } return $ret_val; }
/** * Implements \SiteAudit\Check\Abstract\getResultFail(). */ public function getResultFail() { $ret_val = dt('The following potentially malicious paths have been discovered: @list', array('@list' => implode(', ', array_keys($this->registry['menu_router'])))); if (drush_get_option('detail')) { if (drush_get_option('html')) { $ret_val .= '<br/>'; $ret_val .= '<table class="table table-condensed">'; $ret_val .= '<thead><tr><th>Path</th><th>Reason</th></thead>'; $ret_val .= '<tbody>'; foreach ($this->registry['menu_router'] as $path => $reason) { $ret_val .= '<tr><td>' . $path . '</td><td>' . $reason . '</td></tr>'; } $ret_val .= '</tbody>'; $ret_val .= '</table>'; } else { foreach ($this->registry['menu_router'] as $path => $reason) { $ret_val .= PHP_EOL; if (!drush_get_option('json')) { $ret_val .= str_repeat(' ', 6); } $ret_val .= '- ' . $path . ': ' . $reason; } } } return $ret_val; }
/** * Implements \SiteAudit\Check\Abstract\calculateScore(). */ public function calculateScore() { $drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT'); $handle = opendir($drupal_root . '/sites/'); $this->registry['multisites'] = array(); while (FALSE !== ($entry = readdir($handle))) { if (!in_array($entry, array( '.', '..', 'default', 'all', 'example.sites.php', 'README.txt', '.svn', ))) { if (is_dir($drupal_root . '/sites/' . $entry)) { $this->registry['multisites'][] = $entry; } } } closedir($handle); if (!empty($this->registry['multisites'])) { if (drush_get_option('vendor') == 'pantheon') { return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL; } return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO; } return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS; }
public function removeDrush($project_name) { $drush_dir = drush_get_option('rum-drush-dir', ''); $file = $drush_dir . '/' . $project_name . '.aliases.drushrc.php'; if ($this->file_system->checkFile($file)) { $this->file_system->removeFile($file); } }
public function validateDrushParams($args) { $values = array('num' => array_shift($args), 'kill' => drush_get_option('kill'), 'title_length' => 12); if ($this->isNumber($values['num']) == FALSE) { return drush_set_error('DEVEL_GENERATE_INVALID_INPUT', dt('Invalid number of vocabularies: !num.', array('!num' => $values['num']))); } return $values; }
/** * Implements \SiteAudit\Check\Abstract\getResultFail(). */ public function getResultFail() { if (drush_get_option('detail')) { return dt('PHP Filter is enabled! Executable code should never be stored in the database, and support for this feature was removed in Drupal 8 - https://drupal.org/node/1203886'); } else { return dt('PHP Filter is enabled!'); } }
/** * From the provided source information, instantiate the appropriate migrations * in the active configuration. * * @throws \Exception */ public function configure() { $db_url = drush_get_option('legacy-db-url'); $db_spec = drush_convert_db_from_db_url($db_url); $db_prefix = drush_get_option('legacy-db-prefix'); $db_spec['prefix'] = $db_prefix; $this->migrationList = $this->createMigrations($db_spec, drush_get_option('legacy-root')); }
public function removeVhost() { $link = drush_get_option('rum-http-doc-root', '') . '/' . $this->getProjectName(); if ($this->file_system->checkFile($link)) { $this->file_system->removeFile($link); } $project_domain = $this->getProjectDomain(); $this->web_server->removeVhost($project_domain); }
/** * Implements \SiteAudit\Check\Abstract\calculateScore(). */ public function calculateScore() { $this->registry['syslog_enabled'] = module_exists('syslog'); if ($this->registry['syslog_enabled']) { if (drush_get_option('vendor') == 'pantheon') { return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL; } } return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO; }
public function dumpCmd($table_selection) { if (!$file) { $file = $this->db_spec['database'] . '_' . date('Ymd_His') . '.bak'; } $exec = "sqlcmd -U \"" . $this->db_spec['username'] . "\" -P \"" . $this->db_spec['password'] . "\" -S \"" . $this->db_spec['host'] . "\" -Q \"BACKUP DATABASE [" . $this->db_spec['database'] . "] TO DISK='" . $file . "'\""; if ($option = drush_get_option('extra', $this->query_extra)) { $exec .= " {$option}"; } return array($exec, $file); }
/** * Implements \SiteAudit\Check\Abstract\getAction(). */ public function getAction() { if ($this->score == SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO) { if (drush_get_option('vendor') == 'pantheon') { return dt('Consider using a dedicated API to a caching backend such as redis.'); } elseif (drush_get_option('vendor') == 'acquia') { return dt('Consider using a dedicated API to a caching backend such as memcache.'); } return dt('Consider using a dedicated API to a caching backend, such as redis or memcache.'); } }
function init(&$var) { if (!isset($var)) { $v = drush_get_option('node'); $nid = intval($v); if ($nid == 0) { $nid = 2529; } $var = node_load($nid); } }
public function get_db_spec() { $db_spec = NULL; if ($url = isset($GLOBALS['db_url']) ? $GLOBALS['db_url'] : drush_get_option('db-url', NULL)) { $database = drush_get_option('database', 'default'); $url = is_array($url) ? $url[$database] : $url; $db_spec = drush_convert_db_from_db_url($url); $db_spec['db_prefix'] = isset($GLOBALS['db_prefix']) ? $GLOBALS['db_prefix'] : drush_get_option('db-prefix', NULL); } return $db_spec; }
/** * Constructor. */ public function __construct($type, $engine, $config) { $this->engine_type = $type; $this->engine = $engine; if (is_null($config)) { $config = array(); } $config += array('cache-duration' => drush_get_option('cache-duration-releasexml', self::CACHE_LIFETIME)); $this->engine_config = $config; $this->cache = array(); }