<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12828] trunk: Move blog deletion to ms-delete-site.php.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12828">12828</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-25 22:46:41 +0000 (Mon, 25 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move blog deletion to ms-delete-site.php. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpincludespluggablephp">trunk/wp-includes/pluggable.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminmsdeletesitephp">trunk/wp-admin/ms-delete-site.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (12827 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-25 22:09:43 UTC (rev 12827)
+++ trunk/wp-admin/menu.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -136,6 +136,8 @@
</span><span class="cx">         $submenu['tools.php'][15] = array( __('Export'), 'import', 'export.php' );
</span><span class="cx">         if ( is_super_admin() )
</span><span class="cx">                 $submenu['tools.php'][20] = array( __('Upgrade'), 'install_plugins',  'update-core.php');
</span><ins>+        if ( is_multisite() &amp;&amp; ($current_blog-&gt;domain . $current_blog-&gt;path != $current_site-&gt;domain . $current_site-&gt;path) )
+                $submenu['tools.php'][25] = array( __('Delete Blog'), 'manage_options', 'ms-delete-site.php' );
</ins><span class="cx"> 
</span><span class="cx"> $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' );
</span><span class="cx">         $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
</span><span class="lines">@@ -147,9 +149,8 @@
</span><span class="cx">         $submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
</span><span class="cx">         if ( is_super_admin() )
</span><span class="cx">                 $submenu['options-general.php'][45] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
</span><del>-        if ( !is_multisite() &amp;&amp; is_super_admin() ) {
</del><ins>+        if ( !is_multisite() &amp;&amp; is_super_admin() )
</ins><span class="cx">                 $submenu['options-general.php'][50] = array(__('Network'), 'manage_options', 'options-network.php');
</span><del>-        }
</del><span class="cx"> 
</span><span class="cx"> $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminmsdeletesitephp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/ms-delete-site.php (0 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/ms-delete-site.php                                (rev 0)
+++ trunk/wp-admin/ms-delete-site.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+&lt;?php
+require_once('admin.php');
+
+if ( !is_multisite() )
+        wp_die( __('Multisite support is not enabled.') );
+
+$action = isset($_POST['action']) ? $_POST['action'] : 'splash';
+
+$title = __('Delete Blog');
+$parent_file = 'tools.php';
+require_once('admin-header.php');
+
+echo '&lt;div class=&quot;wrap&quot;&gt;';
+screen_icon();
+echo '&lt;h2&gt;'. esc_html($title) .'&lt;/h2&gt;';
+
+if ( isset($_POST['action']) &amp;&amp; $_POST['action'] == &quot;deleteblog&quot; &amp;&amp; isset($_POST['confirmdelete']) &amp;&amp; $_POST['confirmdelete'] == '1' ) {
+        $hash = wp_generate_password(20, false);
+        update_option( &quot;delete_blog_hash&quot;, $hash );
+        $url_delete = admin_url('ms-delete-site.php?h=' . $hash);
+        $msg = __(&quot;Dear User,
+You recently clicked the 'Delete Blog' link on your blog and filled in a
+form on that page.
+If you really want to delete your blog, click the link below. You will not
+be asked to confirm again so only click this link if you are 100% certain:
+URL_DELETE
+
+If you delete your blog, please consider opening a new blog here
+some time in the future! (But remember your current blog and username
+are gone forever.)
+
+Thanks for using the site,
+Webmaster
+SITE_NAME
+&quot;);
+        $msg = str_replace( &quot;URL_DELETE&quot;, $url_delete, $msg );
+        $msg = str_replace( &quot;SITE_NAME&quot;, $current_site-&gt;site_name, $msg );
+        wp_mail( get_option( &quot;admin_email&quot; ), &quot;[ &quot; . get_option( &quot;blogname&quot; ) . &quot; ] &quot;.__(&quot;Delete My Blog&quot;), $msg );
+        ?&gt;
+        &lt;p&gt;&lt;?php _e('Thank you. Please check your email for a link to confirm your action. Your blog will not be deleted until this link is clicked.') ?&gt;&lt;/p&gt;
+        &lt;?php
+} elseif ( isset( $_GET['h'] ) &amp;&amp; $_GET['h'] != '' &amp;&amp; get_option('delete_blog_hash') != false ) {
+        if ( get_option('delete_blog_hash') == $_GET['h'] ) {
+                wpmu_delete_blog( $wpdb-&gt;blogid );
+                echo &quot;&lt;p&gt;&quot; . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site-&gt;site_name) . &quot;&lt;/p&gt;&quot;;
+        } else {
+                echo &quot;&lt;p&gt;&quot; . __(&quot;I'm sorry, the link you clicked is stale. Please select another option.&quot;) . &quot;&lt;/p&gt;&quot;;
+        }
+} else {
+?&gt;
+&lt;p&gt;&lt;?php printf(__('If you do not want to use your %s blog any more, you can delete it using the form below. When you click &lt;strong&gt;Delete My Blog&lt;/strong&gt; you will be sent an email with a link in it. Click on this link to delete your blog.'), $current_site-&gt;site_name); ?&gt;&lt;/p&gt;
+&lt;p&gt;&lt;?php _e('Remember, once deleted your blog cannot be restored.') ?&gt;&lt;/p&gt;
+&lt;form method='post' name='deletedirect'&gt;
+&lt;input type='hidden' name='action' value='deleteblog' /&gt;
+&lt;p&gt;&lt;input id='confirmdelete' type='checkbox' name='confirmdelete' value='1' /&gt; &lt;label for='confirmdelete'&gt;&lt;strong&gt;&lt;?php printf( __(&quot;I'm sure I want to permanently disable my blog, and I am aware I can never get it back or use %s again.&quot;), $current_blog-&gt;domain); ?&gt;&lt;/strong&gt;&lt;/label&gt;&lt;/p&gt;
+&lt;p class=&quot;submit&quot;&gt;&lt;input type='submit' value='&lt;?php esc_attr_e('Delete My Blog Permanently') ?&gt;' /&gt;&lt;/p&gt;
+&lt;/form&gt;
+&lt;?php
+}
+echo '&lt;/div&gt;';
+
+include('admin-footer.php');
+?&gt;
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-admin/ms-delete-site.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx">   + native
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (12827 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-01-25 22:09:43 UTC (rev 12827)
+++ trunk/wp-includes/ms-functions.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -598,13 +598,13 @@
</span><span class="cx">         $wpdb-&gt;update( $wpdb-&gt;blogs, array($pref =&gt; $value, 'last_updated' =&gt; current_time('mysql', true)), array('blog_id' =&gt; $blog_id) );
</span><span class="cx"> 
</span><span class="cx">         if ( $refresh )
</span><del>-                refresh_blog_details($id);
</del><ins>+                refresh_blog_details($blog_id);
</ins><span class="cx"> 
</span><span class="cx">         if ( $pref == 'spam' ) {
</span><span class="cx">                 if ( $value == 1 )
</span><del>-                        do_action( &quot;make_spam_blog&quot;, $id );
</del><ins>+                        do_action( &quot;make_spam_blog&quot;, $blog_id );
</ins><span class="cx">                 else
</span><del>-                        do_action( &quot;make_ham_blog&quot;, $id );
</del><ins>+                        do_action( &quot;make_ham_blog&quot;, $blog_id );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return $value;
</span><span class="lines">@@ -1766,83 +1766,6 @@
</span><span class="cx">                 return $size; // default
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* Delete blog */
-class delete_blog {
-        function delete_blog() {
-                $this-&gt;reallydeleteblog = false;
-                add_action('admin_menu', array(&amp;$this, 'admin_menu'));
-                add_action('admin_footer', array(&amp;$this, 'admin_footer'));
-        }
-
-        function admin_footer() {
-                global $wpdb, $current_blog, $current_site;
-                if ( $current_blog-&gt;domain . $current_blog-&gt;path == $current_site-&gt;domain . $current_site-&gt;path )
-                        return false;
-
-                if ( $this-&gt;reallydeleteblog == true )
-                        wpmu_delete_blog( $wpdb-&gt;blogid );
-        }
-
-        function admin_menu() {
-                global $current_blog, $current_site;
-                if ( $current_blog-&gt;domain . $current_blog-&gt;path != $current_site-&gt;domain . $current_site-&gt;path )
-                        add_submenu_page('options-general.php', __('Delete Blog'), __('Delete Blog'), 'manage_options', 'delete-blog', array(&amp;$this, 'plugin_content'));
-        }
-
-        function plugin_content() {
-                global $current_blog, $current_site;
-                $this-&gt;delete_blog_hash = get_settings('delete_blog_hash');
-                echo '&lt;div class=&quot;wrap&quot;&gt;&lt;h2&gt;' . __('Delete Blog') . '&lt;/h2&gt;';
-                if ( $_POST['action'] == &quot;deleteblog&quot; &amp;&amp; $_POST['confirmdelete'] == '1' ) {
-                        $hash = substr( md5( $_SERVER['REQUEST_URI'] . time() ), 0, 6 );
-                        update_option( &quot;delete_blog_hash&quot;, $hash );
-                        $url_delete = get_option( &quot;siteurl&quot; ) . &quot;/wp-admin/options-general.php?page=delete-blog&amp;h=&quot; . $hash;
-                        $msg = __(&quot;Dear User,
-You recently clicked the 'Delete Blog' link on your blog and filled in a
-form on that page.
-If you really want to delete your blog, click the link below. You will not
-be asked to confirm again so only click this link if you are 100% certain:
-URL_DELETE
-
-If you delete your blog, please consider opening a new blog here
-some time in the future! (But remember your current blog and username
-are gone forever.)
-
-Thanks for using the site,
-Webmaster
-SITE_NAME
-&quot;);
-                        $msg = str_replace( &quot;URL_DELETE&quot;, $url_delete, $msg );
-                        $msg = str_replace( &quot;SITE_NAME&quot;, $current_site-&gt;site_name, $msg );
-                        wp_mail( get_option( &quot;admin_email&quot; ), &quot;[ &quot; . get_option( &quot;blogname&quot; ) . &quot; ] &quot;.__(&quot;Delete My Blog&quot;), $msg );
-                        ?&gt;
-                        &lt;p&gt;&lt;?php _e('Thank you. Please check your email for a link to confirm your action. Your blog will not be deleted until this link is clicked.') ?&gt;&lt;/p&gt;
-                        &lt;?php
-                } elseif ( isset( $_GET['h'] ) &amp;&amp; $_GET['h'] != '' &amp;&amp; get_option('delete_blog_hash') != false ) {
-                        if ( get_option('delete_blog_hash') == $_GET['h'] ) {
-                                $this-&gt;reallydeleteblog = true;
-                                echo &quot;&lt;p&gt;&quot; . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site-&gt;site_name) . &quot;&lt;/p&gt;&quot;;
-                        } else {
-                                $this-&gt;reallydeleteblog = false;
-                                echo &quot;&lt;p&gt;&quot; . __(&quot;I'm sorry, the link you clicked is stale. Please select another option.&quot;) . &quot;&lt;/p&gt;&quot;;
-                        }
-                } else {
-?&gt;
-                        &lt;p&gt;&lt;?php printf(__('If you do not want to use your %s blog any more, you can delete it using the form below. When you click &lt;strong&gt;Delete My Blog&lt;/strong&gt; you will be sent an email with a link in it. Click on this link to delete your blog.'), $current_site-&gt;site_name); ?&gt;&lt;/p&gt;
-                        &lt;p&gt;&lt;?php _e('Remember, once deleted your blog cannot be restored.') ?&gt;&lt;/p&gt;
-                        &lt;form method='post' name='deletedirect'&gt;
-                        &lt;input type=&quot;hidden&quot; name=&quot;page&quot; value=&quot;&lt;?php echo esc_attr($_GET['page']) ?&gt;&quot; /&gt;
-                        &lt;input type='hidden' name='action' value='deleteblog' /&gt;
-                        &lt;p&gt;&lt;input id='confirmdelete' type='checkbox' name='confirmdelete' value='1' /&gt; &lt;label for='confirmdelete'&gt;&lt;strong&gt;&lt;?php printf( __(&quot;I'm sure I want to permanently disable my blog, and I am aware I can never get it back or use %s again.&quot;), $current_blog-&gt;domain); ?&gt;&lt;/strong&gt;&lt;/label&gt;&lt;/p&gt;
-                        &lt;p class=&quot;submit&quot;&gt;&lt;input type='submit' value='&lt;?php esc_attr_e('Delete My Blog Permanently') ?&gt;' /&gt;&lt;/p&gt;
-                        &lt;/form&gt;
-&lt;?php
-                }
-                echo &quot;&lt;/div&gt;&quot;;
-        }
-}
-$delete_blog_obj = new delete_blog();
-
</del><span class="cx"> /* Global Categories */
</span><span class="cx"> function global_terms( $term_id, $deprecated = '' ) {
</span><span class="cx">         global $wpdb;
</span></span></pre></div>
<a id="trunkwpincludespluggablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/pluggable.php (12827 => 12828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/pluggable.php        2010-01-25 22:09:43 UTC (rev 12827)
+++ trunk/wp-includes/pluggable.php        2010-01-25 22:46:41 UTC (rev 12828)
</span><span class="lines">@@ -1791,4 +1791,3 @@
</span><span class="cx">         return $r;
</span><span class="cx"> }
</span><span class="cx"> endif;
</span><del>-
</del></span></pre>
</div>
</div>

</body>
</html>