Changeset 3847006
- Timestamp:
- 12/06/2026 02:06:04 AM (less than one hour ago)
- Location:
- marn-easy-migrate
- Files:
-
- 3 edited
- 12 copied
-
tags/1.2.3 (copied) (copied from marn-easy-migrate/trunk )
-
tags/1.2.3/assets/css/admin.css (copied) (copied from marn-easy-migrate/trunk/assets/css/admin.css )
-
tags/1.2.3/assets/js/admin.js (copied) (copied from marn-easy-migrate/trunk/assets/js/admin.js )
-
tags/1.2.3/includes/class-wpzm-admin.php (copied) (copied from marn-easy-migrate/trunk/includes/class-wpzm-admin.php )
-
tags/1.2.3/includes/class-wpzm-backup-manager.php (copied) (copied from marn-easy-migrate/trunk/includes/class-wpzm-backup-manager.php )
-
tags/1.2.3/includes/class-wpzm-exporter.php (copied) (copied from marn-easy-migrate/trunk/includes/class-wpzm-exporter.php )
-
tags/1.2.3/includes/class-wpzm-scheduler.php (copied) (copied from marn-easy-migrate/trunk/includes/class-wpzm-scheduler.php )
-
tags/1.2.3/includes/storage (copied) (copied from marn-easy-migrate/trunk/includes/storage )
-
tags/1.2.3/includes/storage/class-wpzm-storage-ftp.php (copied) (copied from marn-easy-migrate/trunk/includes/storage/class-wpzm-storage-ftp.php ) (7 diffs)
-
tags/1.2.3/marn-easy-migrate.php (copied) (copied from marn-easy-migrate/trunk/marn-easy-migrate.php ) (2 diffs)
-
tags/1.2.3/readme.txt (copied) (copied from marn-easy-migrate/trunk/readme.txt ) (2 diffs)
-
tags/1.2.3/uninstall.php (copied) (copied from marn-easy-migrate/trunk/uninstall.php )
-
trunk/includes/storage/class-wpzm-storage-ftp.php (modified) (7 diffs)
-
trunk/marn-easy-migrate.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
marn-easy-migrate/tags/1.2.3/includes/storage/class-wpzm-storage-ftp.php
r3847002 r3847006 14 14 15 15 /** 16 * Last directory error encountered during mkdir/chdir. 17 * 18 * @var string 19 */ 20 private $last_dir_error = ''; 21 22 /** 16 23 * {@inheritdoc} 17 24 */ … … 154 161 foreach ( $parts as $part ) { 155 162 if ( ! @ftp_chdir( $conn, $part ) ) { 156 @ftp_mkdir( $conn, $part ); 163 $created = @ftp_mkdir( $conn, $part ); 164 if ( false === $created ) { 165 $err = error_get_last(); 166 if ( is_array( $err ) && ! empty( $err['message'] ) ) { 167 $this->last_dir_error = wp_strip_all_tags( $err['message'] ); 168 } 169 } 157 170 if ( ! @ftp_chdir( $conn, $part ) ) { 158 171 return false; … … 161 174 } 162 175 return true; 176 } 177 178 /** 179 * List up to 8 top-level entry names in the current FTP directory for diagnostics. 180 * 181 * @param resource|\FTP\Connection $conn Active FTP connection. 182 * @return array 183 */ 184 private function list_dir_entries( $conn ) { 185 $raw = @ftp_nlist( $conn, '.' ); 186 $names = array(); 187 if ( is_array( $raw ) ) { 188 foreach ( $raw as $item ) { 189 $name = basename( (string) $item ); 190 if ( '' === $name || '.' === $name || '..' === $name ) { 191 continue; 192 } 193 $names[] = $name; 194 if ( count( $names ) >= 8 ) { 195 break; 196 } 197 } 198 } 199 return $names; 163 200 } 164 201 … … 211 248 */ 212 249 public function test_connection( array $config ) { 213 $res = $this->connect( $config ); 250 $this->last_dir_error = ''; 251 $res = $this->connect( $config ); 214 252 if ( empty( $res['success'] ) ) { 215 253 return $res; … … 218 256 $conn = $res['conn']; 219 257 $home_dir = @ftp_pwd( $conn ); 258 $home_items = $this->list_dir_entries( $conn ); 220 259 $remote_path = isset( $config['remote_path'] ) ? (string) $config['remote_path'] : ''; 221 260 222 261 if ( '' !== trim( $remote_path ) && ! $this->ensure_remote_dir( $conn, $remote_path ) ) { 223 $last_err = error_get_last(); 224 $detail = ( is_array( $last_err ) && ! empty( $last_err['message'] ) ) ? ' ' . wp_strip_all_tags( $last_err['message'] ) : ''; 262 $detail = '' !== $this->last_dir_error ? ' (' . $this->last_dir_error . ')' : ''; 263 $hint = ! empty( $home_items ) 264 ? ' ' . sprintf( 265 /* translators: %s: comma-separated list of existing folders/items in FTP home directory */ 266 __( 'Available items in home directory: %s', 'marn-easy-migrate' ), 267 implode( ', ', $home_items ) 268 ) 269 : ''; 225 270 @ftp_close( $conn ); 226 271 return array( 227 272 'success' => false, 228 273 'message' => sprintf( 229 /* translators: 1: initial FTP home directory, 2: optional FTP error detail*/230 __( 'Connected to FTP server (home directory: %1$s), but could not access or create the specified remote directory.%2$s ', 'marn-easy-migrate' ),274 /* translators: 1: initial FTP home directory, 2: optional error detail, 3: optional list of available folders */ 275 __( 'Connected to FTP server (home directory: %1$s), but could not access or create the specified remote directory.%2$s%3$s', 'marn-easy-migrate' ), 231 276 is_string( $home_dir ) && '' !== $home_dir ? $home_dir : '/', 232 $detail 277 $detail, 278 $hint 233 279 ), 234 280 ); … … 236 282 237 283 $active_dir = @ftp_pwd( $conn ); 284 $items_hint = ! empty( $home_items ) && ( '/' === trim( $remote_path ) || '' === trim( $remote_path ) ) 285 ? ' | ' . sprintf( 286 /* translators: %s: comma-separated list of items */ 287 __( 'Items: %s', 'marn-easy-migrate' ), 288 implode( ', ', $home_items ) 289 ) 290 : ''; 238 291 @ftp_close( $conn ); 239 292 … … 241 294 'success' => true, 242 295 'message' => sprintf( 243 /* translators: %s: active remote FTP directory */ 244 __( 'FTP connection successful! Active directory: %s', 'marn-easy-migrate' ), 245 is_string( $active_dir ) && '' !== $active_dir ? $active_dir : '/' 296 /* translators: 1: active remote FTP directory, 2: optional list of items */ 297 __( 'FTP connection successful! Active directory: %1$s%2$s', 'marn-easy-migrate' ), 298 is_string( $active_dir ) && '' !== $active_dir ? $active_dir : '/', 299 $items_hint 246 300 ), 247 301 ); -
marn-easy-migrate/tags/1.2.3/marn-easy-migrate.php
r3847002 r3847006 4 4 * Plugin URI: https://marn-easy-migrate.marnstudio.click/ 5 5 * Description: Export and import full WordPress site (database and files) as a clean .zip package with automated domain/path replacement. 6 * Version: 1.2. 26 * Version: 1.2.3 7 7 * Requires at least: 6.0 8 8 * Requires PHP: 7.4 … … 33 33 34 34 // Plugin constants. 35 define( 'WPZM_VERSION', '1.2. 2' );35 define( 'WPZM_VERSION', '1.2.3' ); 36 36 define( 'WPZM_FILE', __FILE__ ); 37 37 define( 'WPZM_PATH', plugin_dir_path( __FILE__ ) ); -
marn-easy-migrate/tags/1.2.3/readme.txt
r3847002 r3847006 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.4 8 Stable tag: 1.2. 28 Stable tag: 1.2.3 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 == Changelog == 84 84 85 = 1.2.3 = 86 * Enhancement: Improve FTP Test Connection diagnostics to display exact `ftp_mkdir()` errors and list available folders in the FTP home directory. 87 85 88 = 1.2.2 = 86 89 * Bugfix: Improve FTP remote directory creation (`ensure_remote_dir`) to automatically fall back to the FTP account's home directory when root `/` is not writable, fix nested subdirectory path handling, and report the active FTP directory on Test Connection. -
marn-easy-migrate/trunk/includes/storage/class-wpzm-storage-ftp.php
r3847002 r3847006 14 14 15 15 /** 16 * Last directory error encountered during mkdir/chdir. 17 * 18 * @var string 19 */ 20 private $last_dir_error = ''; 21 22 /** 16 23 * {@inheritdoc} 17 24 */ … … 154 161 foreach ( $parts as $part ) { 155 162 if ( ! @ftp_chdir( $conn, $part ) ) { 156 @ftp_mkdir( $conn, $part ); 163 $created = @ftp_mkdir( $conn, $part ); 164 if ( false === $created ) { 165 $err = error_get_last(); 166 if ( is_array( $err ) && ! empty( $err['message'] ) ) { 167 $this->last_dir_error = wp_strip_all_tags( $err['message'] ); 168 } 169 } 157 170 if ( ! @ftp_chdir( $conn, $part ) ) { 158 171 return false; … … 161 174 } 162 175 return true; 176 } 177 178 /** 179 * List up to 8 top-level entry names in the current FTP directory for diagnostics. 180 * 181 * @param resource|\FTP\Connection $conn Active FTP connection. 182 * @return array 183 */ 184 private function list_dir_entries( $conn ) { 185 $raw = @ftp_nlist( $conn, '.' ); 186 $names = array(); 187 if ( is_array( $raw ) ) { 188 foreach ( $raw as $item ) { 189 $name = basename( (string) $item ); 190 if ( '' === $name || '.' === $name || '..' === $name ) { 191 continue; 192 } 193 $names[] = $name; 194 if ( count( $names ) >= 8 ) { 195 break; 196 } 197 } 198 } 199 return $names; 163 200 } 164 201 … … 211 248 */ 212 249 public function test_connection( array $config ) { 213 $res = $this->connect( $config ); 250 $this->last_dir_error = ''; 251 $res = $this->connect( $config ); 214 252 if ( empty( $res['success'] ) ) { 215 253 return $res; … … 218 256 $conn = $res['conn']; 219 257 $home_dir = @ftp_pwd( $conn ); 258 $home_items = $this->list_dir_entries( $conn ); 220 259 $remote_path = isset( $config['remote_path'] ) ? (string) $config['remote_path'] : ''; 221 260 222 261 if ( '' !== trim( $remote_path ) && ! $this->ensure_remote_dir( $conn, $remote_path ) ) { 223 $last_err = error_get_last(); 224 $detail = ( is_array( $last_err ) && ! empty( $last_err['message'] ) ) ? ' ' . wp_strip_all_tags( $last_err['message'] ) : ''; 262 $detail = '' !== $this->last_dir_error ? ' (' . $this->last_dir_error . ')' : ''; 263 $hint = ! empty( $home_items ) 264 ? ' ' . sprintf( 265 /* translators: %s: comma-separated list of existing folders/items in FTP home directory */ 266 __( 'Available items in home directory: %s', 'marn-easy-migrate' ), 267 implode( ', ', $home_items ) 268 ) 269 : ''; 225 270 @ftp_close( $conn ); 226 271 return array( 227 272 'success' => false, 228 273 'message' => sprintf( 229 /* translators: 1: initial FTP home directory, 2: optional FTP error detail*/230 __( 'Connected to FTP server (home directory: %1$s), but could not access or create the specified remote directory.%2$s ', 'marn-easy-migrate' ),274 /* translators: 1: initial FTP home directory, 2: optional error detail, 3: optional list of available folders */ 275 __( 'Connected to FTP server (home directory: %1$s), but could not access or create the specified remote directory.%2$s%3$s', 'marn-easy-migrate' ), 231 276 is_string( $home_dir ) && '' !== $home_dir ? $home_dir : '/', 232 $detail 277 $detail, 278 $hint 233 279 ), 234 280 ); … … 236 282 237 283 $active_dir = @ftp_pwd( $conn ); 284 $items_hint = ! empty( $home_items ) && ( '/' === trim( $remote_path ) || '' === trim( $remote_path ) ) 285 ? ' | ' . sprintf( 286 /* translators: %s: comma-separated list of items */ 287 __( 'Items: %s', 'marn-easy-migrate' ), 288 implode( ', ', $home_items ) 289 ) 290 : ''; 238 291 @ftp_close( $conn ); 239 292 … … 241 294 'success' => true, 242 295 'message' => sprintf( 243 /* translators: %s: active remote FTP directory */ 244 __( 'FTP connection successful! Active directory: %s', 'marn-easy-migrate' ), 245 is_string( $active_dir ) && '' !== $active_dir ? $active_dir : '/' 296 /* translators: 1: active remote FTP directory, 2: optional list of items */ 297 __( 'FTP connection successful! Active directory: %1$s%2$s', 'marn-easy-migrate' ), 298 is_string( $active_dir ) && '' !== $active_dir ? $active_dir : '/', 299 $items_hint 246 300 ), 247 301 ); -
marn-easy-migrate/trunk/marn-easy-migrate.php
r3847002 r3847006 4 4 * Plugin URI: https://marn-easy-migrate.marnstudio.click/ 5 5 * Description: Export and import full WordPress site (database and files) as a clean .zip package with automated domain/path replacement. 6 * Version: 1.2. 26 * Version: 1.2.3 7 7 * Requires at least: 6.0 8 8 * Requires PHP: 7.4 … … 33 33 34 34 // Plugin constants. 35 define( 'WPZM_VERSION', '1.2. 2' );35 define( 'WPZM_VERSION', '1.2.3' ); 36 36 define( 'WPZM_FILE', __FILE__ ); 37 37 define( 'WPZM_PATH', plugin_dir_path( __FILE__ ) ); -
marn-easy-migrate/trunk/readme.txt
r3847002 r3847006 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.4 8 Stable tag: 1.2. 28 Stable tag: 1.2.3 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 == Changelog == 84 84 85 = 1.2.3 = 86 * Enhancement: Improve FTP Test Connection diagnostics to display exact `ftp_mkdir()` errors and list available folders in the FTP home directory. 87 85 88 = 1.2.2 = 86 89 * Bugfix: Improve FTP remote directory creation (`ensure_remote_dir`) to automatically fall back to the FTP account's home directory when root `/` is not writable, fix nested subdirectory path handling, and report the active FTP directory on Test Connection.
Note:
See TracChangeset
for help on using the changeset viewer.