Skip to content

Commit

Permalink
Use perchten/rmrdir for directory removal.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Zimmerman committed Apr 6, 2017
1 parent 4199021 commit 37ab804
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 18 deletions.
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -30,7 +30,8 @@
"pimple/pimple": "^3.0",
"leafo/scssphp": "^0.6.7",
"vanilla/htmlawed": "^2.2",
"pressbooks/pb-api": "^1.1"
"pressbooks/pb-api": "^1.1",
"perchten/rmrdir": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~5.5",
Expand Down
44 changes: 43 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion includes/class-pb-themelock.php
Expand Up @@ -80,7 +80,6 @@ static function lockTheme() {

static function copyAssets() {
if ( ! WP_Filesystem() ) {
wp_die('Lacking credentials.');
exit;
}

Expand Down
16 changes: 1 addition & 15 deletions includes/pb-utility.php
Expand Up @@ -738,19 +738,5 @@ function mail_from_name( $name ) {
*/

function delete_directory( $dirpath ) {
if ( ! function_exists( '\\WP_Filesystem' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}

if ( ! \WP_Filesystem() ) {
exit;
}

global $wp_filesystem;

if ( ! $wp_filesystem->is_dir( $dirpath ) ) {
throw new \InvalidArgumentException( "$dirpath must be a directory." );
}

$wp_filesystem->rmdir( $dirpath, true );
return \rmdir( $dirpath );
}

0 comments on commit 37ab804

Please sign in to comment.