codeigniter4 / shield

Authentication and Authorization for CodeIgniter 4
https://shield.codeigniter.com
MIT License
352 stars 130 forks source link

Bug: Skipped APPPATH\Config\Routes.php. It has already been updated. #1066

Closed ifjtoledo closed 5 months ago

ifjtoledo commented 5 months ago

PHP Version

8.0

CodeIgniter4 Version

4.4.6

Shield Version

dev-develop

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MariaDB 10.4

Did you customize Shield?

No

What happened?

Always said: "Skipped APPPATH\Config\Routes.php. It has already been updated." even the Routes.php do not have the service('auth')->routes($routes); line

Steps to Reproduce

php spark shield:setup

Expected Output

Add the lines needed to work with Shield in the config files

Anything else?

No response

datamweb commented 5 months ago

even the Routes.php do not have the service('auth')->routes($routes);

Updated: APPPATH\Config\Routes.php

CodeIgniter v4.4.6 Command Line Tool - Server Time: 2024-03-15 18:46:34 UTC+03:30

  File 'APPPATH\Config\Auth.php' already exists in destination. Overwrite? [n, y]: n
  Skipped APPPATH\Config\Auth.php. If you wish to overwrite, please use the '-f' option or reply 'y' to the prompt.
  File 'APPPATH\Config\AuthGroups.php' already exists in destination. Overwrite? [n, y]: n
  Skipped APPPATH\Config\AuthGroups.php. If you wish to overwrite, please use the '-f' option or reply 'y' to the prompt.
  File 'APPPATH\Config\AuthToken.php' already exists in destination. Overwrite? [n, y]: n
  Skipped APPPATH\Config\AuthToken.php. If you wish to overwrite, please use the '-f' option or reply 'y' to the prompt.
  Autoload Setup: Everything is fine.
  Updated: APPPATH\Config\Routes.php
  Security Setup: Everything is fine.
  The required Config\Email::$fromEmail is not set. Do you set now? [y, n]: n
  The required Config\Email::$fromName is not set. Do you set now? [y, n]: n
  Updated: APPPATH\Config\Email.php
  Run `spark migrate --all` now? [y, n]: n
ifjtoledo commented 5 months ago

Hello, and do you look in your Routes.php? the line service('auth')->routes($routes); it has been written?

ifjtoledo commented 5 months ago

may be this line in Setup.php : $output = $this->replacer->add($content, $code, $pattern, $replace);

    if ($output === true) {
        $this->error("  Skipped {$cleanPath}. It has already been updated.");
        return;
    }    

May be always goes to true, because $output it is a string. Because never puts the line service('auth')->routes($routes); in the Routes.php file.

datamweb commented 5 months ago

Hello, and do you look in your Routes.php? the line service('auth')->routes($routes); it has been written?

Hi, Yes.

https://github.com/codeigniter4/shield/assets/9530214/197e822c-99da-4631-acbe-add40edd1a62

ifjtoledo commented 5 months ago

Oh so good, i am totally wrong, how knows why this is happen to my codeigniter installation, sorry for the false alarm