The script management window allows one to controle scripts currently running, but can also run regenerate page scripts.
Regenerating pages
Page regeneration is practical for taking into account a modification you have made on the site configuration, a template or a row without going through Automne. For example when you edit your models or rows directly on the server.
You can choose to regenerate one or many precise pages by entering their identifiers (separated by commas, or dashes to specify an interval) in the field "Specify pages". You can also select the pages if you don't know their identifier. For this click "Select" next to the field "Specify pages". You can then select your page in the tree of your site.
You can also choose to regenerate all pages of the site by choosing "Regenerate all" or regenerate all the pages descending from a precise page by choosing "Regenerate a branch".
Script management
The scripts in progress section allows you to see the scripts executed by Automne. You can decide to stop these scripts by clicking "Stop scripts", cancel their execution by clicking "Delete queue" or relaunch the execution of all scripts by clicking "Relaunch scripts".
You can follow the progress of scripts in the progress bar located under the action buttons.
You can also display details about scripts in progress or about the script queue by clicking "Detail scripts in progress" or "Detail script queue".
Details of scripts in progress:
This will display:
- the name of the script
- the date and hour when the script begins
- script status (succeeded or failed)
Details of the queue:
You will here have a list of all the scripts waiting to be executed in the order they will be treated.
Adding a PHP script to the queue and executing it
During your PHP development, you will perhaps want to effect a background script with PHP
For example a News module, codename "news".
In the class module, located in /automne/classes/modules/news.php, we indicate that the module extendss the class of the plymod module in order to inherit is essential functions:
<?php
class news extends CMS_polymod{
// My class here...
}
?>
In the body of the class module next specify the "scriptTask" feature.
This feature allows one to indicate what the script must do:
<?php
function scriptTask($parameters) {
// My parameters
$myTask = $parameters['task']; // 'myTaskName'
$myVar= $parameters['myVar']; // $myVar
// My script here...
}
?>
In your PHP code, in a row or model, for example, indicate the the code to add a task to the queue and then execute it:
<?php
// Add a script to the queue
$parameters = array(
'task' => 'myTaskName',
'myVar' => $myVar,
);
CMS_scriptsManager::addScript('news', $parameters);
// Launch the queue treatment
CMS_scriptsManager::startScript();
?>
CMS_scriptsManager::addScript allows indicating what module to use, here "news", then to indicate the parameter necessary to execute the script.
CMS_scriptsManager::startScript allowing launching the execution of the queue.
Add a contribution