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

Public Member Functions

 __construct ($id, $type)
 getConf ()
 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_CONF = 'phpmyadminConf'
const ROOT_CFG_VERSION = 'phpmyadminVersion'
Data Fields inherited from Module
 $currentPath
 $rootPath
 $symlinkPath

Protected Member Functions

 updateConfig ($version=null, $sub=0, $showWindow=false)
Protected Member Functions inherited from Module
 __construct ()
 replace ($key, $value)
 replaceAll ($params)

Private Attributes

 $conf

Additional Inherited Members

Static Public Member Functions inherited from Module
static clearMemoryCache ()
static invalidateConfigCacheForPath ($sourcePath)
Protected Attributes inherited from Module
 $bearsamppConf
 $bearsamppConfRaw
 $enable
 $name
 $release = 'N/A'
 $version

Detailed Description

Class AppPhpmyadmin

This class represents the phpMyAdmin application module in the Bearsampp application. It extends the Module class and provides functionalities specific to phpMyAdmin, such as configuration management and version handling.

Definition at line 17 of file class.app.phpmyadmin.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $id,
$type )

Constructor for the AppPhpmyadmin class.

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

Definition at line 40 of file class.app.phpmyadmin.php.

41 {
42 Log::initClass($this);
43 $this->reload($id, $type);
44 }
reload($id=null, $type=null)
static initClass($classInstance)

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

Here is the call graph for this function:

Member Function Documentation

◆ getConf()

getConf ( )

Gets the path to the phpMyAdmin configuration file.

Returns
string The path to the configuration file.

Definition at line 153 of file class.app.phpmyadmin.php.

154 {
155 return $this->conf;
156 }

Referenced by updateConfig().

Here is the caller graph for this function:

◆ reload()

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

Reloads the 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 52 of file class.app.phpmyadmin.php.

53 {
55 Log::reloadClass($this);
56
57 // This makes name and version the values in bearsampp.conf
58 $this->name = $bearsamppLang->getValue(Lang::PHPMYADMIN);
59 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
60 parent::reload($id, $type);
61
62 if ($this->bearsamppConfRaw !== false) {
63 $this->conf = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_CONF];
64 }
65
66 if (!$this->enable) {
67 Log::info($this->name . ' is not enabled!');
68
69 return;
70 }
71 if (!is_dir($this->currentPath)) {
72 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
73 }
74 if (!is_dir($this->symlinkPath)) {
75 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
76
77 return;
78 }
79 if (!is_file($this->bearsamppConf)) {
80 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
81 }
82 if (!is_file($this->conf)) {
83 Log::error(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->conf));
84 }
85 }
global $bearsamppLang
const ERROR_CONF_NOT_FOUND
const PHPMYADMIN
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_FILE_NOT_FOUND, Log\info(), Lang\PHPMYADMIN, and Log\reloadClass().

Referenced by __construct().

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

◆ setVersion()

setVersion ( $version)

Sets the version of the phpMyAdmin module.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 140 of file class.app.phpmyadmin.php.

141 {
142 global $bearsamppConfig;
143 $this->version = $version;
144 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
145 $this->reload();
146 }

◆ updateConfig()

updateConfig ( $version = null,
$sub = 0,
$showWindow = false )
protected

Updates the configuration of the phpMyAdmin module.

Parameters
string | null$versionThe version to update to. If null, the current version is used.
int$subThe sub-level for logging indentation.
bool$showWindowWhether to show a window during the update process.
Returns
bool True if the update was successful, false otherwise.

Reimplemented from Module.

Definition at line 96 of file class.app.phpmyadmin.php.

97 {
99
100 if (!$this->enable) {
101 return true;
102 }
103
104 $version = $version == null ? $this->version : $version;
105 Log::debug(($sub > 0 ? str_repeat(' ', 2 * $sub) : '') . 'Update ' . $this->name . ' ' . $version . ' config');
106
107 $alias = Path::getAliasPath() . '/phpmyadmin.conf';
108 if (is_file($alias)) {
109 Util::replaceInFile($alias, array(
110 '/^Alias\s\/phpmyadmin\s.*/' => 'Alias /phpmyadmin "' . Path::getModuleSymlinkPath($this) . '/"',
111 '/^<Directory\s.*/' => '<Directory "' . Path::getModuleSymlinkPath($this) . '/">',
112 ));
113 } else {
114 Log::error($this->getName() . ' alias not found : ' . $alias);
115 }
116
117 if ($bearsamppBins->getMysql()->isEnable()) {
118 Util::replaceInFile($this->getConf(), array(
119 '/^\$mysqlPort\s=\s(\d+)/' => '$mysqlPort = ' . $bearsamppBins->getMysql()->getPort() . ';',
120 '/^\$mysqlRootUser\s=\s/' => '$mysqlRootUser = \'' . $bearsamppBins->getMysql()->getRootUser() . '\';',
121 '/^\$mysqlRootPwd\s=\s/' => '$mysqlRootPwd = \'' . $bearsamppBins->getMysql()->getRootPwd() . '\';'
122 ));
123 }
124 if ($bearsamppBins->getMariadb()->isEnable()) {
125 Util::replaceInFile($this->getConf(), array(
126 '/^\$mariadbPort\s=\s(\d+)/' => '$mariadbPort = ' . $bearsamppBins->getMariadb()->getPort() . ';',
127 '/^\$mariadbRootUser\s=\s/' => '$mariadbRootUser = \'' . $bearsamppBins->getMariadb()->getRootUser() . '\';',
128 '/^\$mariadbRootPwd\s=\s/' => '$mariadbRootPwd = \'' . $bearsamppBins->getMariadb()->getRootPwd() . '\';'
129 ));
130 }
131
132 return true;
133 }
global $bearsamppBins
global $bearsamppRoot
static debug($data, $file=null)
static getAliasPath($aetrayPath=false)
static getModuleSymlinkPath($module)
static replaceInFile($path, $replaceList)

References $bearsamppBins, $bearsamppRoot, Module\$version, Log\debug(), Log\error(), Path\getAliasPath(), getConf(), Path\getModuleSymlinkPath(), Module\getName(), and Util\replaceInFile().

Here is the call graph for this function:

Field Documentation

◆ $conf

$conf
private

Definition at line 32 of file class.app.phpmyadmin.php.

◆ LOCAL_CFG_CONF

const LOCAL_CFG_CONF = 'phpmyadminConf'

Constant for the configuration key representing the phpMyAdmin configuration file.

Definition at line 27 of file class.app.phpmyadmin.php.

◆ ROOT_CFG_VERSION

const ROOT_CFG_VERSION = 'phpmyadminVersion'

Constant for the configuration key representing the phpMyAdmin version.

Definition at line 22 of file class.app.phpmyadmin.php.


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