Media File Renamer - Version 4.0.2

Version Description

  • Fix: PDF thumbnails support.
  • Update: Code improvement, faster SQL queries.
Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 Media File Renamer
Version 4.0.2
Comparing to
See all releases

Code changes from version 4.0.1 to 4.0.2

Files changed (3) hide show
  1. core.php +131 -90
  2. media-file-renamer.php +2 -2
  3. readme.txt +6 -2
core.php CHANGED
@@ -105,7 +105,7 @@ class Meow_MFRH_Core {
105
  }
106
  // Compare filenames
107
  foreach ( $fileArray as $file ) {
108
- if ( preg_match( "/{$filename}/{$i}", $file ) ) {
109
  $output = $file;
110
  break;
111
  }
@@ -497,6 +497,7 @@ class Meow_MFRH_Core {
497
  $old_filepath = get_attached_file( $id );
498
  $old_filepath = Meow_MFRH_Core::sensitive_file_exists( $old_filepath );
499
  $path_parts = pathinfo( $old_filepath );
 
500
  $directory = $path_parts['dirname'];
501
  $old_filename = $path_parts['basename'];
502
 
@@ -675,7 +676,7 @@ class Meow_MFRH_Core {
675
  $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_manual_file_renaming'" );
676
  $wpdb->query( "INSERT INTO $wpdb->postmeta (meta_key, meta_value, post_id)
677
  SELECT '_manual_file_renaming', 1, p.ID
678
- FROM $wpdb->posts p WHERE p.post_status = 'inherit' AND p.post_type = 'attachment'"
679
  );
680
  echo '<div class="updated"><p>';
681
  echo __( 'All the media files are now locked.', 'media-file-renamer' );
@@ -1103,18 +1104,12 @@ class Meow_MFRH_Core {
1103
  add_post_meta( $id, '_original_filename', $old_filename, true );
1104
 
1105
  // Rename the main media file.
1106
- // try {
1107
  if ( !$this->rename_file( $old_filepath, $new_filepath, $case_issue ) && !$force_rename ) {
1108
- $this->log( "The file couldn't be renamed from $old_filepath to $new_filepath." );
1109
  return $post;
1110
  }
1111
- $this->log( "File $old_filepath renamed to $new_filepath." );
1112
  do_action( 'mfrh_path_renamed', $post, $old_filepath, $new_filepath );
1113
- // }
1114
- // catch ( Exception $e ) {
1115
- // $this->log( "The file couldn't be renamed from $old_filepath to $new_filepath." );
1116
- // return $post;
1117
- // }
1118
 
1119
  // The new extension (or maybe it's just the old one)
1120
  $old_ext = $path_parts['extension'];
@@ -1130,6 +1125,7 @@ class Meow_MFRH_Core {
1130
 
1131
  // Update the attachment meta
1132
  $meta = wp_get_attachment_metadata( $id );
 
1133
  if ( $meta ) {
1134
  if ( isset( $meta['file'] ) && !empty( $meta['file'] ) )
1135
  $meta['file'] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta['file'] );
@@ -1139,74 +1135,73 @@ class Meow_MFRH_Core {
1139
  $meta['url'] = $noext_new_filename . '.' . $old_ext;
1140
  }
1141
 
1142
- // Images
1143
- if ( wp_attachment_is_image( $id ) ) {
1144
- // Loop through the different sizes in the case of an image, and rename them.
 
 
 
1145
  $orig_image_urls = array();
1146
  $orig_image_data = wp_get_attachment_image_src( $id, 'full' );
1147
  $orig_image_urls['full'] = $orig_image_data[0];
1148
- if ( empty( $meta['sizes'] ) ) {
1149
- $this->log( "The WP metadata for attachment " . $id . " does not exist.", true );
1150
- }
1151
- else {
1152
- foreach ( $meta['sizes'] as $size => $meta_size ) {
1153
- if ( !isset($meta['sizes'][$size]['file'] ) )
1154
- continue;
1155
- $meta_old_filename = $meta['sizes'][$size]['file'];
1156
- $meta_old_filepath = trailingslashit( $directory ) . $meta_old_filename;
1157
- $meta_new_filename = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta_old_filename );
1158
-
1159
- // Manual Rename also uses the new extension (if it was not stripped to avoid user mistake)
1160
- if ( $force_rename && !empty( $new_ext ) ) {
1161
- $meta_new_filename = $this->str_replace( $old_ext, $new_ext, $meta_new_filename );
1162
- }
1163
 
1164
- $meta_new_filepath = trailingslashit( $directory ) . $meta_new_filename;
1165
- $orig_image_data = wp_get_attachment_image_src( $id, $size );
1166
- $orig_image_urls[$size] = $orig_image_data[0];
1167
-
1168
- // Double check files exist before trying to rename.
1169
- if ( $force_rename || ( file_exists( $meta_old_filepath )
1170
- && ( ( !file_exists( $meta_new_filepath ) ) || is_writable( $meta_new_filepath ) ) ) ) {
1171
- // WP Retina 2x is detected, let's rename those files as well
1172
- if ( function_exists( 'wr2x_get_retina' ) ) {
1173
- $wr2x_old_filepath = $this->str_replace( '.' . $old_ext, '@2x.' . $old_ext, $meta_old_filepath );
1174
- $wr2x_new_filepath = $this->str_replace( '.' . $new_ext, '@2x.' . $new_ext, $meta_new_filepath );
1175
- if ( file_exists( $wr2x_old_filepath ) && ( ( !file_exists( $wr2x_new_filepath ) ) || is_writable( $wr2x_new_filepath ) ) ) {
1176
-
1177
- // Rename retina file
1178
- if ( !$this->rename_file( $wr2x_old_filepath, $wr2x_new_filepath, $case_issue ) && !$force_rename ) {
1179
- $this->log( "The file couldn't be renamed from $wr2x_old_filepath to $wr2x_new_filepath." );
1180
- return $post;
1181
- }
1182
- $this->log( "Retina file $wr2x_old_filepath renamed to $wr2x_new_filepath." );
1183
- do_action( 'mfrh_path_renamed', $post, $wr2x_old_filepath, $wr2x_new_filepath );
1184
  }
 
 
1185
  }
 
1186
 
1187
- // Rename meta file
1188
- if ( !$this->rename_file( $meta_old_filepath, $meta_new_filepath, $case_issue ) && !$force_rename ) {
1189
- $this->log( "The file couldn't be renamed from $meta_old_filepath to $meta_new_filepath." );
1190
- return $post;
1191
- }
1192
 
1193
- $meta['sizes'][$size]['file'] = $meta_new_filename;
1194
 
1195
- // Detect if another size has exactly the same filename
1196
- foreach ( $meta['sizes'] as $s => $m ) {
1197
- if ( !isset( $meta['sizes'][$s]['file'] ) )
1198
- continue;
1199
- if ( $meta['sizes'][$s]['file'] == $meta_old_filename ) {
1200
- $this->log( "Updated $s based on $size, as they use the same file (probably same size)." );
1201
- $meta['sizes'][$s]['file'] = $meta_new_filename;
1202
- }
1203
  }
 
1204
 
1205
- // Success, call other plugins
1206
- $this->log( "File $meta_old_filepath renamed to $meta_new_filepath." );
1207
- do_action( 'mfrh_path_renamed', $post, $meta_old_filepath, $meta_new_filepath );
1208
 
1209
- }
1210
  }
1211
  }
1212
  }
@@ -1227,13 +1222,22 @@ class Meow_MFRH_Core {
1227
  update_attached_file( $id, $new_filepath );
1228
  clean_post_cache( $id );
1229
 
 
 
 
 
 
 
 
 
 
 
1230
  // Call the actions so that the plugin's plugins can update everything else (than the files)
1231
- if ( wp_attachment_is_image( $id ) ) {
1232
  $orig_image_url = $orig_image_urls['full'];
1233
  $new_image_data = wp_get_attachment_image_src( $id, 'full' );
1234
  $new_image_url = $new_image_data[0];
1235
  $this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url );
1236
-
1237
  if ( !empty( $meta['sizes'] ) ) {
1238
  foreach ( $meta['sizes'] as $size => $meta_size ) {
1239
  $orig_image_url = $orig_image_urls[$size];
@@ -1248,18 +1252,9 @@ class Meow_MFRH_Core {
1248
  $this->call_hooks_rename_url( $post, $orig_attachment_url, $new_attachment_url );
1249
  }
1250
 
1251
- // SLUG
1252
- if ( get_option( "mfrh_rename_slug" ) ) {
1253
- $oldslug = $post['post_name'];
1254
- $info = pathinfo( $new_filepath );
1255
- $newslug = preg_replace( '/\\.[^.\\s]{3,4}$/', '', $info['basename'] );
1256
- $post['post_name'] = $newslug;
1257
- if ( wp_update_post( $post ) )
1258
- $this->log( "Renamed slug from $oldslug to $newslug." );
1259
- }
1260
-
1261
  // HTTP REFERER set to the new media link
1262
- if ( isset( $_REQUEST['_wp_original_http_referer'] ) && strpos( $_REQUEST['_wp_original_http_referer'], '/wp-admin/' ) === false ) {
 
1263
  $_REQUEST['_wp_original_http_referer'] = get_permalink( $id );
1264
  }
1265
 
@@ -1303,24 +1298,26 @@ class Meow_MFRH_Core {
1303
  $this->log_sql( $query, $query_revert );
1304
  $wpdb->query( $query );
1305
  clean_post_cache( $post['ID'] );
1306
- $this->log( "Guid $old_guid changed to $new_filepath." );
1307
  }
1308
 
1309
  // Mass update of all the meta with the new filenames
1310
  function action_update_postmeta( $post, $orig_image_url, $new_image_url ) {
1311
  global $wpdb;
1312
- $query = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = '%s'
 
1313
  WHERE meta_key <> '_original_filename'
1314
  AND (TRIM(meta_value) = '%s'
1315
  OR TRIM(meta_value) = '%s'
1316
  );", $new_image_url, $orig_image_url, str_replace( ' ', '%20', $orig_image_url ) );
1317
- $query_revert = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = '%s'
 
1318
  WHERE meta_key <> '_original_filename'
1319
  AND meta_value = '%s';
1320
  ", $orig_image_url, $new_image_url );
1321
  $wpdb->query( $query );
1322
  $this->log_sql( $query, $query_revert );
1323
- $this->log( "Metadata exactly like $orig_image_url were replaced by $new_image_url." );
1324
  }
1325
 
1326
  // Mass update of all the articles with the new filenames
@@ -1328,17 +1325,61 @@ class Meow_MFRH_Core {
1328
  global $wpdb;
1329
 
1330
  // Content
1331
- $query = $wpdb->prepare( "UPDATE $wpdb->posts SET post_content = REPLACE(post_content, '%s', '%s');", $orig_image_url, $new_image_url );
1332
- $query_revert = $wpdb->prepare( "UPDATE $wpdb->posts SET post_content = REPLACE(post_content, '%s', '%s');", $new_image_url, $orig_image_url );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1333
  $wpdb->query( $query );
1334
  $this->log_sql( $query, $query_revert );
1335
- $this->log( "Post content like $orig_image_url were replaced by $new_image_url." );
1336
-
1337
  // Excerpt
1338
- $query = $wpdb->prepare( "UPDATE $wpdb->posts SET post_excerpt = REPLACE(post_excerpt, '%s', '%s');", $orig_image_url, $new_image_url );
1339
- $query_revert = $wpdb->prepare( "UPDATE $wpdb->posts SET post_excerpt = REPLACE(post_excerpt, '%s', '%s');", $new_image_url, $orig_image_url );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1340
  $wpdb->query( $query );
1341
  $this->log_sql( $query, $query_revert );
1342
- $this->log( "Post content like $orig_image_url were replaced by $new_image_url." );
1343
  }
1344
  }
105
  }
106
  // Compare filenames
107
  foreach ( $fileArray as $file ) {
108
+ if ( preg_match( "/" . preg_quote( $filename ) . "/{$i}", $file ) ) {
109
  $output = $file;
110
  break;
111
  }
497
  $old_filepath = get_attached_file( $id );
498
  $old_filepath = Meow_MFRH_Core::sensitive_file_exists( $old_filepath );
499
  $path_parts = pathinfo( $old_filepath );
500
+ //print_r( $path_parts );
501
  $directory = $path_parts['dirname'];
502
  $old_filename = $path_parts['basename'];
503
 
676
  $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_manual_file_renaming'" );
677
  $wpdb->query( "INSERT INTO $wpdb->postmeta (meta_key, meta_value, post_id)
678
  SELECT '_manual_file_renaming', 1, p.ID
679
+ FROM $wpdb->posts p WHERE post_status = 'inherit' AND post_type = 'attachment'"
680
  );
681
  echo '<div class="updated"><p>';
682
  echo __( 'All the media files are now locked.', 'media-file-renamer' );
1104
  add_post_meta( $id, '_original_filename', $old_filename, true );
1105
 
1106
  // Rename the main media file.
 
1107
  if ( !$this->rename_file( $old_filepath, $new_filepath, $case_issue ) && !$force_rename ) {
1108
+ $this->log( "[!] File $old_filepath -> $new_filepath" );
1109
  return $post;
1110
  }
1111
+ $this->log( "File\t$old_filepath -> $new_filepath" );
1112
  do_action( 'mfrh_path_renamed', $post, $old_filepath, $new_filepath );
 
 
 
 
 
1113
 
1114
  // The new extension (or maybe it's just the old one)
1115
  $old_ext = $path_parts['extension'];
1125
 
1126
  // Update the attachment meta
1127
  $meta = wp_get_attachment_metadata( $id );
1128
+
1129
  if ( $meta ) {
1130
  if ( isset( $meta['file'] ) && !empty( $meta['file'] ) )
1131
  $meta['file'] = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta['file'] );
1135
  $meta['url'] = $noext_new_filename . '.' . $old_ext;
1136
  }
1137
 
1138
+ // Better to check like this rather than with wp_attachment_is_image
1139
+ // PDFs also have thumbnails now, since WP 4.7
1140
+ $has_thumbnails = isset( $meta['sizes'] );
1141
+
1142
+ // Loop through the different sizes in the case of an image, and rename them.
1143
+ if ( $has_thumbnails ) {
1144
  $orig_image_urls = array();
1145
  $orig_image_data = wp_get_attachment_image_src( $id, 'full' );
1146
  $orig_image_urls['full'] = $orig_image_data[0];
1147
+ foreach ( $meta['sizes'] as $size => $meta_size ) {
1148
+ if ( !isset($meta['sizes'][$size]['file'] ) )
1149
+ continue;
1150
+ $meta_old_filename = $meta['sizes'][$size]['file'];
1151
+ $meta_old_filepath = trailingslashit( $directory ) . $meta_old_filename;
1152
+ $meta_new_filename = $this->str_replace( $noext_old_filename, $noext_new_filename, $meta_old_filename );
1153
+
1154
+ // Manual Rename also uses the new extension (if it was not stripped to avoid user mistake)
1155
+ if ( $force_rename && !empty( $new_ext ) ) {
1156
+ $meta_new_filename = $this->str_replace( $old_ext, $new_ext, $meta_new_filename );
1157
+ }
 
 
 
 
1158
 
1159
+ $meta_new_filepath = trailingslashit( $directory ) . $meta_new_filename;
1160
+ $orig_image_data = wp_get_attachment_image_src( $id, $size );
1161
+ $orig_image_urls[$size] = $orig_image_data[0];
1162
+
1163
+ // Double check files exist before trying to rename.
1164
+ if ( $force_rename || ( file_exists( $meta_old_filepath )
1165
+ && ( ( !file_exists( $meta_new_filepath ) ) || is_writable( $meta_new_filepath ) ) ) ) {
1166
+ // WP Retina 2x is detected, let's rename those files as well
1167
+ if ( function_exists( 'wr2x_get_retina' ) ) {
1168
+ $wr2x_old_filepath = $this->str_replace( '.' . $old_ext, '@2x.' . $old_ext, $meta_old_filepath );
1169
+ $wr2x_new_filepath = $this->str_replace( '.' . $new_ext, '@2x.' . $new_ext, $meta_new_filepath );
1170
+ if ( file_exists( $wr2x_old_filepath )
1171
+ && ( ( !file_exists( $wr2x_new_filepath ) ) || is_writable( $wr2x_new_filepath ) ) ) {
1172
+
1173
+ // Rename retina file
1174
+ if ( !$this->rename_file( $wr2x_old_filepath, $wr2x_new_filepath, $case_issue ) && !$force_rename ) {
1175
+ $this->log( "[!] Retina $wr2x_old_filepath -> $wr2x_new_filepath" );
1176
+ return $post;
 
 
1177
  }
1178
+ $this->log( "Retina\t$wr2x_old_filepath -> $wr2x_new_filepath" );
1179
+ do_action( 'mfrh_path_renamed', $post, $wr2x_old_filepath, $wr2x_new_filepath );
1180
  }
1181
+ }
1182
 
1183
+ // Rename meta file
1184
+ if ( !$this->rename_file( $meta_old_filepath, $meta_new_filepath, $case_issue ) && !$force_rename ) {
1185
+ $this->log( "[!] File $meta_old_filepath -> $meta_new_filepath" );
1186
+ return $post;
1187
+ }
1188
 
1189
+ $meta['sizes'][$size]['file'] = $meta_new_filename;
1190
 
1191
+ // Detect if another size has exactly the same filename
1192
+ foreach ( $meta['sizes'] as $s => $m ) {
1193
+ if ( !isset( $meta['sizes'][$s]['file'] ) )
1194
+ continue;
1195
+ if ( $meta['sizes'][$s]['file'] == $meta_old_filename ) {
1196
+ $this->log( "Updated $s based on $size, as they use the same file (probably same size)." );
1197
+ $meta['sizes'][$s]['file'] = $meta_new_filename;
 
1198
  }
1199
+ }
1200
 
1201
+ // Success, call other plugins
1202
+ $this->log( "File\t$meta_old_filepath -> $meta_new_filepath" );
1203
+ do_action( 'mfrh_path_renamed', $post, $meta_old_filepath, $meta_new_filepath );
1204
 
 
1205
  }
1206
  }
1207
  }
1222
  update_attached_file( $id, $new_filepath );
1223
  clean_post_cache( $id );
1224
 
1225
+ // Rename slug/permalink
1226
+ if ( get_option( "mfrh_rename_slug" ) ) {
1227
+ $oldslug = $post['post_name'];
1228
+ $info = pathinfo( $new_filepath );
1229
+ $newslug = preg_replace( '/\\.[^.\\s]{3,4}$/', '', $info['basename'] );
1230
+ $post['post_name'] = $newslug;
1231
+ if ( wp_update_post( $post ) )
1232
+ $this->log( "Slug\t$oldslug -> $newslug" );
1233
+ }
1234
+
1235
  // Call the actions so that the plugin's plugins can update everything else (than the files)
1236
+ if ( $has_thumbnails ) {
1237
  $orig_image_url = $orig_image_urls['full'];
1238
  $new_image_data = wp_get_attachment_image_src( $id, 'full' );
1239
  $new_image_url = $new_image_data[0];
1240
  $this->call_hooks_rename_url( $post, $orig_image_url, $new_image_url );
 
1241
  if ( !empty( $meta['sizes'] ) ) {
1242
  foreach ( $meta['sizes'] as $size => $meta_size ) {
1243
  $orig_image_url = $orig_image_urls[$size];
1252
  $this->call_hooks_rename_url( $post, $orig_attachment_url, $new_attachment_url );
1253
  }
1254
 
 
 
 
 
 
 
 
 
 
 
1255
  // HTTP REFERER set to the new media link
1256
+ if ( isset( $_REQUEST['_wp_original_http_referer'] ) &&
1257
+ strpos( $_REQUEST['_wp_original_http_referer'], '/wp-admin/' ) === false ) {
1258
  $_REQUEST['_wp_original_http_referer'] = get_permalink( $id );
1259
  }
1260
 
1298
  $this->log_sql( $query, $query_revert );
1299
  $wpdb->query( $query );
1300
  clean_post_cache( $post['ID'] );
1301
+ $this->log( "GUID\t$old_guid -> $new_filepath." );
1302
  }
1303
 
1304
  // Mass update of all the meta with the new filenames
1305
  function action_update_postmeta( $post, $orig_image_url, $new_image_url ) {
1306
  global $wpdb;
1307
+ $query = $wpdb->prepare( "UPDATE $wpdb->postmeta
1308
+ SET meta_value = '%s'
1309
  WHERE meta_key <> '_original_filename'
1310
  AND (TRIM(meta_value) = '%s'
1311
  OR TRIM(meta_value) = '%s'
1312
  );", $new_image_url, $orig_image_url, str_replace( ' ', '%20', $orig_image_url ) );
1313
+ $query_revert = $wpdb->prepare( "UPDATE $wpdb->postmeta
1314
+ SET meta_value = '%s'
1315
  WHERE meta_key <> '_original_filename'
1316
  AND meta_value = '%s';
1317
  ", $orig_image_url, $new_image_url );
1318
  $wpdb->query( $query );
1319
  $this->log_sql( $query, $query_revert );
1320
+ $this->log( "Meta\t$orig_image_url -> $new_image_url" );
1321
  }
1322
 
1323
  // Mass update of all the articles with the new filenames
1325
  global $wpdb;
1326
 
1327
  // Content
1328
+ $query = $wpdb->prepare( "UPDATE $wpdb->posts
1329
+ SET post_content = REPLACE(post_content, '%s', '%s')
1330
+ WHERE post_status != 'inherit'
1331
+ AND post_status != 'trash'
1332
+ AND post_type != 'attachment'
1333
+ AND post_type NOT LIKE '%acf-%'
1334
+ AND post_type NOT LIKE '%edd_%'
1335
+ AND post_type != 'shop_order'
1336
+ AND post_type != 'shop_order_refund'
1337
+ AND post_type != 'nav_menu_item'
1338
+ AND post_type != 'revision'
1339
+ AND post_type != 'auto-draft'", $orig_image_url, $new_image_url );
1340
+ $query_revert = $wpdb->prepare( "UPDATE $wpdb->posts
1341
+ SET post_content = REPLACE(post_content, '%s', '%s')
1342
+ WHERE post_status != 'inherit'
1343
+ AND post_status != 'trash'
1344
+ AND post_type != 'attachment'
1345
+ AND post_type NOT LIKE '%acf-%'
1346
+ AND post_type NOT LIKE '%edd_%'
1347
+ AND post_type != 'shop_order'
1348
+ AND post_type != 'shop_order_refund'
1349
+ AND post_type != 'nav_menu_item'
1350
+ AND post_type != 'revision'
1351
+ AND post_type != 'auto-draft'", $new_image_url, $orig_image_url );
1352
  $wpdb->query( $query );
1353
  $this->log_sql( $query, $query_revert );
1354
+ $this->log( "Content\t$orig_image_url -> $new_image_url" );
1355
+
1356
  // Excerpt
1357
+ $query = $wpdb->prepare( "UPDATE $wpdb->posts
1358
+ SET post_excerpt = REPLACE(post_excerpt, '%s', '%s')
1359
+ WHERE post_status != 'inherit'
1360
+ AND post_status != 'trash'
1361
+ AND post_type != 'attachment'
1362
+ AND post_type NOT LIKE '%acf-%'
1363
+ AND post_type NOT LIKE '%edd_%'
1364
+ AND post_type != 'shop_order'
1365
+ AND post_type != 'shop_order_refund'
1366
+ AND post_type != 'nav_menu_item'
1367
+ AND post_type != 'revision'
1368
+ AND post_type != 'auto-draft'", $orig_image_url, $new_image_url );
1369
+ $query_revert = $wpdb->prepare( "UPDATE $wpdb->posts
1370
+ SET post_excerpt = REPLACE(post_excerpt, '%s', '%s')
1371
+ WHERE post_status != 'inherit'
1372
+ AND post_status != 'trash'
1373
+ AND post_type != 'attachment'
1374
+ AND post_type NOT LIKE '%acf-%'
1375
+ AND post_type NOT LIKE '%edd_%'
1376
+ AND post_type != 'shop_order'
1377
+ AND post_type != 'shop_order_refund'
1378
+ AND post_type != 'nav_menu_item'
1379
+ AND post_type != 'revision'
1380
+ AND post_type != 'auto-draft'", $new_image_url, $orig_image_url );
1381
  $wpdb->query( $query );
1382
  $this->log_sql( $query, $query_revert );
1383
+ $this->log( "Excerpt\t$orig_image_url -> $new_image_url" );
1384
  }
1385
  }
media-file-renamer.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Media File Renamer
4
  Plugin URI: http://meowapps.com
5
  Description: Auto-rename the files when titles are modified and update and the references (links). Manual Rename is a Pro option. Please read the description.
6
- Version: 4.0.1
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
@@ -29,7 +29,7 @@ if ( class_exists( 'Meow_MFRH_Core' ) ) {
29
  if ( is_admin() ) {
30
 
31
  global $mfrh_version, $mfrh_core;
32
- $mfrh_version = '4.0.1';
33
 
34
  // Admin
35
  require( 'mfrh_admin.php');
3
  Plugin Name: Media File Renamer
4
  Plugin URI: http://meowapps.com
5
  Description: Auto-rename the files when titles are modified and update and the references (links). Manual Rename is a Pro option. Please read the description.
6
+ Version: 4.0.2
7
  Author: Jordy Meow
8
  Author URI: http://meowapps.com
9
  Text Domain: media-file-renamer
29
  if ( is_admin() ) {
30
 
31
  global $mfrh_version, $mfrh_core;
32
+ $mfrh_version = '4.0.2';
33
 
34
  // Admin
35
  require( 'mfrh_admin.php');
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: TigrouMeow
3
  Tags: rename, file, files, media, manager, image, renamer, wpml, optimization, seo, retina, gutenberg
4
  Requires at least: 4.6
5
- Tested up to: 4.9
6
- Stable tag: 4.0.1
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
@@ -100,6 +100,10 @@ You are welcome to create plugins using Media File Renamer using special rules f
100
 
101
  == Changelog ==
102
 
 
 
 
 
103
  = 4.0.1 =
104
  * Fix: Issue with the tolowercase feature.
105
  * Fix: Extension issue with mfrh_new_filename filter.
2
  Contributors: TigrouMeow
3
  Tags: rename, file, files, media, manager, image, renamer, wpml, optimization, seo, retina, gutenberg
4
  Requires at least: 4.6
5
+ Tested up to: 4.9.4
6
+ Stable tag: 4.0.2
7
 
8
  Automatically rename files depending on Media titles dynamically + update links. Pro version has many more options. Check the description :)
9
 
100
 
101
  == Changelog ==
102
 
103
+ = 4.0.2 =
104
+ * Fix: PDF thumbnails support.
105
+ * Update: Code improvement, faster SQL queries.
106
+
107
  = 4.0.1 =
108
  * Fix: Issue with the tolowercase feature.
109
  * Fix: Extension issue with mfrh_new_filename filter.