Najpierw wrzuć plik, np. o nazwie riptask.php do folderu sources/tasks/, którego treść wygląda tak:
<?php
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class task_item
{
var $class = "";
var $root_path = "";
var $task = "";
/*-------------------------------------------------------------------------*/
// Our 'auto_run' function
// ADD CODE HERE
/*-------------------------------------------------------------------------*/
function run_task()
{
//-----------------------------------------
// Code section description
//-----------------------------------------
/* CUSTOM CODE */
//-----------------------------------------
// Log to log table - modify but dont delete
//-----------------------------------------
$this->class->append_task_log( $this->task, 'Custom task run successfully' );
//-----------------------------------------
// Unlock Task: DO NOT MODIFY!
//-----------------------------------------
$this->class->unlock_task( $this->task );
}
/*-------------------------------------------------------------------------*/
// register_class
// LEAVE ALONE
/*-------------------------------------------------------------------------*/
function register_class(&$class)
{
$this->class = &$class;
$this->ipsclass =& $class->ipsclass;
$this->root_path = $this->class->root_path;
}
/*-------------------------------------------------------------------------*/
// pass_task
// LEAVE ALONE
/*-------------------------------------------------------------------------*/
function pass_task( $this_task )
{
$this->task = $this_task;
}
}
Gdzie zmieniasz tylko ten fragment:
//-----------------------------------------
// Code section description
//-----------------------------------------
/* CUSTOM CODE */
Który edytujesz i zamieniasz na swój kod PHP.
Niżej możesz zmienić informację, jaka zostanie dodana do logów:
'Custom task run successfully'
Kolejna operacja to dodanie tasku w ACP:
ACP TOOLS & SETTINGS Task Manager Task Manager Add New Task
I wypełnienie formularza -> nazwa opis, nazwa wysłanego pliku (Task PHP File To Run) oraz ustawienia uruchamiania tasku.
( Temat z listy ToDo - nie zapominam )