CHUH

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
in reply to: No “Delete a file when detatched” options #179482

CHUH
Member

I just updated and these options are there now. Thanks!

in reply to: No “Delete a file when detatched” options #179465

CHUH
Member

I do not. I only have the Gutenberg option.

I’m backing up my site this morning before I remove my dead files, and I’m going to remove and reinstall the most recent version of the plugin.

in reply to: No “Delete a file when detatched” options #179446

CHUH
Member

I just wrote a small plugin that moves all unused files to a trash directory. USE AT OWN RISK. Make sure you edit the *** areas with your own settings.

<?php
/*
Plugin Name: WPDM Dead File Checker
Plugin URI: https://wordpress.org/plugins/wpdm_check
Description: Make a list of valid documents.
Version: 1
Author: Colin T
Author URI: http://maniacalventures.com
License: GPLv2 or later
Text Domain: wpdm_check
*/

$dwhtk = new wpdm_check;

class wpdm_check {
	var $wp_prefix = '****';
	var $file_dir	= '***\wp-content\uploads\download-manager-files';
	var $trash_dir	= '***\wp-content\uploads\download-manager-files-trash';
	function __construct() {
		if( !is_dir( $this->trash_dir ) ) {
			mkdir( $this->trash_dir );
		}
		add_action( 'admin_menu', [ $this, 'activate_page' ] );		
	}
	function doit() {
		global $wpdb;				
		$query = "	SELECT po.ID, pm.meta_value FROM {$this->wp_prefix}_posts po 
					LEFT JOIN {$this->wp_prefix}_postmeta pm ON po.ID = pm.post_id 
					WHERE post_type LIKE 'wpdmpro' and meta_key LIKE '__wpdm_files'";
		$raw = $wpdb->get_results( $query );		
		$valid_list = [];
		foreach( $raw as $val ) {
			$valid_list += unserialize( $val->meta_value );
		}
		sort( $valid_list );		
		$real_list = [];		
		foreach( scandir( $this->file_dir ) as $val ) {
			if( $val == '.' or  $val == '..' ) continue;
			$real_list[] = $val;
		}
		$difference = array_diff( $real_list, $valid_list );		
		foreach( $difference as $val ) {
			echo "Trashing: ".$val."<br>\r\n";
			rename( $this->file_dir .'\\'. $val, $this->trash_dir.'\\'.$val );
		}		
	}	
	function activate_page() {
		add_menu_page( 'WPDM Check', 'WPDM Check', 'read', 'wpdm_check_management',  [ $this, 'doit' ], '', 200 );
	}
}
in reply to: Deleted files still on server #179428

CHUH
Member

I do not have those options.

Also, is there a way to clean the hundreds of files that are now not being used?

How do I get this option?


CHUH
Member

Would the fact that I can post in the Pro forum but my WP installation says license is expired indicate that there is an issue with the external license server?


CHUH
Member

I’ve used the paid version for a couple years. It shows as expired today, yet we bought the last license on August 16th of last year. So, we’ve lost a month of time with this license.

On your site, it shows as still valid. On my site, the license key now shows as invalid.

Viewing 6 posts - 1 through 6 (of 6 total)