1. 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?

Discussion in 'XenForo Development Discussions' started by chrisj, Jul 18, 2012.

  1. chrisj

    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.
     
  2. Jeremy P

    Jeremy P Well-Known Member

    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.
     
    chrisj and Jake Bunce like this.
  3. chrisj

    chrisj Active Member

    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'];
     
  4. ragtek

    ragtek Guest

    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'];
     
    chrisj likes this.

Share This Page