Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Re-licensed as MIT
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Kruchkoff committed Mar 14, 2016
1 parent 875484d commit 165e98a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 60 deletions.
27 changes: 4 additions & 23 deletions LICENSE.txt
@@ -1,26 +1,7 @@
Copyright (c) 2015, 10up Inc.
All rights reserved.
Copyright (c) 2015, Ivan Kruchkoff, 10up Inc.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 changes: 12 additions & 12 deletions README.md
@@ -1,5 +1,5 @@
#WP Sweep
``wp sweep`` is created to help you sweep up your environment of personally identifiable information and extra content that is not necessary.
#WP Hammer
``wp ha`` is created to help you sweep up your environment of personally identifiable information and extra content that is not necessary.

## WARNING ##
__WARNING__ All changes are final and modify your site DB. Make sure you take a backup of your database __BEFORE__ you play around with the tool ``wp db export``
Expand All @@ -8,24 +8,24 @@ __WARNING__ All changes are final and modify your site DB. Make sure you take a

This tool will help you work on a client's site without having to worry about any of their user's personal information (emails, post content etc) being hosted on your dev environment.

With ``wp sweep`` you can:
With ``wp ha`` you can:

* Clean up user emails. ``wp sweep -f users.user_email='ivan.k+__ID__@10up.com``
* Clean up user passwords. ``wp sweep -f users.user_pass=auto``
* Replace posts with dummy posts. ``wp sweep -f posts.post_content=markov``
* Remove extra users. `` wp sweep -l users=10``
* Clean up user emails. ``wp ha -f users.user_email='ivan.k+__ID__@10up.com``
* Clean up user passwords. ``wp ha -f users.user_pass=auto``
* Replace posts with dummy posts. ``wp ha -f posts.post_content=markov``
* Remove extra users. `` wp ha -l users=10``

Before you do anything, composer install, to fetch the dependencies

Usage is best explained with an example, which we'll break down in parts as the syntax is fairly powerful
wp sweep -f posts.post_author=auto,users.user_pass=auto,users.user_email='ivan.k+__ID__@10up.com',posts.post_title=ipsum,posts.post_content=markov -l users=10,posts=100.post_date
wp ha -f posts.post_author=auto,users.user_pass=auto,users.user_email='ivan.k+__ID__@10up.com',posts.post_title=ipsum,posts.post_content=markov -l users=10,posts=100.post_date

wp sweep
wp ha
How you invoke the command

### Format
`
wp sweep -f posts.post_author=auto users.user_pass=__user_email__UMINtHeroJEreAGleC users.user_email='ivank+__ID__@10up.com' posts.post_title=ipsum posts.post_content=markov
wp ha -f posts.post_author=auto users.user_pass=__user_email__UMINtHeroJEreAGleC users.user_email='ivank+__ID__@10up.com' posts.post_title=ipsum posts.post_content=markov
`
`posts.post_author` is set to a random user ID (from those that will remain after we've performed any adjustments to the users)
`users.user_pass` is set to the user email followed by UMINtHeroJEreAGleC
Expand All @@ -48,8 +48,8 @@ We keep the following posts:
### Another example
`
wp db import production.sql &&
wp sweep posts.post_author=auto,users.user_pass=XGRwPjb7uFD5de23,users.user_email='ivan.k+__ID__@10up.com',posts.post_title=ipsum,posts.post_content=markov -l users=10 &&
wp ha posts.post_author=auto,users.user_pass=XGRwPjb7uFD5de23,users.user_email='ivan.k+__ID__@10up.com',posts.post_title=ipsum,posts.post_content=markov -l users=10 &&
wp db export sweep.sql
`

Created by Ivan Kruchkoff ( @ivankk on WordPress.org ), @10up
Created by Ivan Kruchkoff ( @ivankk on WordPress.org ), at 10up.com.
3 changes: 1 addition & 2 deletions tests/bootstrap.php
Expand Up @@ -9,10 +9,9 @@

function _manually_load_plugin() {
require_once getcwd() . '/vendor/autoload.php';
//require dirname( __FILE__ ) . '/../wp-sweep.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

require $_tests_dir . '/includes/bootstrap.php';

require dirname( __FILE__ ) . '/wp-sweep-testcase.php';
require dirname( __FILE__ ) . '/wp-hammer-testcase.php';
4 changes: 2 additions & 2 deletions tests/test-prune.php
@@ -1,11 +1,11 @@
<?php

class PruneTest extends WP_SweepTestCase {
class PruneTest extends WP_HammerTestCase {
protected $prune;

public function setUp() {
parent::setUp();
$this->prune = new WP_CLI\Sweep\Prune( $this->settings->limits, $this->settings->dry_run );
$this->prune = new WP_CLI\Hammer\Prune( $this->settings->limits, $this->settings->dry_run );
}

public function testParsePrunes() {
Expand Down
2 changes: 1 addition & 1 deletion tests/test-settings.php
@@ -1,6 +1,6 @@
<?php

class SettingsTest extends WP_SweepTestCase {
class SettingsTest extends WP_HammerTestCase {
protected $settings;

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/wp-sweep-testcase.php → tests/wp-hammer-testcase.php
Expand Up @@ -4,7 +4,7 @@
* Base unit test class for Co-Authors Plus
*/

class WP_SweepTestCase extends WP_UnitTestCase {
class WP_HammerTestCase extends WP_UnitTestCase {

protected $suppress = false;

Expand Down Expand Up @@ -65,7 +65,7 @@ public function setUp() {
"posts.post_author=auto,users.user_pass=auto,users.user_email=ivan+__ID__@kruchkoff.com,posts.post_title=ipsum",
);
$assoc_args = array();
$this->settings = new WP_CLI\Sweep\Settings();
$this->settings = new WP_CLI\Hammer\Settings();
$this->settings->parse_arguments( $args, $assoc_args );
}

Expand Down
18 changes: 0 additions & 18 deletions wp-sweep.php

This file was deleted.

0 comments on commit 165e98a

Please sign in to comment.