This is a mirror from the (offline blog post) from web-crossing - see foot-notes!
Do you work with Typo3?
Do you make Extensions on a daily basis?
Do you want to keep them centralized while you test, expand, and deploy?
A private repository is the way to go.
Most developers working with Typo3 know that good documentation is hard to find. You have Tsref and the mailing lists, and a handful of other other sources, but quality varies pretty widely. Although it is relatively simple for an experienced Typo3 developer to setup your private repo, the manual is half-written and not very useful. So, after some trial and error (as always with Typo3), we cooked up this tutorial for you.
This is tested and working on 4.x versions of Typo3, but as always be sure to test before using in a production environment. You must have PHP5 and it must be compiled with the php5 SOAP module for this to work!
What are going to do?
This tutorial gets you setup with a Typo3 extension repository. This allows you to
- store your own extensions on a Typo3 website
- make your extensions available to others
- grant access to FE users to allow them to upload their extenisions
The first thing you'll want to do is install the extension ter via the extension manager.
You need to specify a path where you would like to store your extensions. This is the same path that you will later point your extension manager to when you want to download from your repository.
We have to move a few things around to get things working.
First, we need to expose the wsdl services. If you browse to the ext/ter/ directory, you will see a file called tx_ter_wsdl.php. It must live in a directory off of your website root, so make a directory in the html root called wdsl and move the file there.
Go ahead and add the following in Typo3
- a sysfolder to hold your extension keys in. You can name it what you like.
- a sysfolder to hold your FE Users in
- A BE user without admin rights called "_CLI_ter"
- A FE usergroup called "extension uploaders"
- A new FE user in that user group
- A new page. IMPORTANT - the alias of this page must be "ter"
- An new extension template record for this new page. We are going to add some typoscript that applies only to this page.
The following typoscript must go in the Setup section of your ter page's extension template record.
### Make sure the xml displays cleanly
disableCharsetHeader = 1
disableAllHeaderCode = 1
disablePrefixComment = 1
debug = 0
### Setup the plugin.
pid = 66 # Change this to the PID of your new sysfolder for Extensions
adminFrontendUsergroupUid = 2 # UID of the FE-Usergroup
### Setup the PAGE
page = PAGE
page.typeNum = 0
page.10 =< plugin.tx_ter_pi1
Open for business
We need to make sure the wsdl directory is being accessed directly and not routed to Typo3. If you are using the default .htaccess setup that comes with Typo3, you need to add wsdl to the list of directories that are ignored by the Apache rewrite.
Open up .htaccess in your root directory and look for the following line:
RewriteRule ^(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic.php)/ - [L]
Just add wsdl somewhere in the list, being sure that there is a | character on both sides of it. Take a look at the result, we've put it right at the beginning, after typo3:
RewriteRule ^(typo3|wsdl|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic.php)/ - [L]
Test for the love
If you followed everything correctly so far, run these two quick tests...
Visit this url: http://your-server.com/index.php?id=ter
You should get a short xml file telling you it was a Bad Request.
Visit this url: http://yourserver.com/wsdl/tx_ter_wsdl.php
You should get a longer xml file looking nice and complicated.
Got it? Good! Not yet? Just go back and double check that you've done all the little things (I know there are a lot!)
The extension ter comes with a way to add extension keys to the backend.
Guess what? It's broken. No suprise, and also nothing to worry about.
Actually, it's not broken, but ter was developed to be used with a FE system like they have over at typo3.org. We want to just insert extension keys in the back end, so we want it a little different - Since you are a Typo3 professional, you are just going to fix it right up.
We need to be able to add extension keys in the Typo3 BE so that when we try to upload to our repository, Typo3 will say "yes, that extension is allowed on this server" - This is built in security for the main Typo3 repository. We don't really need it, but it's easier just to fix this up rather than completely hack away at the ter extension to bypass it.
So, we are going to modify the TCA of the ter extension. That means you need to open up the file tca.php in the typo3conf/ext/ter/ directory and make a few changes.
We want to be able to add and delete extension keys directly in the BE (the main Typo3 repo does it with FE editing) so we need to add extensionkey to the showitem array. This lets you view and modify the extension key field in the BE.
'types' => Array (
'1' => Array('showitem' => 'hidden;;;;1-1-1, title,extensionkey,description,ownerusername,maxstoressize')
We also want to specify an owner for the uploaded extensions. When you want to upload to your repository, you will have to provide a username and password authenticate (against FE users) and the extension record in the BE must contain. Depending on how you want to setup and who else you want uploading, you can add the following into tca.php to allow yourself to specify usernames. Just take a look at the other items there and squeeze this code into the columns array, between description and extensionkey for example.
'label' => 'LLL:EXT:ter/locallang_tca.php:tx_ter_keytable.ownerusername',
'config' => Array(
## You can put a FE Username here if you want to have a default value.
For nice label-fields we aso have to edit the locallang_tca.php and replace it with the following code:
$LOCAL_LANG = Array (
'default' => Array (
'tx_ter_keytable.ownerusername' => 'FE User - Owner of Extension',
'tx_ter_keytable.description' => 'Description',
'tx_ter_keytable.extensionkey' => 'Extension-Key',
'tx_ter_keytable.maxstoresize' => 'Max. Store-Size',
Changed files in a ZIP-Archive for people with no PHP experience
You can download a Zip-Archive with all files I changed here: ter-change.zip
Simply extract and replace them in the typo3conf/ext/ter/ directory
There is a piece of magic code which browses through your extension repository and generates a file (called extensions.xml.gz) which contains a list of all extensions on your server available for download.
This piece of magic code can be called manually, but probably you want to run it every minute or so. That way, after you upload an extension, at longest you must wait one minute before it will be available for download.
The script you want to call is in typo3conf/ext/ter/cli/build-extension-index.php
It's easy to setup a cron job to call the script (assuming you have permissions to do so on your server) - if not, just contact your host. The exact command you want will vary, but it will be something like this:
wget http://your-server.com/typo3conf/ext/ter/cli/build-extension-index.php -O /dev/null 2>&1
Upload with ease
Now that we have our repository setup, we want to make sure we can upload to it! On any Typo3 installation (4.x) we just need to change a special variable so that Typo3 knows where our repository is. You can do this in localconf.php in the typo3conf directory, or you can make your own extension that contains a file called ext_localconf.php. The first way is easiest just to get it working for testing purposes!
$TYPO3_CONF_VARS['EXT']['em_wsdlURL'] = 'http://your-server.com/wsdl/tx_ter_wsdl.php';
Look familiar? Once you have set this path, all extension uploads from Typo3 will be directed to your server.
Remember, you before you can upload you must add your extension keys in the BE sysfolder.
Cross your fingers
If you followed these overcomplicated instructions correctly, you should be able to go to the extension manager, select an extension, and select "Upload to TER" and upload an extension. Try it! You can use any extension you like, but remember, before you can upload it, you must register the extension key in the BE. Kind of a pain in the ass, but hey, it works great.
Assuming that you got the cron job going and the upload was successful, you have about 1 minute until your extension is available for download!
What goes up also comes down
After you have got a few extensions in your repository, it's time to download!
On any Typo3 installation, you only need to change the repository URL in the extension manager settings to download from your repository. Don't forget the trailing slash on the end of the URL.
It must point to the location of the extensions.xml.gz :-)
Make sure to click "Retrieve/Update" to get the the updated list of extensions from your server. Whenever you change repository URLs you will need to get a fresh copy of the list before you can lookup and download extensions.
The fun part
Please note that there is no protection or authentication preventing others from downloading your extensions. At it's heart Typo3 is about sharing, so everything you put into your repository will technically be available to anyone who knows the URL.
As always with Typo3, there are a few catches!
On Cpanel? Zach from CastIronCoding.com says:
The php soap module won't be available in php5 via easyapache compilation script -- update to cpanel Edge, if you dare, to get it via easyapache.
Translation Handling When you change the repository path to download from your private repository, translation handling will not function, as Typo3 downloads translations from the same place as extensions. No worries though, just switch back to one of the normal mirrors!
Existing Extensions If you for some reason need to add existing TYPO3 extensions to your repository, it's recommended to select the option "Override this development version (0.x.x)" - This allows you to store a copy of a public extension which can be useful (for example to use the import/export module to import all extensions at once). Of course, if you modify the extension (to change a template, for example), it is up to you whether you rename or increase the versioning.
Create, share and create some more
Now that you have a safe place to develop your extensions in, you have the opportunity to test and perfect them before uploading to the main TYPO3 repository. Don't forget about the main repository! The Typo3 developers have worked hard to create a central location to share from. The point of this tutorial is not to encourage the creation of other alternative extension repositories, but to give developers a tool to develop with!
I am! Now, get back to development! And let me know if I've left anything out or confused you in any way.
Many thanks also go to Zach at CastIronCoding.com for walking through this jungle of a tutorial and testing it out. Thanks Zach!
Note from Sven Weiss / Source of this tutorial
Thanks to web-crossing - I found your Tutorial on web.archive.org and I think the world should read it public and not in an archive, so I created this mirror.