CLI scripts - graphidev/WOK GitHub Wiki

The CLI scripts are made to make easier some tasks. This part of WOK is only made for development step. Do not push it on your production server !

You can find scripts and add some in the /scripts folder. They have to be called with your console/terminal as following :

php cli.php myscript [option] [...]

Be sure to be logged as super user (su/sudo/...) in order to have no problem with scripts execution.

To know which scripts are available please use ...

php cli.php

without any option

Create a new script

The cli.php script initialize and call the script you ask for (if it exists). You can use anything that it contained in WOK (core libraries, additional libraries, controllers, ...)

It also defined some variables and tools that could help you.

The only requirement to create a new script is that you must add it in the /scripts folder

Command options

The command options are accessible with :

(array) $_opts

Execution input

To ask some something during the script execution, use input function which is defined in clip.php :

$response = input('Give me a response :');

Notice 1 : 'exit' anwser will shut down the script execution.

Notice 2 : the script will be paused on calling this function.