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


PHP WP_CLI::Success方法代码示例

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


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

示例1: deactivate

 /**
  * Deactivate ElasticPress
  *
  * @since 0.9.3
  */
 public function deactivate()
 {
     $this->_connect_check();
     $status = ep_is_activated();
     if (!$status) {
         WP_CLI::warning('ElasticPress is already deactivated.');
     } else {
         WP_CLI::log('ElasticPress is currently activated, deactivating...');
         $result = ep_deactivate();
         if ($result) {
             WP_CLI::Success('ElasticPress was deactivated!');
         } else {
             WP_CLI::warning('ElasticPress was unable to be deactivated.');
         }
     }
 }
开发者ID:Blueprint-Marketing,项目名称:ElasticPress,代码行数:21,代码来源:wp-cli.php

示例2: purge

 /**
  * Migrates records from the legacy custom tables into custom post type
  *
  * ## OPTIONS
  *
  * [<days_old>]
  * Delete entries older than this many days, defaults to whatever you
  * have configured in the plugin settings
  *
  * --dry-run
  * Shows number of entries that would be deleted but does not
  * delete them
  * 
  * ## EXAMPLES
  *
  *     wp rest-api-log purge
  *
  *     wp rest-api-log purge 90
  *
  * @synopsis [<days_old>] [--dry-run]
  */
 function purge($positional_args, $assoc_args = array())
 {
     $days_old = absint(!empty($positional_args[0]) ? $positional_args[0] : 0);
     $dry_run = !empty($assoc_args['dry-run']);
     WP_CLI::Line("Purging old REST API log entries...");
     $log = new WP_REST_API_Log();
     $number_deleted = $log->purge_old_records($days_old, $dry_run);
     WP_CLI::Success(sprintf("%d entries purged", $number_deleted));
 }
开发者ID:petenelson,项目名称:wp-rest-api-log,代码行数:30,代码来源:class-wp-rest-api-log-wp-cli-log.php


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