O'Reilly logo

FuelPHP Application Development Blueprints by Sébastien Drouyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Clearing rejected comments

If your blog gets spammed and you find yourself with a lot of comments with status set as not_published, you might want to remove all these comments to clean your comments database. We could simply implement a link and an action but, for the sake of the example, let's implement a task for doing that.

Tasks are classes that can be executed through the command line using the oil utility. They are generally used for background processes or cron jobs. Sometimes, they can also be used for generating or modifying existing code, like the task we previously used for moving scaffolds to modules.

Let's generate our task file using the oil utility:

php oil generate task clearComments

It should output:

No tasks actions have been provided, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required