Re: included file var scope

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I'm not sure what you mean. If you're saying you want to include a file from inside a function but for all parts of it to behave as if it were being included at the global scope then I don't believe there's a way to do it.

Maybe it would be better if you tell us exactly what you're trying to achieve. I don't really see why my solution above would not work so I probably don't fully understand what you're trying to do.

-Stut


Some operations in the system are expensive or just take very long. As a solution, every time such a request is made the system schedules itself to be executed at a different moment. A cron job runs every night and checks if there are any scheduled processes, and if so it executes them. A process is defined by the state of the system when the process was delayed (all super global variables make up for the state). The scheduler restores the state and then includes the index.php file so that the process can be executed.

Your solution would definitely work, however, the problem is that the system is huge and designed in a terrible way. To search the code and find all variables that have been defined in the global scope would be a monstrous task that would take days.

Apart from that, it would be great if we can reuse this scheduler for different systems without having to touch the actual system.

I do see a couple of solutions, but none are very elegant. You could, for example, have all work done outside of a function. However, this means uncoupling the functionality from the Scheduler object, which means we get scattered functionality that belongs to the same logical group - scheduling a process and invoking a process is done in different files.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux