Version Description
- Fix: Could not empty trash if Media was already removed.
Download this release
Release Info
Developer | TigrouMeow |
Plugin | Media Cleaner |
Version | 4.2.4 |
Comparing to | |
See all releases |
Code changes from version 4.2.3 to 4.2.4
- common/admin.php +10 -4
- core.php +5 -1
- media-cleaner.php +2 -2
- readme.txt +6 -3
- wpmc_admin.php +0 -1
- wpmc_checkers.php +3 -0
common/admin.php
CHANGED
@@ -19,6 +19,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
19 |
add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
|
20 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
21 |
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
|
|
22 |
}
|
23 |
MeowApps_Admin::$loaded = true;
|
24 |
}
|
@@ -42,6 +43,11 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
42 |
}
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
45 |
function show_meowapps_create_rating_date() {
|
46 |
delete_option( 'meowapps_hide_meowapps' );
|
47 |
$this->create_rating_date();
|
@@ -77,8 +83,8 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
77 |
return;
|
78 |
}
|
79 |
$rating_date = get_option( $this->prefix . '_rating_date' );
|
80 |
-
echo '<div class="notice notice-success" data-rating-date="' . $rating_date . '>';
|
81 |
-
echo '<p style="font-size:
|
82 |
echo '<p>
|
83 |
<form method="post" action="" style="float: right;">
|
84 |
<input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
|
@@ -196,7 +202,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
196 |
$value = get_option( 'meowapps_hide_ads', null );
|
197 |
$html = '<input type="checkbox" id="meowapps_hide_ads" name="meowapps_hide_ads" value="1" ' .
|
198 |
checked( 1, get_option( 'meowapps_hide_ads' ), false ) . '/>';
|
199 |
-
$html .= __( '<label>Hide</label><br /><small>Doesn\'t display the ads.</small>', '
|
200 |
echo $html;
|
201 |
}
|
202 |
|
@@ -204,7 +210,7 @@ if ( !class_exists( 'MeowApps_Admin' ) ) {
|
|
204 |
$value = get_option( 'meowapps_hide_meowapps', null );
|
205 |
$html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
|
206 |
checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
|
207 |
-
$html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a nicer an faster WordPress admin UI. An option will be added in Settings > General to display it again.</small>', '
|
208 |
echo $html;
|
209 |
}
|
210 |
|
19 |
add_action( 'admin_menu', array( $this, 'admin_menu_start' ) );
|
20 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
21 |
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
|
22 |
+
add_filter( 'updraftplus_com_link', array( $this, 'updraftplus_com_link' ) );
|
23 |
}
|
24 |
MeowApps_Admin::$loaded = true;
|
25 |
}
|
43 |
}
|
44 |
}
|
45 |
|
46 |
+
function updraftplus_com_link( $url ) {
|
47 |
+
$url = $url . "?afref=460";
|
48 |
+
return $url;
|
49 |
+
}
|
50 |
+
|
51 |
function show_meowapps_create_rating_date() {
|
52 |
delete_option( 'meowapps_hide_meowapps' );
|
53 |
$this->create_rating_date();
|
83 |
return;
|
84 |
}
|
85 |
$rating_date = get_option( $this->prefix . '_rating_date' );
|
86 |
+
echo '<div class="notice notice-success" data-rating-date="' . date( 'Y-m-d', $rating_date ) . '">';
|
87 |
+
echo '<p style="font-size: 100%;">You have been using <b>' . $this->nice_name_from_file( $this->mainfile ) . '</b> for some time now. If you enjoy it, could you share your thoughts and give the developers a sweet spike of motivation? In that case, please: <a target="_blank" href="https://wordpress.org/support/plugin/' . $this->nice_short_url_from_file( $this->mainfile ) . '/reviews/?rate=5#new-post">review it</a>. Thank you :)';
|
88 |
echo '<p>
|
89 |
<form method="post" action="" style="float: right;">
|
90 |
<input type="hidden" name="' . $this->prefix . '_never_remind_me" value="true">
|
202 |
$value = get_option( 'meowapps_hide_ads', null );
|
203 |
$html = '<input type="checkbox" id="meowapps_hide_ads" name="meowapps_hide_ads" value="1" ' .
|
204 |
checked( 1, get_option( 'meowapps_hide_ads' ), false ) . '/>';
|
205 |
+
$html .= __( '<label>Hide</label><br /><small>Doesn\'t display the ads.</small>', 'meowapps' );
|
206 |
echo $html;
|
207 |
}
|
208 |
|
210 |
$value = get_option( 'meowapps_hide_meowapps', null );
|
211 |
$html = '<input type="checkbox" id="meowapps_hide_meowapps" name="meowapps_hide_meowapps" value="1" ' .
|
212 |
checked( 1, get_option( 'meowapps_hide_meowapps' ), false ) . '/>';
|
213 |
+
$html .= __( '<label>Hide <b>Meow Apps</b> Menu</label><br /><small>Hide Meow Apps menu and all its components, for a nicer an faster WordPress admin UI. An option will be added in Settings > General to display it again.</small>', 'meowapps' );
|
214 |
echo $html;
|
215 |
}
|
216 |
|
core.php
CHANGED
@@ -524,6 +524,10 @@ class Meow_WPMC_Core {
|
|
524 |
|
525 |
// Copy the main file back
|
526 |
$fullpath = get_attached_file( $issue->postId );
|
|
|
|
|
|
|
|
|
527 |
$mainfile = $this->wpmc_clean_uploaded_filename( $fullpath );
|
528 |
$baseUp = pathinfo( $mainfile );
|
529 |
$baseUp = $baseUp['dirname'];
|
@@ -1093,7 +1097,7 @@ class Meow_WPMC_Core {
|
|
1093 |
$hide_warning = get_option( 'wpmc_hide_warning', false );
|
1094 |
|
1095 |
if ( !$hide_warning ) {
|
1096 |
-
_e( "<div class='notice notice-error'><p><b style='color: red;'>Important.</b> <b>Backup your DB and your /uploads directory before using Media Cleaner. </b> The deleted files will be temporarily moved to the <b>uploads/wpmc-trash</b> directory. After testing your website, you can check the <a href='?page=media-cleaner&s&view=deleted'>trash</a> to either empty it or recover the media and files. The Media Cleaner does its best to be safe to use. However, WordPress being a very dynamic and pluggable system, it is impossible to predict all the situations in which your files are used. <b style='color: red;'>Again, please backup!</b> <br /><br /><b style='color: red;'>Be thoughtful.</b> Don't blame Media Cleaner if it deleted too many or not enough of your files. It makes cleaning possible and this task is only possible this way; don't post a bad review because it broke your install. <b>If you have a proper backup, there is no risk</b>. Sorry for the lengthy message, but better be safe than sorry. You can disable this big warning in the options if you have a Pro license. Make sure you read this warning twice. Media Cleaner is awesome and always getting better so I hope you will enjoy it. Thank you :)</p></div>", 'media-cleaner' );
|
1097 |
}
|
1098 |
|
1099 |
if ( !MEDIA_TRASH ) {
|
524 |
|
525 |
// Copy the main file back
|
526 |
$fullpath = get_attached_file( $issue->postId );
|
527 |
+
if ( empty( $fullpath ) ) {
|
528 |
+
error_log( "Media {$issue->postId} does not have attached file anymore." );
|
529 |
+
return false;
|
530 |
+
}
|
531 |
$mainfile = $this->wpmc_clean_uploaded_filename( $fullpath );
|
532 |
$baseUp = pathinfo( $mainfile );
|
533 |
$baseUp = $baseUp['dirname'];
|
1097 |
$hide_warning = get_option( 'wpmc_hide_warning', false );
|
1098 |
|
1099 |
if ( !$hide_warning ) {
|
1100 |
+
_e( "<div class='notice notice-error'><p><b style='color: red;'>Important.</b> <b>Backup your DB and your /uploads directory before using Media Cleaner. </b> The deleted files will be temporarily moved to the <b>uploads/wpmc-trash</b> directory. After testing your website, you can check the <a href='?page=media-cleaner&s&view=deleted'>trash</a> to either empty it or recover the media and files. The Media Cleaner does its best to be safe to use. However, WordPress being a very dynamic and pluggable system, it is impossible to predict all the situations in which your files are used. <b style='color: red;'>Again, please backup!</b> If you don't know how, give a try to this: <a href='https://updraftplus.com/?afref=460' target='_blank'>UpdraftPlus</a>. <br /><br /><b style='color: red;'>Be thoughtful.</b> Don't blame Media Cleaner if it deleted too many or not enough of your files. It makes cleaning possible and this task is only possible this way; don't post a bad review because it broke your install. <b>If you have a proper backup, there is no risk</b>. Sorry for the lengthy message, but better be safe than sorry. You can disable this big warning in the options if you have a Pro license. Make sure you read this warning twice. Media Cleaner is awesome and always getting better so I hope you will enjoy it. Thank you :)</p></div>", 'media-cleaner' );
|
1101 |
}
|
1102 |
|
1103 |
if ( !MEDIA_TRASH ) {
|
media-cleaner.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Media Cleaner
|
4 |
Plugin URI: http://meowapps.com
|
5 |
Description: Clean your Media Library, many options, trash system.
|
6 |
-
Version: 4.2.
|
7 |
Author: Jordy Meow
|
8 |
Author URI: http://meowapps.com
|
9 |
Text Domain: media-cleaner
|
@@ -27,7 +27,7 @@ if ( class_exists( 'Meow_WPMC_Core' ) ) {
|
|
27 |
if ( is_admin() ) {
|
28 |
|
29 |
global $wpmc_version;
|
30 |
-
$wpmc_version = '4.2.
|
31 |
|
32 |
// Admin
|
33 |
require( 'wpmc_admin.php' );
|
3 |
Plugin Name: Media Cleaner
|
4 |
Plugin URI: http://meowapps.com
|
5 |
Description: Clean your Media Library, many options, trash system.
|
6 |
+
Version: 4.2.4
|
7 |
Author: Jordy Meow
|
8 |
Author URI: http://meowapps.com
|
9 |
Text Domain: media-cleaner
|
27 |
if ( is_admin() ) {
|
28 |
|
29 |
global $wpmc_version;
|
30 |
+
$wpmc_version = '4.2.4';
|
31 |
|
32 |
// Admin
|
33 |
require( 'wpmc_admin.php' );
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: TigrouMeow
|
|
3 |
Tags: management, admin, file, files, images, image, media, library, upload, clean, cleaning
|
4 |
Requires at least: 4.2
|
5 |
Tested up to: 4.8
|
6 |
-
Stable tag: 4.2.
|
7 |
|
8 |
Clean your Media Library and Uploads directory. It has an internal trash and recovery features. Please read the description.
|
9 |
|
@@ -11,7 +11,7 @@ Clean your Media Library and Uploads directory. It has an internal trash and rec
|
|
11 |
|
12 |
Clean your Media Library from the media which aren't used in any of your posts, gallery and so on. It features an internal trash, moving the files in there temporarily for you to make sure the files aren't actually in used; once checked, you can trash them permanently. **Before using this plugin, make sure you have a proper backup of your files and database. This is the most important step on the usage of this plugin as you can't trust any file deletion tools.** The Pro version of this plugin brings also scanning to the /uploads folder and will detect which files aren't registered in the Media Library, not used in your content and so on. Retina images are also detected and supported, shortcodes, HTML in sidebars and of course your posts, pages and all post types.
|
13 |
|
14 |
-
**This tool is a knife. I do my best to make this knife a perfect one. However, this is still a knife, and in the hands of somebody who doesn't know how to use it, it might end badly. Don't use it if you don't have any backup, or if you don't know what it does.**
|
15 |
|
16 |
**PAGE BUILDER**. I am adding support for page builders little by little. Each page builder requires a particular code in the Media Cleaner. As for now, Visual Composer by WPBakery is supported.
|
17 |
|
@@ -19,7 +19,7 @@ Clean your Media Library from the media which aren't used in any of your posts,
|
|
19 |
|
20 |
**DASHBOARD**. Those file will be shown in a specific dashboard. At this point, it will be up to you to delete them. Files detected as un-used are added to a specific dashboard where you can choose to trash them. They will be then moved to a trash internal to the plugin. After more testing, you can trash them definitely.
|
21 |
|
22 |
-
**FREE / PRO**. The Free version of the plugin works with the media available in your Media Library. The Pro version adds
|
23 |
|
24 |
**AGAIN, BE CAREFUL**. Again, this plugin deletes files so... be careful! Backup is not only important, it is **necessary**. Don't use this plugin if you don't understand how WordPress works. This is a knife, you need to understand what it does and how before using it.
|
25 |
|
@@ -50,6 +50,9 @@ It re-creates the Media Cleaner table in the database. You will need to re-run t
|
|
50 |
|
51 |
== Changelog ==
|
52 |
|
|
|
|
|
|
|
53 |
= 4.2.3 =
|
54 |
* Fix: Meta search issue.
|
55 |
* Fix: SQL typo for WooCommerce detection.
|
3 |
Tags: management, admin, file, files, images, image, media, library, upload, clean, cleaning
|
4 |
Requires at least: 4.2
|
5 |
Tested up to: 4.8
|
6 |
+
Stable tag: 4.2.4
|
7 |
|
8 |
Clean your Media Library and Uploads directory. It has an internal trash and recovery features. Please read the description.
|
9 |
|
11 |
|
12 |
Clean your Media Library from the media which aren't used in any of your posts, gallery and so on. It features an internal trash, moving the files in there temporarily for you to make sure the files aren't actually in used; once checked, you can trash them permanently. **Before using this plugin, make sure you have a proper backup of your files and database. This is the most important step on the usage of this plugin as you can't trust any file deletion tools.** The Pro version of this plugin brings also scanning to the /uploads folder and will detect which files aren't registered in the Media Library, not used in your content and so on. Retina images are also detected and supported, shortcodes, HTML in sidebars and of course your posts, pages and all post types.
|
13 |
|
14 |
+
**This tool is a knife. I do my best to make this knife a perfect one. However, this is still a knife, and in the hands of somebody who doesn't know how to use it, it might end badly. Don't use it if you don't have any backup, or if you don't know what it does. For backup, you can use such a plugin as [UpdraftPlus](https://updraftplus.com/?afref=460).**
|
15 |
|
16 |
**PAGE BUILDER**. I am adding support for page builders little by little. Each page builder requires a particular code in the Media Cleaner. As for now, Visual Composer by WPBakery is supported.
|
17 |
|
19 |
|
20 |
**DASHBOARD**. Those file will be shown in a specific dashboard. At this point, it will be up to you to delete them. Files detected as un-used are added to a specific dashboard where you can choose to trash them. They will be then moved to a trash internal to the plugin. After more testing, you can trash them definitely.
|
21 |
|
22 |
+
**FREE / PRO**. The Free version of the plugin works with the media available in your Media Library. The Pro version adds scanning to your physical /uploads directory.
|
23 |
|
24 |
**AGAIN, BE CAREFUL**. Again, this plugin deletes files so... be careful! Backup is not only important, it is **necessary**. Don't use this plugin if you don't understand how WordPress works. This is a knife, you need to understand what it does and how before using it.
|
25 |
|
50 |
|
51 |
== Changelog ==
|
52 |
|
53 |
+
= 4.2.4 =
|
54 |
+
* Fix: Could not empty trash if Media was already removed.
|
55 |
+
|
56 |
= 4.2.3 =
|
57 |
* Fix: Meta search issue.
|
58 |
* Fix: SQL typo for WooCommerce detection.
|
wpmc_admin.php
CHANGED
@@ -155,7 +155,6 @@ class Meow_WPMC_Admin extends MeowApps_Admin {
|
|
155 |
<?php
|
156 |
echo $this->display_title( "Media Cleaner" );
|
157 |
?>
|
158 |
-
<p>This plugin will help you cleaning your WordPress install.</p>
|
159 |
<div class="meow-section meow-group">
|
160 |
<div class="meow-box meow-col meow-span_2_of_2">
|
161 |
<h3>How to use</h3>
|
155 |
<?php
|
156 |
echo $this->display_title( "Media Cleaner" );
|
157 |
?>
|
|
|
158 |
<div class="meow-section meow-group">
|
159 |
<div class="meow-box meow-col meow-span_2_of_2">
|
160 |
<h3>How to use</h3>
|
wpmc_checkers.php
CHANGED
@@ -105,6 +105,9 @@ class Meow_WPMC_Checkers {
|
|
105 |
if ( !get_option( 'wpmc_postmeta', true ) )
|
106 |
return false;
|
107 |
|
|
|
|
|
|
|
108 |
global $wpdb;
|
109 |
$uploads = wp_upload_dir();
|
110 |
$parsedURL = parse_url( $uploads['baseurl'] );
|
105 |
if ( !get_option( 'wpmc_postmeta', true ) )
|
106 |
return false;
|
107 |
|
108 |
+
// There is a META called 'gallery' with something like '5342, 8392, 5832'
|
109 |
+
// By what is it created?
|
110 |
+
|
111 |
global $wpdb;
|
112 |
$uploads = wp_upload_dir();
|
113 |
$parsedURL = parse_url( $uploads['baseurl'] );
|