Jump to content

Edit History

ps8modules

ps8modules

Of course, you can also run your own script to change permissions for folders and subfolders in ./img/p/.
Just insert this script into the root of the eshop and call it in the URL.
For example, the file will be named img-permission.php
So you run it, for example, https://my-shop.com/img-permission.php

<?php
    include('./config/config.inc.php');
    include('./init.php');
    
    $files = false; /* change permission on all files in dir "Demanding on script runtime" */
    $time_start = microtime(true); 

    for($ii = 1; $ii <= 9; $ii++){
        $path = _PS_PROD_IMG_DIR_.$ii;
        changeDirPermission($path, $files);

        for($jj = 0; $jj <= 9; $jj++)
        {
            $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj;
            changeDirPermission($path, $files);

            for($kk = 0; $kk <= 9; $kk++)
            {
                $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk;
                changeDirPermission($path, $files);

                for($ll = 0; $ll <= 9; $ll++)
                {
                    $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll;
                    changeDirPermission($path, $files);
                        
                    for($mm = 0; $mm <= 9; $mm++)
                    {
                        $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll.'/'.$mm;
                        changeDirPermission($path, $files);
                            
                        for($nn = 0; $nn <= 9; $nn++)
                        {
                            $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll.'/'.$mm.'/'.$nn;
                            changeDirPermission($path, $files);
                        }
                    }
                }
            }
        }
    }

    $time_end = microtime(true);

    $execution_time = ($time_end - $time_start);

    echo '<b>Total Execution Time:</b> '.round($execution_time, 2).' second';
   
    function changeDirPermission($path, $files) /* It should not be longer than 60 seconds */
    {
        if (file_exists($path)){
            chmod($path, 0755);
            if ($files == true){
                changeFilesPermission($path);
            }
        }
    } 

    function changeFilesPermission($path)
    {
        if (file_exists($path)){
            $files = scandir($path);
            if ($files){
                foreach ($files as $file){
                    chmod($file, 0644);
                }
            }
        }
    }

 

ps8modules

ps8modules

Of course, you can also run your own script to change permissions for folders and subfolders in img/p.
Just insert this script into the root of the eshop and call it in the URL.
For example, the file will be named img-permission.php
So you run it, for example, https://my-shop.com/img-permission.php

<?php
    include('./config/config.inc.php');
    include('./init.php');
    
    $files = false; /* change permission on all files in dir "Demanding on script runtime" */
    $time_start = microtime(true); 

    for($ii = 1; $ii <= 9; $ii++){
        $path = _PS_PROD_IMG_DIR_.$ii;
        changeDirPermission($path, $files);

        for($jj = 0; $jj <= 9; $jj++)
        {
            $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj;
            changeDirPermission($path, $files);

            for($kk = 0; $kk <= 9; $kk++)
            {
                $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk;
                changeDirPermission($path, $files);

                for($ll = 0; $ll <= 9; $ll++)
                {
                    $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll;
                    changeDirPermission($path, $files);
                        
                    for($mm = 0; $mm <= 9; $mm++)
                    {
                        $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll.'/'.$mm;
                        changeDirPermission($path, $files);
                            
                        for($nn = 0; $nn <= 9; $nn++)
                        {
                            $path = _PS_PROD_IMG_DIR_.$ii.'/'.$jj.'/'.$kk.'/'.$ll.'/'.$mm.'/'.$nn;
                            changeDirPermission($path, $files);
                        }
                    }
                }
            }
        }
    }

    $time_end = microtime(true);

    $execution_time = ($time_end - $time_start);

    echo '<b>Total Execution Time:</b> '.round($execution_time, 2).' second';
   
    function changeDirPermission($path, $files) /* It should not be longer than 60 seconds */
    {
        if (file_exists($path)){
            chmod($path, 0755);
            if ($files == true){
                changeFilesPermission($path);
            }
        }
    } 

    function changeFilesPermission($path)
    {
        if (file_exists($path)){
            $files = scandir($path);
            if ($files){
                foreach ($files as $file){
                    chmod($file, 0644);
                }
            }
        }
    }

 

×
×
  • Create New...