Upgrading via Command Line

Hello,

I’m trying to update Cs-cart via Command Line Cs-cart CS-Cart 4.14.3.SP1 B2B

php admin.php --dispatch=upgrade_center.console upgrade

and I get a message like this
[Access denied] You must log in before you can access this resource!

any idea how to solve this?

https://docs.cs-cart.com/latest/upgrade/upgrade_via_console.html#required-file-and-directory-permissions

I have the correct permissions,

when I move upgrade_center.php to the frontend folder its working correctly

/app/controllers/backend/upgrade_center.php
/app/controllers/frontend/upgrade_center.php

php index.php --dispatch=upgrade_center.console upgrade

Hi!

If the root administrator is missing or has an ID other than 1 in the database of your shop, interaction with the console may end with this error in versions older than 4.15.1. This issue was fixed in 4.15.1. You can apply a hotfix in your installation by replacing the code:

        $user_id = fn_get_session_data($area . '_user_id');

        if (defined('CONSOLE') && SiteArea::isAdmin($area)) {
            $user_id = 1;
        }

with:

        $user_id = fn_get_session_data($area . '_user_id');

        if (defined('CONSOLE') && SiteArea::isAdmin($area)) {
            $user_id = db_get_field('SELECT user_id FROM ?:users WHERE user_type = ?s AND is_root = ?s AND company_id = ?i', 'A', 'Y', 0);
        }

in the app/functions/fn.init.php file.

you’re the best, yes that’s it big thanks

root user id has changed during many years form 1 to other

1 Like