ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Rar.php
Go to the documentation of this file.
1<?php
2
4
7
10// available at http://getid3.sourceforge.net //
11// or http://www.getid3.org //
13// See readme.txt for more details //
15// //
16// module.archive.rar.php //
17// module for analyzing RAR files //
18// dependencies: NONE //
19// ///
21
29class Rar extends BaseHandler
30{
36
41 public function analyze()
42 {
43 $info = &$this->getid3->info;
44
45 $info['fileformat'] = 'rar';
46
47 if ($this->option_use_rar_extension === true) {
48 if (function_exists('rar_open')) {
49 if ($rp = rar_open($info['filenamepath'])) {
50 $info['rar']['files'] = array();
51 $entries = rar_list($rp);
52 foreach ($entries as $entry) {
53 $info['rar']['files'] = Helper::array_merge_clobber($info['rar']['files'],
54 Helper::CreateDeepArray($entry->getName(),
55 '/',
56 $entry->getUnpackedSize()));
57 }
58 rar_close($rp);
59
60 return true;
61 } else {
62 $info['error'][] = 'failed to rar_open(' . $info['filename'] . ')';
63 }
64 } else {
65 $info['error'][] = 'RAR support does not appear to be available in this PHP installation';
66 }
67 } else {
68 $info['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)';
69 }
70
71 return false;
72 }
73}
An exception for terminatinating execution or to throw for unit testing.
GetId3() by James Heinrich info@getid3.org //.
Definition: BaseHandler.php:26
GetId3() by James Heinrich info@getid3.org //.
Definition: Helper.php:27
static array_merge_clobber($array1, $array2)
Definition: Helper.php:561
static CreateDeepArray($ArrayPath, $Separator, $Value)
Definition: Helper.php:726
GetId3() by James Heinrich info@getid3.org //.
Definition: Rar.php:30
$info
Definition: example_052.php:80