Media Cleaner - Version 5.4.4

Version Description

  • Add: Support for Brizy Builder.
  • Fix: Doesn't trigger the timeout check if WP-CLI is being used.
  • Add: WP-CLI can now delete and trash media entries and files.
Download this release

Release Info

Developer TigrouMeow
Plugin Icon 128x128 Media Cleaner
Version 5.4.4
Comparing to
See all releases

Code changes from version 5.4.3 to 5.4.4

Files changed (4) hide show
  1. core.php +15 -11
  2. media-cleaner.php +2 -2
  3. readme.txt +17 -12
  4. views/menu-screen.php +6 -0
core.php CHANGED
@@ -5,6 +5,7 @@ class Meow_WPMC_Core {
5
  public $admin = null;
6
  public $last_analysis = null; //TODO: Is it actually used?
7
  public $engine = null;
 
8
  private $regex_file = '/[A-Za-z0-9-_,.\(\)\s]+[.]{1}(MIMETYPES)/';
9
  public $current_method = 'media';
10
  private $refcache = array();
@@ -93,16 +94,18 @@ class Meow_WPMC_Core {
93
  function timeout_check() {
94
  $this->time_elapsed = time() - $this->start_time;
95
  $this->time_remaining = $this->max_execution_time - $this->wordpress_init_time - $this->time_elapsed;
96
- if ( $this->time_remaining - $this->item_scan_avg_time < 0 ) {
97
- error_log("Media Cleaner Timeout! Check the Media Cleaner logs for more info.");
98
- $this->log( "Timeout! Some info for debug:" );
99
- $this->log( "Elapsed time: $this->time_elapsed" );
100
- $this->log( "WP init time: $this->wordpress_init_time" );
101
- $this->log( "Remaining time: $this->time_remaining" );
102
- $this->log( "Scan time per item: $this->item_scan_avg_time" );
103
- $this->log( "PHP max_execution_time: $this->max_execution_time" );
104
- header("HTTP/1.0 408 Request Timeout");
105
- exit;
 
 
106
  }
107
  }
108
 
@@ -281,9 +284,10 @@ class Meow_WPMC_Core {
281
  continue;
282
  else if ( is_numeric( $value ) )
283
  array_push( $ids, $value );
284
- else
285
  if ( $this->is_url( $value ) )
286
  array_push( $urls, $this->clean_url( $value ) );
 
287
  }
288
  }
289
  }
5
  public $admin = null;
6
  public $last_analysis = null; //TODO: Is it actually used?
7
  public $engine = null;
8
+ public $catch_timeout = true; // This will halt the plugin before reaching the PHP timeout.
9
  private $regex_file = '/[A-Za-z0-9-_,.\(\)\s]+[.]{1}(MIMETYPES)/';
10
  public $current_method = 'media';
11
  private $refcache = array();
94
  function timeout_check() {
95
  $this->time_elapsed = time() - $this->start_time;
96
  $this->time_remaining = $this->max_execution_time - $this->wordpress_init_time - $this->time_elapsed;
97
+ if ( $this->catch_timeout ) {
98
+ if ( $this->time_remaining - $this->item_scan_avg_time < 0 ) {
99
+ error_log("Media Cleaner Timeout! Check the Media Cleaner logs for more info.");
100
+ $this->log( "Timeout! Some info for debug:" );
101
+ $this->log( "Elapsed time: $this->time_elapsed" );
102
+ $this->log( "WP init time: $this->wordpress_init_time" );
103
+ $this->log( "Remaining time: $this->time_remaining" );
104
+ $this->log( "Scan time per item: $this->item_scan_avg_time" );
105
+ $this->log( "PHP max_execution_time: $this->max_execution_time" );
106
+ header("HTTP/1.0 408 Request Timeout");
107
+ exit;
108
+ }
109
  }
110
  }
111
 
284
  continue;
285
  else if ( is_numeric( $value ) )
286
  array_push( $ids, $value );
287
+ else {
288
  if ( $this->is_url( $value ) )
289
  array_push( $urls, $this->clean_url( $value ) );
290
+ }
291
  }
292
  }
293
  }
media-cleaner.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Media Cleaner
4
  Plugin URI: https://meowapps.com
5
  Description: Clean your Media Library, many options, trash system.
6
- Version: 5.4.3
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-cleaner
@@ -25,7 +25,7 @@ if ( is_admin() ) {
25
 
26
  global $wpmc_version;
27
  global $wpmc;
28
- $wpmc_version = '5.4.3';
29
 
30
  require __DIR__ . '/admin.php';
31
  require __DIR__ . '/core.php';
3
  Plugin Name: Media Cleaner
4
  Plugin URI: https://meowapps.com
5
  Description: Clean your Media Library, many options, trash system.
6
+ Version: 5.4.4
7
  Author: Jordy Meow
8
  Author URI: https://meowapps.com
9
  Text Domain: media-cleaner
25
 
26
  global $wpmc_version;
27
  global $wpmc;
28
+ $wpmc_version = '5.4.4';
29
 
30
  require __DIR__ . '/admin.php';
31
  require __DIR__ . '/core.php';
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Media Cleaner ===
2
  Contributors: TigrouMeow
3
- Tags: clean, delete, file, files, images, image, media, library, upload, acf
4
  Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
5
  Requires at least: 4.8
6
  Tested up to: 5.2
7
  Requires PHP: 7.0
8
- Stable tag: 5.4.3
9
 
10
  Clean your WordPress from unused or broken media and files. It has its own trash system and recovery features. Please read the description.
11
 
@@ -17,25 +17,23 @@ Media Cleaner cleans your Media Library from the media entries (and files) which
17
 
18
  For compatibility, Pro version and important information, please read this until the end. Last but not least, it is necessary to read the [tutorial](https://meowapps.com/media-cleaner-tutorial/). It is available on the official website, here: [Media Cleaner](https://meowapps.com/media-cleaner).
19
 
20
- === IMPORTANT ===
21
 
22
- This tool is a knife. Do not use it if you don't have any backup, or if you don't know what it does. Such a plugin is difficult to create and to maintain. If you understand WordPress, you probably know why. This plugin does its best to help you. Learn how to use it and you will get awesome results. And don't forget to make a backup of your website.
23
 
24
  === DASHBOARD ===
25
 
26
- The files detected as not used will be listed in a specific dashboard. At this point, it will be up to you to delete them. They will be then moved to a trash internal to the plugin. After more testing, you can retrieve those files from the trash, or you can delete them permanently.
27
 
28
  === COMPATIBILITY ===
29
 
30
- It works with any kind of media entries, including their retina and/or WebP versions. It is tested on modern WordPress installs (with Gutenberg) as well as older ones, with various themes and by a community of thousands of users. It does support **WooCommerce**. Support for specific plugins is being added little by little. As it requires meticulous a lot of work and testing, **the Pro version might be required if you are using complex plugins to handle the content of your website**.
31
 
32
  === PRO VERSION ===
33
 
34
  The Pro version adds Filesystem Analysis, extra support for complex plugins, Live Site option and WP-CLI support.
35
 
36
- [Media Cleaner Pro](https://meowapps.com/media-cleaner) can scan your physical /uploads directory, and match it against the Media Library.
37
-
38
- It has extra support for complex plugins, such as:
39
 
40
  - ACF (+ ACF Widgets)
41
  - Divi Builder
@@ -43,15 +41,17 @@ It has extra support for complex plugins, such as:
43
  - Visual Composer (WPBakery)
44
  - Elementor
45
  - Beaver Builder
46
- - And others (Theme X, ZipList Recipe, ...)
 
 
47
 
48
  The Live Site option will analyze the online version of your website, which might enhance the accuracy of the Cleaner in edge-cases.
49
 
50
- Last but not least, [Media Cleaner Pro](https://meowapps.com/media-cleaner) has support for WP-CLI. If you have direct access (SSH) to your server, you will be able to run the plugin at a much higher speed, have it ran automatically, etc.
51
 
52
  === AGAIN, BE CAREFUL ===
53
 
54
- Last but not least, and... again: this plugin deletes files. Be careful! Backup is not only important, it is **necessary**. Don't use this plugin if you don't understand what it does and how WordPress works.
55
 
56
  === SPECIAL THANKS ===
57
 
@@ -71,6 +71,11 @@ Last but not least, and... again: this plugin deletes files. Be careful! Backup
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
74
  = 5.4.3 =
75
  * Add: Support for Yoast SEO and its Facebook Image.
76
  * Add: Support for Elementor and Oxygen Builder.
1
  === Media Cleaner ===
2
  Contributors: TigrouMeow
3
+ Tags: clean, delete, file, files, images, image, media, library, upload, acf, gutenberg
4
  Donate link: https://commerce.coinbase.com/checkout/d047546a-77a8-41c8-9ea9-4a950f61832f
5
  Requires at least: 4.8
6
  Tested up to: 5.2
7
  Requires PHP: 7.0
8
+ Stable tag: 5.4.4
9
 
10
  Clean your WordPress from unused or broken media and files. It has its own trash system and recovery features. Please read the description.
11
 
17
 
18
  For compatibility, Pro version and important information, please read this until the end. Last but not least, it is necessary to read the [tutorial](https://meowapps.com/media-cleaner-tutorial/). It is available on the official website, here: [Media Cleaner](https://meowapps.com/media-cleaner).
19
 
20
+ === VERY IMPORTANT ===
21
 
22
+ This tool is a knife. Do not use it if you don't have any backup, or if you don't understand what it does. This plugin does its best to help you. Learn how to use it and you will get awesome results.
23
 
24
  === DASHBOARD ===
25
 
26
+ The files detected as not used will be listed in a specific dashboard. It will be up to you to delete them. Then, they will be moved to a trash internal to the plugin. After more testing, you can retrieve those files from the trash, or you can delete them permanently.
27
 
28
  === COMPATIBILITY ===
29
 
30
+ It works with any kind of media entries, including their retina and/or WebP versions. It is tested on modern WordPress installs (Gutenberg included) as well as older ones, with various themes and by a community of thousands of users. It does support **WooCommerce**. As it requires meticulous a lot of work and testing, **the Pro version might be required if you are using complex plugins to handle the content of your website**. I am constantly increasing the compatibility.
31
 
32
  === PRO VERSION ===
33
 
34
  The Pro version adds Filesystem Analysis, extra support for complex plugins, Live Site option and WP-CLI support.
35
 
36
+ With the Filesystem Analysis, [Media Cleaner Pro](https://meowapps.com/media-cleaner) scans your physical /uploads directory, and match it against the Media Library. It also has extra support for complex plugins, such as:
 
 
37
 
38
  - ACF (+ ACF Widgets)
39
  - Divi Builder
41
  - Visual Composer (WPBakery)
42
  - Elementor
43
  - Beaver Builder
44
+ - Brizy Builder
45
+ - Oxygen Builder
46
+ - And more (Theme X, ZipList Recipe, UberMenu...)
47
 
48
  The Live Site option will analyze the online version of your website, which might enhance the accuracy of the Cleaner in edge-cases.
49
 
50
+ Last but not least, [Media Cleaner Pro](https://meowapps.com/media-cleaner) has support for WP-CLI. If you have direct access (SSH) to your server, you will be able to run the plugin at a much higher speed or have it ran automatically, if you like.
51
 
52
  === AGAIN, BE CAREFUL ===
53
 
54
+ Better to be safe than sorry. This plugin deletes files! Therefore, backup is not only important, it is **necessary**. Don't use this plugin if you are not ready. I can't help you if you damaged your install.
55
 
56
  === SPECIAL THANKS ===
57
 
71
 
72
  == Changelog ==
73
 
74
+ = 5.4.4 =
75
+ * Add: Support for Brizy Builder.
76
+ * Fix: Doesn't trigger the timeout check if WP-CLI is being used.
77
+ * Add: WP-CLI can now delete and trash media entries and files.
78
+
79
  = 5.4.3 =
80
  * Add: Support for Yoast SEO and its Facebook Image.
81
  * Add: Support for Elementor and Oxygen Builder.
views/menu-screen.php CHANGED
@@ -196,6 +196,12 @@
196
  echo "</p></div>";
197
  }
198
 
 
 
 
 
 
 
199
  if ( function_exists( 'amd_zlrecipe_convert_to_recipe' ) ) {
200
  echo "<div class='notice notice-warning'><p>";
201
  _e( "<b>ZipList Recipe has been detected</b>. The free version might detect the files used by ZipList Recipe correctly, but its full support is only available in <a target='_blank' href='//meowapps.com/media-cleaner'>Media Cleaner Pro</a>.", 'media-cleaner' );
196
  echo "</p></div>";
197
  }
198
 
199
+ if ( class_exists( 'Brizy_Editor_Post' ) ) {
200
+ echo "<div class='notice notice-warning'><p>";
201
+ _e( "<b>Brizy has been detected</b>. The free version might detect the files used by Brizy correctly, but its full support is only available in <a target='_blank' href='//meowapps.com/media-cleaner'>Media Cleaner Pro</a>.", 'media-cleaner' );
202
+ echo "</p></div>";
203
+ }
204
+
205
  if ( function_exists( 'amd_zlrecipe_convert_to_recipe' ) ) {
206
  echo "<div class='notice notice-warning'><p>";
207
  _e( "<b>ZipList Recipe has been detected</b>. The free version might detect the files used by ZipList Recipe correctly, but its full support is only available in <a target='_blank' href='//meowapps.com/media-cleaner'>Media Cleaner Pro</a>.", 'media-cleaner' );