XF 1.1 Cron Entry for CometChat

The callback needs a class and method within XenForo's namespace. Create a directory and PHP file to define a class. For example, create:

library/Comet/Cron.php

Code:
<?php

class Comet_Cron
{
	public static function runCron()
	{
		include 'http://www.yoursite.com/cometchat/cron.php';
	}
}

Then your callback would be:

Class = Comet_Cron
Method = runCron
 
Thanks for your reply.

There's already a cron.php on the root for another xenforo add-on. Can I name this "cron2.php" and change the code you gave me to say "runCron2" on the fifth line?
 
Okay. Got a Cron.php file as you outlined in post #2 above and placed it in a Comet folder in the library. Here's the result when I made a run:

Server Error

include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0
  1. XenForo_Application::handlePhpError() in Comet/Cron.php at line 7
  2. Comet_Cron::runCron() in Comet/Cron.php at line 7
  3. Comet_Cron::runCron()
  4. call_user_func() in XenForo/Model/Cron.php at line 356
  5. XenForo_Model_Cron->runEntry() in XenForo/ControllerAdmin/Cron.php at line 204
  6. XenForo_ControllerAdmin_Cron->actionRun() in XenForo/FrontController.php at line 310
  7. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  8. XenForo_FrontController->run() in /home/xxxxxx/public_html/admin.php at line 13
 
I am trying to do something similar - I want to create some tables on my database and have the php file:

/library/UpdateRatingsComments/Ratings.php

to do the job.

I want a cron to run the php regularly.

I have created the following Cron.php file:

PHP:
<?php
 
class Ratings_Cron
{
    public static function runCron()
    {
        include 'http://www.arsenaltalk.net/library/UpdateRatingsComments/Ratings.php';
    }
}

When creating my cron I am using

Class : Ratings_Cron
Method : runCron

however I get the following error:

"Please enter a valid callback method." when trying to create the cron job

What am I doing wrong here?
 
Finally not completely solved. I got this error...

Erreur Info
ErrorException: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home2/grenon/public_html/library/XenForo/Cron.php:47) - cometchat/cometchat_init.php:85
Généré par: Compte inconnu, Aujourd'hui à 14:40
Trace de la pile
#0 [internal function]: XenForo_Application::handlePhpError(2, 'session_start()...', '/home2/grenon/p...', 85, Array)
#1 /home2/grenon/public_html/cometchat/cometchat_init.php(85): session_start()
#2 /home2/grenon/public_html/cometchat/modules.php(3): include_once('/home2/grenon/p...')
#3 /home2/grenon/public_html/cometchat/cron.php(56): include_once('/home2/grenon/p...')
#4 /home2/grenon/public_html/library/Comet/Cron.php(7): include('/home2/grenon/p...')
#5 [internal function]: Comet_Cron::runCron(Array)
#6 /home2/grenon/public_html/library/XenForo/Model/Cron.php(356): call_user_func(Array, Array)
#7 /home2/grenon/public_html/library/WhoHasReadAThread/Model/Cron.php(30): XenForo_Model_Cron->runEntry(Array)
#8 /home2/grenon/public_html/library/XenForo/Cron.php(29): WhoHasReadAThread_Model_Cron->runEntry(Array)
#9 /home2/grenon/public_html/library/XenForo/Cron.php(64): XenForo_Cron->run()
#10 /home2/grenon/public_html/cron.php(12): XenForo_Cron::runAndOutput()
#11 {main}
État de la demande
array(3) {
["url"] => string(46) "http://www.miui-france.org/cron.php?1350909642"
["_GET"] => array(1) {
[1350909642] => string(0) ""
}
["_POST"] => array(0) {
}
}

Anyone can help me? Thanks!
 
Surround your require or include line with ob functions. This is the code example linked above:

Code:
        ob_start();
        require('/path/to/your/html/file.html');
        $myContent = ob_get_contents();
        ob_end_clean();
 
Top Bottom