@@ 81-103 (lines=23) @@ | ||
78 | return $this->filename; |
|
79 | } |
|
80 | ||
81 | public function open() |
|
82 | { |
|
83 | $this->state->open(); |
|
84 | ||
85 | $tmp_filename = tempnam(sys_get_temp_dir(), 'sitemap'); |
|
86 | ||
87 | if ($tmp_filename === false) { |
|
88 | throw FileAccessException::failedCreateUnique(sys_get_temp_dir(), 'sitemap'); |
|
89 | } |
|
90 | ||
91 | $handle = @fopen($tmp_filename, 'wb'); |
|
92 | ||
93 | if ($handle === false) { |
|
94 | throw FileAccessException::notWritable($tmp_filename); |
|
95 | } |
|
96 | ||
97 | $this->tmp_filename = $tmp_filename; |
|
98 | $this->handle = $handle; |
|
99 | ||
100 | $this->write($this->render->start()); |
|
101 | // render end string only once |
|
102 | $this->end_string = $this->render->end(); |
|
103 | } |
|
104 | ||
105 | public function close() |
|
106 | { |
@@ 93-115 (lines=23) @@ | ||
90 | return $this->filename; |
|
91 | } |
|
92 | ||
93 | public function open() |
|
94 | { |
|
95 | $this->state->open(); |
|
96 | ||
97 | $tmp_filename = tempnam(sys_get_temp_dir(), 'sitemap'); |
|
98 | ||
99 | if ($tmp_filename === false) { |
|
100 | throw FileAccessException::failedCreateUnique(sys_get_temp_dir(), 'sitemap'); |
|
101 | } |
|
102 | ||
103 | $handle = @gzopen($tmp_filename, 'wb'.$this->compression_level); |
|
104 | ||
105 | if ($handle === false) { |
|
106 | throw FileAccessException::notWritable($tmp_filename); |
|
107 | } |
|
108 | ||
109 | $this->tmp_filename = $tmp_filename; |
|
110 | $this->handle = $handle; |
|
111 | ||
112 | $this->write($this->render->start()); |
|
113 | // render end string only once |
|
114 | $this->end_string = $this->render->end(); |
|
115 | } |
|
116 | ||
117 | public function close() |
|
118 | { |
@@ 94-115 (lines=22) @@ | ||
91 | return $this->filename; |
|
92 | } |
|
93 | ||
94 | public function open() |
|
95 | { |
|
96 | $this->state->open(); |
|
97 | $this->substream->open(); |
|
98 | ||
99 | $tmp_filename = tempnam(sys_get_temp_dir(), 'sitemap_index'); |
|
100 | ||
101 | if ($tmp_filename === false) { |
|
102 | throw FileAccessException::failedCreateUnique(sys_get_temp_dir(), 'sitemap_index'); |
|
103 | } |
|
104 | ||
105 | $handle = @fopen($tmp_filename, 'wb'); |
|
106 | ||
107 | if ($handle === false) { |
|
108 | throw FileAccessException::notWritable($tmp_filename); |
|
109 | } |
|
110 | ||
111 | $this->tmp_filename = $tmp_filename; |
|
112 | $this->handle = $handle; |
|
113 | ||
114 | fwrite($this->handle, $this->render->start()); |
|
115 | } |
|
116 | ||
117 | public function close() |
|
118 | { |