cPanel Plugin

Where Did This Plugin Come From?

The LiteSpeed Web Cache Manager plugin for cPanel is a companion plugin to the LiteSpeed plugin for WHM. If a hosting provider is using both LiteSpeed Web Server and the LiteSpeed plugin for WHM, they are able to install this plugin for their cPanel end-users.

!User-end CPanel Plugin Icon In CPanel User Dashboard

Installation

The LiteSpeed Web Cache Manager plugin for cPanel can be easily installed using the LiteSpeed WHM Plugin as of v3.1.0.

!WHM Plugin Main Page With User-end CPanel Plugin Install Icon Circled

Once successfully installed, the cPanel Plugin section of the WHM plugin should change to the following:

!WHM Plugin "CPanel Plugin" Section As It Appears After CPanel Plugin Installation

Plugin Not Available For cPanel Users?

If the LiteSpeed Web Cache Manager plugin is not appearing for cPanel users after installing through the LiteSpeed WHM plugin, please try the following:

  1. Log in to WHM and navigate to the Feature List screen by selecting Packages > Feature Manager.

  2. From here you can add or remove user access to plugins by creating or editing feature lists.

  3. Create or edit the feature list you wish to modify.

  4. Click the checkbox labelled LS Web Cache Manager and then press the Save button. This will add or remove this plugin in your current feature list, which can then be assigned to a package if it has not been already.

This plugin should now appear in the Advanced section of the cPanel home screen for all users assigned this package.

!User-end CPanel Plugin Icon In CPanel User Dashboard

If you do not see the LiteSpeed Web Cache Manager item in the advanced section of your cPanel home screen, please upgrade LiteSpeed Web Server to 5.1.x at the minimum.

You must have a license with LSCache enabled to use these features. How To Get LSCache

Note

If you would like to install the LiteSpeed Web Cache Manager plugin but do not have WHM access, please contact your server administrator or hosting provider.

Using A Custom Template

The LiteSpeed Web Cache Manager plugin for cPanel can be customized to load a custom template through the LiteSpeed WHM plugin. A custom template allows a hosting provider to modify or completely replace the content of the LiteSpeed Web Cache Manager plugin's landing page for all cPanel users without modifying existing plugin files directly.

This provides an easy way to modify the plugin to advertise features or specialized services or recommend/upsell related hosting packages.

Preparing A Custom Template

Preparing and using a custom template for the LiteSpeed Web Cache Manager plugin for cPanel is an easy process. Simply navigate to /usr/local/cpanel/base/frontend/paper_lantern/ls_web_cache_manager/landing and create a directory named for your custom template, such as myCustomTemplate.

Once you have created the template directory, you can either copy the existing index.php file under /usr/local/cpanel/base/frontend/paper_lantern/ls_web_cache_manager/landing/default into this directory to get started, or copy over your own version from elsewhere. This file will handle calling any custom code or files you need to manage. It will display the new landing page while still having relative access to all the existing classes, functions, and pages already built into the plugin.

Tip

It is strongly recommended that all custom template code be backed up at different location to prevent possible loss of the LiteSpeed Web Cache Manager plugin during uninstall or upgrade. As such, we also recommend using a symlink in place of these files in the actual plugin location.

Setting A Custom Template

To set a custom template for use, first make sure that the LiteSpeed Web Cache Manager plugin has been installed through the LiteSpeed WHM plugin. Once this step has been completed, select the Settings icon from the cPanel Plugin section of the LiteSpeed WHM plugin.

!WHM Plugin Main Page With User-end CPanel Plugin Settings Icon Circled

You should now be on the cPanel Plugin Settings page which will display a Use Custom Template setting field.

!WHM Plugin "CPanel Plugin Settings" Page

Here you can set a custom template to be used if it has already been created. Using the example from the previous section, we would enter myCustomTemplate here and save. If the template folder exists and contains the required index.php file, the save operation should succeed. From now on, all cPanel users should see your custom landing page when accessing the LiteSpeed Web Cache Manager plugin through the cPanel dashboard.

Uninstallation

The LiteSpeed Web Cache Manager Plugin for cPanel can be easily uninstalled through the LiteSpeed WHM Plugin:

!WHM Plugin "CPanel Plugin" Section With User-end CPanel Plugin Uninstall Icon Circled

Plugin Breakdown

Main Page

This is the first page shown when visiting the plugin page. Here you will be presented with 3 sections and a link to the settings page.

!User-end CPanel Plugin Main Page

  • Why Use LSCache? - Contains some information on LSCache and the various available LSCache plugins through the Available LSCache Plugins link.

  • Flush LSCache - This section contains a button for flushing the contents of your LSCache folder. This will clear the cache for all owned sites with LSCache enabled.

  • LiteSpeed Cache Management - This section contains a link to the LiteSpeed Cache Management page for owned WordPress sites where LSCWP can be selectively enabled and disabled on a per site basis.

  • Settings - This link will take you to the plugin settings page.

The LiteSpeed Cache Management and Settings pages will be covered in more detail below.

LiteSpeed Cache Management - WordPress Cache

The manage view is where most of the magic happens. Here you can manage LSCWP for your WordPress installations individually or in groups.

!User-end CPanel Plugin "LiteSpeed Web Cache Manager" Page

Starting from the actual table we have the following fields:

  • Discovered WordPress Installations: This field contains the path of each WordPress installation discovered during the last scan operation.

  • Cache Status: Displays the last known status of LSCWP for the listed WordPress installation.

  • Flag: This field can either be blank or display a flag icon. While an installation is flagged (in other words, displaying the flag icon), it will be excluded from all future Mass Enable/Disable LSCWP operations in the WHM plugin.

  • Actions: This field contains action buttons that perform a specific action only for the related WordPress installation. These actions include Enable/Disable LSCWP and Flag/Unflag this installation.

Looking at the top row of buttons, we have Scan/Re-scan, Refresh Status, and to the right, Flush All.

  • Scan/Re-scan: Discovers all WordPress installations under each cPanel user's known document root. These discovered installations will then be saved to a data file and displayed on the manager screen. If this data file is removed or corrupted, simply scan again to repopulate the list.

  • Refresh Status: Each listed WordPress installation will have an LSCWP Status reflecting the status of LSCWP for that installation. The Refresh Status button will update this value to the most current status for all listed WordPress installations.

  • Flush All: Like the button of the same name on the main page, this button will flush the contents of your LSCache folder. This will clear the cache for all owned sites with LSCache enabled.

Moving on we have the the bottom row of buttons which are used to perform group operations. These buttons work in tandem with the check-boxes found next to each discovered installation to allow you to perform some basic operations for only the selected group.

  • Enable Selected & Disable Selected: These buttons allow you to enable and disable LSCWP for the selected WordPress installations.

  • Flag Selected & Unflag Selected: These buttons allow you to set or unset the flag field for the selected WordPress Installations. Flagged installations will be excluded from Mass Enable/Disable LSCWP operations in the WHM plugin.

Settings

The Settings page allows you to control various plugin related settings (only one at the moment).

!User-end CPanel Plugin "Settings" Page

  • Log File Level: This setting controls the highest level of log messages that will be written to the log file located at /home/$user/lscmData/ls_webcachemgr.log. The default value is INFO.

Translations

As of the cPanel user-end plugin v1.2.2, a lang/ directory has been added. This will allow custom translations for plugin text. The translation language used is based on the cPanel dashboard locale selected.

The lang/ directory will also contain any translations submitted to LiteSpeed for inclusion in the plugin package. Be aware that these translations will be bypassed if any custom translations for that locale exist in the lang/cust/ directory.

Instructions for translating the plugin are included in the plugin's lang/cust/ directory README file, included below:

Welcome to the LiteSpeed Web Cache Manager user-end cPanel plugin's 'lang/cust'
directory. This directory will contain any custom translations you would like
to use with the LiteSpeed Web Cache Manager user-end cPanel plugin.

This file will now explain how to provide your own custom translations for this
plugin based on the language selected in a user's cPanel dashboard.

1) Choose a cPanel locale to provide translations for. A full list of available
locales can be found through WHM under

Home >> Locales >> View Available Locales

2) Once a locale has been chosen, create a directory under this plugin's
'lang/cust' directory for that locale using the same name as the locale. Then
create an 'en_US' directory under that, and an 'LC_MESSAGES' directory under the
'en_US' directory.

Using French as an example (cPanel locale 'fr') our directory structure would look
like:

lang/
-cust/
--fr/
---en_US/
----LC_MESSAGES/

Note: The 'en_US' directory exists as a workaround for linux systems that may not
contain certain locales, as it is commonly installed on most systems. If you
are running into issues getting your translations to appear, please make sure
that the 'en_US.utf8' locale is installed on your system.

Note: As long as the 'lang/cust/fr' directory exists, this directory will always be
used when looking for translation files, regardless of wheather or not any
exist. If you would like to go back to checking the official translation
directory under 'lang', you must remove/rename the 'cust' locale directory.

3) Generate a 'messages.po' file for your desired language based on the
'messages.pot' file provided under the 'lang' directory, or copy the 'messages.po' file
for your locale if it has already been officially provided under the 'lang'
directory.

4) Update the generated 'messages.po' file with any new translations. You should
also update the 'messages.po' file header info if you have not already.

5) Generate a 'messages.mo' file based on your updated 'messages.po' file and place
both the 'messages.po' and 'messages.mo' files under the custom 'LC_MESSAGES'
directory created earlier.

6) Visit the LiteSpeed user-end cPanel plugin through a cPanel dashboard and
confirm that your translations are appearing.

CAUTION: Any custom translation files will be lost upon uninstalling the
LiteSpeed Web Cache Manager user-end cPanel plugin. Please keep a copy of any
custom translation files elsewhere to prevent loosing these files.

That should be all that is required to begin using custom translations with the
LiteSpeed user-end cPanel plugin.

If you would like to have your custom translations included as official
translations in future versions of the LiteSpeed Web Cache Manager user-end
cPanel plugin, or have updates for exisitng official translations, please send
an email including the locale and both 'messages.po' and 'messages.mo' files to
info@litespeedtech.com.

Last update: April 27, 2020