Skip to main content

Questions tagged [console]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
88 views

Craft 4 DB connection works in WEB context but not from Craft's console command

We just completed an upgrade from Craft 3 to 4 (latest version) and now all web requests (FE+CP) work, but not the console commands, it can not connect to the database ./craft users/list-admins ...
Matthias Redl-Mann's user avatar
0 votes
0 answers
13 views

How does use the Bulk Resave Elements command with checkbox group fields?

I recently added a Checkbox Group with 3 options to a Section. By default, I would want the checkboxes to be checked, and to allow the author to uncheck them as needed. To apply the above "...
Sandwich's user avatar
  • 636
1 vote
1 answer
164 views

Craft's db/restore fails to import a dump

I don't know how you work, but in our projects we have multiple staging zones and in regular intervals we take the production system and import them into the zones before to stay as close to ...
Matthias Redl-Mann's user avatar
2 votes
2 answers
762 views

Recommended caches to clear after server deployments?

Craft has this article about deployment best practices: https://craftcms.com/knowledge-base/deployment-best-practices It also states that you might want to clear caches after deployments, which is of ...
Thijs Kaspers's user avatar
2 votes
1 answer
885 views

How to run custom module controller actions from console?

I have built a custom module with some custom controller actions - some of which I would like to run via console, but I am not sure what the path/command should be for running these actions? In my ...
iamkeir's user avatar
  • 468
1 vote
1 answer
77 views

Remove dynamicly transformed images

Is it possible to remove/delete all, via transformer, generated images? Leaving the original be. Craft creates new directories to handle these images. So i could create a script in combination with a ...
Leonardo's user avatar
  • 471
1 vote
2 answers
2k views

@webroot - how to find out path?

Getting "Error clearing cache Control panel resources: Unable to clear control panel resources because the location isn't known for console commands" and the recommendation to set @webroot ...
Emma Swann's user avatar
2 votes
1 answer
630 views

Parse variable to new queue job

Is there a way to parse a variable to a queue job? I want to re-send some Craft commerce emails via a cron job, so have created a console controller for the cron job to run a command against. This ...
Jaytrix's user avatar
  • 337
1 vote
1 answer
47 views

Console command ./craft db/restore expects "info" table. Why?

Why does the console command ./craft db/restore expect the info table to exist and contain a row? There is also no option to ignore a non-existing info or empty info table. When we create automated ...
Matthias Redl-Mann's user avatar
1 vote
1 answer
208 views

execute Yii2 console command from Yii2 extension with Craft

Does anyone know if and how a console command from a Yii2 extension can be used with Craft? To be more specific, I would like to use https://www.yiiframework.com/extension/yii2-migration-creator which ...
Matthias Redl-Mann's user avatar
1 vote
1 answer
34 views

Running Craft Console Commands on Webfaction

I'm trying to run a few of Craft's console commands on a Webfaction server to automate running Craft migrations and resolving Project Config changes, and it's throwing an error. Here's what I'm doing: ...
Jake Dohm's user avatar
  • 766
1 vote
1 answer
85 views

Craft console app within windows batch script

I try to create a simple deployment batch script that would work on windows. To do that, I need to interact with Craft console app. How do I pass multiple commands to it to perform installation? I ...
Piotr Pogorzelski's user avatar
2 votes
1 answer
1k views

Calling Craft Console Commands from Plugin?

I am in the process of building a plugin that has a controller that accepts a HTTP request. If the token and request are valid, I would like to call a Craft Console Command from within the plugin (e.g....
Jason McCallister's user avatar
2 votes
1 answer
1k views

Why is my custom console command throwing Calling unknown method: ...getAcceptsJson?

I have a module with a console controller (ScriptsController): namespace modules\vetscripts\console\controllers; use yii\console\Controller; use yii\console\ExitCode; use modules\vetscripts\...
Steven Thate's user avatar
1 vote
3 answers
2k views

Unable to run console commands (Craft 3, MAMP)

This was asked and solved previously, but for Craft 2, see Error Connecting To (MAMP Pro) Database in Console Command. Unable to make it work here. In short, running console commands like ./craft abc ...
Stian Karlsen's user avatar
2 votes
1 answer
2k views

How do I create console commands for my module or plugin?

I would like to create a custom console command for my Craft 3 plugin. I've looked at the Yii docs and understand commands are defined using controllers extending \yii\console\Controller but cannot ...
Mike's user avatar
  • 277
1 vote
1 answer
312 views

How can I call console controllers

I have a controller in the console folder. How can I call this controller via ajax please? I tried to config a route in Routes.php, and then call this route by jquery Get() function. But none of ...
yu xia's user avatar
  • 397
2 votes
1 answer
1k views

Reset admin account password using command line interface

Can I reset admin password using console CLI interface? Didn't see anything like that when I run the craft file directly and it displayed list of commands.
Ded Nolyxeux's user avatar
2 votes
2 answers
397 views

How can I render a page template from a queue job/console controller?

I'm trying to call craft\web\View::renderPageTemplate from within a console controller (also tried from a queue job), but running into all kinds of trouble: E.g. Exception 'Twig_Error_Runtime' with ...
Tim Kelty's user avatar
  • 3,081
2 votes
1 answer
325 views

Run Craft Find and Replace via Console

I'm trying to streamline my deployments for local, staging and production and would like to know if it's possible to invoke the Find and Replace method via Console. I have a multi-config in place, but ...
casey's user avatar
  • 437
2 votes
1 answer
664 views

How do I configure multiple environments for console commands?

I have built a plugin with some console commands for automating some regular tasks that will be run by a cron job for my site. In order to get the commands working, I had to replicate my database ...
Jeremy Gimbel's user avatar
2 votes
0 answers
444 views

Craft\ConsoleApp and its behaviors do not have a method or closure named "getTheme"

I'm trying to render a template from a console command, but i'm getting the following error: Craft\ConsoleApp and its behaviors do not have a method or closure named "getTheme" The code looks like ...
Fred Carlsen's user avatar
  • 2,997
1 vote
1 answer
158 views

How to set CRAFT_PLUGINS_PATH when invoking a console plugin action

I have an install where I've moved the plugins/ directory outside of the craft/ directory. I've set CRAFT_PLUGINS_PATH in index.php and for web requests everything works fine. Now I need to run a ...
Tom Davies's user avatar
0 votes
1 answer
97 views

Unable to connect to db via console with a custom config directory path

I've just used yiic for the first time for a plugin record installation and found that the db.php config file didn't seem to be picked up and I got database connection failures. I added a console ...
Russ Back's user avatar
  • 1,503
1 vote
1 answer
704 views

Enable craft.log for console commands [closed]

I've got devMode enabled and can see the log happening in craft/storage/runtime/logs/craft.log for browser requests... but was wondering if there is a way to enable this level of logging (detailing ...
moldedjelly's user avatar
0 votes
1 answer
151 views

Running a console command produces an error mentioning sessions. How do I resolve?

None of the craft core console commands to work. For example: ./yiic querygen all My_MyRecord produces an error which includes mention of session? How do I get craft console commands working again?
Luke Holder's user avatar
  • 6,837