2024.8.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 ()
 
 getCurrentPath ()
 
 getId ()
 
 getName ()
 
 getRelease ()
 
 getRootPath ()
 
 getSymlinkPath ()
 
 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
const BUNDLE_RELEASE = 'bundleRelease'
 

Private Attributes

 $exe
 
 $exeConsole
 

Additional Inherited Members

- 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
 
 $currentPath
 
 $enable
 
 $name
 
 $release = 'N/A'
 
 $rootPath
 
 $symlinkPath
 
 $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()

ToolGhostscript::__construct ( $id,
$type )

Constructor for the ToolGhostscript class.

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

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

32 {
33 Util::logInitClass($this);
34 $this->reload($id, $type);
35 }
reload($id=null, $type=null)
static logInitClass($classInstance)

References Module\$id, Module\$type, Util\logInitClass(), and reload().

Member Function Documentation

◆ getExe()

ToolGhostscript::getExe ( )

Gets the path to the Ghostscript executable.

Returns
string The path to the Ghostscript executable.

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

References $exe.

◆ getExeConsole()

ToolGhostscript::getExeConsole ( )

Gets the path to the Ghostscript console executable.

Returns
string The path to the Ghostscript console executable.

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

104 {
105 return $this->exeConsole;
106 }

References $exeConsole.

◆ reload()

ToolGhostscript::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 43 of file class.tool.ghostscript.php.

43 {
46
47 $this->name = $bearsamppLang->getValue(Lang::GHOSTSCRIPT);
48 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
49 parent::reload($id, $type);
50
51 if ($this->bearsamppConfRaw !== false) {
52 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
53 $this->exeConsole = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE_CONSOLE];
54 }
55
56 if (!$this->enable) {
57 Util::logInfo($this->name . ' is not enabled!');
58 return;
59 }
60 if (!is_dir($this->currentPath)) {
61 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
62 }
63 if (!is_dir($this->symlinkPath)) {
64 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
65 return;
66 }
67 if (!is_file($this->bearsamppConf)) {
68 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
69 }
70 if (!is_file($this->exe)) {
71 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
72 }
73 if (!is_file($this->exeConsole)) {
74 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exeConsole));
75 }
76 }
global $bearsamppLang
const ERROR_FILE_NOT_FOUND
const ERROR_CONF_NOT_FOUND
const ERROR_EXE_NOT_FOUND
const GHOSTSCRIPT
static logReloadClass($classInstance)
static logError($data, $file=null)
static logInfo($data, $file=null)
global $bearsamppConfig
Definition homepage.php:26

References $bearsamppConfig, $bearsamppLang, Module\$id, Module\$type, Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, Lang\GHOSTSCRIPT, LOCAL_CFG_EXE, LOCAL_CFG_EXE_CONSOLE, Util\logError(), Util\logInfo(), and Util\logReloadClass().

Referenced by __construct(), and setVersion().

+ Here is the caller graph for this function:

◆ setVersion()

ToolGhostscript::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 83 of file class.tool.ghostscript.php.

83 {
84 global $bearsamppConfig;
85 $this->version = $version;
86 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
87 $this->reload();
88 }

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

Field Documentation

◆ $exe

ToolGhostscript::$exe
private

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

Referenced by getExe().

◆ $exeConsole

ToolGhostscript::$exeConsole
private

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

Referenced by getExeConsole().

◆ LOCAL_CFG_EXE

const ToolGhostscript::LOCAL_CFG_EXE = 'ghostscriptExe'

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

Referenced by reload().

◆ LOCAL_CFG_EXE_CONSOLE

const ToolGhostscript::LOCAL_CFG_EXE_CONSOLE = 'ghostscriptExeConsole'

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

Referenced by reload().

◆ ROOT_CFG_VERSION

const ToolGhostscript::ROOT_CFG_VERSION = 'ghostscriptVersion'

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


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