Install and Activate LSCWP with Installatron

If you use the Installatron 1-click installer, then you have the option to install the LiteSpeed Cache plugin using their hook system.

From WHM, navigate to Plugins > Installatron > Applications > Customization and add the following code:

<?php 
class i_installer_customcode 
{ 
    function init($o) 
    { 
        $o->registerArchive("litespeed-cache", "https://downloads.wordpress.org/plugin/litespeed-cache.zip", "zip");
        $o->registerCustomCode("wordpress", "all", "install", "input", "wordpressinstallinput");
        $o->registerCustomCode("wordpress", "all", "install", "last", "wordpressinstall");
    } 

    function wordpressinstallinput($o) 
    { 
        $o->setInputFields(array( 
            array( 
                "ID" => "litespeed-cache", 
                "LABEL" => "LiteSpeed Cache", 
                "TEXT" => "Install the LiteSpeed Cache plugin?", 
                "TYPE" => "radio",
                "VALUE" => "yes",
                "OPTIONS" => array( "yes" => "Yes", "no" => "No")
             ), 
        )); 
    } 

    function wordpressinstall($o) 
    { 
        if ( isset($o->input["field_litespeed-cache"]) && $o->input["field_litespeed-cache"] == "yes" ) 
        { 
            $o->installPlugin("litespeed-cache/litespeed-cache.php", "litespeed-cache");
        }
    } 
}
?>

The above code will register the latest LiteSpeed Cache plugin version as an archive in Installatron, then it will make a selection box to choose whether the LiteSpeed Cache plugin should be installed or not (defaults to yes).

If LiteSpeed Cache is set to yes, then it will install the plugin and activate it.

  • Admin
  • Last modified: 2019/08/14 20:46
  • by Michael Alegre