78 $this->enable = $this->enable &&
$bearsamppConfig->getRaw( self::ROOT_CFG_ENABLE );
80 $this->errorLog =
$bearsamppRoot->getLogsPath() .
'/postgresql.log';
82 if ( $this->bearsamppConfRaw !==
false ) {
92 $this->rootUser = isset( $this->bearsamppConfRaw[self::LOCAL_CFG_ROOT_USER] ) ? $this->bearsamppConfRaw[
self::LOCAL_CFG_ROOT_USER] :
'postgres';
93 $this->rootPwd = isset( $this->bearsamppConfRaw[self::LOCAL_CFG_ROOT_PWD] ) ? $this->bearsamppConfRaw[
self::LOCAL_CFG_ROOT_PWD] :
'';
96 if ( !$this->enable ) {
101 if ( !is_dir( $this->currentPath ) ) {
106 if ( !is_dir( $this->symlinkPath ) ) {
111 if ( !is_file( $this->bearsamppConf ) ) {
116 if ( !file_exists( $this->conf ) ) {
119 if ( !file_exists( $this->hbaConf ) ) {
123 if ( !is_file( $this->ctlExe ) ) {
128 if ( !is_file( $this->cliExe ) ) {
133 if ( !is_file( $this->dumpExe ) ) {
138 if ( !is_file( $this->dumpAllExe ) ) {
143 if ( !is_file( $this->conf ) ) {
148 if ( !is_file( $this->hbaConf ) ) {
153 if ( !is_numeric( $this->port ) || $this->port <= 0 ) {
158 if ( empty( $this->rootUser ) ) {
165 $this->service->setBinPath( $this->ctlExe );
328 global $bearsamppWinbinder;
331 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
332 $dbLink = pg_connect(
'host=127.0.0.1 port=' . $this->port .
' user=' . $this->rootUser .
' password=' . $currentPwd );
335 $error = pg_last_error( $dbLink );
338 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
339 $pgr = pg_query_params( $dbLink,
'SELECT quote_ident($1)', array(pg_escape_string( $this->rootUser )) );
340 list( $quoted_user ) = pg_fetch_array( $pgr );
341 $password = pg_escape_string( $newPwd );
342 $result = pg_query( $dbLink,
"ALTER USER $quoted_user WITH PASSWORD '$password'" );
343 if ( empty( $error ) && !
$result ) {
344 $error = pg_last_error( $dbLink );
347 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
352 if ( !empty( $error ) ) {
357 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
362 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
377 global $bearsamppWinbinder;
378 $currentPwd = $currentPwd ==
null ? $this->rootPwd : $currentPwd;
381 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
382 $dbLink = pg_connect(
'host=127.0.0.1 port=' . $this->port .
' user=' . $this->rootUser .
' password=' . $currentPwd );
384 $error = pg_last_error( $dbLink );
387 $bearsamppWinbinder->incrProgressBar( $wbProgressBar );
392 if ( !empty( $error ) ) {
427 if ( !$this->enable ) {
432 Util::logDebug( ($sub > 0 ? str_repeat(
' ', 2 * $sub ) :
'') .
'Update ' . $this->name .
' ' .
$version .
' config' );
447 $bearsamppWinbinder->messageBoxError(
460 $bearsamppWinbinder->messageBoxError(
474 '/^port(.*?)=(.*?)(\d+)/' =>
'port = ' . $this->port
478 $bearsamppApps->getPhppgadmin()->update( $sub + 1 );
481 $bearsamppApps->getAdminer()->update( $sub + 1 );
566 public function setEnable($enabled, $showWindow =
false)
573 $bearsamppWinbinder->messageBoxError(
586 if ( $this->enable ) {