!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/main_file/vendor/laravel/framework/src/Illuminate/Database/Console/   drwxr-xr-x
Free 13.1 GB of 57.97 GB (22.59%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     MonitorCommand.php (4.14 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Illuminate\Database\Console;

use 
Illuminate\Contracts\Events\Dispatcher;
use 
Illuminate\Database\ConnectionResolverInterface;
use 
Illuminate\Database\Events\DatabaseBusy;
use 
Illuminate\Support\Composer;
use 
Symfony\Component\Console\Attribute\AsCommand;

#[
AsCommand(name'db:monitor')]
class 
MonitorCommand extends DatabaseInspectionCommand
{
    
/**
     * The name and signature of the console command.
     *
     * @var string
     */
    
protected $signature 'db:monitor
                {--databases= : The database connections to monitor}
                {--max= : The maximum number of connections that can be open before an event is dispatched}'
;

    
/**
     * The name of the console command.
     *
     * This name is used to identify the command during lazy loading.
     *
     * @var string|null
     *
     * @deprecated
     */
    
protected static $defaultName 'db:monitor';

    
/**
     * The console command description.
     *
     * @var string
     */
    
protected $description 'Monitor the number of connections on the specified database';

    
/**
     * The connection resolver instance.
     *
     * @var \Illuminate\Database\ConnectionResolverInterface
     */
    
protected $connection;

    
/**
     * The events dispatcher instance.
     *
     * @var \Illuminate\Contracts\Events\Dispatcher
     */
    
protected $events;

    
/**
     * Create a new command instance.
     *
     * @param  \Illuminate\Database\ConnectionResolverInterface  $connection
     * @param  \Illuminate\Contracts\Events\Dispatcher  $events
     * @param  \Illuminate\Support\Composer  $composer
     */
    
public function __construct(ConnectionResolverInterface $connectionDispatcher $eventsComposer $composer)
    {
        
parent::__construct($composer);

        
$this->connection $connection;
        
$this->events $events;
    }

    
/**
     * Execute the console command.
     *
     * @return void
     */
    
public function handle()
    {
        
$databases $this->parseDatabases($this->option('databases'));

        
$this->displayConnections($databases);

        if (
$this->option('max')) {
            
$this->dispatchEvents($databases);
        }
    }

    
/**
     * Parse the database into an array of the connections.
     *
     * @param  string  $databases
     * @return \Illuminate\Support\Collection
     */
    
protected function parseDatabases($databases)
    {
        return 
collect(explode(','$databases))->map(function ($database) {
            if (! 
$database) {
                
$database $this->laravel['config']['database.default'];
            }

            
$maxConnections $this->option('max');

            return [
                
'database' => $database,
                
'connections' => $connections $this->getConnectionCount($this->connection->connection($database)),
                
'status' => $maxConnections && $connections >= $maxConnections '<fg=yellow;options=bold>ALERT</>' '<fg=green;options=bold>OK</>',
            ];
        });
    }

    
/**
     * Display the databases and their connection counts in the console.
     *
     * @param  \Illuminate\Support\Collection  $databases
     * @return void
     */
    
protected function displayConnections($databases)
    {
        
$this->newLine();

        
$this->components->twoColumnDetail('<fg=gray>Database name</>''<fg=gray>Connections</>');

        
$databases->each(function ($database) {
            
$status '['.$database['connections'].'] '.$database['status'];

            
$this->components->twoColumnDetail($database['database'], $status);
        });

        
$this->newLine();
    }

    
/**
     * Dispatch the database monitoring events.
     *
     * @param  \Illuminate\Support\Collection  $databases
     * @return void
     */
    
protected function dispatchEvents($databases)
    {
        
$databases->each(function ($database) {
            if (
$database['status'] === '<fg=green;options=bold>OK</>') {
                return;
            }

            
$this->events->dispatch(
                new 
DatabaseBusy(
                    
$database['database'],
                    
$database['connections']
                )
            );
        });
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0063 ]--