• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

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

chrisj

Active member
#1
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.
 

chrisj

Active member
#3
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'];
 
R

ragtek

Guest
#4
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'];