• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wpmu_delete_blog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_follow_and_delete_blog

 /**
  * @group delete
  */
 public function test_follow_and_delete_blog()
 {
     if (!is_multisite()) {
         return;
     }
     // create user and blog
     $u = $this->factory->user->create();
     $b = $this->factory->blog->create(array('title' => 'The Foo Bar Blog', 'user_id' => $u));
     // make blog creator follow own blog
     $f = bp_follow_start_following(array('leader_id' => $b, 'follower_id' => $u, 'follow_type' => 'blogs'));
     // assert that follow relationship worked
     $this->assertTrue($f);
     // now delete blog
     wpmu_delete_blog($b);
     // check if cache was deleted
     $this->assertEmpty(wp_cache_get($u, 'bp_follow_following_blogs_count'));
     $this->assertEmpty(wp_cache_get($b, 'bp_follow_followers_blogs_count'));
     // check if follow relationship was deleted
     $is_following = bp_follow_is_following(array('leader_id' => $b, 'follower_id' => $u, 'follow_type' => 'blogs'));
     $this->assertSame(0, $is_following);
 }
开发者ID:vikramshaw,项目名称:buddypress-followers,代码行数:24,代码来源:blogs.php


示例2: test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files

	/**
	 * When a site is deleted with wpmu_delete_blog(), only the files associated with
	 * that site should be removed. When wpmu_delete_blog() is run a second time, nothing
	 * should change with upload directories.
	 */
	function test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files() {
		$filename = rand_str().'.jpg';
		$contents = rand_str();

		// Upload a file to the main site on the network.
		$file1 = wp_upload_bits( $filename, null, $contents );

		$blog_id = $this->factory->blog->create();

		switch_to_blog( $blog_id );
		$file2 = wp_upload_bits( $filename, null, $contents );
		restore_current_blog();

		wpmu_delete_blog( $blog_id, true );

		// The file on the main site should still exist. The file on the deleted site should not.
		$this->assertTrue( file_exists( $file1['file'] ) );
		$this->assertFalse( file_exists( $file2['file'] ) );

		wpmu_delete_blog( $blog_id, true );

		// The file on the main site should still exist. The file on the deleted site should not.
		$this->assertTrue( file_exists( $file1['file'] ) );
		$this->assertFalse( file_exists( $file2['file'] ) );
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:30,代码来源:ms-files-rewriting.php


示例3: wpTearDownAfterClass

 public static function wpTearDownAfterClass()
 {
     foreach (self::$site_ids as $id) {
         wpmu_delete_blog($id, true);
     }
     wp_update_network_site_counts();
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:7,代码来源:getSite.php


示例4: tearDown

 public function tearDown()
 {
     global $wpdb;
     remove_action('bp_blogs_recorded_existing_blogs', array($this, 'set_autocommit_flag'));
     parent::tearDown();
     // If we detect that a COMMIT has been triggered during the test, clean up blog and user fixtures.
     if ($this->autocommitted) {
         if (is_multisite()) {
             foreach ($wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs} WHERE blog_id != 1") as $blog_id) {
                 wpmu_delete_blog($blog_id, true);
             }
         }
         foreach ($wpdb->get_col("SELECT ID FROM {$wpdb->users} WHERE ID != 1") as $user_id) {
             if (is_multisite()) {
                 wpmu_delete_user($user_id);
             } else {
                 wp_delete_user($user_id);
             }
         }
     }
     $this->commit_transaction();
     // Reactivate any components that have been deactivated.
     foreach ($this->deactivated_components as $component) {
         buddypress()->active_components[$component] = 1;
     }
     $this->deactivated_components = array();
 }
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:27,代码来源:testcase.php


示例5: wpTearDownAfterClass

 public static function wpTearDownAfterClass()
 {
     self::delete_user(self::$user);
     self::delete_user(self::$editor);
     if (is_multisite()) {
         wpmu_delete_blog(self::$site, true);
     }
 }
开发者ID:kucrut,项目名称:wordpress,代码行数:8,代码来源:rest-users-controller.php


示例6: remove_blog

 /**
  * Removes completely a blog from the network
  * @since 0.2.0
  * @param  int $blog_id the blog id
  */
 public static function remove_blog($blog_id)
 {
     switch_to_blog($blog_id);
     $wp_upload_info = wp_upload_dir();
     $dir = str_replace(' ', "\\ ", trailingslashit($wp_upload_info['basedir']));
     restore_current_blog();
     wpmu_delete_blog($blog_id, true);
     // wpmu_delete_blog leaves an empty site upload directory, that we want to remove :
     MUCD_Files::rrmdir($dir);
 }
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:15,代码来源:functions.php


示例7: test_get_active_blog_for_user_with_spam_site

 /**
  * @ticket 38355
  */
 public function test_get_active_blog_for_user_with_spam_site()
 {
     $current_site_id = get_current_blog_id();
     $site_id = self::factory()->blog->create(array('user_id' => self::$user_id, 'meta' => array('spam' => 1)));
     add_user_to_blog($site_id, self::$user_id, 'subscriber');
     update_user_meta(self::$user_id, 'primary_blog', $site_id);
     $result = get_active_blog_for_user(self::$user_id);
     wpmu_delete_blog($site_id, true);
     $this->assertEquals($current_site_id, $result->id);
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:13,代码来源:getActiveBlogForUser.php


示例8: tearDown

 function tearDown()
 {
     parent::tearDown();
     if (is_multisite()) {
         $blogs = wp_get_sites();
         foreach ($blogs as $blog) {
             if (1 !== (int) $blog['blog_id']) {
                 wpmu_delete_blog($blog['blog_id'], true);
             }
         }
     }
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:12,代码来源:testcase.php


示例9: wpTearDownAfterClass

 public static function wpTearDownAfterClass()
 {
     global $wpdb;
     foreach (self::$site_ids as $id) {
         wpmu_delete_blog($id, true);
     }
     foreach (self::$network_ids as $id) {
         $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->sitemeta} WHERE site_id = %d", $id));
         $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->site} WHERE id= %d", $id));
     }
     wp_update_network_site_counts();
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:12,代码来源:getIdFromBlogname.php


示例10: test_get_dashboard_url_for_administrator_of_different_site

 /**
  * @ticket 39065
  */
 public function test_get_dashboard_url_for_administrator_of_different_site()
 {
     if (!is_multisite()) {
         $this->markTestSkipped('Test only runs in multisite.');
     }
     $site_id = self::factory()->blog->create(array('user_id' => self::$user_id));
     remove_user_from_blog(self::$user_id, get_current_blog_id());
     $expected = get_admin_url($site_id);
     $result = get_dashboard_url(self::$user_id);
     remove_user_from_blog(self::$user_id, $site_id);
     add_user_to_blog(get_current_blog_id(), self::$user_id, 'administrator');
     wpmu_delete_blog($site_id, true);
     $this->assertEquals($expected, $result);
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Develop,代码行数:17,代码来源:getDashboardUrl.php


示例11: tearDown

 public function tearDown()
 {
     global $wpdb;
     parent::tearDown();
     if (is_multisite()) {
         foreach ($wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs} WHERE blog_id != 1") as $blog_id) {
             wpmu_delete_blog($blog_id, true);
         }
     }
     foreach ($wpdb->get_col("SELECT ID FROM {$wpdb->users} WHERE ID != 1") as $user_id) {
         if (is_multisite()) {
             wpmu_delete_user($user_id);
         } else {
             wp_delete_user($user_id);
         }
     }
     $this->commit_transaction();
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:18,代码来源:testcase.php


示例12: test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files

 /**
  * When a site is deleted with wpmu_delete_blog(), only the files associated with
  * that site should be removed. When wpmu_delete_blog() is run a second time, nothing
  * should change with upload directories.
  */
 function test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files()
 {
     $filename = __FUNCTION__ . '.jpg';
     $contents = __FUNCTION__ . '_contents';
     // Upload a file to the main site on the network.
     $file1 = wp_upload_bits($filename, null, $contents);
     $blog_id = self::factory()->blog->create();
     switch_to_blog($blog_id);
     $file2 = wp_upload_bits($filename, null, $contents);
     restore_current_blog();
     wpmu_delete_blog($blog_id, true);
     // The file on the main site should still exist. The file on the deleted site should not.
     $this->assertFileExists($file1['file']);
     $this->assertFileNotExists($file2['file']);
     wpmu_delete_blog($blog_id, true);
     // The file on the main site should still exist. The file on the deleted site should not.
     $this->assertFileExists($file1['file']);
     $this->assertFileNotExists($file2['file']);
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:24,代码来源:ms-files-rewriting.php


示例13: test_enable_live_network_site_counts_filter

	/**
	 * @ticket 22917
	 */
	function test_enable_live_network_site_counts_filter() {
		$site_count_start = get_blog_count();
		// false for large networks by default
		add_filter( 'enable_live_network_counts', '__return_false' );
		$this->factory->blog->create_many( 4 );

		// count only updated when cron runs, so unchanged
		$this->assertEquals( $site_count_start, (int) get_blog_count() );

		add_filter( 'enable_live_network_counts', '__return_true' );
		$site_ids = $this->factory->blog->create_many( 4 );

		$this->assertEquals( $site_count_start + 9, (int) get_blog_count() );

		//clean up
		remove_filter( 'enable_live_network_counts', '__return_false' );
		remove_filter( 'enable_live_network_counts', '__return_true' );
		foreach ( $site_ids as $site_id ) {
			wpmu_delete_blog( $site_id, true );
		}
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:24,代码来源:network.php


示例14: test_follow_and_delete_blog

 /**
  * @group delete
  */
 public function test_follow_and_delete_blog()
 {
     if (!is_multisite()) {
         return;
     }
     // create user and blog
     $u = $this->factory->user->create();
     $b = $this->factory->blog->create(array('title' => 'The Foo Bar Blog', 'user_id' => $u));
     // make blog creator follow own blog
     $f = bp_follow_start_following(array('leader_id' => $b, 'follower_id' => $u, 'follow_type' => 'blogs'));
     // assert that follow relationship worked
     $this->assertTrue($f);
     // prime cache
     new BP_Follow($b, $u, 'blogs');
     bp_follow_get_the_following_count(array('user_id' => $u, 'follow_type' => 'blogs'));
     bp_follow_get_the_followers_count(array('object_id' => $b, 'follow_type' => 'blogs'));
     // now delete blog
     wpmu_delete_blog($b);
     // check if cache was deleted
     $this->assertEmpty(wp_cache_get("{$b}:{$u}:blogs", 'bp_follow_data'));
     $this->assertEmpty(wp_cache_get($u, 'bp_follow_user_blogs_following_count'));
     $this->assertEmpty(wp_cache_get($b, 'bp_follow_blogs_followers_count'));
 }
开发者ID:wesavetheworld,项目名称:buddypress-followers,代码行数:26,代码来源:blogs.php


示例15: delete_network

/**
 * Delete a network and all its blogs
 *
 * @param integer id ID of network to delete
 * @param boolean $delete_blogs Flag to permit blog deletion - default setting
 *                               of false will prevent deletion of occupied networks
 */
function delete_network($id, $delete_blogs = false)
{
    global $wpdb;
    $id = (int) $id;
    // Ensure we have a valid network id
    $network = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->site} WHERE id = %d", $id));
    // Bail if network does not exist
    if (empty($network)) {
        return new WP_Error('network_not_exist', __('Network does not exist.', 'wp-multi-network'));
    }
    // ensure there are no blogs attached to this network */
    $sites = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE site_id = %d", $id));
    // Bail if network has blogs and blog deletion is off
    if (false == $delete_blogs && !empty($sites)) {
        return new WP_Error('network_not_empty', __('Cannot delete network with sites.', 'wp-multi-network'));
    }
    // Are we rescuing orphans or deleting them?
    if (true == $delete_blogs && !empty($sites)) {
        foreach ($sites as $site) {
            if (RESCUE_ORPHANED_BLOGS && ENABLE_NETWORK_ZERO) {
                move_site($site->blog_id, 0);
            } else {
                wpmu_delete_blog($site->blog_id, true);
            }
        }
    }
    // Delete from sites table
    $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->site} WHERE id = %d", $id));
    // Delete from site meta table
    $wpdb->query($wpdb->prepare($query = "DELETE FROM {$wpdb->sitemeta} WHERE site_id = %d", $id));
    do_action('delete_network', $network);
}
开发者ID:tlandn,项目名称:akvo-sites-zz-template,代码行数:39,代码来源:functions-wp-ms-networks.php


示例16: delete_site

 /**
  * Delete a site and all its blogs
  * 
  * @uses move_blog()
  * @uses wpmu_delete_blog()
  * 
  * @param integer id ID of site to delete
  * @param boolean $delete_blogs flag to permit blog deletion - default setting of FALSE will prevent deletion of occupied sites
  */
 function delete_site($id, $delete_blogs = FALSE)
 {
     global $wpdb;
     $override = $delete_blogs;
     /* ensure we got a valid site id */
     $query = "SELECT * FROM {$wpdb->site} WHERE id=" . (int) $id;
     $site = $wpdb->get_row($query);
     if (!$site) {
         return new WP_Error('site_not_exist', __('Network does not exist.', 'njsl-networks'));
     }
     /* ensure there are no blogs attached to this site */
     $query = "SELECT * FROM {$wpdb->blogs} WHERE site_id=" . (int) $id;
     $blogs = $wpdb->get_results($query);
     if ($blogs && !$override) {
         return new WP_Error('site_not_empty', __('Cannot delete network with sites.', 'njsl-networks'));
     }
     if ($override) {
         if ($blogs) {
             foreach ($blogs as $blog) {
                 if (RESCUE_ORPHANED_BLOGS && ENABLE_HOLDING_SITE) {
                     move_blog($blog->blog_id, 0);
                 } else {
                     wpmu_delete_blog($blog->blog_id, true);
                 }
             }
         }
     }
     $query = "DELETE FROM {$wpdb->site} WHERE id=" . (int) $id;
     $wpdb->query($query);
     $query = "DELETE FROM {$wpdb->sitemeta} WHERE site_id=" . (int) $id;
     $wpdb->query($query);
     do_action('wpmu_delete_site', $site);
     do_action('wpms_delete_network', $site);
 }
开发者ID:vunh1989,项目名称:evacorp2,代码行数:43,代码来源:networks-functions.php


示例17: deleteBlog

 public function deleteBlog($session_id, $blogId)
 {
     $retour = false;
     if ($this->_isSessionValid($session_id) and $this->_isUserAllowed($session_id, CS_ROLE_MOD, $blogId)) {
         switch_to_blog($blogId);
         include_once 'wp-admin/includes/ms.php';
         wpmu_delete_blog($blogId, true);
         restore_current_blog();
         $retour = true;
     } else {
         if (!$this->_isSessionValid($session_id)) {
             throw new SoapFault('deleteblog', 'Delete Blog failed: Session-ID (' . $session_id . ') is not valid');
         } else {
             throw new SoapFault('deleteblog', 'Delete Blog failed: User (' . $this->_sessionid_to_userid_array[$session_id] . ') is not allowed to delete this blog (' . $blogId . ').');
         }
     }
     return $retour;
 }
开发者ID:a2call,项目名称:commsy,代码行数:18,代码来源:commsyblog.php


示例18: cfgp_reset_shadow_blog

function cfgp_reset_shadow_blog()
{
    $results = array();
    /* Get list of all blogs */
    $blog_list = get_blog_list(null, 'all');
    /* Delete all post_meta in all blogs */
    foreach ($blog_list as $blog_info) {
        cfgp_delete_cfgp_post_meta($blog_info['blog_id']);
    }
    $results['meta_deleted'] = true;
    /* Delete the sitemeta, if this is a legacy install of plugin */
    global $wpdb;
    $sql = '
		DELETE FROM
			wp_sitemeta
		WHERE
			meta_key = "cfgp_blog_id"
	';
    $results['sitemeta_deleted'] = $wpdb->query($sql);
    /* Delete the shadow blog */
    if (!function_exists('wpmu_delete_blog')) {
        require_once ABSPATH . 'wp-admin/includes/ms.php';
    }
    wpmu_delete_blog(cfgp_get_shadow_blog_id(), true);
    $results['success'] = 'true';
    return $results;
}
开发者ID:bigdawggi,项目名称:wp-cf-global-posts,代码行数:27,代码来源:cf-global-posts.php


示例19: test_get_blog_id_from_url_after_dropped

 /**
  * When deleted with the drop parameter as true, the cache will first be false, then set to
  * -1 after an attempt at `get_blog_id_from_url()` is made.
  */
 function test_get_blog_id_from_url_after_dropped()
 {
     $blog_id = self::factory()->blog->create();
     $details = get_blog_details($blog_id, false);
     $key = md5($details->domain . $details->path);
     wpmu_delete_blog($blog_id, true);
     $this->assertEquals(false, wp_cache_get($key, 'blog-id-cache'));
     $this->assertEquals(0, get_blog_id_from_url($details->domain, $details->path));
     $this->assertEquals(-1, wp_cache_get($key, 'blog-id-cache'));
 }
开发者ID:ntwb,项目名称:wordpress-travis,代码行数:14,代码来源:site.php


示例20: admin_footer

 function admin_footer()
 {
     global $wpdb, $current_blog, $current_site;
     if ($current_blog->domain . $current_blog->path == $current_site->domain . $current_site->path) {
         return false;
     }
     if ($this->reallydeleteblog == true) {
         wpmu_delete_blog($wpdb->blogid);
     }
 }
开发者ID:joelglennwright,项目名称:agencypress,代码行数:10,代码来源:wpmu-functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wpmu_delete_user函数代码示例发布时间:2022-05-23
下一篇:
PHP wpmu_current_site函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap