| @@ 1061-1097 (lines=37) @@ | ||
| 1058 | } |
|
| 1059 | } |
|
| 1060 | ||
| 1061 | class CompressBzip2 extends CompressManagerFactory |
|
| 1062 | { |
|
| 1063 | private $fileHandler = null; |
|
| 1064 | ||
| 1065 | public function __construct() |
|
| 1066 | { |
|
| 1067 | if (! function_exists("bzopen")) { |
|
| 1068 | throw new Exception("Compression is enabled, but bzip2 lib is not installed or configured properly"); |
|
| 1069 | } |
|
| 1070 | } |
|
| 1071 | ||
| 1072 | /** |
|
| 1073 | * @param string $filename |
|
| 1074 | */ |
|
| 1075 | public function open($filename) |
|
| 1076 | { |
|
| 1077 | $this->fileHandler = bzopen($filename, "w"); |
|
| 1078 | if (false === $this->fileHandler) { |
|
| 1079 | throw new Exception("Output file is not writable"); |
|
| 1080 | } |
|
| 1081 | ||
| 1082 | return true; |
|
| 1083 | } |
|
| 1084 | ||
| 1085 | public function write($str) |
|
| 1086 | { |
|
| 1087 | if (false === ($bytesWritten = bzwrite($this->fileHandler, $str))) { |
|
| 1088 | throw new Exception("Writting to file failed! Probably, there is no more free space left?"); |
|
| 1089 | } |
|
| 1090 | return $bytesWritten; |
|
| 1091 | } |
|
| 1092 | ||
| 1093 | public function close() |
|
| 1094 | { |
|
| 1095 | return bzclose($this->fileHandler); |
|
| 1096 | } |
|
| 1097 | } |
|
| 1098 | ||
| 1099 | class CompressGzip extends CompressManagerFactory |
|
| 1100 | { |
|
| @@ 1099-1135 (lines=37) @@ | ||
| 1096 | } |
|
| 1097 | } |
|
| 1098 | ||
| 1099 | class CompressGzip extends CompressManagerFactory |
|
| 1100 | { |
|
| 1101 | private $fileHandler = null; |
|
| 1102 | ||
| 1103 | public function __construct() |
|
| 1104 | { |
|
| 1105 | if (! function_exists("gzopen")) { |
|
| 1106 | throw new Exception("Compression is enabled, but gzip lib is not installed or configured properly"); |
|
| 1107 | } |
|
| 1108 | } |
|
| 1109 | ||
| 1110 | /** |
|
| 1111 | * @param string $filename |
|
| 1112 | */ |
|
| 1113 | public function open($filename) |
|
| 1114 | { |
|
| 1115 | $this->fileHandler = gzopen($filename, "wb"); |
|
| 1116 | if (false === $this->fileHandler) { |
|
| 1117 | throw new Exception("Output file is not writable"); |
|
| 1118 | } |
|
| 1119 | ||
| 1120 | return true; |
|
| 1121 | } |
|
| 1122 | ||
| 1123 | public function write($str) |
|
| 1124 | { |
|
| 1125 | if (false === ($bytesWritten = gzwrite($this->fileHandler, $str))) { |
|
| 1126 | throw new Exception("Writting to file failed! Probably, there is no more free space left?"); |
|
| 1127 | } |
|
| 1128 | return $bytesWritten; |
|
| 1129 | } |
|
| 1130 | ||
| 1131 | public function close() |
|
| 1132 | { |
|
| 1133 | return gzclose($this->fileHandler); |
|
| 1134 | } |
|
| 1135 | } |
|
| 1136 | ||
| 1137 | class CompressNone extends CompressManagerFactory |
|
| 1138 | { |
|