2024.8.23
Loading...
Searching...
No Matches
ActionQuit Class Reference

Public Member Functions

 __construct ($args)
 
 processWindow ($window, $id, $ctrl, $param1, $param2)
 

Data Fields

const GAUGE_OTHERS = 1
 
const GAUGE_PROCESSES = 1
 

Private Attributes

 $splash
 

Detailed Description

Class ActionQuit Handles the quitting process of the Bearsampp application. Displays a splash screen and stops all services and processes.

Definition at line 15 of file class.action.quit.php.

Constructor & Destructor Documentation

◆ __construct()

ActionQuit::__construct ( $args)

ActionQuit constructor. Initializes the quitting process, displays the splash screen, and sets up the main loop.

Parameters
array$argsCommand line arguments.

Definition at line 34 of file class.action.quit.php.

35 {
36 global $bearsamppCore, $bearsamppLang, $bearsamppBins, $bearsamppWinbinder, $arrayOfCurrents;
37
38 // Start splash screen
39 $this->splash = new Splash();
40 $this->splash->init(
41 $bearsamppLang->getValue( Lang::QUIT ),
42 self::GAUGE_PROCESSES * count( $bearsamppBins->getServices() ) + self::GAUGE_OTHERS,
43 sprintf( $bearsamppLang->getValue( Lang::EXIT_LEAVING_TEXT ), APP_TITLE . ' ' . $bearsamppCore->getAppVersion() )
44 );
45
46 // Set handler for the splash screen window
47 $bearsamppWinbinder->setHandler( $this->splash->getWbWindow(), $this, 'processWindow', 2000 );
48 $bearsamppWinbinder->mainLoop();
49 $bearsamppWinbinder->reset();
50 }
global $bearsamppBins
global $bearsamppLang
global $bearsamppCore
const QUIT
const EXIT_LEAVING_TEXT
const APP_TITLE
Definition root.php:12

References $bearsamppBins, $bearsamppCore, $bearsamppLang, APP_TITLE, Lang\EXIT_LEAVING_TEXT, and Lang\QUIT.

Member Function Documentation

◆ processWindow()

ActionQuit::processWindow ( $window,
$id,
$ctrl,
$param1,
$param2 )

Processes the splash screen window events. Stops all services, deletes symlinks, and kills remaining processes.

Parameters
resource$windowThe window resource.
int$idThe event ID.
int$ctrlThe control ID.
mixed$param1Additional parameter 1.
mixed$param2Additional parameter 2.

Definition at line 62 of file class.action.quit.php.

63 {
64 global $bearsamppBins, $bearsamppLang, $bearsamppWinbinder;
65
66 // Stop all services
67 foreach ( $bearsamppBins->getServices() as $sName => $service ) {
68 $name = $bearsamppBins->getApache()->getName() . ' ' . $bearsamppBins->getApache()->getVersion();
69 if ( $sName == BinMysql::SERVICE_NAME ) {
70 $name = $bearsamppBins->getMysql()->getName() . ' ' . $bearsamppBins->getMysql()->getVersion();
71 }
72 elseif ( $sName == BinMailhog::SERVICE_NAME ) {
73 $name = $bearsamppBins->getMailhog()->getName() . ' ' . $bearsamppBins->getMailhog()->getVersion();
74 }
75 elseif ( $sName == BinMailpit::SERVICE_NAME ) {
76 $name = $bearsamppBins->getMailpit()->getName() . ' ' . $bearsamppBins->getMailpit()->getVersion();
77 }
78 elseif ( $sName == BinMariadb::SERVICE_NAME ) {
79 $name = $bearsamppBins->getMariadb()->getName() . ' ' . $bearsamppBins->getMariadb()->getVersion();
80 }
81 elseif ( $sName == BinPostgresql::SERVICE_NAME ) {
82 $name = $bearsamppBins->getPostgresql()->getName() . ' ' . $bearsamppBins->getPostgresql()->getVersion();
83 }
84 elseif ( $sName == BinMailhog::SERVICE_NAME ) {
85 $name = $bearsamppBins->getPostgresql()->getName() . ' ' . $bearsamppBins->getPostgresql()->getVersion();
86 }
87 elseif ( $sName == BinMemcached::SERVICE_NAME ) {
88 $name = $bearsamppBins->getMemcached()->getName() . ' ' . $bearsamppBins->getMemcached()->getVersion();
89 }
90 elseif ( $sName == BinFilezilla::SERVICE_NAME ) {
91 $name = $bearsamppBins->getFilezilla()->getName() . ' ' . $bearsamppBins->getFilezilla()->getVersion();
92 } elseif ($sName == BinXlight::SERVICE_NAME) {
93 $name = $bearsamppBins->getXlight()->getName() . ' ' . $bearsamppBins->getXlight()->getVersion();
94 }
95 elseif ( $sName == BinXlight::SERVICE_NAME ) {
96 $name = $bearsamppBins->getXlight()->getName() . ' ' . $bearsamppBins->getXlight()->getVersion();
97 }
98 $name .= ' (' . $service->getName() . ')';
99
100 $this->splash->incrProgressBar();
101 $this->splash->setTextLoading( sprintf( $bearsamppLang->getValue( Lang::EXIT_REMOVE_SERVICE_TEXT ), $name ) );
102 $service->delete();
103 }
104
105 // Purge "current" symlinks
107
108 // Stop other processes
109 $this->splash->incrProgressBar();
110 $this->splash->setTextLoading( $bearsamppLang->getValue( Lang::EXIT_STOP_OTHER_PROCESS_TEXT ) );
111 Win32Ps::killBins( true );
112
113 // Destroy the splash screen window
114 $bearsamppWinbinder->destroyWindow( $window );
115 }
const SERVICE_NAME
const EXIT_REMOVE_SERVICE_TEXT
const EXIT_STOP_OTHER_PROCESS_TEXT
static killBins($refreshProcs=false)

References $bearsamppBins, $bearsamppLang, Symlinks\deleteCurrentSymlinks(), Lang\EXIT_REMOVE_SERVICE_TEXT, Lang\EXIT_STOP_OTHER_PROCESS_TEXT, Win32Ps\killBins(), BinFilezilla\SERVICE_NAME, BinMailhog\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, and BinXlight\SERVICE_NAME.

Field Documentation

◆ $splash

ActionQuit::$splash
private

Definition at line 20 of file class.action.quit.php.

◆ GAUGE_OTHERS

const ActionQuit::GAUGE_OTHERS = 1

Definition at line 26 of file class.action.quit.php.

◆ GAUGE_PROCESSES

const ActionQuit::GAUGE_PROCESSES = 1

Gauge values for progress bar increments.

Definition at line 25 of file class.action.quit.php.


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