[TYPO3-dev]  Refactoring typo3/init.php
    Francois Suter 
    fsuter at cobweb.ch
       
    Sat Mar  7 11:17:50 CET 2009
    
    
  
Hi all,
Ever since I tried to pass remote calls through the TYPO3 BE I pondered 
a revision of the typo3/init.php script which has grown - over time - to 
be quite unwieldy IMO. This script is called:
- when using the TYPO3 BE normally
- during a BE AJAX call
- during a command-line call
- by the Install Tool
The various requisites and peculiarities of those different uses are 
handled by setting a number of constants (TYPO3_enterInstallScript, 
TYPO3_cliMode, TYPO3_PROCEED_IF_NO_USER and such) and testing them 
throughout the script's execution. This makes it very difficult to:
1) have an overview of what's going on
2) more importantly, add a new context of execution
What I would propose is a refactoring of this script. The main aim would 
be to divide it into small dedicated chunks that would each be 
identified by some key (like client_check, user_login, etc.). Then each 
script referring to typo3/init.php (typo3/index.php, typo3/ajax.php, 
typo3/cli_dispatch.phpsh, typo3/install/index.php) would list the chunks 
that it needs, making it easy to create new "contexts" for including 
typo3/init.php (going back to my example of remote calls, you don't need 
to check the client in this case).
In the special case of the Install Tool, I would go so far as to suggest 
duplicating whatever code is necessary in some dedicated file (say 
typo3/install/init.php or directly into typo3/install/index.php) so that 
it can execute really independently of the TYPO3 BE.
What do you think?
Cheers
-- 
Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch
    
    
More information about the TYPO3-dev
mailing list