Пример #1
0
 /**
  * Print druplicon as post-command output.
  *
  * @hook post-command *
  * @option druplicon Shows the druplicon as glorious ASCII art.
  * @todo hidden is not yet part of annotated-command project. It is recognized by Drush's annotation_adapter.inc
  * @hidden-option druplicon
  */
 public function druplicon($result, CommandData $commandData)
 {
     // If one command does a drush_invoke to another command,
     // then this hook will be called multiple times. Only print
     // once.  (n.b. If drush_invoke_process passes along the
     // --druplicon option, then we will still get mulitple output)
     if ($this->printed) {
         return;
     }
     $this->printed = true;
     $annotationData = $commandData->annotationData();
     $commandName = $annotationData['command'];
     // For some reason, Drush help uses drush_invoke_process to call helpsingle
     if ($commandName == 'helpsingle') {
         return;
     }
     if ($commandData->input()->getOption('druplicon')) {
         $this->logger()->debug(dt('Displaying Druplicon for "!command" command.', array('!command' => $commandName)));
         $misc_dir = DRUSH_BASE_PATH . '/misc';
         if (drush_get_context('DRUSH_NOCOLOR')) {
             $content = file_get_contents($misc_dir . '/druplicon-no_color.txt');
         } else {
             $content = file_get_contents($misc_dir . '/druplicon-color.txt');
         }
         // @todo: `$commandData->output->writeln($content)` after $output hooked up to backend invoke
         drush_print($content);
     }
 }
Пример #2
0
  /**
   * 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;
    }
  }
Пример #3
0
 function bootstrap_and_dispatch()
 {
     $phases = _drush_bootstrap_phases(FALSE, TRUE);
     $return = '';
     $command_found = FALSE;
     _drush_bootstrap_output_prepare();
     foreach ($phases as $phase) {
         if (drush_bootstrap_to_phase($phase)) {
             $command = drush_parse_command();
             if (is_array($command)) {
                 $bootstrap_result = drush_bootstrap_to_phase($command['bootstrap']);
                 drush_enforce_requirement_bootstrap_phase($command);
                 drush_enforce_requirement_core($command);
                 drush_enforce_requirement_drupal_dependencies($command);
                 drush_enforce_requirement_drush_dependencies($command);
                 if ($bootstrap_result && empty($command['bootstrap_errors'])) {
                     drush_log(dt("Found command: !command (commandfile=!commandfile)", array('!command' => $command['command'], '!commandfile' => $command['commandfile'])), 'bootstrap');
                     $command_found = TRUE;
                     // Dispatch the command(s).
                     $return = drush_dispatch($command);
                     // Prevent a '1' at the end of the output.
                     if ($return === TRUE) {
                         $return = '';
                     }
                     if (drush_get_context('DRUSH_DEBUG') && !drush_get_context('DRUSH_QUIET')) {
                         // @todo Create version independant wrapper around Drupal timers. Use it.
                         drush_print_timers();
                     }
                     break;
                 }
             }
         } else {
             break;
         }
     }
     if (!$command_found) {
         // If we reach this point, command doesn't fit requirements or we have not
         // found either a valid or matching command.
         // If no command was found check if it belongs to a disabled module.
         if (!$command) {
             $command = drush_command_belongs_to_disabled_module();
         }
         // Set errors related to this command.
         $args = implode(' ', drush_get_arguments());
         if (isset($command) && is_array($command)) {
             foreach ($command['bootstrap_errors'] as $key => $error) {
                 drush_set_error($key, $error);
             }
             drush_set_error('DRUSH_COMMAND_NOT_EXECUTABLE', dt("The drush command '!args' could not be executed.", array('!args' => $args)));
         } elseif (!empty($args)) {
             drush_set_error('DRUSH_COMMAND_NOT_FOUND', dt("The drush command '!args' could not be found.  Run `drush cache-clear drush` to clear the commandfile cache if you have installed new extensions.", array('!args' => $args)));
         }
         // Set errors that occurred in the bootstrap phases.
         $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS', array());
         foreach ($errors as $code => $message) {
             drush_set_error($code, $message);
         }
     }
     return $return;
 }
Пример #4
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if (empty($this->registry['rows_by_table'])) {
         return dt('No tables with less than @min_rows rows.', array('@min_rows' => drush_get_option('min_rows', SiteAuditCheckDatabaseRowCount::AUDIT_CHECK_DB_ROW_MIN_DEFAULT)));
     }
     if (drush_get_option('html')) {
         $ret_val = '<table class="table table-condensed">';
         $ret_val .= '<thead><tr><th>Table Name</th><th>Rows</th></tr></thead>';
         $ret_val .= '<tbody>';
         foreach ($this->registry['rows_by_table'] as $table_name => $rows) {
             $ret_val .= '<tr>';
             $ret_val .= '<td>' . $table_name . '</td>';
             $ret_val .= '<td>' . $rows . '</td>';
             $ret_val .= '</tr>';
         }
         $ret_val .= '</tbody>';
         $ret_val .= '</table>';
     } else {
         $ret_val = dt('Table Name: Rows') . PHP_EOL;
         if (!drush_get_option('json')) {
             $ret_val .= str_repeat(' ', 4);
         }
         $ret_val .= '----------------';
         foreach ($this->registry['rows_by_table'] as $table_name => $rows) {
             $ret_val .= PHP_EOL;
             if (!drush_get_option('json')) {
                 $ret_val .= str_repeat(' ', 4);
             }
             $ret_val .= "{$table_name}: {$rows}";
         }
     }
     return $ret_val;
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function run($name, $time_limit = 0)
 {
     $worker = $this->workerManager->createInstance($name);
     $end = time() + $time_limit;
     $queue = $this->getQueue($name);
     $count = 0;
     while ((!$time_limit || time() < $end) && ($item = $queue->claimItem())) {
         try {
             drush_log(dt('Processing item @id from @name queue.', array('@name' => $name, 'id' => $item->item_id)), 'info');
             $worker->processItem($item->data);
             $queue->deleteItem($item);
             $count++;
         } catch (SuspendQueueException $e) {
             // If the worker indicates there is a problem with the whole queue,
             // release the item and skip to the next queue.
             $queue->releaseItem($item);
             drush_set_error('DRUSH_SUSPEND_QUEUE_EXCEPTION', $e->getMessage());
         } catch (\Exception $e) {
             // In case of any other kind of exception, log it and leave the item
             // in the queue to be processed again later.
             drush_set_error('DRUSH_QUEUE_EXCEPTION', $e->getMessage());
         }
     }
     return $count;
 }
Пример #6
0
 public function fetch($repository, $working_directory)
 {
     $username = drush_prompt(dt('Please provide your username for this svn repository'), '');
     if (!drush_shell_exec("svn --username {$username} co {$repository} {$working_directory}")) {
         throw new RumRepositoryNotCheckedOutException($repository, $working_directory);
     }
 }
 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     $options = $this->event->context['scrub_options'];
     $limit = $options['batch_comment'];
     if ($options['retain_content'] || !module_exists('comment')) {
         return;
     }
     if ($options['avoid_oom']) {
         // Orphaned comments, that is comments by an authenticated user or
         // attached to a node that no longer exists, cannot be deleted by
         // comment_delete_multiple. Handle these items first.
         if ($cids = $this->getOrphanedItems($limit)) {
             $orphaned = TRUE;
         } elseif ($cids = $this->getItems($limit)) {
             $orphaned = FALSE;
         }
         if (!empty($cids)) {
             $this->deleteItems($cids, $orphaned);
             $this->event->dispatcher->interrupt();
         }
     } else {
         do {
             if ($cids = $this->getOrphanedItems($limit)) {
                 $orphaned = TRUE;
             } elseif ($cids = $this->getItems($limit)) {
                 $orphaned = FALSE;
             } else {
                 break;
             }
             $this->deleteItems($cids, $orphaned);
         } while (TRUE);
     }
 }
Пример #8
0
 /**
  * Magic __get, overriding Persistent.
  *
  * @param string $name
  *   Name of the property.
  *
  * @return mixed
  *   Value of set property.
  * @throws \Exception
  */
 public function apiGetField($name)
 {
     $callers = debug_backtrace();
     drush_log(dt('Site @site_name is missing value for @name from @calling_function.', array('@site_name' => $this->name, '@name' => $name, '@calling_function' => $callers[1]['function'])));
     $provider = Switchboard\Provider::getInstance($this->getProvider());
     $provider->siteGetField($this->getName(), $name);
 }
Пример #9
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if ($this->registry['size_files_kb'] < 1024) {
         return dt('Files: @size_files_kbkB', array('@size_files_kb' => number_format($this->registry['size_files_kb'])));
     }
     return dt('Files: @size_files_mbMB', array('@size_files_mb' => number_format($this->registry['size_files_kb'] / 1024, 2)));
 }
Пример #10
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if ($this->registry['managed_filesize'] < 1048576) {
         return dt('Managed file size: @managed_filesize_kbkB', array('@managed_filesize_kb' => number_format($this->registry['managed_filesize'] / 1024, 2)));
     }
     return dt('Managed file size: @managed_filesize_mbMB', array('@managed_filesize_mb' => number_format($this->registry['managed_filesize'] / 1048576, 2)));
 }
Пример #11
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo() {
   if (empty($this->registry['content_type_counts'])) {
     if (drush_get_option('detail')) {
       return dt('No nodes exist.');
     }
     return '';
   }
   $ret_val = '';
   if (drush_get_option('html') == TRUE) {
     $ret_val .= '<table class="table table-condensed">';
     $ret_val .= "<thead><tr><th>Content Type</th><th>Node Count</th></tr></thead>";
     foreach ($this->registry['content_type_counts'] as $content_type => $count) {
       $ret_val .= "<tr><td>$content_type</td><td>$count</td></tr>";
     }
     $ret_val .= '</table>';
   }
   else {
     $ret_val  = 'Content Type: Count' . PHP_EOL;
     if (!drush_get_option('json')) {
       $ret_val .= str_repeat(' ', 4);
     }
     $ret_val .= '-------------------';
     foreach ($this->registry['content_type_counts'] as $content_type => $count) {
       $ret_val .= PHP_EOL;
       if (!drush_get_option('json')) {
         $ret_val .= str_repeat(' ', 4);
       }
       $ret_val .= $content_type . ': ' . $count;
     }
   }
   return $ret_val;
 }
Пример #12
0
 /**
  * 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;
 }
Пример #13
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo() {
   if (!isset($this->registry['vocabulary_counts'])) {
     return dt('The taxonomy module is not enabled.');
   }
   if (empty($this->registry['vocabulary_counts'])) {
     if (drush_get_option('detail')) {
       return dt('No vocabularies exist.');
     }
     return '';
   }
   $ret_val = '';
   if (drush_get_option('html') == TRUE) {
     $ret_val .= '<table class="table table-condensed">';
     $ret_val .= "<thead><tr><th>Vocabulary</th><th>Terms</th></tr></thead>";
     foreach ($this->registry['vocabulary_counts'] as $vocabulary => $count) {
       $ret_val .= "<tr><td>$vocabulary</td><td>$count</td></tr>";
     }
     $ret_val .= '</table>';
   }
   else {
     $ret_val  = 'Vocabulary: Count' . PHP_EOL;
     if (!drush_get_option('json')) {
       $ret_val .= str_repeat(' ', 4);
     }
     $ret_val .= '-------------------';
     foreach ($this->registry['vocabulary_counts'] as $vocabulary => $count) {
       $ret_val .= PHP_EOL;
       if (!drush_get_option('json')) {
         $ret_val .= str_repeat(' ', 4);
       }
       $ret_val .= $vocabulary . ': ' . $count;
     }
   }
   return $ret_val;
 }
Пример #14
0
 /**
  * Rolls back the configured migrations.
  */
 public function rollback()
 {
     $log = new DrushLogMigrateMessage();
     $query = \Drupal::entityQuery('migration');
     $names = $query->execute();
     // Order the migrations according to their dependencies.
     /** @var MigrationInterface[] $migrations */
     $migrations = \Drupal::entityManager()->getStorage('migration')->loadMultiple($names);
     // Assume we want all those tagged 'Drupal %'.
     foreach ($migrations as $migration_id => $migration) {
         $keep = FALSE;
         $tags = $migration->get('migration_tags');
         foreach ($tags as $tag) {
             if (strpos($tag, 'Drupal ') === 0) {
                 $keep = TRUE;
                 break;
             }
         }
         if (!$keep) {
             unset($migrations[$migration_id]);
         }
     }
     // Roll back in reverse order.
     $this->migrationList = array_reverse($migrations);
     foreach ($this->migrationList as $migration_id => $migration) {
         drush_print(dt('Rolling back @migration', ['@migration' => $migration_id]));
         $executable = new MigrateExecutable($migration, $log);
         // drush_op() provides --simulate support.
         drush_op([$executable, 'rollback']);
         $migration->delete();
     }
 }
 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     $tables = array();
     // Invalidate search indexes. If the search module has never been enabled,
     // then it's not enabled now and this block is skipped.
     if (module_exists('search')) {
         // Call this function to ensure that the necessary search hooks get
         // called.
         search_reindex();
         // Calling search_reindex globally (with no parameters) invokes hooks, but
         // does not truncate the following tables:
         $tables[] = 'search_dataset';
         $tables[] = 'search_index';
         $tables[] = 'search_node_links';
         $tables[] = 'search_total';
     }
     $tables[] = 'accesslog';
     $tables[] = 'node_counter';
     $tables[] = 'batch';
     $tables[] = 'queue';
     $tables[] = 'semaphore';
     $tables[] = 'sessions';
     $tables[] = 'themebuilder_session';
     $this->truncateTables($tables);
 }
Пример #16
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if ($this->registry['cron_last']) {
         return dt('Cron last ran at @date (@ago ago)', array('@date' => date('r', $this->registry['cron_last']), '@ago' => format_interval(time() - $this->registry['cron_last'])));
     }
     return dt('Cron has never run.');
 }
Пример #17
0
 public function createSettingsFile($database, $db_user, $db_cred)
 {
     $web_dir = $this->getDocumentRoot();
     $project_domain = $this->getProjectDomain();
     if (empty($web_dir)) {
         $document_root = $this->getProjectDir();
     } else {
         $document_root = $this->getProjectDir() . '/' . $web_dir;
     }
     $project_site_folder = $document_root . '/sites/' . $project_domain;
     // Create the settings.php file
     $this->settings_generator->generate_file($database, $db_user, $db_cred, $project_domain);
     drush_log(dt('Created the settings.php file.'), 'success');
     // Do we want a multisite setup or not?
     $multi = drush_confirm(dt('Do you want to configure Drupal as a multi site setup (settings.php in a separate sites folder)?'));
     if ($multi) {
         // Create an empty project folder. conf_path(FALSE) will pick it up and take care of the rest
         if (!$this->file_system->checkDir($project_site_folder)) {
             $this->file_system->createDir($project_site_folder);
             $source = $this->getProjectDir() . '/' . $this->getDocumentRoot() . '/sites/default/settings.php';
             $target = $this->getProjectDir() . '/' . $this->getDocumentRoot() . '/sites/' . $this->getProjectDomain() . '/settings.php';
             $this->file_system->moveFile($source, $target);
         }
     }
 }
Пример #18
0
/**
 * Parse a URI or partial URI (including just a port, host IP or path).
 *
 * @param string $uri
 *   String that can contain partial URI.
 *
 * @return array
 *   URI array as returned by parse_url.
 */
function runserver_parse_uri($uri)
{
    if (empty($uri)) {
        return array();
    }
    if ($uri[0] == ':') {
        // ':port/path' shorthand, insert a placeholder hostname to allow parsing.
        $uri = 'placeholder-hostname' . $uri;
    }
    // FILTER_VALIDATE_IP expects '[' and ']' to be removed from IPv6 addresses.
    // We check for colon from the right, since IPv6 addresses contain colons.
    $to_path = trim(substr($uri, 0, strpos($uri, '/')), '[]');
    $to_port = trim(substr($uri, 0, strrpos($uri, ':')), '[]');
    if (filter_var(trim($uri, '[]'), FILTER_VALIDATE_IP) || filter_var($to_path, FILTER_VALIDATE_IP) || filter_var($to_port, FILTER_VALIDATE_IP)) {
        // 'IP', 'IP/path' or 'IP:port' shorthand, insert a schema to allow parsing.
        $uri = 'http://' . $uri;
    }
    $uri = parse_url($uri);
    if (empty($uri)) {
        return drush_set_error('RUNSERVER_INVALID_ADDRPORT', dt('Invalid argument - should be in the "host:port/path" format, numeric (port only) or non-numeric (path only).'));
    }
    if (count($uri) == 1 && isset($uri['path'])) {
        if (is_numeric($uri['path'])) {
            // Port only shorthand.
            $uri['port'] = $uri['path'];
            unset($uri['path']);
        }
    }
    if (isset($uri['host']) && $uri['host'] == 'placeholder-hostname') {
        unset($uri['host']);
    }
    return $uri;
}
Пример #19
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     if ($this->registry['count_users_all'] == 1) {
         return dt('There is one user.');
     }
     return dt('There are @count_users_all users.', array('@count_users_all' => $this->registry['count_users_all']));
 }
Пример #20
0
 /**
  * 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.');
     }
 }
Пример #21
0
 /**
  * {@inheritdoc}
  */
 public function getInfo($name)
 {
     $queues = $this->getQueues();
     if (!isset($queues[$name])) {
         throw new QueueException(dt('Could not find the !name queue.', array('!name' => $name)));
     }
     return $queues[$name];
 }
 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;
 }
Пример #23
0
 function bootstrap_and_dispatch()
 {
     $phases = $this->bootstrap_init_phases();
     $return = '';
     $command_found = FALSE;
     _drush_bootstrap_output_prepare();
     foreach ($phases as $phase) {
         if (drush_bootstrap_to_phase($phase)) {
             $command = drush_parse_command();
             if (is_array($command)) {
                 $command += $this->command_defaults();
                 // Insure that we have bootstrapped to a high enough
                 // phase for the command prior to enforcing requirements.
                 $bootstrap_result = drush_bootstrap_to_phase($command['bootstrap']);
                 $this->enforce_requirement($command);
                 if ($bootstrap_result && empty($command['bootstrap_errors'])) {
                     $this->logger->log(LogLevel::BOOTSTRAP, dt("Found command: !command (commandfile=!commandfile)", array('!command' => $command['command'], '!commandfile' => $command['commandfile'])));
                     $command_found = TRUE;
                     // Dispatch the command(s).
                     $return = drush_dispatch($command);
                     if (drush_get_context('DRUSH_DEBUG') && !drush_get_context('DRUSH_QUIET')) {
                         // @todo Create version independant wrapper around Drupal timers. Use it.
                         drush_print_timers();
                     }
                     break;
                 }
             }
         } else {
             break;
         }
     }
     // TODO: If we could not find a legacy Drush command, try running a
     // command via the Symfony application. See also drush_main() in preflight.inc;
     // ultimately, the Symfony application should be called from there.
     if (!$command_found && isset($command)) {
         $container = \Drush::getContainer();
         $application = $container->get('application');
         $args = drush_get_arguments();
         if (count($args)) {
             $name = $args[0];
             if ($this->hasRegisteredSymfonyCommand($application, $name)) {
                 $command_found = true;
                 $input = drush_symfony_input();
                 $application->run($input);
             }
         }
     }
     if (!$command_found) {
         // If we reach this point, command doesn't fit requirements or we have not
         // found either a valid or matching command.
         $this->report_command_error($command);
     }
     // Prevent a '1' at the end of the output.
     if ($return === TRUE) {
         $return = '';
     }
     return $return;
 }
Пример #24
0
 public function __construct()
 {
     // Drupal 6 has no core queue capabilities, and thus requires contrib.
     if (!module_exists('drupal_queue')) {
         throw new QueueException(dt('The drupal_queue module need to be installed/enabled.'));
     } else {
         drupal_queue_include();
     }
 }
Пример #25
0
 /**
  * @inheritdoc
  */
 public function alter(ContainerBuilder $container)
 {
     drush_log(dt("service modifier alter"), LogLevel::DEBUG);
     // http://symfony.com/doc/2.7/components/dependency_injection/tags.html#register-the-pass-with-the-container
     $container->register('drush.service.consolecommands', 'Drush\\Command\\ServiceCommandlist');
     $container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolecommands', 'console.command'));
     $container->register('drush.service.consolidationcommands', 'Drush\\Command\\ServiceCommandlist');
     $container->addCompilerPass(new FindCommandsCompilerPass('drush.service.consolidationcommands', 'consolidation.commandhandler'));
 }
Пример #26
0
 public function fetch($repository, $working_directory = NULL)
 {
     drush_log(dt('Fetching project data from remote source...'), 'status');
     if (!$working_directory) {
         $working_directory = $this->getProjectDir();
     }
     $this->state->fetch($repository, $working_directory);
     return TRUE;
 }
Пример #27
0
 /**
  * Implements \SiteAudit\Check\Abstract\getResultInfo().
  */
 public function getResultInfo()
 {
     // If two different days...
     if (date('Y-m-d', $this->ageOldest) != date('Y-m-d', $this->ageNewest)) {
         return dt('From @from to @to (@days days)', array('@from' => date('r', $this->ageOldest), '@to' => date('r', $this->ageNewest), '@days' => round(($this->ageNewest - $this->ageOldest) / 86400, 2)));
     }
     // Same day; don't calculate number of days.
     return dt('From @from to @to', array('@from' => date('r', $this->ageOldest), '@to' => date('r', $this->ageNewest)));
 }
Пример #28
0
 /**
  * @inheritdoc
  */
 protected function getContainerBuilder()
 {
     drush_log(dt("get container builder"), LogLevel::DEBUG);
     $container = parent::getContainerBuilder();
     foreach ($this->serviceModifiers as $serviceModifier) {
         $serviceModifier->alter($container);
     }
     return $container;
 }
Пример #29
0
 /**
  * Implements \SiteAudit\Check\Abstract\getAction().
  */
 public function getAction()
 {
     if ($this->score == SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN) {
         return dt('Don\'t rely on symbolic links for core configuration files; copy settings.php where it should be and remove the symbolic link.');
     }
     if ($this->score == SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL) {
         return dt('Even if environment settings are injected, create a stub settings.php file for compatibility.');
     }
 }
Пример #30
0
 /**
  * Implements \SiteAudit\Check\Abstract\getAction().
  */
 public function getAction()
 {
     if ($this->score == SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL) {
         return dt('sites/all is necessary; recreate the directory immediately.');
     }
     if ($this->score == SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN) {
         return dt('Avoid changing Drupal\'s site structure; remove the symbolic link and recreate sites/all.');
     }
 }