Hi,
i'm a new user and i try to develop a plugin using cron. i read all web page on the argouments and i don't understand where should i put the contrab file. In the Elgg's package i found the contrab.example file but i don't kown the path where that file must be saved.
help me please.
bye.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Flo@Floris
Flo - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Team Webgalli@webgalli
Team Webgalli - 0 likes
- Flo@Floris
Flo - 0 likes
You must log in to post replies.crontab is a file that is on your server (usually, assuming *nix). If you are using cpanel there is usually a link to a graphical interface for cron where you can set it up easily.
I don't know how other people on windows xampp/localhost do it, when I'm developing using cron hooks I just manually trigger it when I need to test by hitting localhost/<path to elgg>/cron/<interval> in a browser in which I'm not logged in (very important)
Hi, thanks for the answer. I tested my code by hitting localhost/<path elgg>/cron/<interval> in a browser and it works, but I would like the function starts automatically every minute, and this does not occur.
Any idea?
every minute? That's really a lot. Are you sure you need it that frequently?
that will result in utilizing huge server resources. As matt asked, are you sure that you need it every minute?
every minute is only a test. In my script I try to save a file in elgg dataroot. If i try to save a txt file from the plugin, it's work.. but if i try to save a txt file from the script (every minute) it's not work.. Any idea?? Thanks for the answer.
This is my code(with elgg class):
$arff_file_filestore = new ElggDiskFilestore( $CONFIG->dataroot . "/");
$arff_file = new ElggFile();
$arff_file->setFilename('prova.txt');
$arff_file->setMimeType('text');
$arff_file_filestore->open($arff_file,'write');
$arff_file_filestore->write($CONFIG->dataroot . $arff_file_filestore->getFilenameOnFilestore($arff_file),'Hi');
$arff_file_filestore->close();
This is my code (without Elgg Class):
function write_file_log($path,$text)
{
$var=fopen($path,"a+");
fwrite($var, $text);
fwrite($var, "\r\n");
fclose($var);
}
write_file_log($CONFIG -> dataroot . "log.log", 'Try');