This is documentation for Plesk Onyx.
Go to documentation for the latest version, Plesk Obsidian.
Information About Plesk
To retrieve information about Plesk and the server on which it is installed, use the pm_ProductInfo class.
- getVersion() - retrieves the Plesk version.
- getPlatform() - retrieves the platform name.
-
isUnix()
- returns
true
if Plesk is installed on a Linux server, orfalse
otherwise. -
isWindows()
- returns
true
if Plesk is installed on a Windows server, orfalse
otherwise. - getOsName() - retrieves the OS name.
- getOsVersion() - retrieves the OS version.
- getOsArch() - retrieves the OS architecture.
-
getVirtualization()
- retrieves the type of virtualization used on the server (if any).
If the
$all
argument is set totrue
, the method returns an array with all actual virtualization types instead. Constants for virtualization types are named according to the following convention:pm_ProductInfo::VIRT_*
. - getPrivateTempDir() - returns absolute path to Plesk temp directory.
- getProductRootDir() - returns absolute path to Plesk root directory.
Examples
class IndexController extends pm_Controller_Action
{
public function init()
{
parent::init();
if (pm_ProductInfo::getOsName() === pm_ProductInfo::OS_DEBIAN && version_compare(pm_ProductInfo::getOsVersion(), '8.0', '<')) {
pm_Log::info('Debian older then 8.0 is not supported!');
$this->_redirect('not-supported');
}
}
}
class IndexController extends pm_Controller_Action
{
public function init()
{
parent::init();
if (in_array(pm_ProductInfo::getVirtualization(), [pm_ProductInfo::VIRT_VZ, pm_ProductInfo::VIRT_OPENVZ])) {
pm_Log::info('Virtuozzo is not supported!');
$this->_redirect('not-supported');
}
}
}