.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ============== EXT: KB Unpack ============== :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed by: Bernhard Kraft :Changed: 2010-03-11T13:27:22 :Author: Kraft Bernhard :Email: kraftb@gmx.net :Info 3: :Info 4: .. _EXT-KB-Unpack: EXT: KB Unpack ============== Extension Key: **kb\_unpack** Copyright 2000-2002, Kraft Bernhard, This document is published under the Open Content License available from http://www.opencontent.org/opl.shtml 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: KB Unpack 1** **Introduction 1** What does it do? 1 **Users manual 1** Uploading the compressed file 1 Unpacking the compressed file 1 **Configuration 2** Setting up the unzip path 2 Setting up for different unzips 2 **Known problems 3** **To-Do list 3** **Changelog 3** .. _Introduction: Introduction ------------ .. _What-does-it-do: What does it do? ^^^^^^^^^^^^^^^^ This extension is **DEPRECATED** . All of its functionality is included in the “kb\_packman” which can additionally not only extract archives but also create them. No support will be available for this extension! This extension enables a backend user to unpack (decompress) compressed files in the fileadmin folder (via the File / Filelist Module). Currently “zip”, “tar.gz” (“tgz”) and “tar.bz2” (“tbz2”) files are supported. If there is requirement for it also “rar” file support will be added. .. _Users-manual: Users manual ------------ After installing the extension via the Extension Manager it will work without any changes required. .. _Uploading-the-compressed-file: Uploading the compressed file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Go to the “Filelist” Module (In the left Backend menu in the section “Files”). If you are a normal user your administrator could have disabled this menu entry for you. Ask him to enable this feature for you because you would like to upload files to the fileadmin. If you are in the Filelist module left-click on the icon of a directory. A context menu will pop up. In this menu select “Upload Files”. Now you get presented a page where you can upload up to 10 files at a time. Upload your compressed files by selecting them from your harddrive via the “Browse” Button. If you selected all your files click “Upload files”. You can also mark the checkbox “Overwrite existing files” so already existing files with the same name get overwritten. .. _Unpacking-the-compressed-file: Unpacking the compressed file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Now if you have your file uploaded you will see it in the filelist. If you didn't check “Overwrite existing files” and a file with this name already existed your new uploaded file will get appended a number “\_2”. Now click on the Icon of the compressed file. A context menu will open which shows “Unpack” and “Unpack (OVERWRITE)” as the last two entries. If you click “Unpack” the file will get decompressed but all already existing file will be kept. If you click “Unpack (OVERWRITE)” existing files will get overwritten. When you clicked one of the unpack menu items you will get to a page where it is shown which files were actually extracted. It can happen that you get to an page which displays an error message stating that you are not allowed to extract files with .php files in it. The reason why the extraction of “.php” files is inhibited for non- admins is security. A user could upload a malicious php file which could directly modify the database for example. So this is disabled for security reasons. .. _Administration: Administration -------------- The only administrative action a administrator must take to allow a user to unpack files is to set the “Files: Unzip” Flag for this user. To do this log in as admin. Go to the List module and open the site- root where the backend users are stored. Click the Edit icon of the user for which you want to allow unpacking. Go to the bottom of the user config. There you see a section called “Fileoperation permissions”. In this section there is an option/checkbox “Files: Unzip”. Check this checkbox to allow unpacking to the user. Admins have the privilege of unpacking automatically. .. _Configuration: Configuration ------------- Normally it is not required to configure something for KB Unpack. But if your “unzip” binary is in some abnormal location and can't get reached via the “PATH” variables then it is required to configure a little bit. Also if you “unzip” is somehow different from the standard UNIX unzip there will be some configuration required. .. _Setting-up-the-unzip-path: Setting up the unzip path ^^^^^^^^^^^^^^^^^^^^^^^^^ If your “unzip” binary is in some abnormal location you will need to configure where it is. Go to the install tool of Typo3. Go to “All Configuration”. Search for “unzip”. You will find an entry like: :: [BE][unzip_path] = /usr/bin/unzip Set this value to the correct path to your unzip binary. .. _Setting-up-for-different-unzips: Setting up for different unzips ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This configuration is especially for “zip” files. Tar has a standard interface which is common to most UNIXes. So just for unzip special configuration parameters have to get set. This parameters get set in the “ext\_localconf.php” file of the extension (You find this file in the extension directory). After chaning values in this file you will have to clear temp\_cached(The red “clear-cache” button), else the changes will not get applied. It is not really necessary to configure this and the extension will also work without it but the recognition of “.php” files and the listing of the files which got extracted will not be valid without checking that your configuration is OK. To test if your unzip is compliant you will need shell access to the server where your Typo3 is installed. (Of course for this task it is not really required to have shell access but i makes life easier. Without shell access you will have to copy over “zip” and “unzip” to your own server and look there how they act. But this could lead to problems with missing libraries.) .. _Create-sample-zip-file: Create sample zip file """""""""""""""""""""" The first step is to create a sample zip test file which you will use for testing. Use the “zip” command to create a simple zip file containing 3-4 files. .. _The-list-configuration: The list configuration """""""""""""""""""""" Type the following command on the shell in the directory where you created your simple zip file: :: unzip -t my_zipfile.zip If the output from this command looks EXTACTLY like the one below you are safe: :: Archive: test.zip Length Date Time Name -------- ---- ---- ---- 0 01-04-05 13:01 1.html 0 01-04-05 13:01 2.html 0 01-04-05 13:01 3.html 0 01-04-05 13:01 4.html -------- ------- 0 4 files There are 3 lines of text before the real filelisting. These lines are: :: Archive: test.zip Length Date Time Name -------- ---- ---- ---- If you have more or less than those 3 lines before the start of the filelisting then you will need to configure the following variable. :: $TYPO3_CONF_VARS["BE"]["unzip"]["list"]["pre_lines"] = XX; If you have more or less than 2 lines after the file listing you will need to configure the following variable: :: $TYPO3_CONF_VARS["BE"]["unzip"]["list"]["post_lines"] = XX; Then you will have to take a look at the listing itself. This is an example line of the file listing: :: 0 01-04-05 13:01 3.html The listing gets separated by spaces. The 4 :sup:`th` element is the name of the file. So you will need to do the following setup: :: $TYPO3_CONF_VARS["BE"]["unzip"]["list"]["split_char"] = " "; $TYPO3_CONF_VARS["BE"]["unzip"]["list"]["file_pos"] = 3; // Note that this count starts at 0, so the 4th element is 3 If everything is setup correctly for the listing the recognition of “.php” files will work correctly. To get the listing of extracted files to work properly some further steps are required. .. _The-unzip-configuration: The unzip configuration """"""""""""""""""""""" Type the following command in the directory where you have your simple zip file: :: unzip -o test.zip If you get a output like the one below you are safe and won't need to change a thing: :: Archive: test.zip extracting: 1.html extracting: 2.html extracting: 3.html extracting: 4.html You will need again to configure how many lines are before and after the listing of the extracted file. In our case the setup is as following: :: $TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["pre_lines"] = 1; $TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["post_lines"] = 0; After this you will need again to set the split character by which the single parts of a line are recognized and the number of the element containing the filename. In our case this is as follows: :: $TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["split_char"] = ":"; $TYPO3_CONF_VARS["BE"]["unzip"]["unzip"]["file_pos"] = 1; // Note that counting begins at 0, so 1 is the second element After setting up those 8 values everything should work as expected. .. _Known-problems: Known problems -------------- When unpacking a tar.gz or tar.bz2 files without overwriting other files, it will also show those files as extracted which already existed and weren't overwritten. With zip files just those files which really are extracted get shown. .. _To-Do-list: To-Do list ---------- - Add support for “rar” files - Add support for other compression methods .. _Changelog: Changelog --------- .. ### BEGIN~OF~TABLE ### .. _Version: **Version** ^^^^^^^^^^^ .. container:: table-row a **Version** b **Release Date** c **Changelog** .. _0-0-0: 0.0.0 ^^^^^ .. container:: table-row a 0.0.0 b ? c Initial release .. _0-0-1: 0.0.1 ^^^^^ .. container:: table-row a 0.0.1 b ? c Made it CGL360 compliant. Hope to get reviewed. .. _0-0-2: 0.0.2 ^^^^^ .. container:: table-row a 0.0.2 b 2005-03-20, 16:00 CET c Reindexed it with extdeveval .. _0-1-0: 0.1.0 ^^^^^ .. container:: table-row a 0.1.0 b 2006-04-14, 13:30 CET c - Addes support for filename with spaces inside. Thanks to Michiel Roos from netcreators for pointing this issue out. - Set extension state to stable. .. _0-1-1: 0.1.1 ^^^^^ .. container:: table-row a 0.1.1 b 2008-06-24 c Security fix. .. _0-1-2: 0.1.2 ^^^^^ .. container:: table-row a 0.1.2 b 2010-03-11 13:30 CET c Marked extension as OBSOLETE. Use “kb\_packman” instead. .. ###### END~OF~TABLE ###### |img-1| EXT: KB Unpack - 3 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. :border: 0 .. :height: 32 .. :id: Graphic1 .. :name: Graphic1 .. :width: 102