Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthoraekko85
     

    Hi,

    I'm developping a little web application where I parse a xml file to feed my database. And, of course, while my script is working I would like that no one else can launch it again. So I've through about having a global variable that tells wether or not the script is already running. Something like :

       function parse(){
              $GLOBALS['running'] = TRUE;
              //parse document
       }
    

    The problem is, it seems that my global is unsetted when the page is reloaded : a second user coming to the page always get the $GLOBALS['running'] to false !!!

    I've also tried with :

       var running = FALSE;
       function parse(){
                 define('running',TRUE)
                 //parse document
       }
    

    and other variations, and still can't get it working.

    Is there a special way to handle globals in Akelos that I shoud be aware of ?

    Thanks for your help.

    • CommentAuthorKaste
     

    Thats what gets called a 'stateless' app. It has nothing to do with Akelos. You have to write those 'states' (globals) into a file or your db. (etc)

    Actually, you're writing a 'queue', do you?

    • CommentAuthoraekko85
     

    Isn't it the point of superglobals in php to get around that 'stateless' whole things ?

    I mean, when I use $_SESSION, I just absolutly do not worry about how my server register the data (wheter it is a file on the server, a coockie on the client or in the database).

    I don't find the php.net page about $GLOBALS (http://php.net/manual/en/reserved.variables.globals.php) realy clear, but I just assumed it was the same.

    So I just don't understand why I can't assign a value to my global variable in one page, and retrive this value in an other.

    • CommentAuthorinsanet
     
    no, Is not the point of superglobals in php to get around of the 'stateless' thing.

    from the documentation:
    $GLOBALS — References all variables available in global scope.
    • CommentAuthoraekko85
     

    Well, then I'm coming to the question : how can I declare a variable in global scope with Akelos ?

    • CommentAuthorKaste
     

    As I said: You need to make those settings persistent in a file, db, cache.