Obullo has a integrated task functionality and Command Line Interface support who want to create command line tasks. You can run controllers from command line.

CLI (Command Line Interface) Requests

To run task controller which is located in applcation/task folder just type below the codes in your Terminal. Below the example we use /var/www path this is your webroot and it depends on your configuration.

First of all go your framework root folder.

$cd /var/www/framework/

Do a request, all command line requests goes to Obullo task.php which is located in your root directory.

$php task.php hello

This request call the hello controller from tasks folder which is located in your /application/tasks directory.

        _____      ________     __     __  __        __          _______
      / ___  /    / ____   \   / /    / / / /       / /         / ___   /
    /  /   /  /  / /____/  /  / /    / / / /       / /        /  /   /  /
   /  /   /  /  / _____  /   / /    / / / /       / /        /  /   /  /
  /  /___/  /  / /____/  \  / /____/ / / /____   / /_____   /  /__ /  /
  /_______/   /__________/ /________/ /_______/ /_______ /  /_______/ 
  
                Welcome to Obullo Task Manager (c) 2011.
     Please run this command [$php task.php hello help] for help ! 
                YOU ARE IN /APPLICATION/TASKS FOLDER

If you see this screen your command successfully run otherwise check your php path running by this command

$which php // command output /usr/bin/php If your current php path not /usr/bin/php open the index.php which is located in your framework root and define your php path like this define('PHP_PATH', 'your_php_path_that_you_learned_by_which_command'); 

Running Module Tasks

Running below the code will call the another task controller from /MODULES/tasks directory.

$php task.php start

Running below the code will call the another task controller from your /MODULES/welcome/tasks directory.

$php task.php welcome start index arg1 arg2

If above the command successful you will see this screen

Module: welcome
Hello World !
Argument 1: arg1
Argument 2: arg2
The Start Controller Index function successfully works !

Note: When you use the CLI operations cookies and sessions will not works as normal. Please use the tasks for advanced Command Line structures.

Tasks

Tasks are same thing like controller model view structure. The main difference from CLI in the task mode framework rules works like browsing a web page sessions and another some things works well in this mode.To working with tasks just we call the controller from the command line and we have special directories for this operation called tasks.

Obullo has three tasks folder called APPLICATON, MODULES and YOUR MODULE TASKS folder.

APPLICATION TASK FOLDER

- application
    + config
    + core
    + helpers
    + libraries
    + models
    + parents
    - tasks
       - controllers
           hello.php

MODULES TASK FOLDER

+ application
- modules
   + captcha
   + default
   - tasks
       - controllers
            start.php

YOUR MODULE TASK FOLDER

+ application
- modules
   + captcha
   + default
   - welcome
      - tasks
        - start
           start.php

Running APPLICATION Tasks

All command line request goes to Obullo task.php which is located in your root directory. Obullo has a /tasks folder in the application directory if you want to create application tasks just create your controllers, models, helpers .. files in this folder.

Using Task Helper you can run your tasks as a command in the background. Function run like CLI but don't use the task.php.

loader::helper('ob/task');

task_run('hello help', $debug = TRUE);

Running MODULE Tasks

loader::helper('ob/task');

task_run('start help', $debug = TRUE);

Running YOUR MODULE Tasks

loader::helper('ob/task');

task_run('welcome start/index/arg1/arg2', $debug = TRUE);

An Important thing we use the second argument $debug = true just for test don't use this argument except the testing or use it as false.

task_run('welcome hello/index/arg1/arg2', FALSE);

Note: When you use the task function, debug mode should be FALSE, or don't use a second argument except the test otherwise shell command will print output the screen.