Search code examples
phpzend-frameworkzend-authzend-acl

Zend_Auth, Zend_Acl and Cron Jobs/Scheduled Tasks


I have implemented Zend_Auth & Zend_Acl into a project here at work and its working great. However, previously I had sceduled tasks running at various times of the day which now no longer work correctly due to the login process. These are called via cygwin wget to the URL's. I would like to know if there is a way to disable Auth/Acl for one of my controllers that does all the CRON stuff?


Solution

  • You could probably define a constant in your cron-script and process the authentication code based on that.

    For Ex:

    cron.php

    <?php
    
    define("ISCRONJOB", true);
    
    ... continue other flow
    
    ?>
    

    in your auth-controller

    <?php
    # make sure you pass single-quote when checking for a defined constant
    if (!defined('ISCRONJOB')) {
        ...
        ... continue authentication process
    }
    ?>