C:\xampp\htdocs\landing\wp-content\plugins\wp-optimize\optimizations\orphandata.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php

if (!defined('WPO_VERSION')) die('No direct access allowed');

class 
WP_Optimization_orphandata extends WP_Optimization {

    public 
$ui_sort_order 10000;

    public 
$available_for_saving true;

    public 
$support_preview false;

    
/**
     * Do actions after optimize() function.
     */
    
public function after_optimize() {
        
$message sprintf(_n('%s orphaned relationship data deleted''%s orphaned relationship data deleted'$this->processed_count'wp-optimize'), number_format_i18n($this->processed_count));

        if (
$this->is_multisite_mode()) {
            
$message .= ' ' sprintf(_n('across %s site''across %s sites'count($this->blogs_ids), 'wp-optimize'), count($this->blogs_ids));
        }

        
$this->logger->info($message);
        
$this->register_output($message);
    }

    
/**
     * Do optimization.
     */
    
public function optimize() {
        
$clean "DELETE FROM `" $this->wpdb->term_relationships "` WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM `" $this->wpdb->posts "`);";

        
$orphandata $this->query($clean);
        
$this->processed_count += $orphandata;
    }

    
/**
     * Do actions after get_info() function.
     */
    
public function after_get_info() {
        if (
$this->found_count 0) {
            
$message sprintf(_n('%s orphaned relationship data in your database''%s orphaned relationship data in your database'$this->found_count'wp-optimize'), number_format_i18n($this->found_count));
        } else {
            
$message __('No orphaned relationship data in your database''wp-optimize');
        }

        if (
$this->is_multisite_mode()) {
            
$message .= ' ' sprintf(_n('across %s site''across %s sites'count($this->blogs_ids), 'wp-optimize'), count($this->blogs_ids));
        }

        
$this->register_output($message);
    }

    
/**
     * Get count of unoptimized items.
     */
    
public function get_info() {
        
$sql "SELECT COUNT(*) FROM `" $this->wpdb->term_relationships "` WHERE term_taxonomy_id=1 AND object_id NOT IN (SELECT id FROM `" $this->wpdb->posts "`);";
        
$orphandata $this->wpdb->get_var($sql);

        
$this->found_count += $orphandata;
    }
    
    public function 
settings_label() {
        return 
__('Clean orphaned relationship data''wp-optimize');
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586