Media from FTP - Version 11.02

Version Description

Fixed problem of sites dir exclusion on multisite.

Download this release

Release Info

Developer Katsushi Kawamori
Plugin Icon wp plugin Media from FTP
Version 11.02
Comparing to
See all releases

Code changes from version 11.01 to 11.02

Files changed (3) hide show
  1. inc/class-mediafromftp.php +7 -3
  2. mediafromftp.php +1 -1
  3. readme.txt +4 -1
inc/class-mediafromftp.php CHANGED
@@ -151,7 +151,7 @@ class MediaFromFtp {
151
 
152
  global $blog_id;
153
  if ( is_multisite() && is_main_site( $blog_id ) ) {
154
- $excludefile .= '|\/sites\/';
155
  }
156
  if ( isset( $cmdoptions['e'] ) ) {
157
  $excludefile .= '|' . $cmdoptions['e'];
@@ -234,9 +234,11 @@ class MediaFromFtp {
234
  private function scan_dir( $dir ) {
235
 
236
  $excludedir = 'media-from-ftp-tmp'; /* tmp dir */
 
237
  global $blog_id;
238
  if ( is_multisite() && is_main_site( $blog_id ) ) {
239
- $excludedir .= '|\/sites\/';
 
240
  }
241
 
242
  $files = scandir( $dir );
@@ -248,7 +250,9 @@ class MediaFromFtp {
248
  $fullpath = rtrim( $dir, '/' ) . '/' . $file;
249
  if ( is_dir( $fullpath ) ) {
250
  if ( ! preg_match( '/' . $excludedir . '/', $fullpath ) ) {
251
- $list[] = $fullpath;
 
 
252
  }
253
  $list = array_merge( $list, $this->scan_dir( $fullpath ) );
254
  }
151
 
152
  global $blog_id;
153
  if ( is_multisite() && is_main_site( $blog_id ) ) {
154
+ $excludefile .= '|' . str_replace( '/', '\/', $this->upload_dir . '/sites/' );
155
  }
156
  if ( isset( $cmdoptions['e'] ) ) {
157
  $excludefile .= '|' . $cmdoptions['e'];
234
  private function scan_dir( $dir ) {
235
 
236
  $excludedir = 'media-from-ftp-tmp'; /* tmp dir */
237
+ $multisite_top_dir = null;
238
  global $blog_id;
239
  if ( is_multisite() && is_main_site( $blog_id ) ) {
240
+ $excludedir .= '|' . str_replace( '/', '\/', $this->upload_dir . '/sites/' );
241
+ $multisite_top_dir = $this->upload_dir . '/sites';
242
  }
243
 
244
  $files = scandir( $dir );
250
  $fullpath = rtrim( $dir, '/' ) . '/' . $file;
251
  if ( is_dir( $fullpath ) ) {
252
  if ( ! preg_match( '/' . $excludedir . '/', $fullpath ) ) {
253
+ if ( $fullpath <> $multisite_top_dir ) {
254
+ $list[] = $fullpath;
255
+ }
256
  }
257
  $list = array_merge( $list, $this->scan_dir( $fullpath ) );
258
  }
mediafromftp.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Media from FTP
4
  * Plugin URI: https://wordpress.org/plugins/media-from-ftp/
5
  * Description: Register to media library from files that have been uploaded by FTP.
6
- * Version: 11.01
7
  * Author: Katsushi Kawamori
8
  * Author URI: https://riverforest-wp.info/
9
  * License: GPL2
3
  * Plugin Name: Media from FTP
4
  * Plugin URI: https://wordpress.org/plugins/media-from-ftp/
5
  * Description: Register to media library from files that have been uploaded by FTP.
6
+ * Version: 11.02
7
  * Author: Katsushi Kawamori
8
  * Author URI: https://riverforest-wp.info/
9
  * License: GPL2
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: files, ftp, import, media, sync, uploads
5
  Requires at least: 3.6.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.3
8
- Stable tag: 11.01
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -131,6 +131,9 @@ Password: live789user
131
 
132
  == Changelog ==
133
 
 
 
 
134
  = 11.01 =
135
  Supported WordPress 5.3.
136
 
5
  Requires at least: 3.6.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.3
8
+ Stable tag: 11.02
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
131
 
132
  == Changelog ==
133
 
134
+ = 11.02 =
135
+ Fixed problem of sites dir exclusion on multisite.
136
+
137
  = 11.01 =
138
  Supported WordPress 5.3.
139