Changeset 15676
- Timestamp:
- 10/01/2010 01:32:31 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/ms-blogs.php
r15482 r15676 6 6 * @package WordPress 7 7 * @subpackage Multisite 8 * @since 3.0.0 9 */ 10 11 // @todo use update_blog_details 8 * @since MU 9 */ 10 11 /** 12 * Update the last_updated field for the current blog. 13 * 14 * @since MU 15 */ 12 16 function wpmu_update_blogs_date() { 13 17 global $wpdb; 14 18 19 // TODO: use update_blog_details 20 15 21 $wpdb->update( $wpdb->blogs, array('last_updated' => current_time('mysql', true)), array('blog_id' => $wpdb->blogid) ); 16 22 refresh_blog_details( $wpdb->blogid ); … … 19 25 } 20 26 27 /** 28 * Get a full blog URL, given a blog id. 29 * 30 * @since MU 31 * 32 * @param int $blog_id Blog ID 33 * @return string 34 */ 21 35 function get_blogaddress_by_id( $blog_id ) { 22 36 $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! … … 24 38 } 25 39 40 /** 41 * Get a full blog URL, given a blog name. 42 * 43 * @since MU 44 * 45 * @param string $blogname The (subdomain or directory) name 46 * @return string 47 */ 26 48 function get_blogaddress_by_name( $blogname ) { 27 49 global $current_site; … … 39 61 } 40 62 41 function get_blogaddress_by_domain( $domain, $path ){ 63 /** 64 * Get a full blog URL, given a domain and a path. 65 * 66 * @since MU 67 * 68 * @param string $domain 69 * @param string $path 70 * @return string 71 */ 72 function get_blogaddress_by_domain( $domain, $path ) { 42 73 if ( is_subdomain_install() ) { 43 74 $url = "http://".$domain.$path; … … 56 87 } 57 88 89 /** 90 * Given a blog's (subdomain or directory) name, retrieve it's id. 91 * 92 * @since MU 93 * 94 * @param string $name 95 * @return int A blog id 96 */ 58 97 function get_id_from_blogname( $name ) { 59 98 global $wpdb, $current_site; … … 77 116 * Retrieve the details for a blog from the blogs table and blog options. 78 117 * 79 * @since 3.0.0 118 * @since MU 119 * 80 120 * @param int|string|array $fields A blog ID, a blog name, or an array of fields to query against. 81 121 * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true. … … 203 243 * Clear the blog details cache. 204 244 * 205 * @since 3.0.0245 * @since MU 206 246 * 207 247 * @param int $blog_id Blog ID … … 221 261 * Update the details for a blog. Updates the blogs table for a given blog id. 222 262 * 223 * @since 3.0.0263 * @since MU 224 264 * 225 265 * @param int $blog_id Blog ID … … 281 321 * The 'option_$option' filter in get_option() is not called. 282 322 * 283 * @since NA 284 * @package WordPress MU 285 * @subpackage Option 323 * @since MU 286 324 * @uses apply_filters() Calls 'blog_option_$optionname' with the option name value. 287 325 * 288 326 * @param int $blog_id is the id of the blog. 289 * @param string $setting Name of option to retrieve. Should already be SQL-escaped 327 * @param string $setting Name of option to retrieve. Should already be SQL-escaped. 290 328 * @param string $default (optional) Default value returned if option not found. 291 329 * @return mixed Value set for the option. … … 341 379 } 342 380 381 /** 382 * Add an option for a particular blog. 383 * 384 * @since MU 385 * 386 * @param int $id The blog id 387 * @param string $key The option key 388 * @param mixed $value The option value 389 */ 343 390 function add_blog_option( $id, $key, $value ) { 344 391 $id = (int) $id; … … 350 397 } 351 398 399 /** 400 * Delete an option for a particular blog. 401 * 402 * @since MU 403 * 404 * @param int $id The blog id 405 * @param string $key The option key 406 */ 352 407 function delete_blog_option( $id, $key ) { 353 408 $id = (int) $id; … … 359 414 } 360 415 416 /** 417 * Update an option for a particular blog. 418 * 419 * @since MU 420 * 421 * @param int $id The blog id 422 * @param string $key The option key 423 * @param mixed $value The option value 424 * @param bool $refresh Wether to refresh blog details or not 425 */ 361 426 function update_blog_option( $id, $key, $value, $refresh = true ) { 362 427 $id = (int) $id; … … 371 436 } 372 437 438 /** 439 * Switch the current blog. 440 * 441 * This function is useful if you need to pull posts, or other information, 442 * from other blogs. You can switch back afterwards using restore_current_blog(). 443 * 444 * Things that aren't switched: 445 * - autoloaded options. See #14992 446 * - plugins. See #14941 447 * 448 * @see restore_current_blog() 449 * @since MU 450 * 451 * @param int $new_blog The id of the blog you want to switch to. Default: current blog 452 * @param bool $validate Wether to check if $new_blog exists before proceeding 453 * @return bool True on success, False if the validation failed 454 */ 373 455 function switch_to_blog( $new_blog, $validate = false ) { 374 456 global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; … … 433 515 } 434 516 517 /** 518 * Restore the current blog, after calling switch_to_blog() 519 * 520 * @see switch_to_blog() 521 * @since MU 522 * 523 * @return bool True on success, False if we're already on the current blog 524 */ 435 525 function restore_current_blog() { 436 526 global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; … … 491 581 } 492 582 583 /** 584 * Check if a particular blog is archived. 585 * 586 * @since MU 587 * 588 * @param int $id The blog id 589 * @return string Wether the blog is archived or not 590 */ 493 591 function is_archived( $id ) { 494 592 return get_blog_status($id, 'archived'); 495 593 } 496 594 595 /** 596 * Update the 'archived' status of a particular blog. 597 * 598 * @since MU 599 * 600 * @param int $id The blog id 601 * @param string $archived The new status 602 * @return string $archived 603 */ 497 604 function update_archived( $id, $archived ) { 498 605 update_blog_status($id, 'archived', $archived); … … 503 610 * Update a blog details field. 504 611 * 505 * @since 3.0.0612 * @since MU 506 613 * 507 614 * @param int $blog_id BLog ID … … 509 616 * @param string $value Value for $pref 510 617 * @param bool $refresh Whether to refresh the blog details cache. Default is true. 618 * @return string $value 511 619 */ 512 620 function update_blog_status( $blog_id, $pref, $value, $refresh = true ) { … … 531 639 } 532 640 641 /** 642 * Get a blog details field. 643 * 644 * @since MU 645 * 646 * @param int $id The blog id 647 * @param string $pref A field name 648 * @return bool $value 649 */ 533 650 function get_blog_status( $id, $pref ) { 534 651 global $wpdb; … … 541 658 } 542 659 660 /** 661 * Get a list of most recently updated blogs. 662 * 663 * @since MU 664 * 665 * @param $deprecated Not used 666 * @param int $start The offset 667 * @param int $quantity The maximum number of blogs to retrieve. Default is 40. 668 * @return array The list of blogs 669 */ 543 670 function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) { 544 671 global $wpdb;
Note: See TracChangeset
for help on using the changeset viewer.