Vardirlayout scenario

"[email protected]" <[email protected]> Wed, 22 Jul 2009 10:55:27 +0200
Newsgroups gmane.comp.cms.xaraya.devel
Organization Xaraya
Message-ID <[email protected]>
I recently uploaded the vardirlayout scenario 
(com.xaraya.core.jamaica.vardirlayout). The purpose of the scenario is 
to make the main Xaraya directories configurable.
It is a step along the road delineated by the text in docs/devDirlayout.txt.

The scenario focuses mainly on 2 directories that can be moved outside a 
particular instance of Xaraya to a central place

Conceptually the scenario has the following underpinnings:

- In all installations the known point of departure is the location of 
index.php, where the browser points. It is from this "constant" location 
that we can set up the configuration for a given instance.

- The root directory of Xaraya can be defined with respect to index.php. 
This directory is the central point relative to which the main 
directories of the instance are set. The root directory is often thought 
of as sitting at the top of a hierarchy of directories (Xaraya and/or 
others). In the default setup it sits one level up from the html 
directory, for instance. But this not need be so. The root directory is 
simply a convenient central reference point for the instance.

That the root directory's usefulness as a construct comes from the fact 
that it is distinct from index.php. In a single website installation the 
Xaraya configuration could in theory use index.php as its reference 
point. But in a multi-site setup, where different instances share the 
same code, the root directory becomes a common reference point for all 
installs.

- From the root directory we can then go on to define relative locations 
to the main components of Xaraya. The file devDirLayout.txt makes some 
proposals as to what these can be. The vardirlayout focuses on three 
main components:
   - html directory and its subdirectories, which contain the things 
that need to be accessible to the web server.
   - lib directory and its subdirectories, which contain the libraries 
Xaraya uses.
   - code directory and its subdirectories, which contain the code for 
the Xaraya modules (and what more ?).

By making the last 2 of these configurable for each instance we can 
greatly simplify multi-site setups. In the scenario's "default" setup 
both the lib and code directories are on the same level as the html 
directory. The layout paths to these directories are defined in a new 
file var/layout.system.php.

Questions

1. Is the code directory needed (or should "modules" replace "code")?
2. The price we pay in the scenario is to move the bootstrap.php file 
into the html directory. In fact the only thing needed for the above 
concept to work is to have the sys class (and its parent class) live 
next to index.php, but rather than taking that out of bootstrap.php it 
seems easier to just move the whole file. Is there a better solution?
3. What other directories could be moved out from below the webroot in 
the short term? It would make sense to make as many of these moves 
before a final 2.0.0 release.
4. Two new static methods in sys appear: lib() and code() that return 
the relative paths to the respective directories. Perhaps roll them 
along with root() and varpath() into a single method?

On a side note, increasing the flexibility of the configuration layout 
will likely lead to complications (or at least potentially more 
complexity) of module and theme installations, increasing the need for a 
smarter installer/component manager.