Delete the old artisan command with the new artisan command in the laravel 5.2 kernel console

I work in a kernel command where I need to change old commands:

Old team:

php artisan crawl:author 

Now I need to rename it as:

 php artisan crawl-bq:author 

In my command, the file signature changes as follows:

protected $ signature = 'crawl-bq: author';

I cleared the artisan cache using the following command:

 php artisan cache:clear php artisan config:cache 

And yet, my old team works the same as the new team. But when I see the wizard list "php artisan list", then the old commands are also not visible.

Can anybody help me?

+6
source share
4 answers

After a long time, I came to the conclusion that I found that the Laravel 5.2 machine gun command has an error, or it is not an error, since at least one command will be executed according to the first comparison.

Suppose you have two signatures in two different batch files, for example, in the following four cases:

Case I:

 protected $signature = 'crawl:author-usa'; protected $signature = 'crawl:author-uk'; 

OR Case II:

 protected $signature = 'crawl:authorusa'; protected $signature = 'crawl:authoruk'; 

OR case III:

 protected $signature = 'crawl-bq:author-usa'; protected $signature = 'crawl-bq:author-uk'; 

OR Case IV:

 protected $signature = 'crawl-bq:authorusa'; protected $signature = 'crawl-bq:authoruk'; 

In any case, if you run the php artisan crawl:auther and then for Case I, it will show an ambiguous error, for example:

[Symfony\Component\Console\Exception\CommandNotFoundException] Command "crawl:author" is ambiguous (crawl:author-usa, crawl:author-uk).

It will show the same ambiguous message for the remaining 3 cases, but the signature text will be different.

Now suppose the following signature for 4 different cases:

Case I:

 protected $signature = 'crawl:author-usa'; 

OR Case II:

 protected $signature = 'crawl:authorusa'; 

OR case III:

 protected $signature = 'crawl-bq:author-usa'; 

OR Case IV:

 protected $signature = 'crawl-bq:authorusa'; 

In any case, if you run the php artisan crawl:auther , it will execute this command.

For these two scenarios, this is due to the Symfony / Cconsole find () function. The exact command is executed here: crawl[^:]*[^:]*:author[^:]*[^:]* . This means that if any signature has crawl<anything>:author<anything> , it will match php artisan crawl:author

Now, if I come to a solution to this problem, first of all I need to change the public function find($name) about 509 lines to a symfony / consle file . Or, if it is possible to overwrite this function (I'm not sure how this redefinition can be performed).

I was inspired by @ Nadeem0035, where he mentioned the line public function find($name) around 509 in the symfony / consle file . I would be happy if I could reward generosity as the duration of the game, since at least he showed me a way to find the exact script of the console team. That's why the vote before the vote :)

+1
source

Old team:

 php artisan crawl:author 

Now we will rename it as "crawl-bq: author"

 php artisan crawl-bq:author (Will Work) php artisan crawl-b:author (Will Work) php artisan craw:author (Will Work) php artisan crawl:author (Will Work) 

Decision

Rename it with another name, for example, "newcrawl-bq: author"

 php artisan crawl:author (Not work) php artisan crawl-bq:author (Not work) php artisan newcrawl-bq:author (Will work) 
+1
source

I have reproduced all the steps you described, and I have no problem changing signatures. Laravel doesn't seem to include artisan commands in cache configuration or anywhere else. Composer dump-autoload does not matter here if the file names remain unchanged.

The only advice I can give is to check the Console / Kernel.php $ commands to make sure that duplicate commands are not loaded, and all signatures are as they should be. Maybe some other team is still using the old signature?

I understand that this is an old question. Perhaps you managed to solve this problem already?

0
source

you need to delete the old batch file from the application / Console / Commands /

and that should work.

0
source

All Articles