当前位置: 首页>>代码示例>>PHP>>正文


PHP drush_print函数代码示例

本文整理汇总了PHP中drush_print函数的典型用法代码示例。如果您正苦于以下问题:PHP drush_print函数的具体用法?PHP drush_print怎么用?PHP drush_print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drush_print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rollback

 /**
  * 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();
     }
 }
开发者ID:dmyerson,项目名称:d8ecs,代码行数:35,代码来源:MigrateUpgradeDrushRunner.php

示例2: handle

 /**
  * 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);
 }
开发者ID:robtryson,项目名称:nysits,代码行数:29,代码来源:AcsfDuplicationScrubTruncateTablesHandler.php

示例3: druplicon

 /**
  * 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);
     }
 }
开发者ID:jibran,项目名称:drush,代码行数:36,代码来源:DrupliconCommands.php

示例4: handle

 /**
  * 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);
     }
 }
开发者ID:robtryson,项目名称:nysits,代码行数:37,代码来源:AcsfDuplicationScrubCommentHandler.php

示例5: process

 /**
  * @param string $source
  * @param string $destination
  * @param array $options
  *
  * @return string
  */
 public function process($source, $destination, $options = array())
 {
     $command = $this->buildCommandLine($source, $destination, $options);
     if (!empty($options['debug'])) {
         drush_print('$> ' . $command);
     }
     passthru($command);
 }
开发者ID:smalot,项目名称:drush-cerbere,代码行数:15,代码来源:Svn.php

示例6: show_options

function show_options(array $commands = array())
{
    drush_print(t('Please type one of the following options to continue:'));
    show_help($commands);
    $handle = fopen("php://stdin", "r");
    $line = fgets($handle);
    run(trim($line), $commands);
}
开发者ID:NYULibraries,项目名称:dlts_viewer_distro,代码行数:8,代码来源:export.php

示例7: druplicon

 /**
  * Print druplicon as post-command output.
  *
  * @hook post-command *
  * @option $druplicon Shows the druplicon as glorious ASCII art.
  */
 public function druplicon()
 {
     if (drush_get_option('druplicon')) {
         $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');
         }
         drush_print($content);
     }
 }
开发者ID:phenaproxima,项目名称:drush,代码行数:18,代码来源:DrupliconCommands.php

示例8: import

 /**
  * Run the configured migrations.
  */
 public function import()
 {
     $log = new DrushLogMigrateMessage();
     foreach ($this->migrationList as $migration_id) {
         /** @var MigrationInterface $migration */
         $migration = Migration::load($migration_id);
         drush_print(dt('Upgrading !migration', ['!migration' => $migration_id]));
         $executable = new MigrateExecutable($migration, $log);
         // drush_op() provides --simulate support.
         drush_op([$executable, 'import']);
     }
 }
开发者ID:Wylbur,项目名称:eight,代码行数:15,代码来源:MigrateUpgradeDrushRunner.php

示例9: printAsset

 /**
  * @todo document
  */
 public function printAsset($asset)
 {
     if (is_string($asset)) {
         $asset = isset($this->assets[$asset]) ? $this->assets[$asset] : FALSE;
     }
     if ($asset instanceof Asset) {
         $width = drush_get_context('DRUSH_COLUMNS', 80);
         if ($width > 80) {
             $width = 80;
         }
         drush_print(dt("@name\n!separator\n!table", array('@name' => $asset->getName(), '!separator' => str_repeat('_', $width), '!table' => $asset->table())));
     }
 }
开发者ID:markcarver,项目名称:drush-lwg,代码行数:16,代码来源:ActionList.php

示例10: handle

 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     $enable_for_scrub = acsf_vget('acsf_duplication_enable_for_scrub', array());
     if (!empty($enable_for_scrub)) {
         require_once DRUPAL_ROOT . '/includes/install.inc';
         // Re-disable modules that were disabled prior to starting the scrubbing
         // process, and enabled only for scrubbing.
         module_disable($enable_for_scrub);
         // Uninstall these modules. Drupal will drop their tables and any orphaned
         // data remaining in them.
         drupal_uninstall_modules($enable_for_scrub);
     }
 }
开发者ID:robtryson,项目名称:nysits,代码行数:17,代码来源:AcsfDuplicationScrubModuleDisableHandler.php

示例11: handle

 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     if (!$this->isComplete()) {
         $site = acsf_get_acsf_site();
         $site->clean();
         variable_del('acsf_duplication_scrub_status');
         variable_set('site_name', $this->event->context['site_name']);
         variable_set('install_time', time());
         // As a preparatory step, remove any corrupt file entries that may prevent
         // duplication from succeeding. Specifically, remove any file with an
         // empty URI string.
         db_delete('file_managed')->condition('uri', '')->execute();
         $this->setComplete();
     }
 }
开发者ID:robtryson,项目名称:nysits,代码行数:19,代码来源:AcsfDuplicationScrubInitializeHandler.php

示例12: render

 public function render()
 {
     $reporters = module_implements('prod_monitor_summary');
     $lines = array();
     // D7 hooks
     foreach ($reporters as $i => $module) {
         $new_lines = module_invoke($module, 'prod_monitor_summary');
         if (!is_array($new_lines)) {
             throw new MonitoringException($module . ' has invalid output format');
         }
         $lines = array_merge($lines, new_lines);
     }
     // Listeners should call AddOutputLine() on ourself
     $this->notify(ProdObservable::SIGNAL_MONITOR_SUMMARY);
     $lines = array_merge($lines, $this->_lines);
     foreach ($lines as $line) {
         drush_print($line, 0, NULL, TRUE);
     }
 }
开发者ID:regilero,项目名称:prod,代码行数:19,代码来源:Cacti.php

示例13: handle

 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     // Remove all temporary files. This code is copied from system_cron() so see
     // that function for more details. Some highlights:
     // - It's unclear if the status field can ever be anything other than 0
     //   (temporary) or 1 (permanenet), but system_cron() uses the bitwise &
     //   operator, so apparently, it thinks additional status bit fields are
     //   possible.
     // - It's unclear why <> is used instead of != for ("not equal").
     // - Separate placeholders are used instead of a single ":permanent" due to
     //   a bug in some PHP versions (see system_cron() for the d.o. issue link).
     $fids = db_query('SELECT fid FROM {file_managed} WHERE status & :permanent1 <> :permanent2 LIMIT 1000', array(':permanent1' => FILE_STATUS_PERMANENT, ':permanent2' => FILE_STATUS_PERMANENT))->fetchCol();
     foreach ($fids as $fid) {
         if ($file = file_load($fid)) {
             file_delete($file);
         }
     }
 }
开发者ID:robtryson,项目名称:nysits,代码行数:22,代码来源:AcsfDuplicationScrubTemporaryFilesHandler.php

示例14: handle

 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     // Enable any modules that are currently disabled, but were once enabled, so
     // that their data cleanup hooks (e.g. hook_user_delete) and functions
     // (e.g. search_reindex) can be invoked.
     //
     // Note: These modules will all be uninstalled. Uninstalling them should
     // really take care of all the cleanup these modules should be doing. But
     // enable them here for good measure just incase there's some cleanup
     // depending on these hooks.
     require_once DRUPAL_ROOT . '/includes/install.inc';
     $modules = system_rebuild_module_data();
     $enable_for_scrub = array();
     foreach ($modules as $module) {
         // Disabled modules with schema_version > -1 have not been uninstalled.
         if (empty($module->status) && $module->schema_version > SCHEMA_UNINSTALLED) {
             $enable_for_scrub[] = $module->name;
         }
     }
     // Get a list of disabled dependencies. These will get automatically enabled
     // during module_enable(), but we want to be able to disable and uninstall
     // them explicitly later.
     foreach ($enable_for_scrub as $dependent) {
         foreach (array_keys($modules[$dependent]->requires) as $dependency) {
             // Use isset() to make sure the module is still in the filesystem before
             // trying to enable it. (Historically there have been modules in Gardens
             // which were disabled but then removed from the codebase without ever
             // uninstalling them, and we don't want to try to enable those now,
             // because it will fail.)
             if (isset($modules[$dependency]) && empty($modules[$dependency]->status)) {
                 $enable_for_scrub[] = $dependency;
             }
         }
     }
     module_enable($enable_for_scrub);
     acsf_vset('acsf_duplication_enable_for_scrub', $enable_for_scrub, 'acsf_duplication_scrub');
 }
开发者ID:robtryson,项目名称:nysits,代码行数:41,代码来源:AcsfDuplicationScrubModuleEnableHandler.php

示例15: handle

 /**
  * Implements AcsfEventHandler::handle().
  */
 public function handle()
 {
     drush_print(dt('Entered @class', array('@class' => get_class($this))));
     // Clear the theme field so all users will use the default theme.
     db_update('users')->fields(array('theme' => 0))->execute();
     // Clear any in-progress multistep forms that are not normally wiped during
     // cache-clear. The other caches are expected to be cleared externally from
     // this process.
     cache_clear_all('*', 'cache_form', TRUE);
     // Clean up ACSF variables.
     $acsf_variables = acsf_vget_group('acsf_duplication_scrub');
     foreach ($acsf_variables as $name => $value) {
         acsf_vdel($name);
     }
     // Begin the site without any watchdog records. This should happen right at
     // the end of the scubbing process to remove any log entries added by the
     // scrubbing process itself.
     if (db_table_exists('watchdog')) {
         db_delete('watchdog')->execute();
     }
     // Mark the entire scrubbing process as complete.
     variable_set('acsf_duplication_scrub_status', 'complete');
 }
开发者ID:robtryson,项目名称:nysits,代码行数:26,代码来源:AcsfDuplicationScrubFinalizeHandler.php


注:本文中的drush_print函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。