X7ROOT File Manager
Current Path:
/home/katmhsmi/lifecoachbostonma.com/wp-content/plugins/litespeed-cache/src
home
/
katmhsmi
/
lifecoachbostonma.com
/
wp-content
/
plugins
/
litespeed-cache
/
src
/
📁
..
📄
activation.cls.php
(15.06 KB)
📄
admin-display.cls.php
(33.98 KB)
📄
admin-settings.cls.php
(9.15 KB)
📄
admin.cls.php
(4.51 KB)
📄
api.cls.php
(11.28 KB)
📄
avatar.cls.php
(6.26 KB)
📄
base.cls.php
(30.87 KB)
📁
cdn
📄
cdn-setup.cls.php
(9.76 KB)
📄
cdn.cls.php
(13.52 KB)
📄
cloud.cls.php
(40 KB)
📄
conf.cls.php
(18.9 KB)
📄
control.cls.php
(20.75 KB)
📄
core.cls.php
(19.6 KB)
📄
crawler-map.cls.php
(13.44 KB)
📄
crawler.cls.php
(31.24 KB)
📄
css.cls.php
(13.07 KB)
📄
data.cls.php
(17.3 KB)
📄
data.upgrade.func.php
(22.31 KB)
📁
data_structure
📄
db-optm.cls.php
(8.66 KB)
📄
debug2.cls.php
(11.98 KB)
📄
doc.cls.php
(4.04 KB)
📄
error.cls.php
(6.38 KB)
📄
esi.cls.php
(26.45 KB)
📄
file.cls.php
(10.47 KB)
📄
gui.cls.php
(27.87 KB)
📄
health.cls.php
(3 KB)
📄
htaccess.cls.php
(24.33 KB)
📄
img-optm.cls.php
(55.81 KB)
📄
import.cls.php
(4.32 KB)
📄
instance.cls.php
(153 B)
📄
lang.cls.php
(16.64 KB)
📄
localization.cls.php
(3.53 KB)
📄
media.cls.php
(27.1 KB)
📄
metabox.cls.php
(4.22 KB)
📄
object-cache.cls.php
(15.82 KB)
📄
object.lib.php
(33.85 KB)
📄
optimize.cls.php
(35.34 KB)
📄
optimizer.cls.php
(8.81 KB)
📄
placeholder.cls.php
(14.5 KB)
📄
preset.cls.php
(5.56 KB)
📄
purge.cls.php
(30.43 KB)
📄
report.cls.php
(5.43 KB)
📄
rest.cls.php
(7.62 KB)
📄
root.cls.php
(12.9 KB)
📄
router.cls.php
(17.82 KB)
📄
str.cls.php
(1.18 KB)
📄
tag.cls.php
(8.78 KB)
📄
task.cls.php
(4.41 KB)
📄
tool.cls.php
(3.41 KB)
📄
ucss.cls.php
(14.77 KB)
📄
utility.cls.php
(21.15 KB)
📄
vary.cls.php
(19.63 KB)
📄
vpi.cls.php
(7.54 KB)
Editing: db-optm.cls.php
<?php /** * The admin optimize tool * * * @since 1.2.1 * @package LiteSpeed * @subpackage LiteSpeed/src * @author LiteSpeed Technologies <info@litespeedtech.com> */ namespace LiteSpeed; defined( 'WPINC' ) || exit; class DB_Optm extends Root { private static $_hide_more = false; private static $TYPES = array( 'revision', 'auto_draft', 'trash_post', 'spam_comment', 'trash_comment', 'trackback-pingback', 'expired_transient', 'all_transients', 'optimize_tables' ); const TYPE_CONV_TB = 'conv_innodb'; /** * Show if there are more sites in hidden * * @since 3.0 */ public static function hide_more() { return self::$_hide_more; } /** * Clean/Optimize WP tables * * @since 1.2.1 * @access public * @param string $type The type to clean * @param bool $ignore_multisite If ignore multisite check * @return int The rows that will be affected */ public function db_count( $type, $ignore_multisite = false ) { if ( $type === 'all' ) { $num = 0; foreach ( self::$TYPES as $v ) { $num += $this->db_count( $v ); } return $num; } if ( ! $ignore_multisite ) { if ( is_multisite() && is_network_admin() ) { $num = 0; $blogs = Activation::get_network_ids(); foreach ( $blogs as $k => $blog_id ) { if ( $k > 3 ) { self::$_hide_more = true; break; } switch_to_blog( $blog_id ); $num += $this->db_count( $type, true ); restore_current_blog(); } return $num; } } global $wpdb; switch ( $type ) { case 'revision': $rev_max = (int) $this->conf( Base::O_DB_OPTM_REVISIONS_MAX ); $rev_age = (int) $this->conf( Base::O_DB_OPTM_REVISIONS_AGE ); $sql_add = ''; if ( $rev_age ) { $sql_add = " and post_modified < DATE_SUB( NOW(), INTERVAL $rev_age DAY ) "; } $sql = "SELECT COUNT(*) FROM `$wpdb->posts` WHERE post_type = 'revision' $sql_add"; if ( ! $rev_max ) { return $wpdb->get_var( $sql ); } // Has count limit $sql = "SELECT COUNT(*)-$rev_max FROM `$wpdb->posts` WHERE post_type = 'revision' $sql_add GROUP BY post_parent HAVING count(*)>$rev_max"; $res = $wpdb->get_results( $sql, ARRAY_N ); Utility::compatibility(); return array_sum( array_column( $res, 0 ) ); case 'auto_draft': return $wpdb->get_var( "SELECT COUNT(*) FROM `$wpdb->posts` WHERE post_status = 'auto-draft'" ); case 'trash_post': return $wpdb->get_var( "SELECT COUNT(*) FROM `$wpdb->posts` WHERE post_status = 'trash'" ); case 'spam_comment': return $wpdb->get_var( "SELECT COUNT(*) FROM `$wpdb->comments` WHERE comment_approved = 'spam'" ); case 'trash_comment': return $wpdb->get_var( "SELECT COUNT(*) FROM `$wpdb->comments` WHERE comment_approved = 'trash'" ); case 'trackback-pingback': return $wpdb->get_var( "SELECT COUNT(*) FROM `$wpdb->comments` WHERE comment_type = 'trackback' OR comment_type = 'pingback'" ); case 'expired_transient': return $wpdb->get_var( "SELECT COUNT(*) FROM `$wpdb->options` WHERE option_name LIKE '_transient_timeout%' AND option_value < " . time() ); case 'all_transients': return $wpdb->get_var( "SELECT COUNT(*) FROM `$wpdb->options` WHERE option_name LIKE '%_transient_%'" ); case 'optimize_tables': return $wpdb->get_var( "SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_SCHEMA = '" . DB_NAME . "' and ENGINE <> 'InnoDB' and DATA_FREE > 0" ); } return '-'; } /** * Clean/Optimize WP tables * * @since 1.2.1 * @since 3.0 changed to private * @access private */ private function _db_clean( $type ) { if ( $type === 'all' ) { foreach ( self::$TYPES as $v ) { $this->_db_clean( $v ); } return __( 'Clean all successfully.', 'litespeed-cache' ); } global $wpdb; switch ( $type ) { case 'revision': $rev_max = (int) $this->conf( Base::O_DB_OPTM_REVISIONS_MAX ); $rev_age = (int) $this->conf( Base::O_DB_OPTM_REVISIONS_AGE ); $sql_add = ''; if ( $rev_age ) { $sql_add = " and post_modified < DATE_SUB( NOW(), INTERVAL $rev_age DAY ) "; } if ( ! $rev_max ) { $sql = "DELETE FROM `$wpdb->posts` WHERE post_type = 'revision' $sql_add"; $wpdb->query( $sql ); } else { // Has count limit $sql = "SELECT COUNT(*)-$rev_max as del_max,post_parent FROM `$wpdb->posts` WHERE post_type = 'revision' $sql_add GROUP BY post_parent HAVING count(*)>$rev_max"; $res = $wpdb->get_results( $sql ); foreach ( $res as $v ) { $sql = "DELETE FROM `$wpdb->posts` WHERE post_type = 'revision' AND post_parent = %d ORDER BY ID LIMIT %d"; $wpdb->query( $wpdb->prepare( $sql, array( $v->post_parent, $v->del_max ) ) ); } } return __( 'Clean post revisions successfully.', 'litespeed-cache' ); case 'auto_draft': $wpdb->query( "DELETE FROM `$wpdb->posts` WHERE post_status = 'auto-draft'" ); return __( 'Clean auto drafts successfully.', 'litespeed-cache' ); case 'trash_post': $wpdb->query( "DELETE FROM `$wpdb->posts` WHERE post_status = 'trash'" ); return __( 'Clean trashed posts and pages successfully.', 'litespeed-cache' ); case 'spam_comment': $wpdb->query( "DELETE FROM `$wpdb->comments` WHERE comment_approved = 'spam'" ); return __( 'Clean spam comments successfully.', 'litespeed-cache' ); case 'trash_comment': $wpdb->query( "DELETE FROM `$wpdb->comments` WHERE comment_approved = 'trash'" ); return __( 'Clean trashed comments successfully.', 'litespeed-cache' ); case 'trackback-pingback': $wpdb->query( "DELETE FROM `$wpdb->comments` WHERE comment_type = 'trackback' OR comment_type = 'pingback'" ); return __( 'Clean trackbacks and pingbacks successfully.', 'litespeed-cache' ); case 'expired_transient': $wpdb->query( "DELETE FROM `$wpdb->options` WHERE option_name LIKE '_transient_timeout%' AND option_value < " . time() ); return __( 'Clean expired transients successfully.', 'litespeed-cache' ); case 'all_transients': $wpdb->query( "DELETE FROM `$wpdb->options` WHERE option_name LIKE '%\\_transient\\_%'" ); return __( 'Clean all transients successfully.', 'litespeed-cache' ); case 'optimize_tables': $sql = "SELECT table_name, DATA_FREE FROM information_schema.tables WHERE TABLE_SCHEMA = '" . DB_NAME . "' and ENGINE <> 'InnoDB' and DATA_FREE > 0"; $result = $wpdb->get_results( $sql ); if ( $result ) { foreach ( $result as $row ) { $wpdb->query( 'OPTIMIZE TABLE ' . $row->table_name ); } } return __( 'Optimized all tables.', 'litespeed-cache' ); } } /** * Get all myisam tables * * @since 3.0 * @access public */ public function list_myisam() { global $wpdb; $q = "SELECT * FROM information_schema.tables WHERE TABLE_SCHEMA = '" . DB_NAME . "' and ENGINE = 'myisam' AND TABLE_NAME LIKE '{$wpdb->prefix}%'"; return $wpdb->get_results( $q ); } /** * Convert tables to InnoDB * * @since 3.0 * @access private */ private function _conv_innodb() { global $wpdb; if ( empty( $_GET[ 'tb' ] ) ) { Admin_Display::error( 'No table to convert' ); return; } $tb = false; $list = $this->list_myisam(); foreach ( $list as $v ) { if ( $v->TABLE_NAME == $_GET[ 'tb' ] ) { $tb = $v->TABLE_NAME; break; } } if ( ! $tb ) { Admin_Display::error( 'No existing table' ); return; } $q = 'ALTER TABLE ' . DB_NAME . '.' . $tb . ' ENGINE = InnoDB'; $wpdb->query( $q ); Debug2::debug( "[DB] Converted $tb to InnoDB" ); $msg = __( 'Converted to InnoDB successfully.', 'litespeed-cache' ); Admin_Display::succeed( $msg ); } /** * Count all autoload size * * @since 3.0 * @access public */ public function autoload_summary() { global $wpdb; $summary = $wpdb->get_row( "SELECT SUM(LENGTH(option_value)) AS autoload_size,COUNT(*) AS autload_entries FROM `$wpdb->options` WHERE autoload='yes'" ); $summary->autoload_toplist = $wpdb->get_results( "SELECT option_name, LENGTH(option_value) AS option_value_length FROM `$wpdb->options` WHERE autoload='yes' ORDER BY option_value_length DESC LIMIT 20" ); return $summary; } /** * Handle all request actions from main cls * * @since 3.0 * @access public */ public function handler() { $type = Router::verify_type(); switch ( $type ) { case 'all': case in_array( $type, self::$TYPES ): if ( is_multisite() && is_network_admin() ) { $blogs = Activation::get_network_ids(); foreach ( $blogs as $blog_id ) { switch_to_blog( $blog_id ); $msg = $this->_db_clean( $type ); restore_current_blog(); } } else { $msg = $this->_db_clean( $type ); } Admin_Display::succeed( $msg ); break; case self::TYPE_CONV_TB : $this->_conv_innodb(); break; default: break; } Admin::redirect(); } }
Upload File
Create Folder