PHP 클래스 Site_Command, wp-cli

## EXAMPLES # Create site $ wp site create --slug=example Success: Site 3 created: www.example.com/example/ # Output a simple list of site URLs $ wp site list --field=url http://www.example.com/ http://www.example.com/subdir/ # Delete site $ wp site delete 123 Are you sure you want to delete the 'http://www.example.com/example' site? [y/n] y Success: The site at 'http://www.example.com/example' was deleted.
상속: extends WP_CLI\CommandWithDBObject
파일 보기 프로젝트 열기: wp-cli/wp-cli

보호된 프로퍼티들

프로퍼티 타입 설명
$obj_id_key
$obj_type

공개 메소드들

메소드 설명
__construct ( )
_empty ( $args, $assoc_args ) Empty a site of its content (posts, comments, terms, and meta).
activate ( $args ) Activate one or more sites.
archive ( $args ) Archive one or more sites.
create ( $_, $assoc_args ) Create a site in a multisite install.
deactivate ( $args ) Deactivate one or more sites.
delete ( $args, $assoc_args ) Delete a site in a multisite install.
list_ ( $_, $assoc_args ) List all sites in a multisite install.
spam ( $args ) Mark one or more sites as spam.
unarchive ( $args ) Unarchive one or more sites.
unspam ( $args ) Remove one or more sites from spam.

비공개 메소드들

메소드 설명
_empty_comments ( ) Delete comments.
_empty_posts ( ) Delete all posts.
_empty_taxonomies ( ) Delete terms, taxonomies, and tax relationships.
_get_network ( integer $network_id ) : boolean | array Get network data for a given id.
_insert_default_terms ( ) Insert default terms.
update_site_status ( $ids, $pref, $value )

메소드 상세

__construct() 공개 메소드

public __construct ( )

_empty() 공개 메소드

Truncates posts, comments, and terms tables to empty a site of its content. Doesn't affect site configuration (options) or users. If running a persistent object cache, make sure to flush the cache after emptying the site, as the cache values will be invalid otherwise. To also empty custom database tables, you'll need to hook into command execution: WP_CLI::add_hook( 'after_invoke:site empty', function(){ global $wpdb; foreach( array( 'p2p', 'p2pmeta' ) as $table ) { $table = $wpdb->$table; $wpdb->query( "TRUNCATE $table" ); } }); ## OPTIONS [--uploads] : Also delete *all* files in the site's in the uploads directory. [--yes] : Proceed to empty the site without a confirmation prompt. ## EXAMPLES $ wp site empty Are you sure you want to empty the site at http://www.example.com of all posts, comments, and terms? [y/n] y Success: The site at 'http://www.example.com' was emptied.
public _empty ( $args, $assoc_args )

activate() 공개 메소드

## OPTIONS ... : One or more IDs of sites to activate. ## EXAMPLES $ wp site activate 123 Success: Site 123 activated.
public activate ( $args )

archive() 공개 메소드

## OPTIONS ... : One or more IDs of sites to archive. ## EXAMPLES $ wp site archive 123 Success: Site 123 archived.
public archive ( $args )

create() 공개 메소드

## OPTIONS --slug= : Path for the new site. Subdomain on subdomain installs, directory on subdirectory installs. [--title=] : Title of the new site. Default: prettified slug. [--email=<email>] : Email for Admin user. User will be created if none exists. Assignement to Super Admin if not included. [--network_id=<network-id>] : Network to associate new site with. Defaults to current network (typically 1). [--private] : If set, the new site will be non-public (not indexed) [--porcelain] : If set, only the site id will be output on success. ## EXAMPLES $ wp site create --slug=example Success: Site 3 created: http://www.example.com/example/ </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-create">create</a></span> ( <span class="param-name">$_</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-deactivate"> <div class="row"> <div class="col-md-6"> <h3> deactivate() <span class="modifier">공개</span > <span>메소드</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/ko/method/-/Site_Command/deactivate/-" rel="nofollow" title="Site_Command::deactivate 메소드의 소스 코드"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-deactivate" title="Site_Command::deactivate 메소드 문서로의 직접 링크"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS <id>... : One or more IDs of sites to deactivate. ## EXAMPLES $ wp site deactivate 123 Success: Site 123 deactivated. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-deactivate">deactivate</a></span> ( <span class="param-name">$args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-delete"> <div class="row"> <div class="col-md-6"> <h3> delete() <span class="modifier">공개</span > <span>메소드</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/ko/method/-/Site_Command/delete/-" rel="nofollow" title="Site_Command::delete 메소드의 소스 코드"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-delete" title="Site_Command::delete 메소드 문서로의 직접 링크"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS [<site-id>] : The id of the site to delete. If not provided, you must set the --slug parameter. [--slug=<slug>] : Path of the blog to be deleted. Subdomain on subdomain installs, directory on subdirectory installs. [--yes] : Answer yes to the confirmation message. [--keep-tables] : Delete the blog from the list, but don't drop it's tables. ## EXAMPLES $ wp site delete 123 Are you sure you want to delete the http://www.example.com/example site? [y/n] y Success: The site at 'http://www.example.com/example' was deleted. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-delete">delete</a></span> ( <span class="param-name">$args</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-list_"> <div class="row"> <div class="col-md-6"> <h3> list_() <span class="modifier">공개</span > <span>메소드</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/ko/method/-/Site_Command/list_/-" rel="nofollow" title="Site_Command::list_ 메소드의 소스 코드"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-list_" title="Site_Command::list_ 메소드 문서로의 직접 링크"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS [--network=<id>] : The network to which the sites belong. [--<field>=<value>] : Filter by one or more fields (see "Available Fields" section). However, 'url' isn't an available filter, because it's created from domain + path. [--field=<field>] : Prints the value of a single field for each site. [--fields=<fields>] : Comma-separated list of fields to show. [--format=<format>] : Render output in a particular format. --- default: table options: - table - csv - count - ids - json - yaml --- ## AVAILABLE FIELDS These fields will be displayed by default for each site: * blog_id * url * last_updated * registered These fields are optionally available: * site_id * domain * path * public * archived * mature * spam * deleted * lang_id ## EXAMPLES # Output a simple list of site URLs $ wp site list --field=url http://www.example.com/ http://www.example.com/subdir/ </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-list_">list_</a></span> ( <span class="param-name">$_</span>, <span class="param-name">$assoc_args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-spam"> <div class="row"> <div class="col-md-6"> <h3> spam() <span class="modifier">공개</span > <span>메소드</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/ko/method/-/Site_Command/spam/-" rel="nofollow" title="Site_Command::spam 메소드의 소스 코드"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-spam" title="Site_Command::spam 메소드 문서로의 직접 링크"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS <id>... : One or more IDs of sites to be marked as spam. ## EXAMPLES $ wp site spam 123 Success: Site 123 marked as spam. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-spam">spam</a></span> ( <span class="param-name">$args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-unarchive"> <div class="row"> <div class="col-md-6"> <h3> unarchive() <span class="modifier">공개</span > <span>메소드</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/ko/method/-/Site_Command/unarchive/-" rel="nofollow" title="Site_Command::unarchive 메소드의 소스 코드"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-unarchive" title="Site_Command::unarchive 메소드 문서로의 직접 링크"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS <id>... : One or more IDs of sites to unarchive. ## EXAMPLES $ wp site unarchive 123 Success: Site 123 unarchived. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-unarchive">unarchive</a></span> ( <span class="param-name">$args</span> ) </td> </tr> </table> </div> </div> </div> <div class="method-descr-full" id="method-unspam"> <div class="row"> <div class="col-md-6"> <h3> unspam() <span class="modifier">공개</span > <span>메소드</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://src.hotexamples.com/ko/method/-/Site_Command/unspam/-" rel="nofollow" title="Site_Command::unspam 메소드의 소스 코드"><i class='icon-borderless icon-eye'></i></a> <a rel="nofollow" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-unspam" title="Site_Command::unspam 메소드 문서로의 직접 링크"><i class='icon-borderless icon-link'></i></a> </div> </div> <div class="row"> <div class="col-md-12"> ## OPTIONS <id>... : One or more IDs of sites to remove from spam. ## EXAMPLES $ wp site unspam 123 Success: Site 123 removed from spam. </div> </div> <div class="row doc-tags"> <div class="col-md-12"> <div class="tag-block tag-summary"> </div> <div class="tag-block tag-remarks"> </div> <div class="tag-block tag-exception"> </div> <div class="tag-block tag-see"> </div> <div class="tag-block tag-link"> </div> <div class="tag-block tag-deprecated"> </div> <div class="tag-block tag-since"> </div> <div class="tag-block tag-author"> </div> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <tr> <td colspan="3" class="rendered"> <span class="modifier">public</span > <span class="method-name"><a class="method-link" href="https://doc.hotexamples.com/ko/class/-/Site_Command#method-unspam">unspam</a></span> ( <span class="param-name">$args</span> ) </td> </tr> </table> </div> </div> </div> <h2>프로퍼티 상세</h2> <div class="property-descr-full" id="prop-obj_id_key"> <div class="row"> <div class="col-md-6"> <h3 class="name">$obj_id_key <span>보호되어 있는 프로퍼티</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://doc.hotexamples.com/ko/class/-/Site_Command#prop-obj_id_key" title="Site_Command::obj_id_key 프로퍼티 문서로의 직접 링크"> <i class='icon-borderless icon-link'></i> </a> </div> </div> <div class="row"> <div class="col-md-12"> </div> </div> <div class="row doc-tags"> <div class="col-md-12"> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <!-- <tr> <td colspan="3"></td> </tr> --> <tr> <td colspan="3" class="rendered"> <span class="modifier">protected</span > <span class="var-name">$obj_id_key</span> </td> </tr> </table> </div> </div> </div> <div class="property-descr-full" id="prop-obj_type"> <div class="row"> <div class="col-md-6"> <h3 class="name">$obj_type <span>보호되어 있는 프로퍼티</span> </h3> </div> <div class="col-md-6 actions"> <a href="https://doc.hotexamples.com/ko/class/-/Site_Command#prop-obj_type" title="Site_Command::obj_type 프로퍼티 문서로의 직접 링크"> <i class='icon-borderless icon-link'></i> </a> </div> </div> <div class="row"> <div class="col-md-12"> </div> </div> <div class="row doc-tags"> <div class="col-md-12"> </div> </div> <div class="row"> <div class="col-md-12" style="overflow: auto"> <table class="table table-striped"> <!-- <tr> <td colspan="3"></td> </tr> --> <tr> <td colspan="3" class="rendered"> <span class="modifier">protected</span > <span class="var-name">$obj_type</span> </td> </tr> </table> </div> </div> </div> </div> </div> </div></div> <footer class="footer"> <div class="container"> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://hotexamples.com/ko/site/trends?type=php%7Cf">상위 함수들</a> | <a href="https://hotexamples.com/ko/site/trends?type=php%7Cc"> 상위 클래스들 </a> | <a href="https://doc.hotexamples.com/ko/doc/map">문서</a> | <a href="/site/privacy">개인정보 보호정책</a> | <a href="https://cpp.hotexamples.com/direct-sales.html">Advertise with us</a> </div> </div> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://hotexamples.com/ko/">PHP</a> | <a href="https://csharp.hotexamples.com/ko/">C# (CSharp)</a> | <a href="https://java.hotexamples.com/ko/">Java</a> | <a href="https://golang.hotexamples.com/ko/">Golang</a> | <a href="https://cpp.hotexamples.com/ko/">C++ (Cpp)</a> | <a href="https://python.hotexamples.com/ko/">Python</a> | <a href="https://javascript.hotexamples.com/ko/">JavaScript</a> | <a href="https://typescript.hotexamples.com/ko/">TypeScript</a> </div> </div> <div class="row"> <div class="col-md-12" style="text-align: center"> <a href="https://doc.hotexamples.com/class/-/Site_Command">EN</a> | <a href="https://doc.hotexamples.com/ru/class/-/Site_Command">RU</a> | <a href="https://doc.hotexamples.com/de/class/-/Site_Command">DE</a> | <a href="https://doc.hotexamples.com/fr/class/-/Site_Command">FR</a> | <a href="https://doc.hotexamples.com/es/class/-/Site_Command">ES</a> | <a href="https://doc.hotexamples.com/pt/class/-/Site_Command">PT</a> | <a href="https://doc.hotexamples.com/it/class/-/Site_Command">IT</a> | <a href="https://doc.hotexamples.com/jp/class/-/Site_Command">JP</a> | <a href="https://doc.hotexamples.com/zh/class/-/Site_Command">ZH</a> | <a href="https://doc.hotexamples.com/ko/class/-/Site_Command">KO</a> </div> </div> <div class="row"> <div class="col-md-10 col-md-offset-1"> </div> <div class="col-md-1"> <!--LiveInternet counter--> <script type="text/javascript"><!-- document.write("<a href='//www.liveinternet.ru/click' " + "target=_blank><img src='//counter.yadro.ru/hit?t44.6;r" + escape(document.referrer) + ((typeof (screen) == "undefined") ? "" : ";s" + screen.width + "*" + screen.height + "*" + (screen.colorDepth ? screen.colorDepth : screen.pixelDepth)) + ";u" + escape(document.URL) + ";" + Math.random() + "' alt='' title='LiveInternet' " + "border='0' width='31' height='31'><\/a>"); //--></script><!--/LiveInternet--> </div> </div> </div> </footer> <script src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="/assets/30dd86a6f06b64184847037c52c63e07aa3c9a26.js"></script> <script>jQuery(function ($) { jQuery('#search-form').yiiActiveForm([{"id":"searchform-lang","name":"lang","container":".field-searchform-lang","input":"#searchform-lang","enableAjaxValidation":true},{"id":"searchform-search","name":"search","container":".field-searchform-search","input":"#searchform-search","enableAjaxValidation":true,"validate":function (attribute, value, messages, deferred, $form) {yii.validation.required(value, messages, {"message":"Search는 공백일 수 없습니다."});}}], []); });</script></body> </html>