Bearsampp 2026.9.23
Loading...
Searching...
No Matches
ToolGhostscript Class Reference
Inheritance diagram for ToolGhostscript:
Collaboration diagram for ToolGhostscript:

Public Member Functions

 __construct ($id, $type)
 getExe ()
 getExeConsole ()
 reload ($id=null, $type=null)
 setVersion ($version)
Public Member Functions inherited from Module
 __toString ()
 getId ()
 getName ()
 getRelease ()
 getType ()
 getVersion ()
 getVersionList ()
 isEnable ()
 update ($sub=0, $showWindow=false)

Data Fields

const LOCAL_CFG_EXE = 'ghostscriptExe'
const LOCAL_CFG_EXE_CONSOLE = 'ghostscriptExeConsole'
const ROOT_CFG_VERSION = 'ghostscriptVersion'
Data Fields inherited from Module
 $currentPath
 $rootPath
 $symlinkPath

Private Attributes

 $exe
 $exeConsole

Additional Inherited Members

Static Public Member Functions inherited from Module
static clearMemoryCache ()
static invalidateConfigCacheForPath ($sourcePath)
Protected Member Functions inherited from Module
 __construct ()
 replace ($key, $value)
 replaceAll ($params)
 updateConfig ($version=null, $sub=0, $showWindow=false)
Protected Attributes inherited from Module
 $bearsamppConf
 $bearsamppConfRaw
 $enable
 $name
 $release = 'N/A'
 $version

Detailed Description

Class ToolGhostscript

This class represents the Ghostscript tool module in the Bearsampp application. It extends the Module class and provides functionalities specific to Ghostscript, such as loading configurations, setting versions, and retrieving executable paths.

Definition at line 17 of file class.tool.ghostscript.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $id,
$type )

Constructor for the ToolGhostscript class.

Parameters
string$idThe ID of the module.
string$typeThe type of the module.

Definition at line 47 of file class.tool.ghostscript.php.

48 {
49 Log::initClass($this);
50 $this->reload($id, $type);
51 }
static initClass($classInstance)
reload($id=null, $type=null)

References Module\$id, Module\$type, Log\initClass(), and reload().

Here is the call graph for this function:

Member Function Documentation

◆ getExe()

getExe ( )

Gets the path to the Ghostscript executable.

Returns
string The path to the Ghostscript executable.

Definition at line 115 of file class.tool.ghostscript.php.

116 {
117 return $this->exe;
118 }

References $exe.

◆ getExeConsole()

getExeConsole ( )

Gets the path to the Ghostscript console executable.

Returns
string The path to the Ghostscript console executable.

Definition at line 125 of file class.tool.ghostscript.php.

126 {
127 return $this->exeConsole;
128 }

References $exeConsole.

◆ reload()

reload ( $id = null,
$type = null )

Reloads the Ghostscript module configuration based on the provided ID and type.

Parameters
string | null$idThe ID of the module. If null, the current ID is used.
string | null$typeThe type of the module. If null, the current type is used.

Reimplemented from Module.

Definition at line 59 of file class.tool.ghostscript.php.

60 {
62 Log::reloadClass($this);
63
64 $this->name = $bearsamppLang->getValue(Lang::GHOSTSCRIPT);
65 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
66 parent::reload($id, $type);
67
68 if ($this->bearsamppConfRaw !== false) {
69 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
70 $this->exeConsole = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE_CONSOLE];
71 }
72
73 if (!$this->enable) {
74 Log::info($this->name . ' is not enabled!');
75
76 return;
77 }
78 if (!is_dir($this->currentPath)) {
79 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
80 }
81 if (!is_dir($this->symlinkPath)) {
82 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
83
84 return;
85 }
86 if (!is_file($this->bearsamppConf)) {
87 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
88 }
89 if (!is_file($this->exe)) {
90 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
91 }
92 if (!is_file($this->exeConsole)) {
93 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exeConsole));
94 }
95 }
global $bearsamppLang
const GHOSTSCRIPT
const ERROR_EXE_NOT_FOUND
const ERROR_CONF_NOT_FOUND
const ERROR_FILE_NOT_FOUND
static info($data, $file=null)
static reloadClass($classInstance)
static error($data, $file=null)
global $bearsamppConfig
Definition homepage.php:46

References $bearsamppConfig, $bearsamppLang, Module\$id, Module\$type, Log\error(), Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, Lang\GHOSTSCRIPT, Log\info(), and Log\reloadClass().

Referenced by __construct(), and setVersion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVersion()

setVersion ( $version)

Sets the version of the Ghostscript module and reloads the configuration.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 102 of file class.tool.ghostscript.php.

103 {
104 global $bearsamppConfig;
105 $this->version = $version;
106 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
107 $this->reload();
108 }

References $bearsamppConfig, Module\$version, and reload().

Here is the call graph for this function:

Field Documentation

◆ $exe

$exe
private

Definition at line 35 of file class.tool.ghostscript.php.

Referenced by getExe().

◆ $exeConsole

$exeConsole
private

Definition at line 39 of file class.tool.ghostscript.php.

Referenced by getExeConsole().

◆ LOCAL_CFG_EXE

const LOCAL_CFG_EXE = 'ghostscriptExe'

Configuration key for the Ghostscript executable in the local configuration.

Definition at line 26 of file class.tool.ghostscript.php.

◆ LOCAL_CFG_EXE_CONSOLE

const LOCAL_CFG_EXE_CONSOLE = 'ghostscriptExeConsole'

Configuration key for the Ghostscript console executable in the local configuration.

Definition at line 30 of file class.tool.ghostscript.php.

◆ ROOT_CFG_VERSION

const ROOT_CFG_VERSION = 'ghostscriptVersion'

Configuration key for the Ghostscript version in the root configuration.

Definition at line 22 of file class.tool.ghostscript.php.


The documentation for this class was generated from the following file: