Cron Update doesn't work on live site - static function?

chrisj

Active member
My local site is running on 5.4.3. The cron works perfectly although I wasn't familiar with static functions but fixed it by creating a helper class. The cron is very complex so I have many functions which access all the different models and data writers in my add-on.

My live site is running on 5.3.2-1ubuntu4.9. It uses apc. When I run the cron, it breaks right when it creates the helper class.

I tried creating the class using new, XenForo_Model::create, and by using one of the other models to create the helper class. Each way works on my local site but not on my live site.

Edit:
No errors are showing up in the server error log.

This line also seemed to be causing a problem. When it was uncommented it caused php to crash before the class was loaded even though it is in that class:
PHP:
$xfUserModel = XenForo_Model::create('Xenforo_Model_User');
$dwPsnUser->set('username', $xfUserModel->getUserById($ufvWithPsnUser['ufv_user_id'])['username']);
Again, works in local site, not in live.
 
A bit of a stretch and maybe nothing to do with your original problem, but make sure it's
PHP:
$xfUserModel = XenForo_Model::create('XenForo_Model_User');
.. with a capital F.
 
Thanks, that wasn't the issue but it is good practice.

I solved one problem which was I didn't have the curl extension installed.

This code is still causing an error on live:
PHP:
$xfUserModel->getUserById($ufvWithPsnUser['ufv_user_id'])['username'];
 
PHP:
xfUserModel->getUserById($ufvWithPsnUser['ufv_user_id'])['username'];
this doesn't work with php < 5.4


try
$user = xfUserModel->getUserById($ufvWithPsnUser['ufv_user_id']);
$username = $user['username'];
 
Top Bottom