Version Description
- Add: Filters for Filesystem scan. Please have a look at the tutorial (https://meowapps.com/media-cleaner-tutorial/), there is now a section about those filters.
- Fix: Query for metakey.
- Fix: Thumbnails matching.
- Update: Compatibility for WordPress 5 and Gutenberg.
Download this release
Release Info
Developer | TigrouMeow |
Plugin | Media Cleaner |
Version | 5.1.0 |
Comparing to | |
See all releases |
Code changes from version 5.0.1 to 5.1.0
- admin.php +68 -1
- core.php +1 -1
- media-cleaner.css +7 -0
- media-cleaner.php +2 -2
- readme.txt +10 -4
- scan.php +11 -9
- settings.js +49 -0
- ui.php +26 -1
- views/menu-screen.php +4 -4
admin.php
CHANGED
@@ -10,6 +10,40 @@ class Meow_WPMC_Admin extends MeowApps_Admin {
|
|
10 |
parent::__construct( $prefix, $mainfile, $domain );
|
11 |
add_action( 'admin_menu', array( $this, 'app_menu' ) );
|
12 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
function admin_notices() {
|
@@ -76,6 +110,22 @@ class Meow_WPMC_Admin extends MeowApps_Admin {
|
|
76 |
array( $this, 'admin_thumbnails_only_callback' ),
|
77 |
'wpmc_filters_settings-menu', 'wpmc_filters_settings' );
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
// SUBMENU > Settings > UI
|
80 |
add_settings_section( 'wpmc_ui_settings', null, null, 'wpmc_ui_settings-menu' );
|
81 |
add_settings_field( 'wpmc_hide_thumbnails', "Thumbnails",
|
@@ -113,8 +163,9 @@ class Meow_WPMC_Admin extends MeowApps_Admin {
|
|
113 |
register_setting( 'wpmc_settings', 'wpmc_postmeta' );
|
114 |
register_setting( 'wpmc_settings', 'wpmc_debuglogs' );
|
115 |
|
116 |
-
|
117 |
register_setting( 'wpmc_filters_settings', 'wpmc_thumbnails_only' );
|
|
|
|
|
118 |
|
119 |
register_setting( 'wpmc_ui_settings', 'wpmc_hide_thumbnails' );
|
120 |
register_setting( 'wpmc_ui_settings', 'wpmc_hide_warning' );
|
@@ -382,6 +433,22 @@ HTML;
|
|
382 |
echo $html;
|
383 |
}
|
384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
/**
|
386 |
*
|
387 |
* GET / SET OPTIONS (TO REMOVE)
|
10 |
parent::__construct( $prefix, $mainfile, $domain );
|
11 |
add_action( 'admin_menu', array( $this, 'app_menu' ) );
|
12 |
add_action( 'admin_notices', array( $this, 'admin_notices' ) );
|
13 |
+
add_filter( 'pre_update_option', array( $this, 'pre_update_option' ), 10, 3 );
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Filters and performs validation for certain options
|
18 |
+
* @param mixed $value Option value
|
19 |
+
* @param string $option Option name
|
20 |
+
* @param mixed $old_value The current value of the option
|
21 |
+
* @return mixed The actual value to be stored
|
22 |
+
*/
|
23 |
+
function pre_update_option( $value, $option, $old_value ) {
|
24 |
+
if ( strpos( $option, 'wpmc_' ) !== 0 ) return $value; // Never touch extraneous options
|
25 |
+
$validated = $this->validate_option( $option, $value );
|
26 |
+
if ( $validated instanceof WP_Error ) {
|
27 |
+
// TODO: Show warning for invalid option value
|
28 |
+
return $old_value;
|
29 |
+
}
|
30 |
+
return $validated;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Validates certain option values
|
35 |
+
* @param string $option Option name
|
36 |
+
* @param mixed $value Option value
|
37 |
+
* @return mixed|WP_Error Validated value if no problem
|
38 |
+
*/
|
39 |
+
function validate_option( $option, $value ) {
|
40 |
+
switch ( $option ) {
|
41 |
+
case 'wpmc_dirs_filter':
|
42 |
+
case 'wpmc_files_filter':
|
43 |
+
if ( $value && @preg_match( $value, '' ) === false ) return new WP_Error( 'invalid_option', __( "Invalid Regular-Expression", 'media-cleaner' ) );
|
44 |
+
break;
|
45 |
+
}
|
46 |
+
return $value;
|
47 |
}
|
48 |
|
49 |
function admin_notices() {
|
110 |
array( $this, 'admin_thumbnails_only_callback' ),
|
111 |
'wpmc_filters_settings-menu', 'wpmc_filters_settings' );
|
112 |
|
113 |
+
add_settings_field(
|
114 |
+
'wpmc_dirs_filter',
|
115 |
+
'Directories Filter',
|
116 |
+
array( $this, 'admin_dirs_filter_callback' ),
|
117 |
+
'wpmc_filters_settings-menu',
|
118 |
+
'wpmc_filters_settings'
|
119 |
+
);
|
120 |
+
|
121 |
+
add_settings_field(
|
122 |
+
'wpmc_files_filter',
|
123 |
+
'Files Filter',
|
124 |
+
array( $this, 'admin_files_filter_callback' ),
|
125 |
+
'wpmc_filters_settings-menu',
|
126 |
+
'wpmc_filters_settings'
|
127 |
+
);
|
128 |
+
|
129 |
// SUBMENU > Settings > UI
|
130 |
add_settings_section( 'wpmc_ui_settings', null, null, 'wpmc_ui_settings-menu' );
|
131 |
add_settings_field( 'wpmc_hide_thumbnails', "Thumbnails",
|
163 |
register_setting( 'wpmc_settings', 'wpmc_postmeta' );
|
164 |
register_setting( 'wpmc_settings', 'wpmc_debuglogs' );
|
165 |
|
|
|
166 |
register_setting( 'wpmc_filters_settings', 'wpmc_thumbnails_only' );
|
167 |
+
register_setting( 'wpmc_filters_settings', 'wpmc_dirs_filter' );
|
168 |
+
register_setting( 'wpmc_filters_settings', 'wpmc_files_filter' );
|
169 |
|
170 |
register_setting( 'wpmc_ui_settings', 'wpmc_hide_thumbnails' );
|
171 |
register_setting( 'wpmc_ui_settings', 'wpmc_hide_warning' );
|
433 |
echo $html;
|
434 |
}
|
435 |
|
436 |
+
function admin_dirs_filter_callback( $args ) {
|
437 |
+
$value = get_option( 'wpmc_dirs_filter', '' );
|
438 |
+
$invalid = @preg_match( $value, '' ) === false;
|
439 |
+
?>
|
440 |
+
<input type="text" id="wpmc_dirs_filter" name="wpmc_dirs_filter" value="<?php echo $value; ?>" placeholder="/regex/" autocomplete="off" data-needs-validation style="font-family: monospace;">
|
441 |
+
<?php
|
442 |
+
}
|
443 |
+
|
444 |
+
function admin_files_filter_callback( $args ) {
|
445 |
+
$value = get_option( 'wpmc_files_filter', '' );
|
446 |
+
$invalid = @preg_match( $value, '' ) === false;
|
447 |
+
?>
|
448 |
+
<input type="text" id="wpmc_files_filter" name="wpmc_files_filter" value="<?php echo $value; ?>" placeholder="/regex/" autocomplete="off" data-needs-validation style="font-family: monospace;">
|
449 |
+
<?php
|
450 |
+
}
|
451 |
+
|
452 |
/**
|
453 |
*
|
454 |
* GET / SET OPTIONS (TO REMOVE)
|
core.php
CHANGED
@@ -819,7 +819,7 @@ function wpmc_reset () {
|
|
819 |
if ( !is_writable( $basedir ) ) {
|
820 |
echo '<div class="error"><p>' . __( 'The directory for uploads is not writable. Media Cleaner will only be able to scan.', 'media-cleaner' ) . '</p></div>';
|
821 |
}
|
822 |
-
|
823 |
}
|
824 |
|
825 |
function wpmc_install() {
|
819 |
if ( !is_writable( $basedir ) ) {
|
820 |
echo '<div class="error"><p>' . __( 'The directory for uploads is not writable. Media Cleaner will only be able to scan.', 'media-cleaner' ) . '</p></div>';
|
821 |
}
|
822 |
+
|
823 |
}
|
824 |
|
825 |
function wpmc_install() {
|
media-cleaner.css
CHANGED
@@ -83,3 +83,10 @@
|
|
83 |
#wpmc-dialog .prompt .button + .button {
|
84 |
margin-left: 16px;
|
85 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
#wpmc-dialog .prompt .button + .button {
|
84 |
margin-left: 16px;
|
85 |
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Settings
|
89 |
+
*/
|
90 |
+
.meow-box form input:invalid {
|
91 |
+
color: red;
|
92 |
+
}
|
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.0
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: media-cleaner
|
@@ -24,7 +24,7 @@ if ( class_exists( 'Meow_WPMC_Core' ) ) {
|
|
24 |
if ( is_admin() ) {
|
25 |
|
26 |
global $wpmc_version;
|
27 |
-
$wpmc_version = '5.0
|
28 |
|
29 |
// Admin
|
30 |
require __DIR__ . '/admin.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.1.0
|
7 |
Author: Jordy Meow
|
8 |
Author URI: https://meowapps.com
|
9 |
Text Domain: media-cleaner
|
24 |
if ( is_admin() ) {
|
25 |
|
26 |
global $wpmc_version;
|
27 |
+
$wpmc_version = '5.1.0';
|
28 |
|
29 |
// Admin
|
30 |
require __DIR__ . '/admin.php';
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: TigrouMeow, amekusa
|
3 |
Tags: clean, delete, file, files, images, image, media, library, upload, clean, acf
|
4 |
Requires at least: 4.8
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 5.0
|
7 |
|
8 |
Clean your WordPress (broken media, unused media, files). It has its own trash and recovery features. Please read the description.
|
9 |
|
@@ -13,7 +13,7 @@ Clean your Media Library from the media which aren't used in any of your posts,
|
|
13 |
|
14 |
A tutorial is available on the official website, here: [Media Cleaner](https://meowapps.com/media-cleaner).
|
15 |
|
16 |
-
**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. For backup, I recommend use the excellent service called [BlogVault](https://blogvault
|
17 |
|
18 |
**SPECIAL PLUGIN**. 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.
|
19 |
|
@@ -42,7 +42,13 @@ The official FAQ is [here](https://meowapps.com/media-cleaner/faq/).
|
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
-
= 5.0
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
* Update: Remove UpdraftPlus.
|
47 |
* Update: Slight code cleaning.
|
48 |
* Update: Checkboxes are updated dynamically.
|
2 |
Contributors: TigrouMeow, amekusa
|
3 |
Tags: clean, delete, file, files, images, image, media, library, upload, clean, acf
|
4 |
Requires at least: 4.8
|
5 |
+
Tested up to: 5.0
|
6 |
+
Stable tag: 5.1.0
|
7 |
|
8 |
Clean your WordPress (broken media, unused media, files). It has its own trash and recovery features. Please read the description.
|
9 |
|
13 |
|
14 |
A tutorial is available on the official website, here: [Media Cleaner](https://meowapps.com/media-cleaner).
|
15 |
|
16 |
+
**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. For backup, I recommend use the excellent service called [BlogVault](https://meow.click/blogvault).**
|
17 |
|
18 |
**SPECIAL PLUGIN**. 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.
|
19 |
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
+
= 5.1.0 =
|
46 |
+
* Add: Filters for Filesystem scan. Please have a look at the tutorial (https://meowapps.com/media-cleaner-tutorial/), there is now a section about those filters.
|
47 |
+
* Fix: Query for metakey.
|
48 |
+
* Fix: Thumbnails matching.
|
49 |
+
* Update: Compatibility for WordPress 5 and Gutenberg.
|
50 |
+
|
51 |
+
= 5.0.2 =
|
52 |
* Update: Remove UpdraftPlus.
|
53 |
* Update: Slight code cleaning.
|
54 |
* Update: Checkboxes are updated dynamically.
|
scan.php
CHANGED
@@ -3,16 +3,11 @@
|
|
3 |
class MeowApps_WPMC_Scan {
|
4 |
|
5 |
private $core = null;
|
6 |
-
private $likes = "";
|
7 |
private $metakeys = array( '%gallery%', '%ids%' );
|
8 |
|
9 |
public function __construct( $core ) {
|
10 |
$this->core = $core;
|
11 |
|
12 |
-
// Prepare likes for SQL
|
13 |
-
foreach ( $this->metakeys as $metakey )
|
14 |
-
$this->likes .= "OR meta_key LIKE '$metakey' ";
|
15 |
-
|
16 |
// Detect values in the general (known, based on %like%) Meta Keys
|
17 |
add_action( 'wpmc_scan_postmeta', array( $this, 'scan_postmeta' ) );
|
18 |
|
@@ -67,10 +62,17 @@ class MeowApps_WPMC_Scan {
|
|
67 |
|
68 |
public function scan_postmeta( $id ) {
|
69 |
global $wpdb;
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
if ( count( $metas ) > 0 ) {
|
75 |
$postmeta_images_ids = array();
|
76 |
$postmeta_images_urls = array();
|
3 |
class MeowApps_WPMC_Scan {
|
4 |
|
5 |
private $core = null;
|
|
|
6 |
private $metakeys = array( '%gallery%', '%ids%' );
|
7 |
|
8 |
public function __construct( $core ) {
|
9 |
$this->core = $core;
|
10 |
|
|
|
|
|
|
|
|
|
11 |
// Detect values in the general (known, based on %like%) Meta Keys
|
12 |
add_action( 'wpmc_scan_postmeta', array( $this, 'scan_postmeta' ) );
|
13 |
|
62 |
|
63 |
public function scan_postmeta( $id ) {
|
64 |
global $wpdb;
|
65 |
+
|
66 |
+
$likes = array ();
|
67 |
+
foreach ( $this->metakeys as $metakey ) $likes[] = "OR meta_key LIKE '{$metakey}'";
|
68 |
+
$likes = implode( ' ', $likes );
|
69 |
+
|
70 |
+
$q = <<< SQL
|
71 |
+
SELECT meta_value FROM {$wpdb->postmeta}
|
72 |
+
WHERE post_id = %d
|
73 |
+
AND (meta_key = '_thumbnail_id' {$likes})
|
74 |
+
SQL;
|
75 |
+
$metas = $wpdb->get_col( $wpdb->prepare( $q, $id ) );
|
76 |
if ( count( $metas ) > 0 ) {
|
77 |
$postmeta_images_ids = array();
|
78 |
$postmeta_images_urls = array();
|
settings.js
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Script for settings screen
|
3 |
+
*/
|
4 |
+
(function ($) {
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Validation
|
8 |
+
*/
|
9 |
+
$('form *[data-needs-validation]').on('input', function (ev) {
|
10 |
+
var $this = $(this);
|
11 |
+
var form = $this.closest('form');
|
12 |
+
var submit = form.find('*[type=submit]');
|
13 |
+
submit.attr('disabled', true);
|
14 |
+
|
15 |
+
$.ajax(ajaxurl, {
|
16 |
+
method: 'post',
|
17 |
+
dataType: 'json',
|
18 |
+
data: {
|
19 |
+
action: 'wpmc_validate_option',
|
20 |
+
name: $this.attr('name'),
|
21 |
+
value: $this.val()
|
22 |
+
}
|
23 |
+
|
24 |
+
}).always(function () {
|
25 |
+
submit.attr('disabled', false);
|
26 |
+
|
27 |
+
}).done(function (response) {
|
28 |
+
if (response.success) {
|
29 |
+
$this[0].setCustomValidity('');
|
30 |
+
|
31 |
+
} else { // Invalid Data
|
32 |
+
$this[0].setCustomValidity(response.data.message);
|
33 |
+
}
|
34 |
+
});
|
35 |
+
});
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Scanning Method
|
39 |
+
*/
|
40 |
+
$('select#wpmc_method').on('change', function (ev) {
|
41 |
+
var selected = $(this).val();
|
42 |
+
if (selected == 'media') { // Method = "Media Library"
|
43 |
+
$('input#wpmc_media_library').attr('disabled', true);
|
44 |
+
} else { // Method = Other Else
|
45 |
+
$('input#wpmc_media_library').attr('disabled', false);
|
46 |
+
}
|
47 |
+
});
|
48 |
+
|
49 |
+
})(jQuery);
|
ui.php
CHANGED
@@ -19,6 +19,7 @@ class Meow_WPMC_UI {
|
|
19 |
add_action( 'wp_ajax_wpmc_delete_do', array( $this, 'wp_ajax_wpmc_delete_do' ) );
|
20 |
add_action( 'wp_ajax_wpmc_ignore_do', array( $this, 'wp_ajax_wpmc_ignore_do' ) );
|
21 |
add_action( 'wp_ajax_wpmc_recover_do', array( $this, 'wp_ajax_wpmc_recover_do' ) );
|
|
|
22 |
add_filter( 'media_row_actions', array( $this, 'media_row_actions' ), 10, 2 );
|
23 |
}
|
24 |
|
@@ -57,7 +58,16 @@ class Meow_WPMC_UI {
|
|
57 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
58 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
59 |
wp_enqueue_style( 'media-cleaner-css', plugins_url( '/media-cleaner.css', __FILE__ ) );
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
/**
|
@@ -467,4 +477,19 @@ class Meow_WPMC_UI {
|
|
467 |
);
|
468 |
die();
|
469 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
}
|
19 |
add_action( 'wp_ajax_wpmc_delete_do', array( $this, 'wp_ajax_wpmc_delete_do' ) );
|
20 |
add_action( 'wp_ajax_wpmc_ignore_do', array( $this, 'wp_ajax_wpmc_ignore_do' ) );
|
21 |
add_action( 'wp_ajax_wpmc_recover_do', array( $this, 'wp_ajax_wpmc_recover_do' ) );
|
22 |
+
add_action( 'wp_ajax_wpmc_validate_option', array( $this, 'wp_ajax_wpmc_validate_option' ) );
|
23 |
add_filter( 'media_row_actions', array( $this, 'media_row_actions' ), 10, 2 );
|
24 |
}
|
25 |
|
58 |
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
59 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
60 |
wp_enqueue_style( 'media-cleaner-css', plugins_url( '/media-cleaner.css', __FILE__ ) );
|
61 |
+
|
62 |
+
$screen = get_current_screen();
|
63 |
+
switch ( $screen->id ) {
|
64 |
+
case 'media_page_media-cleaner': // Media > Cleaner
|
65 |
+
wp_enqueue_script( 'media-cleaner', plugins_url( '/media-cleaner.js', __FILE__ ), array( 'jquery', 'jquery-ui-dialog' ), "3.7.0", true );
|
66 |
+
break;
|
67 |
+
case 'meow-apps_page_wpmc_settings-menu': // Meow Apps > Media Cleaner (Settings)
|
68 |
+
wp_enqueue_script( 'media-cleaner-settings', plugins_url( '/settings.js', __FILE__ ), array( 'jquery' ), "3.7.0", true );
|
69 |
+
break;
|
70 |
+
}
|
71 |
}
|
72 |
|
73 |
/**
|
477 |
);
|
478 |
die();
|
479 |
}
|
480 |
+
|
481 |
+
function wp_ajax_wpmc_validate_option() {
|
482 |
+
$name = $_POST['name']; // Option Name
|
483 |
+
$value = $_POST['value']; // Option Value
|
484 |
+
$value = wp_unslash( $value ); // Unescape backslashes
|
485 |
+
$validated = $this->admin->validate_option( $name, $value );
|
486 |
+
if ( $validated instanceof WP_Error ) { // Invalid value
|
487 |
+
$error = array (
|
488 |
+
'code' => $validated->get_error_code() ?: 'invalid_option',
|
489 |
+
'message' => $validated->get_error_message() ?: __( "Invalid Option Value", 'media-cleaner' )
|
490 |
+
);
|
491 |
+
wp_send_json_error( $error );
|
492 |
+
}
|
493 |
+
wp_send_json_success();
|
494 |
+
}
|
495 |
}
|
views/menu-screen.php
CHANGED
@@ -129,8 +129,8 @@
|
|
129 |
$method = "";
|
130 |
$table_scan = $wpdb->prefix . "mclean_scan";
|
131 |
$table_refs = $wpdb->prefix . "mclean_refs";
|
132 |
-
if ( $wpdb->get_var("SHOW TABLES LIKE '$table_scan'") != $table_scan ||
|
133 |
-
$wpdb->get_var("SHOW TABLES LIKE '$table_refs'") != $table_refs ) {
|
134 |
_e( "<div class='notice notice-error'><p><b>The database is not ready for Media Cleaner. The scan will not work.</b> Click on the <b>Reset</b> button, it re-creates the tables required by Media Cleaner. If this message still appear, contact the support.</p></div>", 'media-cleaner' );
|
135 |
}
|
136 |
else {
|
@@ -141,11 +141,11 @@
|
|
141 |
$hide_warning = get_option( 'wpmc_hide_warning', false );
|
142 |
|
143 |
if ( !$hide_warning ) {
|
144 |
-
_e( "<div class='notice notice-warning'><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://blogvault
|
145 |
}
|
146 |
|
147 |
if ( !MEDIA_TRASH ) {
|
148 |
-
_e( "<div class='notice notice-warning'><p>The trash for the Media Library is disabled. Any media removed by the plugin will be <b>permanently deleted</b>. To enable it, modify your wp-config.php file and add this line (preferably at the top)
|
149 |
}
|
150 |
}
|
151 |
|
129 |
$method = "";
|
130 |
$table_scan = $wpdb->prefix . "mclean_scan";
|
131 |
$table_refs = $wpdb->prefix . "mclean_refs";
|
132 |
+
if ( strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table_scan'" ) ) != strtolower( $table_scan ) ||
|
133 |
+
strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table_refs'" ) ) != strtolower( $table_refs ) ) {
|
134 |
_e( "<div class='notice notice-error'><p><b>The database is not ready for Media Cleaner. The scan will not work.</b> Click on the <b>Reset</b> button, it re-creates the tables required by Media Cleaner. If this message still appear, contact the support.</p></div>", 'media-cleaner' );
|
135 |
}
|
136 |
else {
|
141 |
$hide_warning = get_option( 'wpmc_hide_warning', false );
|
142 |
|
143 |
if ( !$hide_warning ) {
|
144 |
+
_e( "<div class='notice notice-warning'><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://meow.click/blogvault' target='_blank'>BlogVault</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' );
|
145 |
}
|
146 |
|
147 |
if ( !MEDIA_TRASH ) {
|
148 |
+
_e( "<div class='notice notice-warning'><p>The trash for the Media Library is disabled. Any media removed by the plugin will be <b>permanently deleted</b>. To enable it, modify your wp-config.php file and add this line (preferably at the top): <b>define( 'MEDIA_TRASH', true );</b></p></div>", 'media-cleaner' );
|
149 |
}
|
150 |
}
|
151 |
|