.. You may want to use the usual include line. Uncomment and adjust the path.
.. include:: ../Includes.txt
====================
EXT:package\_manager
====================
:Author:
Peter Russ
:Created:
2007-03-06T16:20:18
:Changed by:
Peter Russ
:Changed:
2007-03-15T17:44:36
:Author:
Peter Russ
:Email:
peter.russ@4many.net
:Info 3:
4Many Servcies
:Info 4:
.. _EXT-package-manager:
EXT:package\_manager
====================
Extension Key: **package\_manager**
Copyright 2007, `4Many Services `_ , Peter
Russ,
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
Version: 0.6.0
PDF-Version available at
`http://www.4many.net/manual/package\_manager/manual.pdf
`_
The content of this document is related to TYPO3
\- a GNU/GPL CMS/Framework available from `www.typo3.com
`_
.. _Table-of-Contents:
Table of Contents
-----------------
**EXT:fdfx\_be\_image 1**
**Introduction 1**
What does it do? 1
Sponsoring 1
Acknowledgment 1
Screenshots 1
**Users manual 3**
**Administration 3**
Installation 3
Setup 3
**Configuration 4**
**To-Do list 4**
**Changelog 4**
.. _Introduction:
Introduction
============
.. _What-does-it-do:
What does it do?
----------------
There are a lot of useful PHP program packages, libraries or code
fragments (herein call package) available in the internet. But often
the license of the individual package is not compatible with the GPL.
So the extension will never make it into TER.
Some extensions uses GPL packages. But due to the fact that these
packages might be available form a different source it's sometime a
hassle to keep them up to date. Either you do it by your own or wait
until the author of the extension publishes an upgraded version.
This extension package\_manager offers a solution for both. It could
be the central point to keep external packages - i.e. packages beyond
TER - up to date in your installation.
.. _To-whom-it-may-concern:
To whom it may concern
----------------------
This extension and it's manual is for admins and programmers. An
regular BE-user will never get in touch with this extension.
.. _Screenshots:
Screenshots
-----------
After the installation you will find a new entry in Tool menu.
Clicking on that will give you the module screen
|img-1|
As you can see there are three packages managed by package\_manager.
The extension itself (package\_manager) contains two packages from PHP
PEAR. As these are included they are already there and could be
updated.
This package is depending on your installation! The extension
fdfx\_yaml requires the YAML package. As this is published under a GPL
incompatible license you have to download this package by yourself. If
you click the download button the source will be downloaded and
expanded to the target.REMEMBER: you will only see this package if the
extension fdfx\_yaml is installed ;-)
|img-2|
.. _PDF:
PDF
---
The actual version of this manual can be downloaded in PDF format at
`http://www.4many.net/manual/package\_manager/manual.pdf
`_
.. _Programmers-Guide:
Programmers Guide
=================
.. _ext-localconf-php:
ext\_localconf.php
------------------
To integrate the download and update capabilities of package\_manger
in your extension you have to include the setup in ext\_localconf.php
of the extension.
::
if (!defined ("TYPO3_MODE")) die ('Access denied.');
if ((TYPO3_MODE == 'BE'))
{
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['externalPackageName']=array(
'url' => '', # required: source url of the package
'path' => '', # required: target path to extract
# root is ALLWAYS the extension path EXT:$_EXTKEY!
'files' => '', # optional: if empty package will be extracted completely
# array or blank separated list of files
'pathToRemove' => '', # optional: if set this path will be removed
'initialize' => array(), # optional: array of source => target files
# array('source file' => 'target file'),
# if defined source files will be copied to target
# Copied ONLY if package is downloaded, i.e. initial
# installation. Might be changed in the future!
);
}
?>
'externalPackageName' has to be changed to your needs and should be
unique within your extension.
**Example:**
ext\_localconf.php for package\_manager might looks like this:
::
if (!defined ("TYPO3_MODE")) die ('Access denied.');
if ((TYPO3_MODE == 'BE'))
{
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]=array('packages'=>null);
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['pear']=array(
'url' =>'http://download.pear.php.net/package/PEAR-1.5.0.tgz',
'path' => 'PEAR',
'files' => 'PEAR-1.5.0/PEAR.php',
'pathToRemove' => 'PEAR-1.5.0'
);
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['pear-tar']=array(
'url' =>'http://download.pear.php.net/package/Archive_Tar-1.3.2.tgz',
'path' => 'PEAR',
'files' => array('Archive_Tar-1.3.2/Archive/Tar.php'),
'pathToRemove' => 'Archive_Tar-1.3.2/Archive'
);
}
?>
The first construct includes the file with the path
*PEAR-1.5.0/PEAR.php* of thePHP PEAR package *PEAR-1.5.0.tgz* from
the url *`http://download.pear.php.net/package/PEAR-1.5.0.tgz
`_* to the path
EXT:package\_manager/PEAR while removing the path *PEAR-1.5.0* . This
is the root of the zipped package.
The second expands the *Tar.php* class from the PHP PEAR package
found at location
*http://download.pear.php.net/package/Archive\_Tar-1.3.2.tgz* to the
some path EXT:package\_manager/PEAR while removing the path
*Archive\_Tar-1.3.2/Archive* . This is the root of the zipped package.
.. _The-initialize-Array:
The initialize-Array
^^^^^^^^^^^^^^^^^^^^
This initialize array defines files that can be copied from the source
location within the extension path EXT:$\_EXTKEY to the target within
the same path. The key of the array is the source file name, the value
has to be the target name.
**Example:**
::
$_EXTCONF = unserialize($_EXTCONF); // unserializing the configuration so we can use it here:
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['yaml']=array(
'url'=> $_EXTCONF['yaml_url']
,'path'=> 'YAML'
,'pathToRemove' => $_EXTCONF['yaml_version']
,'initialize' => array(
array('YAML/layout_storage/layout_1-2-3.html' => 'templates/sub/h-123-f.html')
,array('YAML/layout_storage/layout_1-2-3.html' => 'templates/sub/h-123_abb-f.html')
,array('YAML/layout_storage/layout_3-2-1.html' => 'templates/sub/h-321-f.html')
,array('YAML/layout_storage/layout_1-3-2.html' => 'templates/sub/h-132-f.html')
,array('YAML/layout_storage/layout_1-3-2.html' => 'templates/sub/h-132_baa-f.html')
,array('YAML/layout_storage/layout_2-3-1.html' => 'templates/sub/h-231-f.html')
,array('YAML/layout_storage/layout_2-3-1.html' => 'templates/sub/h-231_aab-f.html')
,array('YAML/layout_storage/layout_3-1-2.html' => 'templates/sub/h-312-f.html')
,array('YAML/layout_storage/layout_2-1-3.html' => 'templates/sub/h-213-f.html')
,array('YAML/layout_storage/layout_1-3-2.html' => 'templates/sub/h-13-f.html')
,array('YAML/layout_storage/layout_1-3-2.html' => 'templates/sub/h-32-f.html')
,array('YAML/layout_storage/layout_1-2-3.html' => 'templates/sub/h-1-23-f.html')
),
);
.. _Enabling-User-Specific-Uploads:
Enabling User Specific Uploads
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Due to the fact that some user uploads might be required to add user
specific changes the package manager can also handle this.
**Example:**
::
if ($_EXTCONF['user_upload'])
{
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['yaml-user']=array(
'url'=> $_EXTCONF['user_upload']
,'path'=> 'templates'
,'pathToRemove' => $_EXTCONF['user_upload_remove_path']
);
if ($_EXTCONF['user_upload_initialize'])
{
$tempFiles=explode(',',stripslashes($_EXTCONF['user_upload_initialize']));
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['yaml-user']['initialize']=array();
foreach ($tempFiles as $tempFile)
{
list($tempSource,$tempTarget)=explode('::',$tempFile);
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['yaml-user']['initialize'][$tempSource]=$tempTarget;
}
unset($tempFiles,$tempFile,$tempSource,$tempTarget);
}
}
.. _ext-conf-template-php:
ext\_conf\_template.php
-----------------------
To enable the upgrade the admin has to change the url and if defined
the pathToRemove. To avoid hacking the code a good strategy is to
provide settings in ext\_conf\_template.php of the extemsion.
::
# cat=file; type=string; label=Source URL:set the url of the package file to download.
source_url=
# cat=file; type=string; label=Path to remove:set the path that should be removed if required
path_to_remove=
**Example:**
ext\_conf\_template.php of the package\_manager looks like this:
::
# cat=file; type=string; label=PEAR Url:set the url of the PEAR framework file to download.
pear_url=http://download.pear.php.net/package/PEAR-1.5.0.tgz
# cat=file; type=string; label=Path to remove:set the path that should be removed
pear_path_to_remove=PEAR-1.5.0
# cat=file; type=string; label=PEAR Tar Url:set the url of the PEAR Tar framework file to download.
pear_tar_url=http://download.pear.php.net/package/Archive_Tar-1.3.2.tgz
# cat=file; type=string; label=Path to remove:set the path that should be removed
pear_tar_path_to_remove=Archive_Tar-1.3.2/Archive
.. _Final-ext-localconf-php:
Final ext\_localconf.php
------------------------
The final version of ext\_localconf.php should look like this:
::
if (!defined ("TYPO3_MODE")) die ('Access denied.');
if ((TYPO3_MODE == 'BE'))
{
$_EXTCONF = unserialize($_EXTCONF); # unserializing the configuration so we can use it here
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]=array('packages'=>null);
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['externalPackageName']=array(
'url' =>$_EXTCONF['url'], # has to be adjusted to your needs
'path' => '', # required: target path to extract
'files' => '', # option: if empty package will be extracted completely
# array or blank separated list of strings
'pathToRemove' => $_EXTCONF['path_to_remove'] # set this only IF required
);
}
?>
'externalPackageName' has to be changed to your needs and should be
unique within your extension.$\_EXTCONF['url'] and
$\_EXTCONF['path\_to\_remove'] depend on the definition you are using
in ext\_conf\_template.php.
**Example:**
With the definition of the constants in ext\_conf\_template.php the
ext\_localconf.php of the package\_manager extension will finally look
like this:
::
if (!defined ("TYPO3_MODE")) die ('Access denied.');
if ((TYPO3_MODE == 'BE'))
{
$_EXTCONF = unserialize($_EXTCONF); // unserializing the configuration so we can use it here
$TYPO3_CONF_VARS['EXTCONF'][$_EXTKEY]=array('packages'=>null);
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['pear']=array(
'url' =>$_EXTCONF['pear_url'],
'path' => 'PEAR',
'files' => 'PEAR-1.5.0/PEAR.php',
'pathToRemove' => $_EXTCONF['pear_path_to_remove']
);
$TYPO3_CONF_VARS['EXTCONF']['package_manager']['packages'][$_EXTKEY]['pear-tar']=array(
'url' =>$_EXTCONF['pear_tar_url'],
'path' => 'PEAR',
'files' => array('Archive_Tar-1.3.2/Archive/Tar.php'),
'pathToRemove' => $_EXTCONF['pear_tar_path_to_remove']
);
}
?>
.. _What-It-Does:
What It Does
------------
The package\_manager will loop through all packages defined at
*$TYPO3\_CONF\_VARS['EXTCONF']['package\_manager']['packages']* . If
the found extension $extKey is installed it will loop through all
packages that are defined for that extension and check whether the
package should be downloaded for the first time or could be updated.
If download is activated the path will be created in the extension
path, i.e. EXT:$extKey/path. The source gets downloaded from the url
and expanded to the path. If files (i.e. one single file or a list of
blank separated files or an array of files) is provided only these
files will be expanded. If a pathToRemove is defined this will be
removed.For compatibility (i.e. with Windows) a file '.mtime' will be
created in EXT:$extKey/path.
If update is activated it works almost similar with the exception of
creating the path and the file '.mtime'. As the path already exists
there is no need to create. The file '.mtime' will be timestamped with
the time of last update EXT:$extKey/path.
.. _Administration:
Administration
==============
.. _Installation:
Installation
------------
Just download the extension using the extension manager.
.. _Setup:
Setup
-----
No need to setup anything at the moment.
.. _What-It-Does:
What It Does
------------
If you click on “Package Manger” at the Tools menu the
package\_manager will loop through all packages defined at *$TYPO3\_C
ONF\_VARS['EXTCONF']['package\_manager']['packages'][$extKey]* . If
the found extension $extKey is installed it will loop through all
packages that are defined for that extension and check whether the
package should be downloaded for the first time or could be updated.
If download is activated the path will be created in the extension
path, i.e. EXT:$extKey/path. The source gets downloaded from the url
and expanded to the path. If files (i.e. one single file or a list of
blank separated files or an array if files) is provided only these
files will be expanded. If a pathToRemove is defined this will be
removed.For compatibility (i.e. with Windows) a file '.mtime' will be
created in EXT:$extKey/path.
If update is activated it works almost similar with the exception of
creating the path and the file '.mtime'. As the path already exists
there is no need to create. The file '.mtime' will be timestamped with
the time of last update EXT:$extKey/path.
.. _Adjustments:
Adjustments
-----------
To change the source of a specific package and if defined the path to
be removed refer to the extension by using the Extension Manager. At
the moment there is no option included to change that directly. This
might change in the future.
.. _To-Do-list:
To-Do list
==========
Option to change extension setting directly. T.B.D
Option to update selected or all packages on one shot.
.. _Changelog:
Changelog
=========
0.6.0 added initialize capabilityminor bugfixes
0.5.0 first public upload
|img-3| EXT:package\_manager - 9
.. ######CUTTER_MARK_IMAGES######
.. |img-1| image:: img-1.jpeg
.. :align: left
.. :border: 0
.. :height: 229
.. :id: Grafik2
.. :name: Grafik2
.. :width: 669
.. |img-2| image:: img-2.png
.. :align: left
.. :border: 0
.. :height: 230
.. :id: Grafik1
.. :name: Grafik1
.. :width: 669
.. |img-3| image:: img-3.png
.. :align: left
.. :border: 0
.. :height: 32
.. :id: Graphic1
.. :name: Graphic1
.. :width: 102