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


PHP drush_log函数代码示例

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


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

示例1: start

 /**
  * Starts the batch process depending on where it was requested from.
  */
 public function start()
 {
     switch ($this->batchInfo['from']) {
         case 'form':
             batch_set($this->batch);
             break;
         case 'drush':
             batch_set($this->batch);
             $this->batch =& batch_get();
             $this->batch['progressive'] = FALSE;
             drush_log(t(self::BATCH_INIT_MESSAGE), 'status');
             drush_backend_batch_process();
             break;
         case 'backend':
             batch_set($this->batch);
             $this->batch =& batch_get();
             $this->batch['progressive'] = FALSE;
             batch_process();
             //todo: Does not take advantage of batch API and eventually runs out of memory on very large sites.
             break;
         case 'nobatch':
             $context = [];
             foreach ($this->batch['operations'] as $i => $operation) {
                 $operation[1][] =& $context;
                 call_user_func_array($operation[0], $operation[1]);
             }
             self::finishGeneration(TRUE, $context['results'], []);
             break;
     }
 }
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:33,代码来源:Batch.php

示例2: createSettingsFile

 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);
         }
     }
 }
开发者ID:netsensei,项目名称:Rum,代码行数:25,代码来源:RumSettingsFile.php

示例3: bootstrap_and_dispatch

 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;
 }
开发者ID:catch56,项目名称:drush,代码行数:60,代码来源:DrupalBoot.php

示例4: __construct

 public function __construct($project_name, $project_dir)
 {
     drush_log(dt('Initializing Rum ...'), 'status');
     // Set a few defaults in .drushrc.php. We can overrule these through the cli
     $this->settings_map = array('rum-workspace', 'rum-host', 'rum-os', 'rum-environment', 'rum-docroot', 'rum-project-db-dir');
     foreach ($this->settings_map as $setting) {
         $this->checkSetting($setting);
     }
     // Set the current time once.
     date_default_timezone_set(drush_get_option('rum-timezone', 'Europe/Brussels'));
     $this->date = date("Y-m-d_H-i-s", $_SERVER['REQUEST_TIME']);
     // Set the workspace
     $this->workspace = drush_get_option('rum-workspace', '');
     // Set the hostname of your machine (i.e. netsensei, stalski, swentel, atlas,...)
     $this->host_name = drush_get_option('rum-host', '');
     // Set the type of OS you're using. Rum is not OS aware.
     $this->os = drush_get_option('rum-os', '');
     // Set the environment
     $this->environment = drush_get_option('rum-environment', '');
     // Set the project name
     $this->project_name = $project_name;
     // Set the project_dir for the action on this particular project
     $project_dir = FileSystem::sanitize($project_dir);
     $this->project_dir = $this->workspace . '/' . $project_dir;
     // Generate a domain name. Will be hostname.project_name (i.e. netsensei.foobar)
     $this->project_domain = $this->host_name . '.' . $project_name;
     // Set the default document root of your project i.e. 'www'
     $this->project_docroot = drush_get_option('rum-docroot', '');
     // Set the default db dir where your project db dumps reside i.e. 'db'
     $this->project_db_dir = drush_get_option('rum-project-db-dir', '');
 }
开发者ID:netsensei,项目名称:Rum,代码行数:31,代码来源:Rum.php

示例5: run

 /**
  * {@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;
 }
开发者ID:nrackleff,项目名称:capstone,代码行数:28,代码来源:Queue8.php

示例6: log

 /**
  * {@inheritdoc}
  */
 public function log($level, $message, array $context = array())
 {
     // Translate the RFC logging levels into their Drush counterparts, more or
     // less.
     // @todo ALERT, CRITICAL and EMERGENCY are considered show-stopping errors,
     // and they should cause Drush to exit or panic. Not sure how to handle this,
     // though.
     switch ($level) {
         case LogLevel::ALERT:
         case LogLevel::CRITICAL:
         case LogLevel::EMERGENCY:
         case LogLevel::ERROR:
             $error_type = 'error';
             break;
         case LogLevel::WARNING:
             $error_type = 'warning';
             break;
         case LogLevel::DEBUG:
         case LogLevel::INFO:
         case LogLevel::NOTICE:
             $error_type = 'notice';
             break;
         default:
             $error_type = $level;
             break;
     }
     drush_log($message, $error_type);
 }
开发者ID:nuwud,项目名称:drush,代码行数:31,代码来源:DrushLog.php

示例7: apiGetField

 /**
  * 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);
 }
开发者ID:fluxsauce,项目名称:switchboard,代码行数:17,代码来源:Site.php

示例8: log

 /**
  * {@inheritdoc}
  */
 public function log($level, $message, array $context = array())
 {
     // Translate the RFC logging levels into their Drush counterparts, more or
     // less.
     // @todo ALERT, CRITICAL and EMERGENCY are considered show-stopping errors,
     // and they should cause Drush to exit or panic. Not sure how to handle this,
     // though.
     switch ($level) {
         case RfcLogLevel::ALERT:
         case RfcLogLevel::CRITICAL:
         case RfcLogLevel::EMERGENCY:
         case RfcLogLevel::ERROR:
             $error_type = 'error';
             break;
         case RfcLogLevel::WARNING:
             $error_type = 'warning';
             break;
         case RfcLogLevel::DEBUG:
         case RfcLogLevel::INFO:
         case RfcLogLevel::NOTICE:
             $error_type = 'notice';
             break;
         default:
             $error_type = $level;
             break;
     }
     // Populate the message placeholders and then replace them in the message.
     $message_placeholders = $this->parser->parseMessagePlaceholders($message, $context);
     $message = empty($message_placeholders) ? $message : strtr($message, $message_placeholders);
     drush_log($message, $error_type);
 }
开发者ID:nrackleff,项目名称:capstone,代码行数:34,代码来源:DrushLog.php

示例9: configure_chosen

function configure_chosen()
{
    drush_log('Configuring chosen', 'ok');
    variable_set('chosen_minimum_multiple', '26');
    variable_set('chosen_minimum_single', '99');
    variable_set('chosen_disable_search_threshold', '32');
    variable_set('chosen_minimum_width', '300');
}
开发者ID:enriquesanchezhernandez,项目名称:campaigns,代码行数:8,代码来源:post-update.php

示例10: getContainerBuilder

 /**
  * @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;
 }
开发者ID:hanoii,项目名称:drush,代码行数:12,代码来源:DrupalKernel.php

示例11: fetch

 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;
 }
开发者ID:netsensei,项目名称:Rum,代码行数:9,代码来源:RumState.php

示例12: alter

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

示例13: valid_credentials

 public function valid_credentials($db_spec)
 {
     // Drupal >=7 requires PDO and Drush requires php 5.6+ which ships with PDO
     // but it may be compiled with --disable-pdo.
     if (!class_exists('\\PDO')) {
         drush_log(dt('PDO support is required.'), LogLevel::BOOTSTRAP);
         return FALSE;
     }
     return TRUE;
 }
开发者ID:jibran,项目名称:drush,代码行数:10,代码来源:SqlVersion.php

示例14: createdb

 /**
  * Create a new database.
  *
  * @param boolean $quoted
  *   Quote the database name. Mysql uses backticks to quote which can cause problems
  *   in a Windows shell. Set TRUE if the CREATE is not running on the bash command line.
  */
 public function createdb($quoted = FALSE)
 {
     // Make sure sqlite can create file
     $file = $this->db_spec['database'];
     $path = dirname($file);
     drush_log("SQLITE: creating '{$path}' for creating '{$file}'", 'debug');
     drush_mkdir($path);
     if (!file_exists($path)) {
         drush_log("SQLITE: Cannot create {$path}", 'error');
     }
 }
开发者ID:catch56,项目名称:drush,代码行数:18,代码来源:Sqlsqlite.php

示例15: destroy

 /**
  * Destroy the SQLite database.
  */
 public static function destroy()
 {
     $location = Sqlite::getLocation();
     drush_log(dt('Destroying SQLite database at @location', array('@location' => $location)));
     if (file_exists($location)) {
         unlink($location);
         drush_cache_clear_all('brain_path', 'switchboard', TRUE);
         drush_log(dt('SQLite database removed.'));
     } else {
         drush_log(dt('SQLite database does not exist, nothing to remove.'));
     }
 }
开发者ID:fluxsauce,项目名称:switchboard,代码行数:15,代码来源:Sqlite.php


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