sebastianbrosch
3/14/2016 - 3:10 PM

A script to create the symlinks for TYPO3 on a Hetzner webspace.

A script to create the symlinks for TYPO3 on a Hetzner webspace.

<?php
//--------------------------------------------------\\
// This script can be used on a Hetzner webserver   \\
// to create the symlinks for a TYPO3 installation. \\
//--------------------------------------------------\\

//show the absolute path of the webspace.
echo 'Arbeitsverzeichnis: '.realpath(getcwd().'/../').'<br/>';

//the path to the folder which will be linked.
$version_folder = realpath(getcwd().'/../').'/typo3.src.6.2.9';

//check if the source folder is available.
if (is_dir($version_folder)) {
    echo 'Source-Verzeichnis vorhanden!<br/>';
    unlink('typo3_src');
    unlink('typo3');
    unlink('index.php');

    //check if the t3lib folder is available.
    if (is_dir('t3lib')) {
        unlink('t3lib');
    }
    
    echo 'Source-Verzeichnis wurde gelöscht!<br/>';

    symlink($version_folder, 'typo3_src');
    symlink('typo3_src/typo3', 'typo3');
    symlink('typo3_src/index.php', 'index.php');

    //check if the t3lib folder is available.
    if (is_dir('typo3_src/t3lib')) {
        symlink('typo3_src/t3lib', 't3lib');
    }

    echo 'Neues Source-Verzeichnis wurde erstellt!<br/>';
} else {
    echo 'Das Source-Verzeichnis ist nicht vorhanden!<br/>';
    echo 'Es wurden keine Änderungen vorgenommen.<br/>';
}