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