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


PHP WP_CLI::debug方法代码示例

本文整理汇总了PHP中WP_CLI::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_CLI::debug方法的具体用法?PHP WP_CLI::debug怎么用?PHP WP_CLI::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_CLI的用法示例。


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

示例1: tgz

 protected static function tgz($args, $assoc_args)
 {
     @(list($repo, $tag) = $args);
     $url = sprintf("https://bitbucket.org/%s/get/%s.tar.gz", $repo, $tag ?: 'master');
     if (array_intersect_key($assoc_args, array('key' => TRUE, 'secret' => TRUE))) {
         WP_CLI::debug("Fetching {$url} via OAuth");
         $tgz = self::fetch_tarball_via_oauth($assoc_args['key'], $assoc_args['secret'], $url);
     } else {
         WP_CLI::debug("Fetching {$url} via cURL");
         $tgz = self::fetch_tarball($url);
     }
     WP_CLI::debug("Fetched {$tgz}");
     WP_CLI::debug("Converting {$tgz} to zip");
     $zip = self::tgz_to_zip($repo, $tgz);
     WP_CLI::debug("Converted {$tgz} to {$zip}");
     return array($url, $tgz, $zip);
 }
开发者ID:nickbreen,项目名称:docker-wp-setup,代码行数:17,代码来源:Bitbucket_Command.php

示例2: tgz

 protected static function tgz($args, $assoc_args)
 {
     @(list($repo, $tag) = $args);
     // Get the tarball URL for the latest (or specified release)
     $url = sprintf("https://api.github.com/repos/%s/releases/%s", $repo, $tag ? "tags/{$tag}" : 'latest');
     WP_CLI::debug("Querying for releases: {$url}");
     $url = self::tarball_url($url, @$assoc_args['token']);
     // If no releases are available fail-back to a commitish
     if ($url) {
         WP_CLI::log("Found release: {$url}");
     } else {
         $url = sprintf("https://api.github.com/repos/%s/tarball/%s", $repo, $tag ?: 'master');
     }
     WP_CLI::debug("Fetching {$url}");
     $tgz = self::fetch_tarball($url, @$assoc_args['token']);
     WP_CLI::debug("Fetched {$tgz}");
     WP_CLI::debug("Converting {$tgz} to zip");
     $zip = self::tgz_to_zip($repo, $tgz);
     WP_CLI::debug("Converted {$tgz} to {$zip}");
     return array($url, $tgz, $zip);
 }
开发者ID:nickbreen,项目名称:docker-wp-setup,代码行数:21,代码来源:GitHub_Command.php

示例3: after_wp_load

 /**
  * Register's all endpoints as commands once WP and WC have all loaded.
  */
 public static function after_wp_load()
 {
     global $wp_rest_server;
     $wp_rest_server = new WP_REST_Server();
     do_action('rest_api_init', $wp_rest_server);
     $request = new WP_REST_Request('GET', '/');
     $request->set_param('context', 'help');
     $response = $wp_rest_server->dispatch($request);
     $response_data = $response->get_data();
     if (empty($response_data)) {
         return;
     }
     // Loop through all of our endpoints and register any valid WC endpoints.
     foreach ($response_data['routes'] as $route => $route_data) {
         // Only register WC endpoints
         if (substr($route, 0, 4) !== '/wc/') {
             continue;
         }
         // Only register endpoints with schemas
         if (empty($route_data['schema']['title'])) {
             WP_CLI::debug(sprintf(__('No schema title found for %s, skipping REST command registration.', 'woocommerce'), $route), 'wc');
             continue;
         }
         // Ignore batch endpoints
         if ('batch' === $route_data['schema']['title']) {
             continue;
         }
         // Disable specific endpoints
         $route_pieces = explode('/', $route);
         $endpoint_piece = str_replace('/wc/' . $route_pieces[2] . '/', '', $route);
         if (in_array($endpoint_piece, self::$disabled_endpoints)) {
             continue;
         }
         self::register_route_commands(new WC_CLI_REST_Command($route_data['schema']['title'], $route, $route_data['schema']), $route, $route_data);
     }
 }
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:39,代码来源:class-wc-cli-runner.php

示例4: apply

 protected static function apply($cmd, $args, $assoc_args)
 {
     $op = array_shift($args);
     list($url, $tgz, $zip) = static::tgz($args, $assoc_args);
     WP_CLI::debug("Installing from {$zip}");
     WP_CLI::run_command(array($cmd, $op, $zip), array('force' => 1));
     WP_CLI::debug("Removing {$tgz}, {$zip}");
     unlink($tgz);
     unlink($zip);
 }
开发者ID:nickbreen,项目名称:docker-wp-setup,代码行数:10,代码来源:SCM_Command.php

示例5: set_url

 /**
  * Set the context in which WP-CLI should be run
  */
 public static function set_url($url)
 {
     WP_CLI::debug('Set URL: ' . $url);
     $url_parts = Utils\parse_url($url);
     self::set_url_params($url_parts);
 }
开发者ID:pardakhtchi,项目名称:wp-cli,代码行数:9,代码来源:class-wp-cli.php

示例6: load_wordpress_with_template

 /**
  * Runs through the entirety of the WP bootstrap process
  */
 private function load_wordpress_with_template()
 {
     global $wp_query;
     WP_CLI::get_runner()->load_wordpress();
     // Set up the main WordPress query.
     wp();
     $interpreted = array();
     foreach ($wp_query as $key => $value) {
         if (0 === stripos($key, 'is_') && $value) {
             $interpreted[] = $key;
         }
     }
     WP_CLI::debug('Main WP_Query: ' . implode(', ', $interpreted), 'redis-debug');
     define('WP_USE_THEMES', true);
     add_filter('template_include', function ($template) {
         $display_template = str_replace(dirname(get_template_directory()) . '/', '', $template);
         WP_CLI::debug("Theme template: {$display_template}", 'redis-debug');
         return $template;
     }, 999);
     // Template is normally loaded in global scope, so we need to replicate
     foreach ($GLOBALS as $key => $value) {
         global ${$key};
     }
     // Load the theme template.
     ob_start();
     require_once ABSPATH . WPINC . '/template-loader.php';
     ob_get_clean();
 }
开发者ID:pantheon-systems,项目名称:wp-redis,代码行数:31,代码来源:cli.php

示例7: debug

 /**
  * @param string $message
  */
 public function debug($message)
 {
     \WP_CLI::debug($message);
 }
开发者ID:eriktorsner,项目名称:wp-bootstrap,代码行数:7,代码来源:CliWrapper.php

示例8: log

 /**
  * Allows us to log if we are using WP_CLI to fire this cron task
  *
  * @see    http://wp-cli.org/docs/internal-api/#output
  *
  * @param  string $type    What kind of log is this
  * @param  string $message message displayed
  *
  * @return void
  */
 public function log($type = 'colorize', $message = '')
 {
     // Log on our Structure
     Tribe__Main::instance()->log()->log_debug($message, 'aggregator');
     // Only go further if we have WP_CLI
     if (!class_exists('WP_CLI')) {
         return false;
     }
     switch ($type) {
         case 'error':
             WP_CLI::error($message);
             break;
         case 'warning':
             WP_CLI::warning($message);
             break;
         case 'success':
             WP_CLI::success($message);
             break;
         case 'debug':
             WP_CLI::debug($message, 'aggregator');
             break;
         case 'colorize':
         default:
             WP_CLI::log(WP_CLI::colorize($message));
             break;
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:37,代码来源:Cron.php

示例9: do_request

    /**
     * Do a REST Request
     *
     * @param string $method
     *
     */
    private function do_request($method, $route, $assoc_args)
    {
        if (!defined('REST_REQUEST')) {
            define('REST_REQUEST', true);
        }
        $request = new WP_REST_Request($method, $route);
        if (in_array($method, array('POST', 'PUT'))) {
            $request->set_body_params($assoc_args);
        } else {
            foreach ($assoc_args as $key => $value) {
                $request->set_param($key, $value);
            }
        }
        if (defined('SAVEQUERIES') && SAVEQUERIES) {
            $original_queries = is_array($GLOBALS['wpdb']->queries) ? array_keys($GLOBALS['wpdb']->queries) : array();
        }
        $response = rest_do_request($request);
        if (defined('SAVEQUERIES') && SAVEQUERIES) {
            $performed_queries = array();
            foreach ((array) $GLOBALS['wpdb']->queries as $key => $query) {
                if (in_array($key, $original_queries)) {
                    continue;
                }
                $performed_queries[] = $query;
            }
            usort($performed_queries, function ($a, $b) {
                if ($a[1] === $b[1]) {
                    return 0;
                }
                return $a[1] > $b[1] ? -1 : 1;
            });
            $query_count = count($performed_queries);
            $query_total_time = 0;
            foreach ($performed_queries as $query) {
                $query_total_time += $query[1];
            }
            $slow_query_message = '';
            if ($performed_queries && 'wc' === WP_CLI::get_config('debug')) {
                $slow_query_message .= '. Ordered by slowness, the queries are:' . PHP_EOL;
                foreach ($performed_queries as $i => $query) {
                    $i++;
                    $bits = explode(', ', $query[2]);
                    $backtrace = implode(', ', array_slice($bits, 13));
                    $seconds = round($query[1], 6);
                    $slow_query_message .= <<<EOT
{$i}:
- {$seconds} seconds
- {$backtrace}
- {$query[0]}
EOT;
                    $slow_query_message .= PHP_EOL;
                }
            } elseif ('wc' !== WP_CLI::get_config('debug')) {
                $slow_query_message = '. Use --debug=wc to see all queries.';
            }
            $query_total_time = round($query_total_time, 6);
            WP_CLI::debug("wc command executed {$query_count} queries in {$query_total_time} seconds{$slow_query_message}", 'wc');
        }
        if ($error = $response->as_error()) {
            WP_CLI::error($error);
        }
        return array($response->get_status(), $response->get_data(), $response->get_headers());
    }
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:69,代码来源:class-wc-cli-rest-command.php


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