JezK
Edit File: database.cls.php
<?php /** * LiteSpeed CLI - database cleanup * * Add CLI database cleanup commands. * * @package LiteSpeed * @since 7.3 */ namespace LiteSpeed\CLI; defined('WPINC') || exit(); use LiteSpeed\Debug2; use LiteSpeed\DB_Optm; use WP_CLI; /** * LiteSpeed Cache Database CLI */ class Database { /** * Current blog id the optimization is working on. * * @var int|false $current_blog Current blog id. */ private $current_blog = false; /** * Database class. * * @var DB_Optim $db Database class. */ private $db; /** * Class constructor. */ public function __construct() { Debug2::debug('CLI_Database init'); $this->db = DB_Optm::cls(); } /** * List all site domains and ids on the network. */ public function network_list() { if ( !is_multisite() ) { WP_CLI::error('This is not a multisite installation!'); return; } $buf = WP_CLI::colorize("%CThe list of installs:%n\n"); $sites = get_sites(); foreach ( $sites as $site ) { $buf .= WP_CLI::colorize( '%Y' . $site->domain . $site->path . ':%n ID ' . $site->blog_id ) . "\n"; } WP_CLI::line($buf); } /** * Change to blog sent as param. * * @param array $args Description. */ private function change_to_blog( $args ) { if ( !isset( $args[0] ) || 'blog' !== $args[0] ) { return; } $this->current_blog = get_current_blog_id(); $blogid = $args[1]; if ( !is_numeric( $blogid ) ) { $error = WP_CLI::colorize( '%RError: invalid blog id entered.%n' ); WP_CLI::line( $error ); $this->network_list( $args ); return; } $site = get_blog_details( $blogid ); if ( false === $site ) { $error = WP_CLI::colorize( '%RError: invalid blog id entered.%n' ); WP_CLI::line( $error ); $this->network_list( $args ); return; } switch_to_blog( $blogid ); } /** * Change to previous blog. */ private function change_to_default() { // Check if previous blog set. if ( $this->current_blog ) { switch_to_blog( $this->current_blog ); // Switched to previous blog. $this->current_blog = false; } } /** * Show CLI response. * * @param boolean $result Flag if result is success or failure. * @param string $action Action name. */ private function show_response( $result, $action ) { if ($result) { WP_CLI::success( $result ); } else { WP_CLI::error( 'Error running optimization: ' . $action ); } } /** * Clean actions function. * * @param int $args Action arguments. * @param array $types What data to clean. */ private function clean_action( $args, $types ) { $this->change_to_blog( $args ); foreach ( $types as $type ) { $result = $this->db->handler_clean_db_cli( $type ); $this->show_response( $result, $type ); } $this->change_to_default(); } /** * Clear posts data(revisions, orphaned, auto drafts, trashed posts). * # Start clearing posts data. * $ wp litespeed-database clear_posts * $ wp litespeed-database clear_posts blog 2 * * @param string $args Action arguments. */ public function clear_posts( $args ) { $types = array( 'revision', 'orphaned_post_meta', 'auto_draft', 'trash_post', ); $this->clean_action( $args, $types ); } /** * Clear comments(spam and trash comments). * # Start clearing comments. * $ wp litespeed-database clear_comments * $ wp litespeed-database clear_comments blog 2 * * @param string $args Action arguments. */ public function clear_comments( $args ) { $types = array( 'spam_comment', 'trash_comment', ); $this->clean_action( $args, $types ); } /** * Clear trackbacks/pingbacks. * # Start clearing trackbacks/pingbacks. * $ wp litespeed-database clear_trackbacks * $ wp litespeed-database clear_trackbacks blog 2 * * @param string $args Action arguments. */ public function clear_trackbacks( $args ) { $types = array( 'trackback-pingback', ); $this->clean_action( $args, $types ); } /** * Clear transients. * # Start clearing transients. * $ wp litespeed-database clear_transients * $ wp litespeed-database clear_transients blog 2 * * @param string $args Action arguments. */ public function clear_transients( $args ) { $types = array( 'expired_transient', 'all_transients', ); $this->clean_action( $args, $types ); } /** * Optimize tables. * # Start optimizing tables. * $ wp litespeed-database optimize_tables * $ wp litespeed-database optimize_tables blog 2 * * @param string $args Action arguments. */ public function optimize_tables( $args ) { $types = array( 'optimize_tables', ); $this->clean_action( $args, $types ); } /** * Optimize database by running all possible operations. * # Start optimizing all. * $ wp litespeed-database optimize_all * $ wp litespeed-database optimize_all blog 2 * * @param string $args Action arguments. */ public function optimize_all( $args ) { $types = array( 'all', ); $this->clean_action( $args, $types ); } }
BanaBridge News
https://validator.w3.org/feed/docs/rss2.html
Court Orders Ex-Weah Protocol Chief Jailed on US$8 Million Bail, Sends 15 Jurors to Prison Over Misconduct
Women Renew Call for War and Economic Crimes Court at Liberia’s Historic Peace Prayer Site
Finance Minister Ngafuan Urges Transparency, Accountability as Liberia Advances ARREST Agenda at UN Retreat
PPCC Donates ICT Equipment to 50 Government Institutions to Expand Electronic Procurement System
Liberia Commissions €100,000 Elemental Analyzer to Strengthen Environmental Research and Food Security
EPA Ends 16 Years of Renting with Purchase of Permanent Headquarters
West African Tax Bodies Deepen Partnership to Boost Revenue Mobilization, Launch Carbon Tax Study
Liberia Hosts Sierra Leone Procurement Delegation for E-GP Reform Study Tour
World Bank Praises Liberia’s Central Bank for Economic Stability and Private Sector Progress
Liberians See Slight Improvement in Corruption Fight, But Graft Still Viewed as Widespread, CENTAL Report Finds
Canada Afrique Care Foundation Set for Official Launch, Expanding Free Mental Health Access Across Canada and Africa
Weah Claims Liberia Has Become a “Narco State” as Opposition Rallies Behind Calls for Independent Probe into US$19 Million Cocaine Bust
EPA Boss Calls for Stronger Student Engagement, Unveils Push for Academic Partnership at UL Climate Symposium
Education Minister Urges Students to Embrace Tax Responsibility at National Student Tax Day
CDC Secretary General Urges U.S. Government to Review Support to Liberia National Police
Liberia Partners with CACFO to Expand Mental Health Services Ahead of Global Launch
Wreh-Toe Appointed Board Chair of CACFO as Foundation Strengthens Mental Health Push
GIABA Opens New Information Center Headquarters in Abidjan
Liberia Wins Fresh Backing as World Bank Group Executive Praises Progress, Pushes Faster Project Delivery
LRA Honors Liberia’s Top Taxpayers as Revenue Collections Hit Historic High
Root Cause in Question as Border Tensions Persist After Conakry Peace Deal
From Enforcement to Innovation: EPA Marks 2025 as a Defining Year for Liberia’s Environment
Weah Declares ‘Road to 2029 Begins Today’ as CDC Marks 22nd Anniversary in Zwedru
500 Documented Governance Failures: Activist Publishes Sweeping End-of-Year Indictment of Boakai Administration
CDC Calls for Probe into Border Crisis, Cites Alleged Mining Activities
Liberia Moves to Strengthen Small Businesses with $672,000 Packaging Solution Initiative
Former Public Works Minister Ruth Coker Collins Defends Zwedru Corridor Strategy, Calls for “Facts Over Rhetoric” in Infrastructure Debate
Power Shake-Up in CDC Diaspora: NEC Dissolves CDC-USA Interim Leadership, Appoints Rev. Muin to Lead U.S. Chapter
Tweah Reemerges, Sparks Fierce National Debate Over Governance and Liberia’s Future
Koijee Slams Tribal Politics and Political Manipulation in Lofa, Accuses Boakai Government
Mali and Burkina Faso Impose Reciprocal Travel Ban on U.S. Citizens
Guinea Election: A Turn Toward Continuity Amid Questions of Democratic Credibility
Liberia’s Revenue Grows Stronger as LRA Exceeds National Target for Second Year
Liberia’s Gender Legal Landscape: Laws in Place, Systems Lag Far Behind
Liberia’s Economy Gains Momentum as CBL Governor Highlights Progress at ECOWAS Meeting
Liberia Positions Itself for Eco Currency Entry as Economy Expands by 5.1%
From Overcrowded Classrooms to Renewal: NPA Mobilizes $1 Million to Transform UL
Ex-Public Works Minister Ruth Coker Collins Slams Ministry’s “Lack of Capacity,” Defends Her Infrastructure Record
CDC Expels Three Senior Members, Citing Alleged Alignment With Government and Undermining Party Ideology
UL to Celebrate 75 Years of Excellence
Saudi Fund Advances Liberia’s Push for Major Infrastructure Development
West African Financial Leaders Convene in Monrovia for ECOWAS Statutory Meetings
Unlocking Liberia’s Potential: Government Launches Major Revenue and Transparency Reforms
Incremental Gains, Enduring Impunity: Liberia’s CPI Improvement Fails the Test of Reform
Boakai’s Call for Unity Faces Scrutiny as Opposition, Citizens Question Actions Behind the Words
REMAPSEN Liberia Set to Strengthen Health and Environmental Reporting
Energy Sector Women Step Into the Spotlight at Liberia’s International Women’s Day Celebration
FeJAL Concludes Three-Day Retreat, Honors Outstanding Women Journalists
Dr. Rasha Kelej Named Among Africa’s 100 Most Influential Leaders
LAVA Honored for Strengthening Liberia–U.S. Ties at 2025 Military Ball