<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>trickeries! &#187; plugin</title>
	<atom:link href="http://trickeries.com/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://trickeries.com</link>
	<description>it's tricky to rock a style thats liked online</description>
	<lastBuildDate>Tue, 02 Mar 2010 06:01:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Wordpress database resetter.</title>
		<link>http://trickeries.com/16/wordpress-database-resetter/</link>
		<comments>http://trickeries.com/16/wordpress-database-resetter/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 06:16:57 +0000</pubDate>
		<dc:creator>atom</dc:creator>
				<category><![CDATA[downloads]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://trickeries.com/16/wordpress-database-resetter/</guid>
		<description><![CDATA[I have found that while developing  for wordpress it is often very useful to be able to quickly and easily drop all the working tables and start from scratch, so i whipped up a plugin to do just that.  It will drop every table from the database defined in your wp-config.php that starts [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://trickeries.com/wp-content/uploads/2008/02/db_reset.zip" title="DB Reset plugin"></a>I have found that while developing  for wordpress it is often very useful to be able to quickly and easily drop all the working tables and start from scratch, so i whipped up a plugin to do just that.  It will drop every table from the database defined in your wp-config.php that starts with the defined prefix, when you tell it to of course.  It will then direct you to the last step of the install, where you will need to define your blog title, and your admin email address.</p>
<h2><a href="http://trickeries.com/wp-content/uploads/2008/02/db_reset.zip" title="download the wordpress DB Reset plugin">download DB Reset</a></h2>
<p>here is the code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #FF00FF; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Plugin Name: DB Reset
Plugin URI: http://trickeries.com/16/wordpress-database-resetter/
Description: terribly simple plugin to basically drop all of your wordpress tables.
Author: atom smith
Version: 1.0
Author URI: http://trickeries.com/
*/</span>
&nbsp;
&nbsp;
add_action<span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'db_reset_delete_tables'</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_db_reset_sub_menu'</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #FF00FF; font-weight: bold;">function</span> add_db_reset_sub_menu<span style="color: #FF6600;">&#40;</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span>
	add_submenu_page<span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'plugins.php'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'DB Reset'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'DB Reset'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">,</span> <span style="color: #FF6600; font-weight: bold;">__FILE__</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'db_reset_output'</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #FF6600;">&#125;</span>
&nbsp;
<span style="color: #FF00FF; font-weight: bold;">function</span> db_reset_output<span style="color: #FF6600;">&#40;</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	&lt;div class=&quot;wrap&quot;&gt;
		&lt;h2&gt;DB Reset&lt;/h2&gt;
		<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">if</span><span style="color: #FF6600;">&#40;</span><span style="color: #339933;">!</span><span style="color: #0066FF;">isSet</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$_POST</span><span style="color: #FF6600;">&#91;</span><span style="color: #0000ff;">'db_reset'</span><span style="color: #FF6600;">&#93;</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> db_reset_get_tables<span style="color: #FF6600;">&#40;</span><span style="color: #FF6600;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/div&gt;
&nbsp;
<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #FF6600;">&#125;</span>
&nbsp;
<span style="color: #FF00FF; font-weight: bold;">function</span> db_reset_get_tables<span style="color: #FF6600;">&#40;</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span>
	<span style="color: #FF00FF; font-weight: bold;">global</span> <span style="color: #00FF00;">$wpdb</span><span style="color: #339933;">;</span>
	<span style="color: #00FF00;">$prefixed_tables</span> <span style="color: #339933;">=</span> <span style="color: #00FF00;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #FF0000;">prefix</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'%'</span><span style="color: #339933;">;</span>
	<span style="color: #00FF00;">$tables</span> <span style="color: #339933;">=</span> <span style="color: #00FF00;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #FF0000;">get_results</span><span style="color: #FF6600;">&#40;</span><span style="color: #FF0000;">&quot;show tables LIKE '<span style="color: #006699; font-weight: bold;">$prefixed_tables</span>'&quot;</span><span style="color: #339933;">,</span> ARRAY_A<span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;div class=&quot;updated&quot;&gt;&lt;strong&gt;Please make sure that you understand what you are doing before using this.  The following tables will be deleted and replaced:&lt;/strong&gt;
		&lt;ul&gt;
		<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">foreach</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$tables</span> <span style="color: #00FF00;">as</span> <span style="color: #00FF00;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #00FF00;">$v</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;li&gt;
				<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">echo</span> <span style="color: #00FF00;">$tables_to_delete</span><span style="color: #FF6600;">&#91;</span><span style="color: #FF6600;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">pos</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$v</span><span style="color: #FF6600;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/li&gt;
		<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/ul&gt;
	&lt;/div&gt;
	&lt;form action=&quot;#&quot; method=&quot;post&quot;&gt;
		<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">foreach</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$tables_to_delete</span> <span style="color: #00FF00;">as</span> <span style="color: #00FF00;">$table</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;input type=&quot;hidden&quot; name=&quot;delete[]&quot; value=&quot;<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">echo</span> <span style="color: #00FF00;">$table</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
		<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span> <span style="color: #00FF00;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;input style=&quot;font-size:100px; width:100%; padding: 20px;&quot; type=&quot;submit&quot; name=&quot;db_reset&quot; value=&quot;Reset DB&quot; /&gt;
	&lt;/form&gt;
<span style="color: #FF00FF; font-weight: bold;">&lt;?php</span>
<span style="color: #FF6600;">&#125;</span>
&nbsp;
<span style="color: #FF00FF; font-weight: bold;">function</span> db_reset_delete_tables<span style="color: #FF6600;">&#40;</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span>
	<span style="color: #00FF00;">if</span><span style="color: #FF6600;">&#40;</span><span style="color: #0066FF;">isSet</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$_POST</span><span style="color: #FF6600;">&#91;</span><span style="color: #0000ff;">'db_reset'</span><span style="color: #FF6600;">&#93;</span><span style="color: #FF6600;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #00FF00;">$_POST</span><span style="color: #FF6600;">&#91;</span><span style="color: #0000ff;">'db_reset'</span><span style="color: #FF6600;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Reset DB'</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span>
		<span style="color: #FF00FF; font-weight: bold;">global</span> <span style="color: #00FF00;">$wpdb</span><span style="color: #339933;">;</span>
		<span style="color: #00FF00;">if</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #FF0000;">prefix</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span>
			<span style="color: #00FF00;">foreach</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$_POST</span><span style="color: #FF6600;">&#91;</span><span style="color: #0000ff;">'delete'</span><span style="color: #FF6600;">&#93;</span> <span style="color: #00FF00;">as</span> <span style="color: #00FF00;">$table</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span>
				<span style="color: #00FF00;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #FF0000;">query</span><span style="color: #FF6600;">&#40;</span><span style="color: #FF0000;">&quot;DROP TABLE <span style="color: #006699; font-weight: bold;">$table</span>&quot;</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #FF6600;">&#125;</span>
			<span style="color: #00FF00;">$location</span> <span style="color: #339933;">=</span> <span style="color: #FF0000;">&quot;..&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #FF6600;">&#125;</span>
		<span style="color: #0066FF;">header</span><span style="color: #FF6600;">&#40;</span><span style="color: #FF0000;">&quot;Location: <span style="color: #006699; font-weight: bold;">$location</span>&quot;</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #FF6600;">&#125;</span>
<span style="color: #FF6600;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://trickeries.com/16/wordpress-database-resetter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
