[Typo3-debian] Problems with BACK_PATH

Michael Stucki mundaun at gmx.ch
Thu Apr 17 17:30:47 CEST 2003


Hey Kasper, hello list,

I'm writing to you because I am having big problems on packaging Typo3 for 
Debian. I have found a perfect (?) solution, but this requires some major 
changes to most of the extensions of Typo3 (including the templates for new 
extensions).

I hope we will find a solution to handle the issue. So please read this mail 
carefully. Thank you.

=========

Preamble:

I am creating Debian packages of Typo3. There is currently just one - the base 
package - but more will follow (installer, testsite, etc.).

Since I want the packages to be fully File-Hierarchy-Standard (FHS) compliant, 
I have to store the folders on some different places:

Read-only data:
  (complete source, except '/typo3/ext' and '/typo3/temp')
/usr/share/typo3/typo3_src-<version>/

Variable data:
  ('temp' and 'ext' directories)
/var/lib/typo3/typo3_src-<version>/ext/
/var/lib/typo3/typo3_src-<version>/temp/

These directories are "mounted" into the source-directory (the upper one) 
using symbolic links.

=========

Problem description:

Most extensions require the scripts "/typo3/init.php" and "typo3/template.php" 
to be included. This is done using a line like this:

  require ($BACK_PATH."init.php");

$BACK_PATH is usually set "conf.php" and defines the relative path to the 
start directory using two dots.

Example: $BACK_PATH = "../../../";

This is where the problem occurs: PHP is not able to include files via in 
relative order through symlinks. Typo3 will complain that the file was not 
found.

=========

First solution (workaround):

In most cases it is one of these three files that is being included:
- /typo3/class.file_list.inc
- /typo3/init.php
- /typo3/template.php

So I have currently created three symlinks in 
/var/lib/typo3/typo3_src-<version>/ pointing to the original one in 
/usr/share/....:

ws01:/var/lib/typo3/typo3_src-3.5.0$ ls -l
total 0
lrwxrwxrwx    1 root     root    58 Mar 26 16:37 class.file_list.inc -> \
    /usr/share/typo3/typo3_src-3.5.0/typo3/class.file_list.inc
lrwxrwxrwx    1 root     root    47 Mar 26 16:37 init.php -> \
    /usr/share/typo3/typo3_src-3.5.0/typo3/init.php
lrwxrwxrwx    1 root     root    51 Mar 26 16:37 template.php -> \
    /usr/share/typo3/typo3_src-3.5.0/typo3/template.php

This works for most of all parts. But there are still problems, such as:

- The user setup module won't find any languages available
  -> Users cannot change their BE language
- Some of the icons of the BE contain wrong links
  -> Images won't be shown

Since I didn't like this way very much, I looked out for a better solution. 
This is what I finally found and what I think is the best solution:

=========

Second (final?) solution:

Do not include the files in /typo3/... using dots ("../../"). Better find out 
the absolute path of the source location:

Before:
$BACK_PATH="../../../";
require ($BACK_PATH."init.php");

Now (my suggestion):
// do not touch BACK_PATH since it is still used in URLs
$SERVER_BACK_PATH=str_replace(TYPO3_MOD_PATH, "", \
    dirname($_SERVER["SCRIPT_FILENAME"])."/");
require ($SERVER_BACK_PATH."init.php");

=========

This requires to modify almost _any_ extension. Since I don't want to do this 
on every new release and since this may also be useful for other purposes I 
ask you to change this at least in the template for new extensions 
(kickstarter?).

I can also offer you to make a list of places that have to be changed.

If you have any comments or questions you are welcome to join the discussion 
in the typo3-debian mailinglist 
(mailto:typo3-debian-request at lists.netfielders.de?subject=subscribe).

Kind regards - michael




More information about the TYPO3-debian mailing list