We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -38,13 +38,13 @@ |
||
38 | 38 | |
39 | 39 | class Apache_Solr_Exception extends Exception |
40 | 40 | { |
41 | - /** |
|
42 | - * SVN Revision meta data for this class |
|
43 | - */ |
|
44 | - const SVN_REVISION = '$Revision: 54 $'; |
|
41 | + /** |
|
42 | + * SVN Revision meta data for this class |
|
43 | + */ |
|
44 | + const SVN_REVISION = '$Revision: 54 $'; |
|
45 | 45 | |
46 | - /** |
|
47 | - * SVN ID meta data for this class |
|
48 | - */ |
|
49 | - const SVN_ID = '$Id: Exception.php 54 2011-02-04 16:29:18Z donovan.jimenez $'; |
|
46 | + /** |
|
47 | + * SVN ID meta data for this class |
|
48 | + */ |
|
49 | + const SVN_ID = '$Id: Exception.php 54 2011-02-04 16:29:18Z donovan.jimenez $'; |
|
50 | 50 | } |
51 | 51 | \ No newline at end of file |
@@ -36,8 +36,7 @@ |
||
36 | 36 | * @author Donovan Jimenez <[email protected]> |
37 | 37 | */ |
38 | 38 | |
39 | -class Apache_Solr_Exception extends Exception |
|
40 | -{ |
|
39 | +class Apache_Solr_Exception extends Exception { |
|
41 | 40 | /** |
42 | 41 | * SVN Revision meta data for this class |
43 | 42 | */ |
@@ -43,213 +43,213 @@ |
||
43 | 43 | */ |
44 | 44 | class Apache_Solr_HttpTransport_Response |
45 | 45 | { |
46 | - /** |
|
47 | - * Status Messages indexed by Status Code |
|
48 | - * Obtained from: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
|
49 | - * |
|
50 | - * @var array |
|
51 | - */ |
|
52 | - static private $_defaultStatusMessages = array( |
|
53 | - // Specific to PHP Solr Client |
|
54 | - 0 => "Communication Error", |
|
46 | + /** |
|
47 | + * Status Messages indexed by Status Code |
|
48 | + * Obtained from: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
|
49 | + * |
|
50 | + * @var array |
|
51 | + */ |
|
52 | + static private $_defaultStatusMessages = array( |
|
53 | + // Specific to PHP Solr Client |
|
54 | + 0 => "Communication Error", |
|
55 | 55 | |
56 | - // Informational 1XX |
|
57 | - 100 => "Continue", |
|
58 | - 101 => "Switching Protocols", |
|
56 | + // Informational 1XX |
|
57 | + 100 => "Continue", |
|
58 | + 101 => "Switching Protocols", |
|
59 | 59 | |
60 | - // Successful 2XX |
|
61 | - 200 => "OK", |
|
62 | - 201 => "Created", |
|
63 | - 202 => "Accepted", |
|
64 | - 203 => "Non-Authoritative Information", |
|
65 | - 204 => "No Content", |
|
66 | - 205 => "Reset Content", |
|
67 | - 206 => "Partial Content", |
|
60 | + // Successful 2XX |
|
61 | + 200 => "OK", |
|
62 | + 201 => "Created", |
|
63 | + 202 => "Accepted", |
|
64 | + 203 => "Non-Authoritative Information", |
|
65 | + 204 => "No Content", |
|
66 | + 205 => "Reset Content", |
|
67 | + 206 => "Partial Content", |
|
68 | 68 | |
69 | - // Redirection 3XX |
|
70 | - 300 => "Multiple Choices", |
|
71 | - 301 => "Moved Permanently", |
|
72 | - 302 => "Found", |
|
73 | - 303 => "See Other", |
|
74 | - 304 => "Not Modified", |
|
75 | - 305 => "Use Proxy", |
|
76 | - 307 => "Temporary Redirect", |
|
69 | + // Redirection 3XX |
|
70 | + 300 => "Multiple Choices", |
|
71 | + 301 => "Moved Permanently", |
|
72 | + 302 => "Found", |
|
73 | + 303 => "See Other", |
|
74 | + 304 => "Not Modified", |
|
75 | + 305 => "Use Proxy", |
|
76 | + 307 => "Temporary Redirect", |
|
77 | 77 | |
78 | - // Client Error 4XX |
|
79 | - 400 => "Bad Request", |
|
80 | - 401 => "Unauthorized", |
|
81 | - 402 => "Payment Required", |
|
82 | - 403 => "Forbidden", |
|
83 | - 404 => "Not Found", |
|
84 | - 405 => "Method Not Allowed", |
|
85 | - 406 => "Not Acceptable", |
|
86 | - 407 => "Proxy Authentication Required", |
|
87 | - 408 => "Request Timeout", |
|
88 | - 409 => "Conflict", |
|
89 | - 410 => "Gone", |
|
90 | - 411 => "Length Required", |
|
91 | - 412 => "Precondition Failed", |
|
92 | - 413 => "Request Entity Too Large", |
|
93 | - 414 => "Request-URI Too Long", |
|
94 | - 415 => "Unsupported Media Type", |
|
95 | - 416 => "Request Range Not Satisfiable", |
|
96 | - 417 => "Expectation Failed", |
|
78 | + // Client Error 4XX |
|
79 | + 400 => "Bad Request", |
|
80 | + 401 => "Unauthorized", |
|
81 | + 402 => "Payment Required", |
|
82 | + 403 => "Forbidden", |
|
83 | + 404 => "Not Found", |
|
84 | + 405 => "Method Not Allowed", |
|
85 | + 406 => "Not Acceptable", |
|
86 | + 407 => "Proxy Authentication Required", |
|
87 | + 408 => "Request Timeout", |
|
88 | + 409 => "Conflict", |
|
89 | + 410 => "Gone", |
|
90 | + 411 => "Length Required", |
|
91 | + 412 => "Precondition Failed", |
|
92 | + 413 => "Request Entity Too Large", |
|
93 | + 414 => "Request-URI Too Long", |
|
94 | + 415 => "Unsupported Media Type", |
|
95 | + 416 => "Request Range Not Satisfiable", |
|
96 | + 417 => "Expectation Failed", |
|
97 | 97 | |
98 | - // Server Error 5XX |
|
99 | - 500 => "Internal Server Error", |
|
100 | - 501 => "Not Implemented", |
|
101 | - 502 => "Bad Gateway", |
|
102 | - 503 => "Service Unavailable", |
|
103 | - 504 => "Gateway Timeout", |
|
104 | - 505 => "HTTP Version Not Supported" |
|
105 | - ); |
|
98 | + // Server Error 5XX |
|
99 | + 500 => "Internal Server Error", |
|
100 | + 501 => "Not Implemented", |
|
101 | + 502 => "Bad Gateway", |
|
102 | + 503 => "Service Unavailable", |
|
103 | + 504 => "Gateway Timeout", |
|
104 | + 505 => "HTTP Version Not Supported" |
|
105 | + ); |
|
106 | 106 | |
107 | - /** |
|
108 | - * Get the HTTP status message based on status code |
|
109 | - * |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - public static function getDefaultStatusMessage($statusCode) |
|
113 | - { |
|
114 | - $statusCode = (int) $statusCode; |
|
107 | + /** |
|
108 | + * Get the HTTP status message based on status code |
|
109 | + * |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + public static function getDefaultStatusMessage($statusCode) |
|
113 | + { |
|
114 | + $statusCode = (int) $statusCode; |
|
115 | 115 | |
116 | - if (isset(self::$_defaultStatusMessages[$statusCode])) |
|
117 | - { |
|
118 | - return self::$_defaultStatusMessages[$statusCode]; |
|
119 | - } |
|
116 | + if (isset(self::$_defaultStatusMessages[$statusCode])) |
|
117 | + { |
|
118 | + return self::$_defaultStatusMessages[$statusCode]; |
|
119 | + } |
|
120 | 120 | |
121 | - return "Unknown Status"; |
|
122 | - } |
|
121 | + return "Unknown Status"; |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * The response's HTTP status code |
|
126 | - * |
|
127 | - * @var integer |
|
128 | - */ |
|
129 | - private $_statusCode; |
|
124 | + /** |
|
125 | + * The response's HTTP status code |
|
126 | + * |
|
127 | + * @var integer |
|
128 | + */ |
|
129 | + private $_statusCode; |
|
130 | 130 | |
131 | - /** |
|
132 | - * The response's HTTP status message |
|
133 | - * |
|
134 | - * @var string |
|
135 | - */ |
|
136 | - private $_statusMessage; |
|
131 | + /** |
|
132 | + * The response's HTTP status message |
|
133 | + * |
|
134 | + * @var string |
|
135 | + */ |
|
136 | + private $_statusMessage; |
|
137 | 137 | |
138 | - /** |
|
139 | - * The response's mime type |
|
140 | - * |
|
141 | - * @var string |
|
142 | - */ |
|
143 | - private $_mimeType; |
|
138 | + /** |
|
139 | + * The response's mime type |
|
140 | + * |
|
141 | + * @var string |
|
142 | + */ |
|
143 | + private $_mimeType; |
|
144 | 144 | |
145 | - /** |
|
146 | - * The response's character encoding |
|
147 | - * |
|
148 | - * @var string |
|
149 | - */ |
|
150 | - private $_encoding; |
|
145 | + /** |
|
146 | + * The response's character encoding |
|
147 | + * |
|
148 | + * @var string |
|
149 | + */ |
|
150 | + private $_encoding; |
|
151 | 151 | |
152 | - /** |
|
153 | - * The response's data |
|
154 | - * |
|
155 | - * @var string |
|
156 | - */ |
|
157 | - private $_responseBody; |
|
152 | + /** |
|
153 | + * The response's data |
|
154 | + * |
|
155 | + * @var string |
|
156 | + */ |
|
157 | + private $_responseBody; |
|
158 | 158 | |
159 | - /** |
|
160 | - * Construct a HTTP transport response |
|
161 | - * |
|
162 | - * @param integer $statusCode The HTTP status code |
|
163 | - * @param string $contentType The VALUE of the Content-Type HTTP header |
|
164 | - * @param string $responseBody The body of the HTTP response |
|
165 | - */ |
|
166 | - public function __construct($statusCode, $contentType, $responseBody) |
|
167 | - { |
|
168 | - // set the status code, make sure its an integer |
|
169 | - $this->_statusCode = (int) $statusCode; |
|
159 | + /** |
|
160 | + * Construct a HTTP transport response |
|
161 | + * |
|
162 | + * @param integer $statusCode The HTTP status code |
|
163 | + * @param string $contentType The VALUE of the Content-Type HTTP header |
|
164 | + * @param string $responseBody The body of the HTTP response |
|
165 | + */ |
|
166 | + public function __construct($statusCode, $contentType, $responseBody) |
|
167 | + { |
|
168 | + // set the status code, make sure its an integer |
|
169 | + $this->_statusCode = (int) $statusCode; |
|
170 | 170 | |
171 | - // lookup up status message based on code |
|
172 | - $this->_statusMessage = self::getDefaultStatusMessage($this->_statusCode); |
|
171 | + // lookup up status message based on code |
|
172 | + $this->_statusMessage = self::getDefaultStatusMessage($this->_statusCode); |
|
173 | 173 | |
174 | - // set the response body, it should always be a string |
|
175 | - $this->_responseBody = (string) $responseBody; |
|
174 | + // set the response body, it should always be a string |
|
175 | + $this->_responseBody = (string) $responseBody; |
|
176 | 176 | |
177 | - // parse the content type header value for mimetype and encoding |
|
178 | - // first set default values that will remain if we can't find |
|
179 | - // what we're looking for in the content type |
|
180 | - $this->_mimeType = "text/plain"; |
|
181 | - $this->_encoding = "UTF-8"; |
|
177 | + // parse the content type header value for mimetype and encoding |
|
178 | + // first set default values that will remain if we can't find |
|
179 | + // what we're looking for in the content type |
|
180 | + $this->_mimeType = "text/plain"; |
|
181 | + $this->_encoding = "UTF-8"; |
|
182 | 182 | |
183 | - if ($contentType) |
|
184 | - { |
|
185 | - // now break apart the header to see if there's character encoding |
|
186 | - $contentTypeParts = explode(';', $contentType, 2); |
|
183 | + if ($contentType) |
|
184 | + { |
|
185 | + // now break apart the header to see if there's character encoding |
|
186 | + $contentTypeParts = explode(';', $contentType, 2); |
|
187 | 187 | |
188 | - if (isset($contentTypeParts[0])) |
|
189 | - { |
|
190 | - $this->_mimeType = trim($contentTypeParts[0]); |
|
191 | - } |
|
188 | + if (isset($contentTypeParts[0])) |
|
189 | + { |
|
190 | + $this->_mimeType = trim($contentTypeParts[0]); |
|
191 | + } |
|
192 | 192 | |
193 | - if (isset($contentTypeParts[1])) |
|
194 | - { |
|
195 | - // we have a second part, split it further |
|
196 | - $contentTypeParts = explode('=', $contentTypeParts[1]); |
|
193 | + if (isset($contentTypeParts[1])) |
|
194 | + { |
|
195 | + // we have a second part, split it further |
|
196 | + $contentTypeParts = explode('=', $contentTypeParts[1]); |
|
197 | 197 | |
198 | - if (isset($contentTypeParts[1])) |
|
199 | - { |
|
200 | - $this->_encoding = trim($contentTypeParts[1]); |
|
201 | - } |
|
202 | - } |
|
203 | - } |
|
204 | - } |
|
198 | + if (isset($contentTypeParts[1])) |
|
199 | + { |
|
200 | + $this->_encoding = trim($contentTypeParts[1]); |
|
201 | + } |
|
202 | + } |
|
203 | + } |
|
204 | + } |
|
205 | 205 | |
206 | - /** |
|
207 | - * Get the status code of the response |
|
208 | - * |
|
209 | - * @return integer |
|
210 | - */ |
|
211 | - public function getStatusCode() |
|
212 | - { |
|
213 | - return $this->_statusCode; |
|
214 | - } |
|
206 | + /** |
|
207 | + * Get the status code of the response |
|
208 | + * |
|
209 | + * @return integer |
|
210 | + */ |
|
211 | + public function getStatusCode() |
|
212 | + { |
|
213 | + return $this->_statusCode; |
|
214 | + } |
|
215 | 215 | |
216 | - /** |
|
217 | - * Get the status message of the response |
|
218 | - * |
|
219 | - * @return string |
|
220 | - */ |
|
221 | - public function getStatusMessage() |
|
222 | - { |
|
223 | - return $this->_statusMessage; |
|
224 | - } |
|
216 | + /** |
|
217 | + * Get the status message of the response |
|
218 | + * |
|
219 | + * @return string |
|
220 | + */ |
|
221 | + public function getStatusMessage() |
|
222 | + { |
|
223 | + return $this->_statusMessage; |
|
224 | + } |
|
225 | 225 | |
226 | - /** |
|
227 | - * Get the mimetype of the response body |
|
228 | - * |
|
229 | - * @return string |
|
230 | - */ |
|
231 | - public function getMimeType() |
|
232 | - { |
|
233 | - return $this->_mimeType; |
|
234 | - } |
|
226 | + /** |
|
227 | + * Get the mimetype of the response body |
|
228 | + * |
|
229 | + * @return string |
|
230 | + */ |
|
231 | + public function getMimeType() |
|
232 | + { |
|
233 | + return $this->_mimeType; |
|
234 | + } |
|
235 | 235 | |
236 | - /** |
|
237 | - * Get the charset encoding of the response body. |
|
238 | - * |
|
239 | - * @return string |
|
240 | - */ |
|
241 | - public function getEncoding() |
|
242 | - { |
|
243 | - return $this->_encoding; |
|
244 | - } |
|
236 | + /** |
|
237 | + * Get the charset encoding of the response body. |
|
238 | + * |
|
239 | + * @return string |
|
240 | + */ |
|
241 | + public function getEncoding() |
|
242 | + { |
|
243 | + return $this->_encoding; |
|
244 | + } |
|
245 | 245 | |
246 | - /** |
|
247 | - * Get the raw response body |
|
248 | - * |
|
249 | - * @return string |
|
250 | - */ |
|
251 | - public function getBody() |
|
252 | - { |
|
253 | - return $this->_responseBody; |
|
254 | - } |
|
246 | + /** |
|
247 | + * Get the raw response body |
|
248 | + * |
|
249 | + * @return string |
|
250 | + */ |
|
251 | + public function getBody() |
|
252 | + { |
|
253 | + return $this->_responseBody; |
|
254 | + } |
|
255 | 255 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @var array |
51 | 51 | */ |
52 | - static private $_defaultStatusMessages = array( |
|
52 | + static private $_defaultStatusMessages = array ( |
|
53 | 53 | // Specific to PHP Solr Client |
54 | 54 | 0 => "Communication Error", |
55 | 55 |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | * implementations and then consumed by the Apache_Solr_Response class which provides |
42 | 42 | * decoding |
43 | 43 | */ |
44 | -class Apache_Solr_HttpTransport_Response |
|
45 | -{ |
|
44 | +class Apache_Solr_HttpTransport_Response { |
|
46 | 45 | /** |
47 | 46 | * Status Messages indexed by Status Code |
48 | 47 | * Obtained from: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
@@ -109,12 +108,10 @@ discard block |
||
109 | 108 | * |
110 | 109 | * @return string |
111 | 110 | */ |
112 | - public static function getDefaultStatusMessage($statusCode) |
|
113 | - { |
|
111 | + public static function getDefaultStatusMessage($statusCode) { |
|
114 | 112 | $statusCode = (int) $statusCode; |
115 | 113 | |
116 | - if (isset(self::$_defaultStatusMessages[$statusCode])) |
|
117 | - { |
|
114 | + if (isset(self::$_defaultStatusMessages[$statusCode])) { |
|
118 | 115 | return self::$_defaultStatusMessages[$statusCode]; |
119 | 116 | } |
120 | 117 | |
@@ -163,8 +160,7 @@ discard block |
||
163 | 160 | * @param string $contentType The VALUE of the Content-Type HTTP header |
164 | 161 | * @param string $responseBody The body of the HTTP response |
165 | 162 | */ |
166 | - public function __construct($statusCode, $contentType, $responseBody) |
|
167 | - { |
|
163 | + public function __construct($statusCode, $contentType, $responseBody) { |
|
168 | 164 | // set the status code, make sure its an integer |
169 | 165 | $this->_statusCode = (int) $statusCode; |
170 | 166 | |
@@ -180,23 +176,19 @@ discard block |
||
180 | 176 | $this->_mimeType = "text/plain"; |
181 | 177 | $this->_encoding = "UTF-8"; |
182 | 178 | |
183 | - if ($contentType) |
|
184 | - { |
|
179 | + if ($contentType) { |
|
185 | 180 | // now break apart the header to see if there's character encoding |
186 | 181 | $contentTypeParts = explode(';', $contentType, 2); |
187 | 182 | |
188 | - if (isset($contentTypeParts[0])) |
|
189 | - { |
|
183 | + if (isset($contentTypeParts[0])) { |
|
190 | 184 | $this->_mimeType = trim($contentTypeParts[0]); |
191 | 185 | } |
192 | 186 | |
193 | - if (isset($contentTypeParts[1])) |
|
194 | - { |
|
187 | + if (isset($contentTypeParts[1])) { |
|
195 | 188 | // we have a second part, split it further |
196 | 189 | $contentTypeParts = explode('=', $contentTypeParts[1]); |
197 | 190 | |
198 | - if (isset($contentTypeParts[1])) |
|
199 | - { |
|
191 | + if (isset($contentTypeParts[1])) { |
|
200 | 192 | $this->_encoding = trim($contentTypeParts[1]); |
201 | 193 | } |
202 | 194 | } |
@@ -208,8 +200,7 @@ discard block |
||
208 | 200 | * |
209 | 201 | * @return integer |
210 | 202 | */ |
211 | - public function getStatusCode() |
|
212 | - { |
|
203 | + public function getStatusCode() { |
|
213 | 204 | return $this->_statusCode; |
214 | 205 | } |
215 | 206 | |
@@ -218,8 +209,7 @@ discard block |
||
218 | 209 | * |
219 | 210 | * @return string |
220 | 211 | */ |
221 | - public function getStatusMessage() |
|
222 | - { |
|
212 | + public function getStatusMessage() { |
|
223 | 213 | return $this->_statusMessage; |
224 | 214 | } |
225 | 215 | |
@@ -228,8 +218,7 @@ discard block |
||
228 | 218 | * |
229 | 219 | * @return string |
230 | 220 | */ |
231 | - public function getMimeType() |
|
232 | - { |
|
221 | + public function getMimeType() { |
|
233 | 222 | return $this->_mimeType; |
234 | 223 | } |
235 | 224 | |
@@ -238,8 +227,7 @@ discard block |
||
238 | 227 | * |
239 | 228 | * @return string |
240 | 229 | */ |
241 | - public function getEncoding() |
|
242 | - { |
|
230 | + public function getEncoding() { |
|
243 | 231 | return $this->_encoding; |
244 | 232 | } |
245 | 233 | |
@@ -248,8 +236,7 @@ discard block |
||
248 | 236 | * |
249 | 237 | * @return string |
250 | 238 | */ |
251 | - public function getBody() |
|
252 | - { |
|
239 | + public function getBody() { |
|
253 | 240 | return $this->_responseBody; |
254 | 241 | } |
255 | 242 | } |
@@ -44,155 +44,155 @@ |
||
44 | 44 | */ |
45 | 45 | class Apache_Solr_HttpTransport_Curl extends Apache_Solr_HttpTransport_Abstract |
46 | 46 | { |
47 | - /** |
|
48 | - * SVN Revision meta data for this class |
|
49 | - */ |
|
50 | - const SVN_REVISION = '$Revision:$'; |
|
51 | - |
|
52 | - /** |
|
53 | - * SVN ID meta data for this class |
|
54 | - */ |
|
55 | - const SVN_ID = '$Id:$'; |
|
56 | - |
|
57 | - /** |
|
58 | - * Curl Session Handle |
|
59 | - * |
|
60 | - * @var resource |
|
61 | - */ |
|
62 | - private $_curl; |
|
63 | - |
|
64 | - /** |
|
65 | - * Initializes a curl session |
|
66 | - */ |
|
67 | - public function __construct() |
|
68 | - { |
|
69 | - // initialize a CURL session |
|
70 | - $this->_curl = curl_init(); |
|
71 | - |
|
72 | - // set common options that will not be changed during the session |
|
73 | - curl_setopt_array($this->_curl, array( |
|
74 | - // return the response body from curl_exec |
|
75 | - CURLOPT_RETURNTRANSFER => true, |
|
76 | - |
|
77 | - // get the output as binary data |
|
78 | - CURLOPT_BINARYTRANSFER => true, |
|
79 | - |
|
80 | - // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
81 | - CURLOPT_HEADER => false |
|
82 | - )); |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * Closes a curl session |
|
87 | - */ |
|
88 | - function __destruct() |
|
89 | - { |
|
90 | - // close our curl session |
|
91 | - curl_close($this->_curl); |
|
92 | - } |
|
93 | - |
|
94 | - public function performGetRequest($url, $timeout = false) |
|
95 | - { |
|
96 | - // check the timeout value |
|
97 | - if ($timeout === false || $timeout <= 0.0) |
|
98 | - { |
|
99 | - // use the default timeout |
|
100 | - $timeout = $this->getDefaultTimeout(); |
|
101 | - } |
|
102 | - |
|
103 | - // set curl GET options |
|
104 | - curl_setopt_array($this->_curl, array( |
|
105 | - // make sure we're returning the body |
|
106 | - CURLOPT_NOBODY => false, |
|
107 | - |
|
108 | - // make sure we're GET |
|
109 | - CURLOPT_HTTPGET => true, |
|
110 | - |
|
111 | - // set the URL |
|
112 | - CURLOPT_URL => $url, |
|
113 | - |
|
114 | - // set the timeout |
|
115 | - CURLOPT_TIMEOUT => $timeout |
|
116 | - )); |
|
117 | - |
|
118 | - // make the request |
|
119 | - $responseBody = curl_exec($this->_curl); |
|
120 | - |
|
121 | - // get info from the transfer |
|
122 | - $statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE); |
|
123 | - $contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE); |
|
124 | - |
|
125 | - return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
126 | - } |
|
127 | - |
|
128 | - public function performHeadRequest($url, $timeout = false) |
|
129 | - { |
|
130 | - // check the timeout value |
|
131 | - if ($timeout === false || $timeout <= 0.0) |
|
132 | - { |
|
133 | - // use the default timeout |
|
134 | - $timeout = $this->getDefaultTimeout(); |
|
135 | - } |
|
136 | - |
|
137 | - // set curl HEAD options |
|
138 | - curl_setopt_array($this->_curl, array( |
|
139 | - // this both sets the method to HEAD and says not to return a body |
|
140 | - CURLOPT_NOBODY => true, |
|
141 | - |
|
142 | - // set the URL |
|
143 | - CURLOPT_URL => $url, |
|
144 | - |
|
145 | - // set the timeout |
|
146 | - CURLOPT_TIMEOUT => $timeout |
|
147 | - )); |
|
148 | - |
|
149 | - // make the request |
|
150 | - $responseBody = curl_exec($this->_curl); |
|
151 | - |
|
152 | - // get info from the transfer |
|
153 | - $statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE); |
|
154 | - $contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE); |
|
155 | - |
|
156 | - return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
157 | - } |
|
158 | - |
|
159 | - public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
160 | - { |
|
161 | - // check the timeout value |
|
162 | - if ($timeout === false || $timeout <= 0.0) |
|
163 | - { |
|
164 | - // use the default timeout |
|
165 | - $timeout = $this->getDefaultTimeout(); |
|
166 | - } |
|
167 | - |
|
168 | - // set curl POST options |
|
169 | - curl_setopt_array($this->_curl, array( |
|
170 | - // make sure we're returning the body |
|
171 | - CURLOPT_NOBODY => false, |
|
172 | - |
|
173 | - // make sure we're POST |
|
174 | - CURLOPT_POST => true, |
|
175 | - |
|
176 | - // set the URL |
|
177 | - CURLOPT_URL => $url, |
|
178 | - |
|
179 | - // set the post data |
|
180 | - CURLOPT_POSTFIELDS => $postData, |
|
181 | - |
|
182 | - // set the content type |
|
183 | - CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"), |
|
184 | - |
|
185 | - // set the timeout |
|
186 | - CURLOPT_TIMEOUT => $timeout |
|
187 | - )); |
|
188 | - |
|
189 | - // make the request |
|
190 | - $responseBody = curl_exec($this->_curl); |
|
191 | - |
|
192 | - // get info from the transfer |
|
193 | - $statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE); |
|
194 | - $contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE); |
|
195 | - |
|
196 | - return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
197 | - } |
|
47 | + /** |
|
48 | + * SVN Revision meta data for this class |
|
49 | + */ |
|
50 | + const SVN_REVISION = '$Revision:$'; |
|
51 | + |
|
52 | + /** |
|
53 | + * SVN ID meta data for this class |
|
54 | + */ |
|
55 | + const SVN_ID = '$Id:$'; |
|
56 | + |
|
57 | + /** |
|
58 | + * Curl Session Handle |
|
59 | + * |
|
60 | + * @var resource |
|
61 | + */ |
|
62 | + private $_curl; |
|
63 | + |
|
64 | + /** |
|
65 | + * Initializes a curl session |
|
66 | + */ |
|
67 | + public function __construct() |
|
68 | + { |
|
69 | + // initialize a CURL session |
|
70 | + $this->_curl = curl_init(); |
|
71 | + |
|
72 | + // set common options that will not be changed during the session |
|
73 | + curl_setopt_array($this->_curl, array( |
|
74 | + // return the response body from curl_exec |
|
75 | + CURLOPT_RETURNTRANSFER => true, |
|
76 | + |
|
77 | + // get the output as binary data |
|
78 | + CURLOPT_BINARYTRANSFER => true, |
|
79 | + |
|
80 | + // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
81 | + CURLOPT_HEADER => false |
|
82 | + )); |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * Closes a curl session |
|
87 | + */ |
|
88 | + function __destruct() |
|
89 | + { |
|
90 | + // close our curl session |
|
91 | + curl_close($this->_curl); |
|
92 | + } |
|
93 | + |
|
94 | + public function performGetRequest($url, $timeout = false) |
|
95 | + { |
|
96 | + // check the timeout value |
|
97 | + if ($timeout === false || $timeout <= 0.0) |
|
98 | + { |
|
99 | + // use the default timeout |
|
100 | + $timeout = $this->getDefaultTimeout(); |
|
101 | + } |
|
102 | + |
|
103 | + // set curl GET options |
|
104 | + curl_setopt_array($this->_curl, array( |
|
105 | + // make sure we're returning the body |
|
106 | + CURLOPT_NOBODY => false, |
|
107 | + |
|
108 | + // make sure we're GET |
|
109 | + CURLOPT_HTTPGET => true, |
|
110 | + |
|
111 | + // set the URL |
|
112 | + CURLOPT_URL => $url, |
|
113 | + |
|
114 | + // set the timeout |
|
115 | + CURLOPT_TIMEOUT => $timeout |
|
116 | + )); |
|
117 | + |
|
118 | + // make the request |
|
119 | + $responseBody = curl_exec($this->_curl); |
|
120 | + |
|
121 | + // get info from the transfer |
|
122 | + $statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE); |
|
123 | + $contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE); |
|
124 | + |
|
125 | + return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
126 | + } |
|
127 | + |
|
128 | + public function performHeadRequest($url, $timeout = false) |
|
129 | + { |
|
130 | + // check the timeout value |
|
131 | + if ($timeout === false || $timeout <= 0.0) |
|
132 | + { |
|
133 | + // use the default timeout |
|
134 | + $timeout = $this->getDefaultTimeout(); |
|
135 | + } |
|
136 | + |
|
137 | + // set curl HEAD options |
|
138 | + curl_setopt_array($this->_curl, array( |
|
139 | + // this both sets the method to HEAD and says not to return a body |
|
140 | + CURLOPT_NOBODY => true, |
|
141 | + |
|
142 | + // set the URL |
|
143 | + CURLOPT_URL => $url, |
|
144 | + |
|
145 | + // set the timeout |
|
146 | + CURLOPT_TIMEOUT => $timeout |
|
147 | + )); |
|
148 | + |
|
149 | + // make the request |
|
150 | + $responseBody = curl_exec($this->_curl); |
|
151 | + |
|
152 | + // get info from the transfer |
|
153 | + $statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE); |
|
154 | + $contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE); |
|
155 | + |
|
156 | + return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
157 | + } |
|
158 | + |
|
159 | + public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
160 | + { |
|
161 | + // check the timeout value |
|
162 | + if ($timeout === false || $timeout <= 0.0) |
|
163 | + { |
|
164 | + // use the default timeout |
|
165 | + $timeout = $this->getDefaultTimeout(); |
|
166 | + } |
|
167 | + |
|
168 | + // set curl POST options |
|
169 | + curl_setopt_array($this->_curl, array( |
|
170 | + // make sure we're returning the body |
|
171 | + CURLOPT_NOBODY => false, |
|
172 | + |
|
173 | + // make sure we're POST |
|
174 | + CURLOPT_POST => true, |
|
175 | + |
|
176 | + // set the URL |
|
177 | + CURLOPT_URL => $url, |
|
178 | + |
|
179 | + // set the post data |
|
180 | + CURLOPT_POSTFIELDS => $postData, |
|
181 | + |
|
182 | + // set the content type |
|
183 | + CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"), |
|
184 | + |
|
185 | + // set the timeout |
|
186 | + CURLOPT_TIMEOUT => $timeout |
|
187 | + )); |
|
188 | + |
|
189 | + // make the request |
|
190 | + $responseBody = curl_exec($this->_curl); |
|
191 | + |
|
192 | + // get info from the transfer |
|
193 | + $statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE); |
|
194 | + $contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE); |
|
195 | + |
|
196 | + return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
197 | + } |
|
198 | 198 | } |
199 | 199 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | |
39 | 39 | // Require Apache_Solr_HttpTransport_Abstract |
40 | -require_once(dirname(__FILE__) . '/Abstract.php'); |
|
40 | +require_once(dirname(__FILE__).'/Abstract.php'); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * A Curl based HTTP transport. Uses a single curl session for all requests. |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $this->_curl = curl_init(); |
71 | 71 | |
72 | 72 | // set common options that will not be changed during the session |
73 | - curl_setopt_array($this->_curl, array( |
|
73 | + curl_setopt_array($this->_curl, array ( |
|
74 | 74 | // return the response body from curl_exec |
75 | 75 | CURLOPT_RETURNTRANSFER => true, |
76 | 76 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | // set curl GET options |
104 | - curl_setopt_array($this->_curl, array( |
|
104 | + curl_setopt_array($this->_curl, array ( |
|
105 | 105 | // make sure we're returning the body |
106 | 106 | CURLOPT_NOBODY => false, |
107 | 107 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | // set curl HEAD options |
138 | - curl_setopt_array($this->_curl, array( |
|
138 | + curl_setopt_array($this->_curl, array ( |
|
139 | 139 | // this both sets the method to HEAD and says not to return a body |
140 | 140 | CURLOPT_NOBODY => true, |
141 | 141 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | // set curl POST options |
169 | - curl_setopt_array($this->_curl, array( |
|
169 | + curl_setopt_array($this->_curl, array ( |
|
170 | 170 | // make sure we're returning the body |
171 | 171 | CURLOPT_NOBODY => false, |
172 | 172 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | CURLOPT_POSTFIELDS => $postData, |
181 | 181 | |
182 | 182 | // set the content type |
183 | - CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"), |
|
183 | + CURLOPT_HTTPHEADER => array ("Content-Type: {$contentType}"), |
|
184 | 184 | |
185 | 185 | // set the timeout |
186 | 186 | CURLOPT_TIMEOUT => $timeout |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * A Curl based HTTP transport. Uses a single curl session for all requests. |
44 | 44 | */ |
45 | -class Apache_Solr_HttpTransport_Curl extends Apache_Solr_HttpTransport_Abstract |
|
46 | -{ |
|
45 | +class Apache_Solr_HttpTransport_Curl extends Apache_Solr_HttpTransport_Abstract { |
|
47 | 46 | /** |
48 | 47 | * SVN Revision meta data for this class |
49 | 48 | */ |
@@ -64,8 +63,7 @@ discard block |
||
64 | 63 | /** |
65 | 64 | * Initializes a curl session |
66 | 65 | */ |
67 | - public function __construct() |
|
68 | - { |
|
66 | + public function __construct() { |
|
69 | 67 | // initialize a CURL session |
70 | 68 | $this->_curl = curl_init(); |
71 | 69 | |
@@ -85,17 +83,14 @@ discard block |
||
85 | 83 | /** |
86 | 84 | * Closes a curl session |
87 | 85 | */ |
88 | - function __destruct() |
|
89 | - { |
|
86 | + function __destruct() { |
|
90 | 87 | // close our curl session |
91 | 88 | curl_close($this->_curl); |
92 | 89 | } |
93 | 90 | |
94 | - public function performGetRequest($url, $timeout = false) |
|
95 | - { |
|
91 | + public function performGetRequest($url, $timeout = false) { |
|
96 | 92 | // check the timeout value |
97 | - if ($timeout === false || $timeout <= 0.0) |
|
98 | - { |
|
93 | + if ($timeout === false || $timeout <= 0.0) { |
|
99 | 94 | // use the default timeout |
100 | 95 | $timeout = $this->getDefaultTimeout(); |
101 | 96 | } |
@@ -125,11 +120,9 @@ discard block |
||
125 | 120 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
126 | 121 | } |
127 | 122 | |
128 | - public function performHeadRequest($url, $timeout = false) |
|
129 | - { |
|
123 | + public function performHeadRequest($url, $timeout = false) { |
|
130 | 124 | // check the timeout value |
131 | - if ($timeout === false || $timeout <= 0.0) |
|
132 | - { |
|
125 | + if ($timeout === false || $timeout <= 0.0) { |
|
133 | 126 | // use the default timeout |
134 | 127 | $timeout = $this->getDefaultTimeout(); |
135 | 128 | } |
@@ -156,11 +149,9 @@ discard block |
||
156 | 149 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
157 | 150 | } |
158 | 151 | |
159 | - public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
160 | - { |
|
152 | + public function performPostRequest($url, $postData, $contentType, $timeout = false) { |
|
161 | 153 | // check the timeout value |
162 | - if ($timeout === false || $timeout <= 0.0) |
|
163 | - { |
|
154 | + if ($timeout === false || $timeout <= 0.0) { |
|
164 | 155 | // use the default timeout |
165 | 156 | $timeout = $this->getDefaultTimeout(); |
166 | 157 | } |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | // set common options that will not be changed during the session |
73 | 73 | curl_setopt_array($this->_curl, array( |
74 | 74 | // return the response body from curl_exec |
75 | - CURLOPT_RETURNTRANSFER => true, |
|
75 | + CURLOPT_RETURNTRANSFER => TRUE, |
|
76 | 76 | |
77 | 77 | // get the output as binary data |
78 | - CURLOPT_BINARYTRANSFER => true, |
|
78 | + CURLOPT_BINARYTRANSFER => TRUE, |
|
79 | 79 | |
80 | 80 | // we do not need the headers in the output, we get everything we need from curl_getinfo |
81 | - CURLOPT_HEADER => false |
|
81 | + CURLOPT_HEADER => FALSE |
|
82 | 82 | )); |
83 | 83 | } |
84 | 84 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | curl_close($this->_curl); |
92 | 92 | } |
93 | 93 | |
94 | - public function performGetRequest($url, $timeout = false) |
|
94 | + public function performGetRequest($url, $timeout = FALSE) |
|
95 | 95 | { |
96 | 96 | // check the timeout value |
97 | - if ($timeout === false || $timeout <= 0.0) |
|
97 | + if ($timeout === FALSE || $timeout <= 0.0) |
|
98 | 98 | { |
99 | 99 | // use the default timeout |
100 | 100 | $timeout = $this->getDefaultTimeout(); |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | // set curl GET options |
104 | 104 | curl_setopt_array($this->_curl, array( |
105 | 105 | // make sure we're returning the body |
106 | - CURLOPT_NOBODY => false, |
|
106 | + CURLOPT_NOBODY => FALSE, |
|
107 | 107 | |
108 | 108 | // make sure we're GET |
109 | - CURLOPT_HTTPGET => true, |
|
109 | + CURLOPT_HTTPGET => TRUE, |
|
110 | 110 | |
111 | 111 | // set the URL |
112 | 112 | CURLOPT_URL => $url, |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
126 | 126 | } |
127 | 127 | |
128 | - public function performHeadRequest($url, $timeout = false) |
|
128 | + public function performHeadRequest($url, $timeout = FALSE) |
|
129 | 129 | { |
130 | 130 | // check the timeout value |
131 | - if ($timeout === false || $timeout <= 0.0) |
|
131 | + if ($timeout === FALSE || $timeout <= 0.0) |
|
132 | 132 | { |
133 | 133 | // use the default timeout |
134 | 134 | $timeout = $this->getDefaultTimeout(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // set curl HEAD options |
138 | 138 | curl_setopt_array($this->_curl, array( |
139 | 139 | // this both sets the method to HEAD and says not to return a body |
140 | - CURLOPT_NOBODY => true, |
|
140 | + CURLOPT_NOBODY => TRUE, |
|
141 | 141 | |
142 | 142 | // set the URL |
143 | 143 | CURLOPT_URL => $url, |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
157 | 157 | } |
158 | 158 | |
159 | - public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
159 | + public function performPostRequest($url, $postData, $contentType, $timeout = FALSE) |
|
160 | 160 | { |
161 | 161 | // check the timeout value |
162 | - if ($timeout === false || $timeout <= 0.0) |
|
162 | + if ($timeout === FALSE || $timeout <= 0.0) |
|
163 | 163 | { |
164 | 164 | // use the default timeout |
165 | 165 | $timeout = $this->getDefaultTimeout(); |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | // set curl POST options |
169 | 169 | curl_setopt_array($this->_curl, array( |
170 | 170 | // make sure we're returning the body |
171 | - CURLOPT_NOBODY => false, |
|
171 | + CURLOPT_NOBODY => FALSE, |
|
172 | 172 | |
173 | 173 | // make sure we're POST |
174 | - CURLOPT_POST => true, |
|
174 | + CURLOPT_POST => TRUE, |
|
175 | 175 | |
176 | 176 | // set the URL |
177 | 177 | CURLOPT_URL => $url, |
@@ -46,151 +46,151 @@ |
||
46 | 46 | */ |
47 | 47 | class Apache_Solr_HttpTransport_CurlNoReuse extends Apache_Solr_HttpTransport_Abstract |
48 | 48 | { |
49 | - /** |
|
50 | - * SVN Revision meta data for this class |
|
51 | - */ |
|
52 | - const SVN_REVISION = '$Revision:$'; |
|
53 | - |
|
54 | - /** |
|
55 | - * SVN ID meta data for this class |
|
56 | - */ |
|
57 | - const SVN_ID = '$Id:$'; |
|
58 | - |
|
59 | - public function performGetRequest($url, $timeout = false) |
|
60 | - { |
|
61 | - // check the timeout value |
|
62 | - if ($timeout === false || $timeout <= 0.0) |
|
63 | - { |
|
64 | - // use the default timeout |
|
65 | - $timeout = $this->getDefaultTimeout(); |
|
66 | - } |
|
49 | + /** |
|
50 | + * SVN Revision meta data for this class |
|
51 | + */ |
|
52 | + const SVN_REVISION = '$Revision:$'; |
|
53 | + |
|
54 | + /** |
|
55 | + * SVN ID meta data for this class |
|
56 | + */ |
|
57 | + const SVN_ID = '$Id:$'; |
|
58 | + |
|
59 | + public function performGetRequest($url, $timeout = false) |
|
60 | + { |
|
61 | + // check the timeout value |
|
62 | + if ($timeout === false || $timeout <= 0.0) |
|
63 | + { |
|
64 | + // use the default timeout |
|
65 | + $timeout = $this->getDefaultTimeout(); |
|
66 | + } |
|
67 | 67 | |
68 | - $curl = curl_init(); |
|
68 | + $curl = curl_init(); |
|
69 | 69 | |
70 | - // set curl GET options |
|
71 | - curl_setopt_array($curl, array( |
|
72 | - // return the response body from curl_exec |
|
73 | - CURLOPT_RETURNTRANSFER => true, |
|
70 | + // set curl GET options |
|
71 | + curl_setopt_array($curl, array( |
|
72 | + // return the response body from curl_exec |
|
73 | + CURLOPT_RETURNTRANSFER => true, |
|
74 | 74 | |
75 | - // get the output as binary data |
|
76 | - CURLOPT_BINARYTRANSFER => true, |
|
75 | + // get the output as binary data |
|
76 | + CURLOPT_BINARYTRANSFER => true, |
|
77 | 77 | |
78 | - // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
79 | - CURLOPT_HEADER => false, |
|
78 | + // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
79 | + CURLOPT_HEADER => false, |
|
80 | 80 | |
81 | - // set the URL |
|
82 | - CURLOPT_URL => $url, |
|
81 | + // set the URL |
|
82 | + CURLOPT_URL => $url, |
|
83 | 83 | |
84 | - // set the timeout |
|
85 | - CURLOPT_TIMEOUT => $timeout |
|
86 | - )); |
|
84 | + // set the timeout |
|
85 | + CURLOPT_TIMEOUT => $timeout |
|
86 | + )); |
|
87 | 87 | |
88 | - // make the request |
|
89 | - $responseBody = curl_exec($curl); |
|
88 | + // make the request |
|
89 | + $responseBody = curl_exec($curl); |
|
90 | 90 | |
91 | - // get info from the transfer |
|
92 | - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
93 | - $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); |
|
91 | + // get info from the transfer |
|
92 | + $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
93 | + $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); |
|
94 | 94 | |
95 | - // close our curl session - we're done with it |
|
96 | - curl_close($curl); |
|
97 | - |
|
98 | - return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
99 | - } |
|
100 | - |
|
101 | - public function performHeadRequest($url, $timeout = false) |
|
102 | - { |
|
103 | - // check the timeout value |
|
104 | - if ($timeout === false || $timeout <= 0.0) |
|
105 | - { |
|
106 | - // use the default timeout |
|
107 | - $timeout = $this->getDefaultTimeout(); |
|
108 | - } |
|
95 | + // close our curl session - we're done with it |
|
96 | + curl_close($curl); |
|
97 | + |
|
98 | + return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
99 | + } |
|
100 | + |
|
101 | + public function performHeadRequest($url, $timeout = false) |
|
102 | + { |
|
103 | + // check the timeout value |
|
104 | + if ($timeout === false || $timeout <= 0.0) |
|
105 | + { |
|
106 | + // use the default timeout |
|
107 | + $timeout = $this->getDefaultTimeout(); |
|
108 | + } |
|
109 | 109 | |
110 | - $curl = curl_init(); |
|
110 | + $curl = curl_init(); |
|
111 | 111 | |
112 | - // set curl HEAD options |
|
113 | - curl_setopt_array($curl, array( |
|
114 | - // return the response body from curl_exec |
|
115 | - CURLOPT_RETURNTRANSFER => true, |
|
112 | + // set curl HEAD options |
|
113 | + curl_setopt_array($curl, array( |
|
114 | + // return the response body from curl_exec |
|
115 | + CURLOPT_RETURNTRANSFER => true, |
|
116 | 116 | |
117 | - // get the output as binary data |
|
118 | - CURLOPT_BINARYTRANSFER => true, |
|
117 | + // get the output as binary data |
|
118 | + CURLOPT_BINARYTRANSFER => true, |
|
119 | 119 | |
120 | - // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
121 | - CURLOPT_HEADER => false, |
|
120 | + // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
121 | + CURLOPT_HEADER => false, |
|
122 | 122 | |
123 | - // this both sets the method to HEAD and says not to return a body |
|
124 | - CURLOPT_NOBODY => true, |
|
123 | + // this both sets the method to HEAD and says not to return a body |
|
124 | + CURLOPT_NOBODY => true, |
|
125 | 125 | |
126 | - // set the URL |
|
127 | - CURLOPT_URL => $url, |
|
126 | + // set the URL |
|
127 | + CURLOPT_URL => $url, |
|
128 | 128 | |
129 | - // set the timeout |
|
130 | - CURLOPT_TIMEOUT => $timeout |
|
131 | - )); |
|
129 | + // set the timeout |
|
130 | + CURLOPT_TIMEOUT => $timeout |
|
131 | + )); |
|
132 | 132 | |
133 | - // make the request |
|
134 | - $responseBody = curl_exec($curl); |
|
133 | + // make the request |
|
134 | + $responseBody = curl_exec($curl); |
|
135 | 135 | |
136 | - // get info from the transfer |
|
137 | - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
138 | - $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); |
|
136 | + // get info from the transfer |
|
137 | + $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
138 | + $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); |
|
139 | 139 | |
140 | - // close our curl session - we're done with it |
|
141 | - curl_close($curl); |
|
142 | - |
|
143 | - return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
144 | - } |
|
145 | - |
|
146 | - public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
147 | - { |
|
148 | - // check the timeout value |
|
149 | - if ($timeout === false || $timeout <= 0.0) |
|
150 | - { |
|
151 | - // use the default timeout |
|
152 | - $timeout = $this->getDefaultTimeout(); |
|
153 | - } |
|
154 | - |
|
155 | - $curl = curl_init(); |
|
140 | + // close our curl session - we're done with it |
|
141 | + curl_close($curl); |
|
142 | + |
|
143 | + return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
144 | + } |
|
145 | + |
|
146 | + public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
147 | + { |
|
148 | + // check the timeout value |
|
149 | + if ($timeout === false || $timeout <= 0.0) |
|
150 | + { |
|
151 | + // use the default timeout |
|
152 | + $timeout = $this->getDefaultTimeout(); |
|
153 | + } |
|
154 | + |
|
155 | + $curl = curl_init(); |
|
156 | 156 | |
157 | - // set curl POST options |
|
158 | - curl_setopt_array($curl, array( |
|
159 | - // return the response body from curl_exec |
|
160 | - CURLOPT_RETURNTRANSFER => true, |
|
157 | + // set curl POST options |
|
158 | + curl_setopt_array($curl, array( |
|
159 | + // return the response body from curl_exec |
|
160 | + CURLOPT_RETURNTRANSFER => true, |
|
161 | 161 | |
162 | - // get the output as binary data |
|
163 | - CURLOPT_BINARYTRANSFER => true, |
|
162 | + // get the output as binary data |
|
163 | + CURLOPT_BINARYTRANSFER => true, |
|
164 | 164 | |
165 | - // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
166 | - CURLOPT_HEADER => false, |
|
165 | + // we do not need the headers in the output, we get everything we need from curl_getinfo |
|
166 | + CURLOPT_HEADER => false, |
|
167 | 167 | |
168 | - // make sure we're POST |
|
169 | - CURLOPT_POST => true, |
|
168 | + // make sure we're POST |
|
169 | + CURLOPT_POST => true, |
|
170 | 170 | |
171 | - // set the URL |
|
172 | - CURLOPT_URL => $url, |
|
171 | + // set the URL |
|
172 | + CURLOPT_URL => $url, |
|
173 | 173 | |
174 | - // set the post data |
|
175 | - CURLOPT_POSTFIELDS => $postData, |
|
174 | + // set the post data |
|
175 | + CURLOPT_POSTFIELDS => $postData, |
|
176 | 176 | |
177 | - // set the content type |
|
178 | - CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"), |
|
177 | + // set the content type |
|
178 | + CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"), |
|
179 | 179 | |
180 | - // set the timeout |
|
181 | - CURLOPT_TIMEOUT => $timeout |
|
182 | - )); |
|
180 | + // set the timeout |
|
181 | + CURLOPT_TIMEOUT => $timeout |
|
182 | + )); |
|
183 | 183 | |
184 | - // make the request |
|
185 | - $responseBody = curl_exec($curl); |
|
184 | + // make the request |
|
185 | + $responseBody = curl_exec($curl); |
|
186 | 186 | |
187 | - // get info from the transfer |
|
188 | - $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
189 | - $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); |
|
187 | + // get info from the transfer |
|
188 | + $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
|
189 | + $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); |
|
190 | 190 | |
191 | - // close our curl session - we're done with it |
|
192 | - curl_close($curl); |
|
191 | + // close our curl session - we're done with it |
|
192 | + curl_close($curl); |
|
193 | 193 | |
194 | - return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
195 | - } |
|
194 | + return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
|
195 | + } |
|
196 | 196 | } |
197 | 197 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | |
39 | 39 | // Require Apache_Solr_HttpTransport_Abstract |
40 | -require_once(dirname(__FILE__) . '/Abstract.php'); |
|
40 | +require_once(dirname(__FILE__).'/Abstract.php'); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * An alternative Curl HTTP transport that opens and closes a curl session for |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $curl = curl_init(); |
69 | 69 | |
70 | 70 | // set curl GET options |
71 | - curl_setopt_array($curl, array( |
|
71 | + curl_setopt_array($curl, array ( |
|
72 | 72 | // return the response body from curl_exec |
73 | 73 | CURLOPT_RETURNTRANSFER => true, |
74 | 74 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $curl = curl_init(); |
111 | 111 | |
112 | 112 | // set curl HEAD options |
113 | - curl_setopt_array($curl, array( |
|
113 | + curl_setopt_array($curl, array ( |
|
114 | 114 | // return the response body from curl_exec |
115 | 115 | CURLOPT_RETURNTRANSFER => true, |
116 | 116 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $curl = curl_init(); |
156 | 156 | |
157 | 157 | // set curl POST options |
158 | - curl_setopt_array($curl, array( |
|
158 | + curl_setopt_array($curl, array ( |
|
159 | 159 | // return the response body from curl_exec |
160 | 160 | CURLOPT_RETURNTRANSFER => true, |
161 | 161 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | CURLOPT_POSTFIELDS => $postData, |
176 | 176 | |
177 | 177 | // set the content type |
178 | - CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"), |
|
178 | + CURLOPT_HTTPHEADER => array ("Content-Type: {$contentType}"), |
|
179 | 179 | |
180 | 180 | // set the timeout |
181 | 181 | CURLOPT_TIMEOUT => $timeout |
@@ -44,8 +44,7 @@ discard block |
||
44 | 44 | * every request. This isn't the recommended way to use curl, but some version of |
45 | 45 | * PHP have memory issues. |
46 | 46 | */ |
47 | -class Apache_Solr_HttpTransport_CurlNoReuse extends Apache_Solr_HttpTransport_Abstract |
|
48 | -{ |
|
47 | +class Apache_Solr_HttpTransport_CurlNoReuse extends Apache_Solr_HttpTransport_Abstract { |
|
49 | 48 | /** |
50 | 49 | * SVN Revision meta data for this class |
51 | 50 | */ |
@@ -56,11 +55,9 @@ discard block |
||
56 | 55 | */ |
57 | 56 | const SVN_ID = '$Id:$'; |
58 | 57 | |
59 | - public function performGetRequest($url, $timeout = false) |
|
60 | - { |
|
58 | + public function performGetRequest($url, $timeout = false) { |
|
61 | 59 | // check the timeout value |
62 | - if ($timeout === false || $timeout <= 0.0) |
|
63 | - { |
|
60 | + if ($timeout === false || $timeout <= 0.0) { |
|
64 | 61 | // use the default timeout |
65 | 62 | $timeout = $this->getDefaultTimeout(); |
66 | 63 | } |
@@ -98,11 +95,9 @@ discard block |
||
98 | 95 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
99 | 96 | } |
100 | 97 | |
101 | - public function performHeadRequest($url, $timeout = false) |
|
102 | - { |
|
98 | + public function performHeadRequest($url, $timeout = false) { |
|
103 | 99 | // check the timeout value |
104 | - if ($timeout === false || $timeout <= 0.0) |
|
105 | - { |
|
100 | + if ($timeout === false || $timeout <= 0.0) { |
|
106 | 101 | // use the default timeout |
107 | 102 | $timeout = $this->getDefaultTimeout(); |
108 | 103 | } |
@@ -143,11 +138,9 @@ discard block |
||
143 | 138 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
144 | 139 | } |
145 | 140 | |
146 | - public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
147 | - { |
|
141 | + public function performPostRequest($url, $postData, $contentType, $timeout = false) { |
|
148 | 142 | // check the timeout value |
149 | - if ($timeout === false || $timeout <= 0.0) |
|
150 | - { |
|
143 | + if ($timeout === false || $timeout <= 0.0) { |
|
151 | 144 | // use the default timeout |
152 | 145 | $timeout = $this->getDefaultTimeout(); |
153 | 146 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | */ |
57 | 57 | const SVN_ID = '$Id:$'; |
58 | 58 | |
59 | - public function performGetRequest($url, $timeout = false) |
|
59 | + public function performGetRequest($url, $timeout = FALSE) |
|
60 | 60 | { |
61 | 61 | // check the timeout value |
62 | - if ($timeout === false || $timeout <= 0.0) |
|
62 | + if ($timeout === FALSE || $timeout <= 0.0) |
|
63 | 63 | { |
64 | 64 | // use the default timeout |
65 | 65 | $timeout = $this->getDefaultTimeout(); |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | // set curl GET options |
71 | 71 | curl_setopt_array($curl, array( |
72 | 72 | // return the response body from curl_exec |
73 | - CURLOPT_RETURNTRANSFER => true, |
|
73 | + CURLOPT_RETURNTRANSFER => TRUE, |
|
74 | 74 | |
75 | 75 | // get the output as binary data |
76 | - CURLOPT_BINARYTRANSFER => true, |
|
76 | + CURLOPT_BINARYTRANSFER => TRUE, |
|
77 | 77 | |
78 | 78 | // we do not need the headers in the output, we get everything we need from curl_getinfo |
79 | - CURLOPT_HEADER => false, |
|
79 | + CURLOPT_HEADER => FALSE, |
|
80 | 80 | |
81 | 81 | // set the URL |
82 | 82 | CURLOPT_URL => $url, |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
99 | 99 | } |
100 | 100 | |
101 | - public function performHeadRequest($url, $timeout = false) |
|
101 | + public function performHeadRequest($url, $timeout = FALSE) |
|
102 | 102 | { |
103 | 103 | // check the timeout value |
104 | - if ($timeout === false || $timeout <= 0.0) |
|
104 | + if ($timeout === FALSE || $timeout <= 0.0) |
|
105 | 105 | { |
106 | 106 | // use the default timeout |
107 | 107 | $timeout = $this->getDefaultTimeout(); |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | // set curl HEAD options |
113 | 113 | curl_setopt_array($curl, array( |
114 | 114 | // return the response body from curl_exec |
115 | - CURLOPT_RETURNTRANSFER => true, |
|
115 | + CURLOPT_RETURNTRANSFER => TRUE, |
|
116 | 116 | |
117 | 117 | // get the output as binary data |
118 | - CURLOPT_BINARYTRANSFER => true, |
|
118 | + CURLOPT_BINARYTRANSFER => TRUE, |
|
119 | 119 | |
120 | 120 | // we do not need the headers in the output, we get everything we need from curl_getinfo |
121 | - CURLOPT_HEADER => false, |
|
121 | + CURLOPT_HEADER => FALSE, |
|
122 | 122 | |
123 | 123 | // this both sets the method to HEAD and says not to return a body |
124 | - CURLOPT_NOBODY => true, |
|
124 | + CURLOPT_NOBODY => TRUE, |
|
125 | 125 | |
126 | 126 | // set the URL |
127 | 127 | CURLOPT_URL => $url, |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody); |
144 | 144 | } |
145 | 145 | |
146 | - public function performPostRequest($url, $postData, $contentType, $timeout = false) |
|
146 | + public function performPostRequest($url, $postData, $contentType, $timeout = FALSE) |
|
147 | 147 | { |
148 | 148 | // check the timeout value |
149 | - if ($timeout === false || $timeout <= 0.0) |
|
149 | + if ($timeout === FALSE || $timeout <= 0.0) |
|
150 | 150 | { |
151 | 151 | // use the default timeout |
152 | 152 | $timeout = $this->getDefaultTimeout(); |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | // set curl POST options |
158 | 158 | curl_setopt_array($curl, array( |
159 | 159 | // return the response body from curl_exec |
160 | - CURLOPT_RETURNTRANSFER => true, |
|
160 | + CURLOPT_RETURNTRANSFER => TRUE, |
|
161 | 161 | |
162 | 162 | // get the output as binary data |
163 | - CURLOPT_BINARYTRANSFER => true, |
|
163 | + CURLOPT_BINARYTRANSFER => TRUE, |
|
164 | 164 | |
165 | 165 | // we do not need the headers in the output, we get everything we need from curl_getinfo |
166 | - CURLOPT_HEADER => false, |
|
166 | + CURLOPT_HEADER => FALSE, |
|
167 | 167 | |
168 | 168 | // make sure we're POST |
169 | - CURLOPT_POST => true, |
|
169 | + CURLOPT_POST => TRUE, |
|
170 | 170 | |
171 | 171 | // set the URL |
172 | 172 | CURLOPT_URL => $url, |
@@ -42,48 +42,48 @@ |
||
42 | 42 | */ |
43 | 43 | abstract class Apache_Solr_HttpTransport_Abstract implements Apache_Solr_HttpTransport_Interface |
44 | 44 | { |
45 | - /** |
|
46 | - * Our default timeout value for requests that don't specify a timeout |
|
47 | - * |
|
48 | - * @var float |
|
49 | - */ |
|
50 | - private $_defaultTimeout = false; |
|
45 | + /** |
|
46 | + * Our default timeout value for requests that don't specify a timeout |
|
47 | + * |
|
48 | + * @var float |
|
49 | + */ |
|
50 | + private $_defaultTimeout = false; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Get the current default timeout setting (initially the default_socket_timeout ini setting) |
|
54 | - * in seconds |
|
55 | - * |
|
56 | - * @return float |
|
57 | - */ |
|
58 | - public function getDefaultTimeout() |
|
59 | - { |
|
60 | - // lazy load the default timeout from the ini settings |
|
61 | - if ($this->_defaultTimeout === false) |
|
62 | - { |
|
63 | - $this->_defaultTimeout = (int) ini_get('default_socket_timeout'); |
|
52 | + /** |
|
53 | + * Get the current default timeout setting (initially the default_socket_timeout ini setting) |
|
54 | + * in seconds |
|
55 | + * |
|
56 | + * @return float |
|
57 | + */ |
|
58 | + public function getDefaultTimeout() |
|
59 | + { |
|
60 | + // lazy load the default timeout from the ini settings |
|
61 | + if ($this->_defaultTimeout === false) |
|
62 | + { |
|
63 | + $this->_defaultTimeout = (int) ini_get('default_socket_timeout'); |
|
64 | 64 | |
65 | - // double check we didn't get 0 for a timeout |
|
66 | - if ($this->_defaultTimeout <= 0) |
|
67 | - { |
|
68 | - $this->_defaultTimeout = 60; |
|
69 | - } |
|
70 | - } |
|
65 | + // double check we didn't get 0 for a timeout |
|
66 | + if ($this->_defaultTimeout <= 0) |
|
67 | + { |
|
68 | + $this->_defaultTimeout = 60; |
|
69 | + } |
|
70 | + } |
|
71 | 71 | |
72 | - return $this->_defaultTimeout; |
|
73 | - } |
|
72 | + return $this->_defaultTimeout; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Set the current default timeout for all HTTP requests |
|
77 | - * |
|
78 | - * @param float $timeout |
|
79 | - */ |
|
80 | - public function setDefaultTimeout($timeout) |
|
81 | - { |
|
82 | - $timeout = (float) $timeout; |
|
75 | + /** |
|
76 | + * Set the current default timeout for all HTTP requests |
|
77 | + * |
|
78 | + * @param float $timeout |
|
79 | + */ |
|
80 | + public function setDefaultTimeout($timeout) |
|
81 | + { |
|
82 | + $timeout = (float) $timeout; |
|
83 | 83 | |
84 | - if ($timeout >= 0) |
|
85 | - { |
|
86 | - $this->_defaultTimeout = $timeout; |
|
87 | - } |
|
88 | - } |
|
84 | + if ($timeout >= 0) |
|
85 | + { |
|
86 | + $this->_defaultTimeout = $timeout; |
|
87 | + } |
|
88 | + } |
|
89 | 89 | } |
90 | 90 | \ No newline at end of file |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | * Convenience class that implements the transport implementation. Can be extended by |
41 | 41 | * real implementations to do some of the common book keeping |
42 | 42 | */ |
43 | -abstract class Apache_Solr_HttpTransport_Abstract implements Apache_Solr_HttpTransport_Interface |
|
44 | -{ |
|
43 | +abstract class Apache_Solr_HttpTransport_Abstract implements Apache_Solr_HttpTransport_Interface { |
|
45 | 44 | /** |
46 | 45 | * Our default timeout value for requests that don't specify a timeout |
47 | 46 | * |
@@ -55,16 +54,13 @@ discard block |
||
55 | 54 | * |
56 | 55 | * @return float |
57 | 56 | */ |
58 | - public function getDefaultTimeout() |
|
59 | - { |
|
57 | + public function getDefaultTimeout() { |
|
60 | 58 | // lazy load the default timeout from the ini settings |
61 | - if ($this->_defaultTimeout === false) |
|
62 | - { |
|
59 | + if ($this->_defaultTimeout === false) { |
|
63 | 60 | $this->_defaultTimeout = (int) ini_get('default_socket_timeout'); |
64 | 61 | |
65 | 62 | // double check we didn't get 0 for a timeout |
66 | - if ($this->_defaultTimeout <= 0) |
|
67 | - { |
|
63 | + if ($this->_defaultTimeout <= 0) { |
|
68 | 64 | $this->_defaultTimeout = 60; |
69 | 65 | } |
70 | 66 | } |
@@ -77,12 +73,10 @@ discard block |
||
77 | 73 | * |
78 | 74 | * @param float $timeout |
79 | 75 | */ |
80 | - public function setDefaultTimeout($timeout) |
|
81 | - { |
|
76 | + public function setDefaultTimeout($timeout) { |
|
82 | 77 | $timeout = (float) $timeout; |
83 | 78 | |
84 | - if ($timeout >= 0) |
|
85 | - { |
|
79 | + if ($timeout >= 0) { |
|
86 | 80 | $this->_defaultTimeout = $timeout; |
87 | 81 | } |
88 | 82 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @var float |
49 | 49 | */ |
50 | - private $_defaultTimeout = false; |
|
50 | + private $_defaultTimeout = FALSE; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Get the current default timeout setting (initially the default_socket_timeout ini setting) |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function getDefaultTimeout() |
59 | 59 | { |
60 | 60 | // lazy load the default timeout from the ini settings |
61 | - if ($this->_defaultTimeout === false) |
|
61 | + if ($this->_defaultTimeout === FALSE) |
|
62 | 62 | { |
63 | 63 | $this->_defaultTimeout = (int) ini_get('default_socket_timeout'); |
64 | 64 |
@@ -44,173 +44,173 @@ |
||
44 | 44 | */ |
45 | 45 | class Apache_Solr_HttpTransport_FileGetContents extends Apache_Solr_HttpTransport_Abstract |
46 | 46 | { |
47 | - /** |
|
48 | - * SVN Revision meta data for this class |
|
49 | - */ |
|
50 | - const SVN_REVISION = '$Revision: $'; |
|
51 | - |
|
52 | - /** |
|
53 | - * SVN ID meta data for this class |
|
54 | - */ |
|
55 | - const SVN_ID = '$Id: $'; |
|
47 | + /** |
|
48 | + * SVN Revision meta data for this class |
|
49 | + */ |
|
50 | + const SVN_REVISION = '$Revision: $'; |
|
51 | + |
|
52 | + /** |
|
53 | + * SVN ID meta data for this class |
|
54 | + */ |
|
55 | + const SVN_ID = '$Id: $'; |
|
56 | 56 | |
57 | - /** |
|
58 | - * Reusable stream context resources for GET and POST operations |
|
59 | - * |
|
60 | - * @var resource |
|
61 | - */ |
|
62 | - private $_getContext, $_headContext, $_postContext; |
|
57 | + /** |
|
58 | + * Reusable stream context resources for GET and POST operations |
|
59 | + * |
|
60 | + * @var resource |
|
61 | + */ |
|
62 | + private $_getContext, $_headContext, $_postContext; |
|
63 | 63 | |
64 | - /** |
|
65 | - * Initializes our reuseable get and post stream contexts |
|
66 | - */ |
|
67 | - public function __construct() |
|
68 | - { |
|
69 | - $this->_getContext = stream_context_create(); |
|
70 | - $this->_headContext = stream_context_create(); |
|
71 | - $this->_postContext = stream_context_create(); |
|
72 | - } |
|
73 | - |
|
74 | - public function performGetRequest($url, $timeout = false) |
|
75 | - { |
|
76 | - // set the timeout if specified |
|
77 | - if ($timeout !== FALSE && $timeout > 0.0) |
|
78 | - { |
|
79 | - // timeouts with file_get_contents seem to need |
|
80 | - // to be halved to work as expected |
|
81 | - $timeout = (float) $timeout / 2; |
|
82 | - |
|
83 | - stream_context_set_option($this->_getContext, 'http', 'timeout', $timeout); |
|
84 | - } |
|
85 | - else |
|
86 | - { |
|
87 | - // use the default timeout pulled from default_socket_timeout otherwise |
|
88 | - stream_context_set_option($this->_getContext, 'http', 'timeout', $this->getDefaultTimeout()); |
|
89 | - } |
|
90 | - |
|
91 | - // $http_response_headers will be updated by the call to file_get_contents later |
|
92 | - // see http://us.php.net/manual/en/wrappers.http.php for documentation |
|
93 | - // Unfortunately, it will still create a notice in analyzers if we don't set it here |
|
94 | - $http_response_header = null; |
|
95 | - $responseBody = @file_get_contents($url, false, $this->_getContext); |
|
64 | + /** |
|
65 | + * Initializes our reuseable get and post stream contexts |
|
66 | + */ |
|
67 | + public function __construct() |
|
68 | + { |
|
69 | + $this->_getContext = stream_context_create(); |
|
70 | + $this->_headContext = stream_context_create(); |
|
71 | + $this->_postContext = stream_context_create(); |
|
72 | + } |
|
73 | + |
|
74 | + public function performGetRequest($url, $timeout = false) |
|
75 | + { |
|
76 | + // set the timeout if specified |
|
77 | + if ($timeout !== FALSE && $timeout > 0.0) |
|
78 | + { |
|
79 | + // timeouts with file_get_contents seem to need |
|
80 | + // to be halved to work as expected |
|
81 | + $timeout = (float) $timeout / 2; |
|
82 | + |
|
83 | + stream_context_set_option($this->_getContext, 'http', 'timeout', $timeout); |
|
84 | + } |
|
85 | + else |
|
86 | + { |
|
87 | + // use the default timeout pulled from default_socket_timeout otherwise |
|
88 | + stream_context_set_option($this->_getContext, 'http', 'timeout', $this->getDefaultTimeout()); |
|
89 | + } |
|
90 | + |
|
91 | + // $http_response_headers will be updated by the call to file_get_contents later |
|
92 | + // see http://us.php.net/manual/en/wrappers.http.php for documentation |
|
93 | + // Unfortunately, it will still create a notice in analyzers if we don't set it here |
|
94 | + $http_response_header = null; |
|
95 | + $responseBody = @file_get_contents($url, false, $this->_getContext); |
|
96 | 96 | |
97 | - return $this->_getResponseFromParts($responseBody, $http_response_header); |
|
98 | - } |
|
99 | - |
|
100 | - public function performHeadRequest($url, $timeout = false) |
|
101 | - { |
|
102 | - stream_context_set_option($this->_headContext, array( |
|
103 | - 'http' => array( |
|
104 | - // set HTTP method |
|
105 | - 'method' => 'HEAD', |
|
106 | - |
|
107 | - // default timeout |
|
108 | - 'timeout' => $this->getDefaultTimeout() |
|
109 | - ) |
|
110 | - ) |
|
111 | - ); |
|
112 | - |
|
113 | - // set the timeout if specified |
|
114 | - if ($timeout !== FALSE && $timeout > 0.0) |
|
115 | - { |
|
116 | - // timeouts with file_get_contents seem to need |
|
117 | - // to be halved to work as expected |
|
118 | - $timeout = (float) $timeout / 2; |
|
119 | - |
|
120 | - stream_context_set_option($this->_headContext, 'http', 'timeout', $timeout); |
|
121 | - } |
|
97 | + return $this->_getResponseFromParts($responseBody, $http_response_header); |
|
98 | + } |
|
99 | + |
|
100 | + public function performHeadRequest($url, $timeout = false) |
|
101 | + { |
|
102 | + stream_context_set_option($this->_headContext, array( |
|
103 | + 'http' => array( |
|
104 | + // set HTTP method |
|
105 | + 'method' => 'HEAD', |
|
106 | + |
|
107 | + // default timeout |
|
108 | + 'timeout' => $this->getDefaultTimeout() |
|
109 | + ) |
|
110 | + ) |
|
111 | + ); |
|
112 | + |
|
113 | + // set the timeout if specified |
|
114 | + if ($timeout !== FALSE && $timeout > 0.0) |
|
115 | + { |
|
116 | + // timeouts with file_get_contents seem to need |
|
117 | + // to be halved to work as expected |
|
118 | + $timeout = (float) $timeout / 2; |
|
119 | + |
|
120 | + stream_context_set_option($this->_headContext, 'http', 'timeout', $timeout); |
|
121 | + } |
|
122 | 122 | |
123 | - // $http_response_headers will be updated by the call to file_get_contents later |
|
124 | - // see http://us.php.net/manual/en/wrappers.http.php for documentation |
|
125 | - // Unfortunately, it will still create a notice in analyzers if we don't set it here |
|
126 | - $http_response_header = null; |
|
127 | - $responseBody = @file_get_contents($url, false, $this->_headContext); |
|
128 | - |
|
129 | - return $this->_getResponseFromParts($responseBody, $http_response_header); |
|
130 | - } |
|
123 | + // $http_response_headers will be updated by the call to file_get_contents later |
|
124 | + // see http://us.php.net/manual/en/wrappers.http.php for documentation |
|
125 | + // Unfortunately, it will still create a notice in analyzers if we don't set it here |
|
126 | + $http_response_header = null; |
|
127 | + $responseBody = @file_get_contents($url, false, $this->_headContext); |
|
128 | + |
|
129 | + return $this->_getResponseFromParts($responseBody, $http_response_header); |
|
130 | + } |
|
131 | 131 | |
132 | - public function performPostRequest($url, $rawPost, $contentType, $timeout = false) |
|
133 | - { |
|
134 | - stream_context_set_option($this->_postContext, array( |
|
135 | - 'http' => array( |
|
136 | - // set HTTP method |
|
137 | - 'method' => 'POST', |
|
138 | - |
|
139 | - // Add our posted content type |
|
140 | - 'header' => "Content-Type: $contentType", |
|
141 | - |
|
142 | - // the posted content |
|
143 | - 'content' => $rawPost, |
|
144 | - |
|
145 | - // default timeout |
|
146 | - 'timeout' => $this->getDefaultTimeout() |
|
147 | - ) |
|
148 | - ) |
|
149 | - ); |
|
150 | - |
|
151 | - // set the timeout if specified |
|
152 | - if ($timeout !== FALSE && $timeout > 0.0) |
|
153 | - { |
|
154 | - // timeouts with file_get_contents seem to need |
|
155 | - // to be halved to work as expected |
|
156 | - $timeout = (float) $timeout / 2; |
|
157 | - |
|
158 | - stream_context_set_option($this->_postContext, 'http', 'timeout', $timeout); |
|
159 | - } |
|
160 | - |
|
161 | - // $http_response_header will be updated by the call to file_get_contents later |
|
162 | - // see http://us.php.net/manual/en/wrappers.http.php for documentation |
|
163 | - // Unfortunately, it will still create a notice in analyzers if we don't set it here |
|
164 | - $http_response_header = null; |
|
165 | - $responseBody = @file_get_contents($url, false, $this->_postContext); |
|
132 | + public function performPostRequest($url, $rawPost, $contentType, $timeout = false) |
|
133 | + { |
|
134 | + stream_context_set_option($this->_postContext, array( |
|
135 | + 'http' => array( |
|
136 | + // set HTTP method |
|
137 | + 'method' => 'POST', |
|
138 | + |
|
139 | + // Add our posted content type |
|
140 | + 'header' => "Content-Type: $contentType", |
|
141 | + |
|
142 | + // the posted content |
|
143 | + 'content' => $rawPost, |
|
144 | + |
|
145 | + // default timeout |
|
146 | + 'timeout' => $this->getDefaultTimeout() |
|
147 | + ) |
|
148 | + ) |
|
149 | + ); |
|
150 | + |
|
151 | + // set the timeout if specified |
|
152 | + if ($timeout !== FALSE && $timeout > 0.0) |
|
153 | + { |
|
154 | + // timeouts with file_get_contents seem to need |
|
155 | + // to be halved to work as expected |
|
156 | + $timeout = (float) $timeout / 2; |
|
157 | + |
|
158 | + stream_context_set_option($this->_postContext, 'http', 'timeout', $timeout); |
|
159 | + } |
|
160 | + |
|
161 | + // $http_response_header will be updated by the call to file_get_contents later |
|
162 | + // see http://us.php.net/manual/en/wrappers.http.php for documentation |
|
163 | + // Unfortunately, it will still create a notice in analyzers if we don't set it here |
|
164 | + $http_response_header = null; |
|
165 | + $responseBody = @file_get_contents($url, false, $this->_postContext); |
|
166 | 166 | |
167 | - // reset content of post context to reclaim memory |
|
168 | - stream_context_set_option($this->_postContext, 'http', 'content', ''); |
|
167 | + // reset content of post context to reclaim memory |
|
168 | + stream_context_set_option($this->_postContext, 'http', 'content', ''); |
|
169 | 169 | |
170 | - return $this->_getResponseFromParts($responseBody, $http_response_header); |
|
171 | - } |
|
170 | + return $this->_getResponseFromParts($responseBody, $http_response_header); |
|
171 | + } |
|
172 | 172 | |
173 | - private function _getResponseFromParts($rawResponse, $httpHeaders) |
|
174 | - { |
|
175 | - //Assume 0, false as defaults |
|
176 | - $status = 0; |
|
177 | - $contentType = false; |
|
178 | - |
|
179 | - //iterate through headers for real status, type, and encoding |
|
180 | - if (is_array($httpHeaders) && count($httpHeaders) > 0) |
|
181 | - { |
|
182 | - //look at the first headers for the HTTP status code |
|
183 | - //and message (errors are usually returned this way) |
|
184 | - // |
|
185 | - //HTTP 100 Continue response can also be returned before |
|
186 | - //the REAL status header, so we need look until we find |
|
187 | - //the last header starting with HTTP |
|
188 | - // |
|
189 | - //the spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1 |
|
190 | - // |
|
191 | - //Thanks to Daniel Andersson for pointing out this oversight |
|
192 | - while (isset($httpHeaders[0]) && substr($httpHeaders[0], 0, 4) == 'HTTP') |
|
193 | - { |
|
194 | - // we can do a intval on status line without the "HTTP/1.X " to get the code |
|
195 | - $status = intval(substr($httpHeaders[0], 9)); |
|
196 | - |
|
197 | - // remove this from the headers so we can check for more |
|
198 | - array_shift($httpHeaders); |
|
199 | - } |
|
200 | - |
|
201 | - //Look for the Content-Type response header and determine type |
|
202 | - //and encoding from it (if possible - such as 'Content-Type: text/plain; charset=UTF-8') |
|
203 | - foreach ($httpHeaders as $header) |
|
204 | - { |
|
205 | - // look for the header that starts appropriately |
|
206 | - if (strncasecmp($header, 'Content-Type:', 13) == 0) |
|
207 | - { |
|
208 | - $contentType = substr($header, 13); |
|
209 | - break; |
|
210 | - } |
|
211 | - } |
|
212 | - } |
|
173 | + private function _getResponseFromParts($rawResponse, $httpHeaders) |
|
174 | + { |
|
175 | + //Assume 0, false as defaults |
|
176 | + $status = 0; |
|
177 | + $contentType = false; |
|
178 | + |
|
179 | + //iterate through headers for real status, type, and encoding |
|
180 | + if (is_array($httpHeaders) && count($httpHeaders) > 0) |
|
181 | + { |
|
182 | + //look at the first headers for the HTTP status code |
|
183 | + //and message (errors are usually returned this way) |
|
184 | + // |
|
185 | + //HTTP 100 Continue response can also be returned before |
|
186 | + //the REAL status header, so we need look until we find |
|
187 | + //the last header starting with HTTP |
|
188 | + // |
|
189 | + //the spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1 |
|
190 | + // |
|
191 | + //Thanks to Daniel Andersson for pointing out this oversight |
|
192 | + while (isset($httpHeaders[0]) && substr($httpHeaders[0], 0, 4) == 'HTTP') |
|
193 | + { |
|
194 | + // we can do a intval on status line without the "HTTP/1.X " to get the code |
|
195 | + $status = intval(substr($httpHeaders[0], 9)); |
|
196 | + |
|
197 | + // remove this from the headers so we can check for more |
|
198 | + array_shift($httpHeaders); |
|
199 | + } |
|
200 | + |
|
201 | + //Look for the Content-Type response header and determine type |
|
202 | + //and encoding from it (if possible - such as 'Content-Type: text/plain; charset=UTF-8') |
|
203 | + foreach ($httpHeaders as $header) |
|
204 | + { |
|
205 | + // look for the header that starts appropriately |
|
206 | + if (strncasecmp($header, 'Content-Type:', 13) == 0) |
|
207 | + { |
|
208 | + $contentType = substr($header, 13); |
|
209 | + break; |
|
210 | + } |
|
211 | + } |
|
212 | + } |
|
213 | 213 | |
214 | - return new Apache_Solr_HttpTransport_Response($status, $contentType, $rawResponse); |
|
215 | - } |
|
214 | + return new Apache_Solr_HttpTransport_Response($status, $contentType, $rawResponse); |
|
215 | + } |
|
216 | 216 | } |
217 | 217 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | |
39 | 39 | // Require Apache_Solr_HttpTransport_Abstract |
40 | -require_once(dirname(__FILE__) . '/Abstract.php'); |
|
40 | +require_once(dirname(__FILE__).'/Abstract.php'); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * HTTP Transport implemenation that uses the builtin http URL wrappers and file_get_contents |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | |
100 | 100 | public function performHeadRequest($url, $timeout = false) |
101 | 101 | { |
102 | - stream_context_set_option($this->_headContext, array( |
|
103 | - 'http' => array( |
|
102 | + stream_context_set_option($this->_headContext, array ( |
|
103 | + 'http' => array ( |
|
104 | 104 | // set HTTP method |
105 | 105 | 'method' => 'HEAD', |
106 | 106 | |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | |
132 | 132 | public function performPostRequest($url, $rawPost, $contentType, $timeout = false) |
133 | 133 | { |
134 | - stream_context_set_option($this->_postContext, array( |
|
135 | - 'http' => array( |
|
134 | + stream_context_set_option($this->_postContext, array ( |
|
135 | + 'http' => array ( |
|
136 | 136 | // set HTTP method |
137 | 137 | 'method' => 'POST', |
138 | 138 |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * HTTP Transport implemenation that uses the builtin http URL wrappers and file_get_contents |
44 | 44 | */ |
45 | -class Apache_Solr_HttpTransport_FileGetContents extends Apache_Solr_HttpTransport_Abstract |
|
46 | -{ |
|
45 | +class Apache_Solr_HttpTransport_FileGetContents extends Apache_Solr_HttpTransport_Abstract { |
|
47 | 46 | /** |
48 | 47 | * SVN Revision meta data for this class |
49 | 48 | */ |
@@ -64,26 +63,21 @@ discard block |
||
64 | 63 | /** |
65 | 64 | * Initializes our reuseable get and post stream contexts |
66 | 65 | */ |
67 | - public function __construct() |
|
68 | - { |
|
66 | + public function __construct() { |
|
69 | 67 | $this->_getContext = stream_context_create(); |
70 | 68 | $this->_headContext = stream_context_create(); |
71 | 69 | $this->_postContext = stream_context_create(); |
72 | 70 | } |
73 | 71 | |
74 | - public function performGetRequest($url, $timeout = false) |
|
75 | - { |
|
72 | + public function performGetRequest($url, $timeout = false) { |
|
76 | 73 | // set the timeout if specified |
77 | - if ($timeout !== FALSE && $timeout > 0.0) |
|
78 | - { |
|
74 | + if ($timeout !== FALSE && $timeout > 0.0) { |
|
79 | 75 | // timeouts with file_get_contents seem to need |
80 | 76 | // to be halved to work as expected |
81 | 77 | $timeout = (float) $timeout / 2; |
82 | 78 | |
83 | 79 | stream_context_set_option($this->_getContext, 'http', 'timeout', $timeout); |
84 | - } |
|
85 | - else |
|
86 | - { |
|
80 | + } else { |
|
87 | 81 | // use the default timeout pulled from default_socket_timeout otherwise |
88 | 82 | stream_context_set_option($this->_getContext, 'http', 'timeout', $this->getDefaultTimeout()); |
89 | 83 | } |
@@ -97,8 +91,7 @@ discard block |
||
97 | 91 | return $this->_getResponseFromParts($responseBody, $http_response_header); |
98 | 92 | } |
99 | 93 | |
100 | - public function performHeadRequest($url, $timeout = false) |
|
101 | - { |
|
94 | + public function performHeadRequest($url, $timeout = false) { |
|
102 | 95 | stream_context_set_option($this->_headContext, array( |
103 | 96 | 'http' => array( |
104 | 97 | // set HTTP method |
@@ -111,8 +104,7 @@ discard block |
||
111 | 104 | ); |
112 | 105 | |
113 | 106 | // set the timeout if specified |
114 | - if ($timeout !== FALSE && $timeout > 0.0) |
|
115 | - { |
|
107 | + if ($timeout !== FALSE && $timeout > 0.0) { |
|
116 | 108 | // timeouts with file_get_contents seem to need |
117 | 109 | // to be halved to work as expected |
118 | 110 | $timeout = (float) $timeout / 2; |
@@ -129,8 +121,7 @@ discard block |
||
129 | 121 | return $this->_getResponseFromParts($responseBody, $http_response_header); |
130 | 122 | } |
131 | 123 | |
132 | - public function performPostRequest($url, $rawPost, $contentType, $timeout = false) |
|
133 | - { |
|
124 | + public function performPostRequest($url, $rawPost, $contentType, $timeout = false) { |
|
134 | 125 | stream_context_set_option($this->_postContext, array( |
135 | 126 | 'http' => array( |
136 | 127 | // set HTTP method |
@@ -149,8 +140,7 @@ discard block |
||
149 | 140 | ); |
150 | 141 | |
151 | 142 | // set the timeout if specified |
152 | - if ($timeout !== FALSE && $timeout > 0.0) |
|
153 | - { |
|
143 | + if ($timeout !== FALSE && $timeout > 0.0) { |
|
154 | 144 | // timeouts with file_get_contents seem to need |
155 | 145 | // to be halved to work as expected |
156 | 146 | $timeout = (float) $timeout / 2; |
@@ -170,15 +160,13 @@ discard block |
||
170 | 160 | return $this->_getResponseFromParts($responseBody, $http_response_header); |
171 | 161 | } |
172 | 162 | |
173 | - private function _getResponseFromParts($rawResponse, $httpHeaders) |
|
174 | - { |
|
163 | + private function _getResponseFromParts($rawResponse, $httpHeaders) { |
|
175 | 164 | //Assume 0, false as defaults |
176 | 165 | $status = 0; |
177 | 166 | $contentType = false; |
178 | 167 | |
179 | 168 | //iterate through headers for real status, type, and encoding |
180 | - if (is_array($httpHeaders) && count($httpHeaders) > 0) |
|
181 | - { |
|
169 | + if (is_array($httpHeaders) && count($httpHeaders) > 0) { |
|
182 | 170 | //look at the first headers for the HTTP status code |
183 | 171 | //and message (errors are usually returned this way) |
184 | 172 | // |
@@ -189,8 +177,7 @@ discard block |
||
189 | 177 | //the spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1 |
190 | 178 | // |
191 | 179 | //Thanks to Daniel Andersson for pointing out this oversight |
192 | - while (isset($httpHeaders[0]) && substr($httpHeaders[0], 0, 4) == 'HTTP') |
|
193 | - { |
|
180 | + while (isset($httpHeaders[0]) && substr($httpHeaders[0], 0, 4) == 'HTTP') { |
|
194 | 181 | // we can do a intval on status line without the "HTTP/1.X " to get the code |
195 | 182 | $status = intval(substr($httpHeaders[0], 9)); |
196 | 183 | |
@@ -200,11 +187,9 @@ discard block |
||
200 | 187 | |
201 | 188 | //Look for the Content-Type response header and determine type |
202 | 189 | //and encoding from it (if possible - such as 'Content-Type: text/plain; charset=UTF-8') |
203 | - foreach ($httpHeaders as $header) |
|
204 | - { |
|
190 | + foreach ($httpHeaders as $header) { |
|
205 | 191 | // look for the header that starts appropriately |
206 | - if (strncasecmp($header, 'Content-Type:', 13) == 0) |
|
207 | - { |
|
192 | + if (strncasecmp($header, 'Content-Type:', 13) == 0) { |
|
208 | 193 | $contentType = substr($header, 13); |
209 | 194 | break; |
210 | 195 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->_postContext = stream_context_create(); |
72 | 72 | } |
73 | 73 | |
74 | - public function performGetRequest($url, $timeout = false) |
|
74 | + public function performGetRequest($url, $timeout = FALSE) |
|
75 | 75 | { |
76 | 76 | // set the timeout if specified |
77 | 77 | if ($timeout !== FALSE && $timeout > 0.0) |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | // $http_response_headers will be updated by the call to file_get_contents later |
92 | 92 | // see http://us.php.net/manual/en/wrappers.http.php for documentation |
93 | 93 | // Unfortunately, it will still create a notice in analyzers if we don't set it here |
94 | - $http_response_header = null; |
|
95 | - $responseBody = @file_get_contents($url, false, $this->_getContext); |
|
94 | + $http_response_header = NULL; |
|
95 | + $responseBody = @file_get_contents($url, FALSE, $this->_getContext); |
|
96 | 96 | |
97 | 97 | return $this->_getResponseFromParts($responseBody, $http_response_header); |
98 | 98 | } |
99 | 99 | |
100 | - public function performHeadRequest($url, $timeout = false) |
|
100 | + public function performHeadRequest($url, $timeout = FALSE) |
|
101 | 101 | { |
102 | 102 | stream_context_set_option($this->_headContext, array( |
103 | 103 | 'http' => array( |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | // $http_response_headers will be updated by the call to file_get_contents later |
124 | 124 | // see http://us.php.net/manual/en/wrappers.http.php for documentation |
125 | 125 | // Unfortunately, it will still create a notice in analyzers if we don't set it here |
126 | - $http_response_header = null; |
|
127 | - $responseBody = @file_get_contents($url, false, $this->_headContext); |
|
126 | + $http_response_header = NULL; |
|
127 | + $responseBody = @file_get_contents($url, FALSE, $this->_headContext); |
|
128 | 128 | |
129 | 129 | return $this->_getResponseFromParts($responseBody, $http_response_header); |
130 | 130 | } |
131 | 131 | |
132 | - public function performPostRequest($url, $rawPost, $contentType, $timeout = false) |
|
132 | + public function performPostRequest($url, $rawPost, $contentType, $timeout = FALSE) |
|
133 | 133 | { |
134 | 134 | stream_context_set_option($this->_postContext, array( |
135 | 135 | 'http' => array( |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | // $http_response_header will be updated by the call to file_get_contents later |
162 | 162 | // see http://us.php.net/manual/en/wrappers.http.php for documentation |
163 | 163 | // Unfortunately, it will still create a notice in analyzers if we don't set it here |
164 | - $http_response_header = null; |
|
165 | - $responseBody = @file_get_contents($url, false, $this->_postContext); |
|
164 | + $http_response_header = NULL; |
|
165 | + $responseBody = @file_get_contents($url, FALSE, $this->_postContext); |
|
166 | 166 | |
167 | 167 | // reset content of post context to reclaim memory |
168 | 168 | stream_context_set_option($this->_postContext, 'http', 'content', ''); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | { |
175 | 175 | //Assume 0, false as defaults |
176 | 176 | $status = 0; |
177 | - $contentType = false; |
|
177 | + $contentType = FALSE; |
|
178 | 178 | |
179 | 179 | //iterate through headers for real status, type, and encoding |
180 | 180 | if (is_array($httpHeaders) && count($httpHeaders) > 0) |
@@ -19,265 +19,265 @@ |
||
19 | 19 | */ |
20 | 20 | class ext_update { |
21 | 21 | |
22 | - /** |
|
23 | - * This holds the output ready to return |
|
24 | - * |
|
25 | - * @var string |
|
26 | - * @access protected |
|
27 | - */ |
|
28 | - protected $content = ''; |
|
22 | + /** |
|
23 | + * This holds the output ready to return |
|
24 | + * |
|
25 | + * @var string |
|
26 | + * @access protected |
|
27 | + */ |
|
28 | + protected $content = ''; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Triggers the update option in the extension manager |
|
32 | - * |
|
33 | - * @access public |
|
34 | - * |
|
35 | - * @return boolean Should the update option be shown? |
|
36 | - */ |
|
37 | - public function access() { |
|
30 | + /** |
|
31 | + * Triggers the update option in the extension manager |
|
32 | + * |
|
33 | + * @access public |
|
34 | + * |
|
35 | + * @return boolean Should the update option be shown? |
|
36 | + */ |
|
37 | + public function access() { |
|
38 | 38 | |
39 | - if (count($this->getMetadataConfig())) { |
|
39 | + if (count($this->getMetadataConfig())) { |
|
40 | 40 | |
41 | - return TRUE; |
|
41 | + return TRUE; |
|
42 | 42 | |
43 | - } else if ($this->oldIndexRelatedTableNames()) { |
|
43 | + } else if ($this->oldIndexRelatedTableNames()) { |
|
44 | 44 | |
45 | - return TRUE; |
|
45 | + return TRUE; |
|
46 | 46 | |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - return FALSE; |
|
49 | + return FALSE; |
|
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Get all outdated metadata configuration records |
|
55 | - * |
|
56 | - * @access protected |
|
57 | - * |
|
58 | - * @return array Array of UIDs of outdated records |
|
59 | - */ |
|
60 | - protected function getMetadataConfig() { |
|
53 | + /** |
|
54 | + * Get all outdated metadata configuration records |
|
55 | + * |
|
56 | + * @access protected |
|
57 | + * |
|
58 | + * @return array Array of UIDs of outdated records |
|
59 | + */ |
|
60 | + protected function getMetadataConfig() { |
|
61 | 61 | |
62 | - $uids = array (); |
|
62 | + $uids = array (); |
|
63 | 63 | |
64 | - // check if tx_dlf_metadata.xpath exists anyhow |
|
65 | - $fieldsInDatabase = $GLOBALS['TYPO3_DB']->admin_get_fields('tx_dlf_metadata'); |
|
64 | + // check if tx_dlf_metadata.xpath exists anyhow |
|
65 | + $fieldsInDatabase = $GLOBALS['TYPO3_DB']->admin_get_fields('tx_dlf_metadata'); |
|
66 | 66 | |
67 | - if (! in_array('xpath', array_keys($fieldsInDatabase))) { |
|
67 | + if (! in_array('xpath', array_keys($fieldsInDatabase))) { |
|
68 | 68 | |
69 | - return $uids; |
|
69 | + return $uids; |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - // Get all records with outdated configuration. |
|
74 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
75 | - 'tx_dlf_metadata.uid AS uid', |
|
76 | - 'tx_dlf_metadata', |
|
77 | - 'tx_dlf_metadata.format=0 AND NOT tx_dlf_metadata.xpath=\'\''.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
78 | - '', |
|
79 | - '', |
|
80 | - '' |
|
81 | - ); |
|
73 | + // Get all records with outdated configuration. |
|
74 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
75 | + 'tx_dlf_metadata.uid AS uid', |
|
76 | + 'tx_dlf_metadata', |
|
77 | + 'tx_dlf_metadata.format=0 AND NOT tx_dlf_metadata.xpath=\'\''.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
78 | + '', |
|
79 | + '', |
|
80 | + '' |
|
81 | + ); |
|
82 | 82 | |
83 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
83 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
84 | 84 | |
85 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
85 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
86 | 86 | |
87 | - $uids[] = intval($resArray['uid']); |
|
87 | + $uids[] = intval($resArray['uid']); |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | - return $uids; |
|
93 | + return $uids; |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * The main method of the class |
|
99 | - * |
|
100 | - * @access public |
|
101 | - * |
|
102 | - * @return string The content that is displayed on the website |
|
103 | - */ |
|
104 | - public function main() { |
|
97 | + /** |
|
98 | + * The main method of the class |
|
99 | + * |
|
100 | + * @access public |
|
101 | + * |
|
102 | + * @return string The content that is displayed on the website |
|
103 | + */ |
|
104 | + public function main() { |
|
105 | 105 | |
106 | - // Load localization file. |
|
107 | - $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml'); |
|
106 | + // Load localization file. |
|
107 | + $GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml'); |
|
108 | 108 | |
109 | - // Update the metadata configuration. |
|
110 | - if (count($this->getMetadataConfig())) { |
|
111 | - $this->updateMetadataConfig(); |
|
112 | - } |
|
109 | + // Update the metadata configuration. |
|
110 | + if (count($this->getMetadataConfig())) { |
|
111 | + $this->updateMetadataConfig(); |
|
112 | + } |
|
113 | 113 | |
114 | - if ($this->oldIndexRelatedTableNames()) { |
|
114 | + if ($this->oldIndexRelatedTableNames()) { |
|
115 | 115 | |
116 | - $this->renameIndexRelatedColumns(); |
|
116 | + $this->renameIndexRelatedColumns(); |
|
117 | 117 | |
118 | - } |
|
118 | + } |
|
119 | 119 | |
120 | - return $this->content; |
|
120 | + return $this->content; |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * Check for old index related colums |
|
126 | - * |
|
127 | - * @access protected |
|
128 | - * |
|
129 | - * @return boolean true if old index related columns exist |
|
130 | - */ |
|
131 | - protected function oldIndexRelatedTableNames() { |
|
124 | + /** |
|
125 | + * Check for old index related colums |
|
126 | + * |
|
127 | + * @access protected |
|
128 | + * |
|
129 | + * @return boolean true if old index related columns exist |
|
130 | + */ |
|
131 | + protected function oldIndexRelatedTableNames() { |
|
132 | 132 | |
133 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
134 | - 'column_name', |
|
135 | - 'INFORMATION_SCHEMA.COLUMNS', |
|
136 | - 'TABLE_NAME = "tx_dlf_metadata"', |
|
137 | - '', |
|
138 | - '', |
|
139 | - '' |
|
140 | - ); |
|
133 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
134 | + 'column_name', |
|
135 | + 'INFORMATION_SCHEMA.COLUMNS', |
|
136 | + 'TABLE_NAME = "tx_dlf_metadata"', |
|
137 | + '', |
|
138 | + '', |
|
139 | + '' |
|
140 | + ); |
|
141 | 141 | |
142 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
142 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
143 | 143 | |
144 | - if($resArray['column_name'] == 'tokenized' |
|
145 | - || $resArray['column_name'] == 'stored' |
|
146 | - || $resArray['column_name'] == 'indexed' |
|
147 | - || $resArray['column_name'] == 'boost' |
|
148 | - || $resArray['column_name'] == 'autocomplete') { |
|
144 | + if($resArray['column_name'] == 'tokenized' |
|
145 | + || $resArray['column_name'] == 'stored' |
|
146 | + || $resArray['column_name'] == 'indexed' |
|
147 | + || $resArray['column_name'] == 'boost' |
|
148 | + || $resArray['column_name'] == 'autocomplete') { |
|
149 | 149 | |
150 | - return TRUE; |
|
150 | + return TRUE; |
|
151 | 151 | |
152 | - } |
|
152 | + } |
|
153 | 153 | |
154 | - } |
|
154 | + } |
|
155 | 155 | |
156 | - } |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * Copy the data of the old index related columns to the new columns |
|
160 | - * |
|
161 | - * @access protected |
|
162 | - * |
|
163 | - * @return void |
|
164 | - */ |
|
165 | - protected function renameIndexRelatedColumns() { |
|
158 | + /** |
|
159 | + * Copy the data of the old index related columns to the new columns |
|
160 | + * |
|
161 | + * @access protected |
|
162 | + * |
|
163 | + * @return void |
|
164 | + */ |
|
165 | + protected function renameIndexRelatedColumns() { |
|
166 | 166 | |
167 | - $sqlQuery = "UPDATE tx_dlf_metadata SET `index_tokenized` = `tokenized` |
|
167 | + $sqlQuery = "UPDATE tx_dlf_metadata SET `index_tokenized` = `tokenized` |
|
168 | 168 | , `index_stored` = `stored` |
169 | 169 | , `index_indexed` = `indexed` |
170 | 170 | , `index_boost` = `boost` |
171 | 171 | , `index_autocomplete` = `autocomplete`"; |
172 | 172 | |
173 | - // Copy the content of the old tables to the new ones |
|
174 | - $result = $GLOBALS['TYPO3_DB']->sql_query($sqlQuery); |
|
173 | + // Copy the content of the old tables to the new ones |
|
174 | + $result = $GLOBALS['TYPO3_DB']->sql_query($sqlQuery); |
|
175 | 175 | |
176 | - if($result) { |
|
176 | + if($result) { |
|
177 | 177 | |
178 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
179 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
180 | - $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsOkay', TRUE), |
|
181 | - $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE), |
|
182 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
183 | - FALSE |
|
184 | - ); |
|
178 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
179 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
180 | + $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsOkay', TRUE), |
|
181 | + $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE), |
|
182 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
183 | + FALSE |
|
184 | + ); |
|
185 | 185 | |
186 | - } else { |
|
186 | + } else { |
|
187 | 187 | |
188 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
189 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
190 | - $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsNotOkay', TRUE), |
|
191 | - $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE), |
|
192 | - \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
193 | - FALSE |
|
194 | - ); |
|
188 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
189 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
190 | + $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumnsNotOkay', TRUE), |
|
191 | + $GLOBALS['LANG']->getLL('update.copyIndexRelatedColumns', TRUE), |
|
192 | + \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
193 | + FALSE |
|
194 | + ); |
|
195 | 195 | |
196 | - } |
|
196 | + } |
|
197 | 197 | |
198 | - $this->content .= $message->render(); |
|
198 | + $this->content .= $message->render(); |
|
199 | 199 | |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - /** |
|
203 | - * Update all outdated metadata configuration records |
|
204 | - * |
|
205 | - * @access protected |
|
206 | - * |
|
207 | - * @return void |
|
208 | - */ |
|
209 | - protected function updateMetadataConfig() { |
|
202 | + /** |
|
203 | + * Update all outdated metadata configuration records |
|
204 | + * |
|
205 | + * @access protected |
|
206 | + * |
|
207 | + * @return void |
|
208 | + */ |
|
209 | + protected function updateMetadataConfig() { |
|
210 | 210 | |
211 | - $metadataUids = $this->getMetadataConfig(); |
|
211 | + $metadataUids = $this->getMetadataConfig(); |
|
212 | 212 | |
213 | - if (!empty($metadataUids)) { |
|
213 | + if (!empty($metadataUids)) { |
|
214 | 214 | |
215 | - $data = array (); |
|
215 | + $data = array (); |
|
216 | 216 | |
217 | - // Get all old metadata configuration records. |
|
218 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
219 | - 'tx_dlf_metadata.uid AS uid,tx_dlf_metadata.pid AS pid,tx_dlf_metadata.cruser_id AS cruser_id,tx_dlf_metadata.encoded AS encoded,tx_dlf_metadata.xpath AS xpath,tx_dlf_metadata.xpath_sorting AS xpath_sorting', |
|
220 | - 'tx_dlf_metadata', |
|
221 | - 'tx_dlf_metadata.uid IN ('.implode(',', $metadataUids).')'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
222 | - '', |
|
223 | - '', |
|
224 | - '' |
|
225 | - ); |
|
217 | + // Get all old metadata configuration records. |
|
218 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
219 | + 'tx_dlf_metadata.uid AS uid,tx_dlf_metadata.pid AS pid,tx_dlf_metadata.cruser_id AS cruser_id,tx_dlf_metadata.encoded AS encoded,tx_dlf_metadata.xpath AS xpath,tx_dlf_metadata.xpath_sorting AS xpath_sorting', |
|
220 | + 'tx_dlf_metadata', |
|
221 | + 'tx_dlf_metadata.uid IN ('.implode(',', $metadataUids).')'.tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
222 | + '', |
|
223 | + '', |
|
224 | + '' |
|
225 | + ); |
|
226 | 226 | |
227 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
227 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
228 | 228 | |
229 | - $newId = uniqid('NEW'); |
|
229 | + $newId = uniqid('NEW'); |
|
230 | 230 | |
231 | - // Copy record to new table. |
|
232 | - $data['tx_dlf_metadataformat'][$newId] = array ( |
|
233 | - 'pid' => $resArray['pid'], |
|
234 | - 'cruser_id' => $resArray['cruser_id'], |
|
235 | - 'parent_id' => $resArray['uid'], |
|
236 | - 'encoded' => $resArray['encoded'], |
|
237 | - 'xpath' => $resArray['xpath'], |
|
238 | - 'xpath_sorting' => $resArray['xpath_sorting'] |
|
239 | - ); |
|
231 | + // Copy record to new table. |
|
232 | + $data['tx_dlf_metadataformat'][$newId] = array ( |
|
233 | + 'pid' => $resArray['pid'], |
|
234 | + 'cruser_id' => $resArray['cruser_id'], |
|
235 | + 'parent_id' => $resArray['uid'], |
|
236 | + 'encoded' => $resArray['encoded'], |
|
237 | + 'xpath' => $resArray['xpath'], |
|
238 | + 'xpath_sorting' => $resArray['xpath_sorting'] |
|
239 | + ); |
|
240 | 240 | |
241 | - // Add reference to old table. |
|
242 | - $data['tx_dlf_metadata'][$resArray['uid']]['format'] = $newId; |
|
241 | + // Add reference to old table. |
|
242 | + $data['tx_dlf_metadata'][$resArray['uid']]['format'] = $newId; |
|
243 | 243 | |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | - if (!empty($data)) { |
|
246 | + if (!empty($data)) { |
|
247 | 247 | |
248 | - // Process datamap. |
|
249 | - $substUids = tx_dlf_helper::processDBasAdmin($data); |
|
248 | + // Process datamap. |
|
249 | + $substUids = tx_dlf_helper::processDBasAdmin($data); |
|
250 | 250 | |
251 | - unset ($data); |
|
251 | + unset ($data); |
|
252 | 252 | |
253 | - if (!empty($substUids)) { |
|
253 | + if (!empty($substUids)) { |
|
254 | 254 | |
255 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
256 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
257 | - $GLOBALS['LANG']->getLL('update.metadataConfigOkay', TRUE), |
|
258 | - $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), |
|
259 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
260 | - FALSE |
|
261 | - ); |
|
255 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
256 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
257 | + $GLOBALS['LANG']->getLL('update.metadataConfigOkay', TRUE), |
|
258 | + $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), |
|
259 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
260 | + FALSE |
|
261 | + ); |
|
262 | 262 | |
263 | - } else { |
|
263 | + } else { |
|
264 | 264 | |
265 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
266 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
267 | - $GLOBALS['LANG']->getLL('update.metadataConfigNotOkay', TRUE), |
|
268 | - $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), |
|
269 | - \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
270 | - FALSE |
|
271 | - ); |
|
265 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
266 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
267 | + $GLOBALS['LANG']->getLL('update.metadataConfigNotOkay', TRUE), |
|
268 | + $GLOBALS['LANG']->getLL('update.metadataConfig', TRUE), |
|
269 | + \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
270 | + FALSE |
|
271 | + ); |
|
272 | 272 | |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - $this->content .= $message->render(); |
|
275 | + $this->content .= $message->render(); |
|
276 | 276 | |
277 | - } |
|
277 | + } |
|
278 | 278 | |
279 | - } |
|
279 | + } |
|
280 | 280 | |
281 | - } |
|
281 | + } |
|
282 | 282 | |
283 | 283 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // check if tx_dlf_metadata.xpath exists anyhow |
65 | 65 | $fieldsInDatabase = $GLOBALS['TYPO3_DB']->admin_get_fields('tx_dlf_metadata'); |
66 | 66 | |
67 | - if (! in_array('xpath', array_keys($fieldsInDatabase))) { |
|
67 | + if (!in_array('xpath', array_keys($fieldsInDatabase))) { |
|
68 | 68 | |
69 | 69 | return $uids; |
70 | 70 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
143 | 143 | |
144 | - if($resArray['column_name'] == 'tokenized' |
|
144 | + if ($resArray['column_name'] == 'tokenized' |
|
145 | 145 | || $resArray['column_name'] == 'stored' |
146 | 146 | || $resArray['column_name'] == 'indexed' |
147 | 147 | || $resArray['column_name'] == 'boost' |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | // Copy the content of the old tables to the new ones |
174 | 174 | $result = $GLOBALS['TYPO3_DB']->sql_query($sqlQuery); |
175 | 175 | |
176 | - if($result) { |
|
176 | + if ($result) { |
|
177 | 177 | |
178 | 178 | $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
179 | 179 | 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
@@ -19,368 +19,368 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_modIndexing extends tx_dlf_module { |
21 | 21 | |
22 | - protected $modPath = 'indexing/'; |
|
22 | + protected $modPath = 'indexing/'; |
|
23 | 23 | |
24 | - protected $buttonArray = array ( |
|
25 | - 'SHORTCUT' => '', |
|
26 | - ); |
|
24 | + protected $buttonArray = array ( |
|
25 | + 'SHORTCUT' => '', |
|
26 | + ); |
|
27 | 27 | |
28 | - protected $markerArray = array ( |
|
29 | - 'CSH' => '', |
|
30 | - 'MOD_MENU' => '', |
|
31 | - 'CONTENT' => '', |
|
32 | - ); |
|
28 | + protected $markerArray = array ( |
|
29 | + 'CSH' => '', |
|
30 | + 'MOD_MENU' => '', |
|
31 | + 'CONTENT' => '', |
|
32 | + ); |
|
33 | 33 | |
34 | - /** |
|
35 | - * This holds a list of documents to index |
|
36 | - * |
|
37 | - * @var tx_dlf_list |
|
38 | - * @access protected |
|
39 | - */ |
|
40 | - protected $list; |
|
34 | + /** |
|
35 | + * This holds a list of documents to index |
|
36 | + * |
|
37 | + * @var tx_dlf_list |
|
38 | + * @access protected |
|
39 | + */ |
|
40 | + protected $list; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Builds HTML form for selecting a collection |
|
44 | - * |
|
45 | - * @access protected |
|
46 | - * |
|
47 | - * @return string The HTML output |
|
48 | - */ |
|
49 | - protected function getCollList() { |
|
42 | + /** |
|
43 | + * Builds HTML form for selecting a collection |
|
44 | + * |
|
45 | + * @access protected |
|
46 | + * |
|
47 | + * @return string The HTML output |
|
48 | + */ |
|
49 | + protected function getCollList() { |
|
50 | 50 | |
51 | - // Get all available Solr cores. |
|
52 | - $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
53 | - 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', |
|
54 | - 'tx_dlf_solrcores', |
|
55 | - 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
56 | - '', |
|
57 | - '', |
|
58 | - '' |
|
59 | - ); |
|
51 | + // Get all available Solr cores. |
|
52 | + $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
53 | + 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', |
|
54 | + 'tx_dlf_solrcores', |
|
55 | + 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
56 | + '', |
|
57 | + '', |
|
58 | + '' |
|
59 | + ); |
|
60 | 60 | |
61 | - // Get all available collections. |
|
62 | - $_collections = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
63 | - 'tx_dlf_collections.label AS label,tx_dlf_collections.uid AS uid', |
|
64 | - 'tx_dlf_collections', |
|
65 | - 'tx_dlf_collections.fe_cruser_id=0 AND tx_dlf_collections.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
66 | - '', |
|
67 | - 'tx_dlf_collections.label ASC', |
|
68 | - '' |
|
69 | - ); |
|
61 | + // Get all available collections. |
|
62 | + $_collections = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
63 | + 'tx_dlf_collections.label AS label,tx_dlf_collections.uid AS uid', |
|
64 | + 'tx_dlf_collections', |
|
65 | + 'tx_dlf_collections.fe_cruser_id=0 AND tx_dlf_collections.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
66 | + '', |
|
67 | + 'tx_dlf_collections.label ASC', |
|
68 | + '' |
|
69 | + ); |
|
70 | 70 | |
71 | - // TODO: Ändern! |
|
72 | - $form = '<label for="tx-dlf-modIndexing-id">Kollektion:</label>'; |
|
71 | + // TODO: Ändern! |
|
72 | + $form = '<label for="tx-dlf-modIndexing-id">Kollektion:</label>'; |
|
73 | 73 | |
74 | - $form .= '<select id="tx-dlf-modIndexing-collection" name="'.$this->prefixId.'[collection]">'; |
|
74 | + $form .= '<select id="tx-dlf-modIndexing-collection" name="'.$this->prefixId.'[collection]">'; |
|
75 | 75 | |
76 | - $form .= '<option value="0">Alle</option>'; |
|
76 | + $form .= '<option value="0">Alle</option>'; |
|
77 | 77 | |
78 | - while ($_collection = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_collections)) { |
|
78 | + while ($_collection = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_collections)) { |
|
79 | 79 | |
80 | - $form .= '<option value="'.$_collection['uid'].'">'.htmlspecialchars($_collection['label']).'</option>'; |
|
80 | + $form .= '<option value="'.$_collection['uid'].'">'.htmlspecialchars($_collection['label']).'</option>'; |
|
81 | 81 | |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | - $form .= '</select><br />'; |
|
84 | + $form .= '</select><br />'; |
|
85 | 85 | |
86 | - $form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">'; |
|
86 | + $form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">'; |
|
87 | 87 | |
88 | - $form .= '<option value="0">---</option>'; |
|
88 | + $form .= '<option value="0">---</option>'; |
|
89 | 89 | |
90 | - while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) { |
|
90 | + while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) { |
|
91 | 91 | |
92 | - $form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>'; |
|
92 | + $form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>'; |
|
93 | 93 | |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | - $form .= '</select><br />'; |
|
96 | + $form .= '</select><br />'; |
|
97 | 97 | |
98 | - $form .= '<input type="hidden" name="CMD" value="reindexDocs" />'; |
|
98 | + $form .= '<input type="hidden" name="CMD" value="reindexDocs" />'; |
|
99 | 99 | |
100 | - $form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />'; |
|
100 | + $form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />'; |
|
101 | 101 | |
102 | - return $form; |
|
102 | + return $form; |
|
103 | 103 | |
104 | - } |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Builds HTML form for selecting a file |
|
108 | - * |
|
109 | - * @access protected |
|
110 | - * |
|
111 | - * @return string The HTML output |
|
112 | - */ |
|
113 | - protected function getFileForm() { |
|
106 | + /** |
|
107 | + * Builds HTML form for selecting a file |
|
108 | + * |
|
109 | + * @access protected |
|
110 | + * |
|
111 | + * @return string The HTML output |
|
112 | + */ |
|
113 | + protected function getFileForm() { |
|
114 | 114 | |
115 | - // Get all available Solr cores. |
|
116 | - $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
117 | - 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', |
|
118 | - 'tx_dlf_solrcores', |
|
119 | - 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
120 | - '', |
|
121 | - '', |
|
122 | - '' |
|
123 | - ); |
|
115 | + // Get all available Solr cores. |
|
116 | + $_cores = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
117 | + 'tx_dlf_solrcores.label AS label,tx_dlf_solrcores.uid AS uid', |
|
118 | + 'tx_dlf_solrcores', |
|
119 | + 'tx_dlf_solrcores.pid IN (0,'.intval($this->id).')'.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
120 | + '', |
|
121 | + '', |
|
122 | + '' |
|
123 | + ); |
|
124 | 124 | |
125 | - // TODO: Ändern! |
|
126 | - $form = '<label for="tx-dlf-modIndexing-id">METS-Datei:</label>'; |
|
125 | + // TODO: Ändern! |
|
126 | + $form = '<label for="tx-dlf-modIndexing-id">METS-Datei:</label>'; |
|
127 | 127 | |
128 | - $form .= '<input type="text" id="tx-dlf-modIndexing-id" name="'.$this->prefixId.'[id]" value="" /><br />'; |
|
128 | + $form .= '<input type="text" id="tx-dlf-modIndexing-id" name="'.$this->prefixId.'[id]" value="" /><br />'; |
|
129 | 129 | |
130 | - $form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">'; |
|
130 | + $form .= '<select id="tx-dlf-modIndexing-core" name="'.$this->prefixId.'[core]">'; |
|
131 | 131 | |
132 | - $form .= '<option value="0">---</option>'; |
|
132 | + $form .= '<option value="0">---</option>'; |
|
133 | 133 | |
134 | - while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) { |
|
134 | + while ($_core = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_cores)) { |
|
135 | 135 | |
136 | - $form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>'; |
|
136 | + $form .= '<option value="'.$_core['uid'].'">'.htmlspecialchars($_core['label']).'</option>'; |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - $form .= '</select><br />'; |
|
140 | + $form .= '</select><br />'; |
|
141 | 141 | |
142 | - $form .= '<input type="hidden" name="CMD" value="indexFile" />'; |
|
142 | + $form .= '<input type="hidden" name="CMD" value="indexFile" />'; |
|
143 | 143 | |
144 | - $form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />'; |
|
144 | + $form .= '<input type="submit" name="'.$this->prefixId.'[submit]" value="'.$GLOBALS['LANG']->getLL('form.submit').'" />'; |
|
145 | 145 | |
146 | - return $form; |
|
146 | + return $form; |
|
147 | 147 | |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * Iterates through list of documents and indexes them |
|
152 | - * |
|
153 | - * @access protected |
|
154 | - * |
|
155 | - * @return void |
|
156 | - */ |
|
157 | - protected function indexLoop() { |
|
150 | + /** |
|
151 | + * Iterates through list of documents and indexes them |
|
152 | + * |
|
153 | + * @access protected |
|
154 | + * |
|
155 | + * @return void |
|
156 | + */ |
|
157 | + protected function indexLoop() { |
|
158 | 158 | |
159 | - // Get document from list. |
|
160 | - list ($uid, $title) = $this->list->remove(0); |
|
159 | + // Get document from list. |
|
160 | + list ($uid, $title) = $this->list->remove(0); |
|
161 | 161 | |
162 | - $this->list->save(); |
|
162 | + $this->list->save(); |
|
163 | 163 | |
164 | - // Save document to database and index. |
|
165 | - $doc =& tx_dlf_document::getInstance($uid, 0, TRUE); |
|
164 | + // Save document to database and index. |
|
165 | + $doc =& tx_dlf_document::getInstance($uid, 0, TRUE); |
|
166 | 166 | |
167 | - if ($doc->ready) { |
|
167 | + if ($doc->ready) { |
|
168 | 168 | |
169 | - $doc->save($doc->pid, $this->data['core']); |
|
169 | + $doc->save($doc->pid, $this->data['core']); |
|
170 | 170 | |
171 | - } |
|
171 | + } |
|
172 | 172 | |
173 | - // Give feedback about progress. |
|
174 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
175 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
176 | - htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentsToGo'), count($this->list))), |
|
177 | - tx_dlf_helper::getLL('flash.running', TRUE), |
|
178 | - \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
179 | - TRUE |
|
180 | - ); |
|
173 | + // Give feedback about progress. |
|
174 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
175 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
176 | + htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentsToGo'), count($this->list))), |
|
177 | + tx_dlf_helper::getLL('flash.running', TRUE), |
|
178 | + \TYPO3\CMS\Core\Messaging\FlashMessage::INFO, |
|
179 | + TRUE |
|
180 | + ); |
|
181 | 181 | |
182 | - $this->markerArray['CONTENT'] .= $_message->render(); |
|
182 | + $this->markerArray['CONTENT'] .= $_message->render(); |
|
183 | 183 | |
184 | - // Start next loop. |
|
185 | - $this->markerArray['CONTENT'] .= '<script type="text/javascript">window.location.href=unescape("'.\TYPO3\CMS\Core\Utility\GeneralUtility::rawUrlEncodeJS(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'indexLoop', $this->prefixId => array ('core' => $this->data['core']), 'random' => uniqid())))).'");</script>'; |
|
184 | + // Start next loop. |
|
185 | + $this->markerArray['CONTENT'] .= '<script type="text/javascript">window.location.href=unescape("'.\TYPO3\CMS\Core\Utility\GeneralUtility::rawUrlEncodeJS(\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'indexLoop', $this->prefixId => array ('core' => $this->data['core']), 'random' => uniqid())))).'");</script>'; |
|
186 | 186 | |
187 | - $this->printContent(); |
|
187 | + $this->printContent(); |
|
188 | 188 | |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | - /** |
|
192 | - * Main function of the module |
|
193 | - * |
|
194 | - * @access public |
|
195 | - * |
|
196 | - * @return void |
|
197 | - */ |
|
198 | - public function main() { |
|
191 | + /** |
|
192 | + * Main function of the module |
|
193 | + * |
|
194 | + * @access public |
|
195 | + * |
|
196 | + * @return void |
|
197 | + */ |
|
198 | + public function main() { |
|
199 | 199 | |
200 | - // Is the user allowed to access this page? |
|
201 | - $access = is_array($this->pageInfo) || $GLOBALS['BE_USER']->isAdmin(); |
|
200 | + // Is the user allowed to access this page? |
|
201 | + $access = is_array($this->pageInfo) || $GLOBALS['BE_USER']->isAdmin(); |
|
202 | 202 | |
203 | - if ($this->id && $access) { |
|
203 | + if ($this->id && $access) { |
|
204 | 204 | |
205 | - // Increase max_execution_time and max_input_time for large documents. |
|
206 | - if (!ini_get('safe_mode')) { |
|
205 | + // Increase max_execution_time and max_input_time for large documents. |
|
206 | + if (!ini_get('safe_mode')) { |
|
207 | 207 | |
208 | - ini_set('max_execution_time', '0'); |
|
208 | + ini_set('max_execution_time', '0'); |
|
209 | 209 | |
210 | - ini_set('max_input_time', '-1'); |
|
210 | + ini_set('max_input_time', '-1'); |
|
211 | 211 | |
212 | - } |
|
212 | + } |
|
213 | 213 | |
214 | - switch ($this->CMD) { |
|
214 | + switch ($this->CMD) { |
|
215 | 215 | |
216 | - case 'indexFile': |
|
216 | + case 'indexFile': |
|
217 | 217 | |
218 | - if (!empty($this->data['id']) && isset($this->data['core'])) { |
|
218 | + if (!empty($this->data['id']) && isset($this->data['core'])) { |
|
219 | 219 | |
220 | - // Save document to database and index. |
|
221 | - $doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE); |
|
220 | + // Save document to database and index. |
|
221 | + $doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE); |
|
222 | 222 | |
223 | - if ($doc->ready) { |
|
223 | + if ($doc->ready) { |
|
224 | 224 | |
225 | - $doc->save($this->id, $this->data['core']); |
|
225 | + $doc->save($this->id, $this->data['core']); |
|
226 | 226 | |
227 | - } else { |
|
227 | + } else { |
|
228 | 228 | |
229 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
230 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
231 | - htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.fileNotLoaded'), $this->data['id'])), |
|
232 | - tx_dlf_helper::getLL('flash.error', TRUE), |
|
233 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
234 | - TRUE |
|
235 | - ); |
|
229 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
230 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
231 | + htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.fileNotLoaded'), $this->data['id'])), |
|
232 | + tx_dlf_helper::getLL('flash.error', TRUE), |
|
233 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
234 | + TRUE |
|
235 | + ); |
|
236 | 236 | |
237 | - tx_dlf_helper::addMessage($_message); |
|
237 | + tx_dlf_helper::addMessage($_message); |
|
238 | 238 | |
239 | - } |
|
239 | + } |
|
240 | 240 | |
241 | - } |
|
241 | + } |
|
242 | 242 | |
243 | - break; |
|
243 | + break; |
|
244 | 244 | |
245 | - case 'reindexDocs': |
|
245 | + case 'reindexDocs': |
|
246 | 246 | |
247 | - if (isset($this->data['core'])) { |
|
247 | + if (isset($this->data['core'])) { |
|
248 | 248 | |
249 | - if (!empty($this->data['collection'])) { |
|
249 | + if (!empty($this->data['collection'])) { |
|
250 | 250 | |
251 | - // Get all documents in this collection. |
|
252 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
253 | - 'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', |
|
254 | - 'tx_dlf_documents', |
|
255 | - 'tx_dlf_relations', |
|
256 | - 'tx_dlf_collections', |
|
257 | - 'AND tx_dlf_documents.pid='.intval($this->id).' AND tx_dlf_collections.uid='.intval($this->data['collection']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
258 | - 'tx_dlf_documents.uid', |
|
259 | - '', |
|
260 | - '' |
|
261 | - ); |
|
251 | + // Get all documents in this collection. |
|
252 | + $_result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
253 | + 'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', |
|
254 | + 'tx_dlf_documents', |
|
255 | + 'tx_dlf_relations', |
|
256 | + 'tx_dlf_collections', |
|
257 | + 'AND tx_dlf_documents.pid='.intval($this->id).' AND tx_dlf_collections.uid='.intval($this->data['collection']).' AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
258 | + 'tx_dlf_documents.uid', |
|
259 | + '', |
|
260 | + '' |
|
261 | + ); |
|
262 | 262 | |
263 | - } else { |
|
263 | + } else { |
|
264 | 264 | |
265 | - // Get all documents. |
|
266 | - $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
267 | - 'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', |
|
268 | - 'tx_dlf_documents', |
|
269 | - 'tx_dlf_documents.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
270 | - '', |
|
271 | - '', |
|
272 | - '' |
|
273 | - ); |
|
265 | + // Get all documents. |
|
266 | + $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
267 | + 'tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', |
|
268 | + 'tx_dlf_documents', |
|
269 | + 'tx_dlf_documents.pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
270 | + '', |
|
271 | + '', |
|
272 | + '' |
|
273 | + ); |
|
274 | 274 | |
275 | - } |
|
275 | + } |
|
276 | 276 | |
277 | - // Save them as a list object in user's session. |
|
278 | - $elements = array (); |
|
277 | + // Save them as a list object in user's session. |
|
278 | + $elements = array (); |
|
279 | 279 | |
280 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
|
280 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { |
|
281 | 281 | |
282 | - $elements[] = array ($resArray['uid'], $resArray['title']); |
|
282 | + $elements[] = array ($resArray['uid'], $resArray['title']); |
|
283 | 283 | |
284 | - } |
|
284 | + } |
|
285 | 285 | |
286 | - $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list', $elements); |
|
286 | + $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list', $elements); |
|
287 | 287 | |
288 | - // Start index looping. |
|
289 | - if (count($this->list) > 0) { |
|
288 | + // Start index looping. |
|
289 | + if (count($this->list) > 0) { |
|
290 | 290 | |
291 | - $this->indexLoop(); |
|
291 | + $this->indexLoop(); |
|
292 | 292 | |
293 | - } |
|
293 | + } |
|
294 | 294 | |
295 | - } |
|
295 | + } |
|
296 | 296 | |
297 | - break; |
|
297 | + break; |
|
298 | 298 | |
299 | - case 'indexLoop': |
|
299 | + case 'indexLoop': |
|
300 | 300 | |
301 | - // Refresh user's session to prevent session timeout. |
|
302 | - $GLOBALS['BE_USER']->fetchUserSession(); |
|
301 | + // Refresh user's session to prevent session timeout. |
|
302 | + $GLOBALS['BE_USER']->fetchUserSession(); |
|
303 | 303 | |
304 | - // Get document list from user's session. |
|
305 | - $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
304 | + // Get document list from user's session. |
|
305 | + $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
306 | 306 | |
307 | - // Continue index looping. |
|
308 | - if (count($this->list) > 0 && isset($this->data['core'])) { |
|
307 | + // Continue index looping. |
|
308 | + if (count($this->list) > 0 && isset($this->data['core'])) { |
|
309 | 309 | |
310 | - $this->indexLoop(); |
|
310 | + $this->indexLoop(); |
|
311 | 311 | |
312 | - } else { |
|
312 | + } else { |
|
313 | 313 | |
314 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
315 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
316 | - tx_dlf_helper::getLL('flash.seeLog', TRUE), |
|
317 | - tx_dlf_helper::getLL('flash.done', TRUE), |
|
318 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
319 | - TRUE |
|
320 | - ); |
|
314 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
315 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
316 | + tx_dlf_helper::getLL('flash.seeLog', TRUE), |
|
317 | + tx_dlf_helper::getLL('flash.done', TRUE), |
|
318 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
319 | + TRUE |
|
320 | + ); |
|
321 | 321 | |
322 | - tx_dlf_helper::addMessage($_message); |
|
322 | + tx_dlf_helper::addMessage($_message); |
|
323 | 323 | |
324 | - } |
|
324 | + } |
|
325 | 325 | |
326 | - break; |
|
326 | + break; |
|
327 | 327 | |
328 | - } |
|
328 | + } |
|
329 | 329 | |
330 | 330 | |
331 | - $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); |
|
331 | + $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); |
|
332 | 332 | |
333 | - switch ($this->MOD_SETTINGS['function']) { |
|
333 | + switch ($this->MOD_SETTINGS['function']) { |
|
334 | 334 | |
335 | - case 'indexFile': |
|
335 | + case 'indexFile': |
|
336 | 336 | |
337 | - $this->markerArray['CONTENT'] .= $this->getFileForm(); |
|
337 | + $this->markerArray['CONTENT'] .= $this->getFileForm(); |
|
338 | 338 | |
339 | - break; |
|
339 | + break; |
|
340 | 340 | |
341 | - case 'reindexDoc': |
|
341 | + case 'reindexDoc': |
|
342 | 342 | |
343 | - $this->markerArray['CONTENT'] .= $this->getDocList(); |
|
343 | + $this->markerArray['CONTENT'] .= $this->getDocList(); |
|
344 | 344 | |
345 | - break; |
|
345 | + break; |
|
346 | 346 | |
347 | - case 'reindexDocs': |
|
347 | + case 'reindexDocs': |
|
348 | 348 | |
349 | - $this->markerArray['CONTENT'] .= $this->getCollList(); |
|
349 | + $this->markerArray['CONTENT'] .= $this->getCollList(); |
|
350 | 350 | |
351 | - break; |
|
351 | + break; |
|
352 | 352 | |
353 | - } |
|
353 | + } |
|
354 | 354 | |
355 | - } else { |
|
355 | + } else { |
|
356 | 356 | |
357 | - // TODO: Ändern! |
|
358 | - $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; |
|
357 | + // TODO: Ändern! |
|
358 | + $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; |
|
359 | 359 | |
360 | - } |
|
360 | + } |
|
361 | 361 | |
362 | - $this->printContent(); |
|
362 | + $this->printContent(); |
|
363 | 363 | |
364 | - } |
|
364 | + } |
|
365 | 365 | |
366 | - /** |
|
367 | - * Sets the module's MOD_MENU configuration |
|
368 | - * |
|
369 | - * @access protected |
|
370 | - * |
|
371 | - * @return void |
|
372 | - */ |
|
373 | - protected function setMOD_MENU() { |
|
366 | + /** |
|
367 | + * Sets the module's MOD_MENU configuration |
|
368 | + * |
|
369 | + * @access protected |
|
370 | + * |
|
371 | + * @return void |
|
372 | + */ |
|
373 | + protected function setMOD_MENU() { |
|
374 | 374 | |
375 | - $this->MOD_MENU = array ( |
|
376 | - 'function' => array ( |
|
377 | - 'indexFile' => $GLOBALS['LANG']->getLL('function.indexFile'), |
|
378 | - //'reindexDoc' => $GLOBALS['LANG']->getLL('function.reindexDoc'), |
|
379 | - 'reindexDocs' => $GLOBALS['LANG']->getLL('function.reindexDocs'), |
|
380 | - ) |
|
381 | - ); |
|
375 | + $this->MOD_MENU = array ( |
|
376 | + 'function' => array ( |
|
377 | + 'indexFile' => $GLOBALS['LANG']->getLL('function.indexFile'), |
|
378 | + //'reindexDoc' => $GLOBALS['LANG']->getLL('function.reindexDoc'), |
|
379 | + 'reindexDocs' => $GLOBALS['LANG']->getLL('function.reindexDocs'), |
|
380 | + ) |
|
381 | + ); |
|
382 | 382 | |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | 385 | } |
386 | 386 |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->list->save(); |
163 | 163 | |
164 | 164 | // Save document to database and index. |
165 | - $doc =& tx_dlf_document::getInstance($uid, 0, TRUE); |
|
165 | + $doc = & tx_dlf_document::getInstance($uid, 0, TRUE); |
|
166 | 166 | |
167 | 167 | if ($doc->ready) { |
168 | 168 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if (!empty($this->data['id']) && isset($this->data['core'])) { |
219 | 219 | |
220 | 220 | // Save document to database and index. |
221 | - $doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE); |
|
221 | + $doc = & tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE); |
|
222 | 222 | |
223 | 223 | if ($doc->ready) { |
224 | 224 |
@@ -19,489 +19,489 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_modNewclient extends tx_dlf_module { |
21 | 21 | |
22 | - protected $modPath = 'newclient/'; |
|
22 | + protected $modPath = 'newclient/'; |
|
23 | 23 | |
24 | - protected $buttonArray = array ( |
|
25 | - 'SHORTCUT' => '', |
|
26 | - ); |
|
24 | + protected $buttonArray = array ( |
|
25 | + 'SHORTCUT' => '', |
|
26 | + ); |
|
27 | 27 | |
28 | - protected $markerArray = array ( |
|
29 | - 'CSH' => '', |
|
30 | - 'MOD_MENU' => '', |
|
31 | - 'CONTENT' => '', |
|
32 | - ); |
|
28 | + protected $markerArray = array ( |
|
29 | + 'CSH' => '', |
|
30 | + 'MOD_MENU' => '', |
|
31 | + 'CONTENT' => '', |
|
32 | + ); |
|
33 | 33 | |
34 | - /** |
|
35 | - * Add access rights |
|
36 | - * |
|
37 | - * @access protected |
|
38 | - * |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - protected function cmdAddAccessRights() { |
|
34 | + /** |
|
35 | + * Add access rights |
|
36 | + * |
|
37 | + * @access protected |
|
38 | + * |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + protected function cmdAddAccessRights() { |
|
42 | 42 | |
43 | - // Get command line indexer's usergroup. |
|
44 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
45 | - 'uid,db_mountpoints', |
|
46 | - 'be_groups', |
|
47 | - 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') |
|
48 | - ); |
|
43 | + // Get command line indexer's usergroup. |
|
44 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
45 | + 'uid,db_mountpoints', |
|
46 | + 'be_groups', |
|
47 | + 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') |
|
48 | + ); |
|
49 | 49 | |
50 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
50 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
51 | 51 | |
52 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
52 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
53 | 53 | |
54 | - // Add current page to mountpoints. |
|
55 | - if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) { |
|
54 | + // Add current page to mountpoints. |
|
55 | + if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) { |
|
56 | 56 | |
57 | - $data['be_groups'][$resArray['uid']]['db_mountpoints'] = $resArray['db_mountpoints'].','.$this->id; |
|
57 | + $data['be_groups'][$resArray['uid']]['db_mountpoints'] = $resArray['db_mountpoints'].','.$this->id; |
|
58 | 58 | |
59 | - tx_dlf_helper::processDBasAdmin($data); |
|
59 | + tx_dlf_helper::processDBasAdmin($data); |
|
60 | 60 | |
61 | - // Fine. |
|
62 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
63 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
64 | - tx_dlf_helper::getLL('flash.usergroupAddedMsg'), |
|
65 | - tx_dlf_helper::getLL('flash.usergroupAdded', TRUE), |
|
66 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
67 | - FALSE |
|
68 | - ); |
|
61 | + // Fine. |
|
62 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
63 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
64 | + tx_dlf_helper::getLL('flash.usergroupAddedMsg'), |
|
65 | + tx_dlf_helper::getLL('flash.usergroupAdded', TRUE), |
|
66 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
67 | + FALSE |
|
68 | + ); |
|
69 | 69 | |
70 | - tx_dlf_helper::addMessage($_message); |
|
70 | + tx_dlf_helper::addMessage($_message); |
|
71 | 71 | |
72 | - } |
|
72 | + } |
|
73 | 73 | |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * Add metadata configuration |
|
80 | - * |
|
81 | - * @access protected |
|
82 | - * |
|
83 | - * @return void |
|
84 | - */ |
|
85 | - protected function cmdAddMetadata() { |
|
78 | + /** |
|
79 | + * Add metadata configuration |
|
80 | + * |
|
81 | + * @access protected |
|
82 | + * |
|
83 | + * @return void |
|
84 | + */ |
|
85 | + protected function cmdAddMetadata() { |
|
86 | 86 | |
87 | - // Include metadata definition file. |
|
88 | - include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'metadata.inc.php'); |
|
89 | - |
|
90 | - $i = 0; |
|
87 | + // Include metadata definition file. |
|
88 | + include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'metadata.inc.php'); |
|
89 | + |
|
90 | + $i = 0; |
|
91 | 91 | |
92 | - // Build data array. |
|
93 | - foreach ($metadata as $index_name => $values) { |
|
92 | + // Build data array. |
|
93 | + foreach ($metadata as $index_name => $values) { |
|
94 | 94 | |
95 | - $formatIds = array (); |
|
95 | + $formatIds = array (); |
|
96 | 96 | |
97 | - foreach ($values['format'] as $format) { |
|
98 | - |
|
99 | - $formatIds[] = uniqid('NEW'); |
|
100 | - |
|
101 | - $data['tx_dlf_metadataformat'][end($formatIds)] = $format; |
|
102 | - |
|
103 | - $data['tx_dlf_metadataformat'][end($formatIds)]['pid'] = intval($this->id); |
|
97 | + foreach ($values['format'] as $format) { |
|
98 | + |
|
99 | + $formatIds[] = uniqid('NEW'); |
|
100 | + |
|
101 | + $data['tx_dlf_metadataformat'][end($formatIds)] = $format; |
|
102 | + |
|
103 | + $data['tx_dlf_metadataformat'][end($formatIds)]['pid'] = intval($this->id); |
|
104 | 104 | |
105 | - $i++; |
|
105 | + $i++; |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - $data['tx_dlf_metadata'][uniqid('NEW')] = array ( |
|
110 | - 'pid' => intval($this->id), |
|
111 | - 'label' => $GLOBALS['LANG']->getLL($index_name), |
|
112 | - 'index_name' => $index_name, |
|
113 | - 'format' => implode(',', $formatIds), |
|
114 | - 'default_value' => $values['default_value'], |
|
115 | - 'wrap' => (!empty($values['wrap']) ? $values['wrap'] : $GLOBALS['TCA']['tx_dlf_metadata']['columns']['wrap']['config']['default']), |
|
116 | - 'index_tokenized' => $values['index_tokenized'], |
|
117 | - 'index_stored' => $values['index_stored'], |
|
118 | - 'index_indexed' => $values['index_indexed'], |
|
119 | - 'index_boost' => $values['index_boost'], |
|
120 | - 'is_sortable' => $values['is_sortable'], |
|
121 | - 'is_facet' => $values['is_facet'], |
|
122 | - 'is_listed' => $values['is_listed'], |
|
123 | - 'index_autocomplete' => $values['index_autocomplete'], |
|
124 | - ); |
|
125 | - |
|
126 | - $i++; |
|
127 | - |
|
128 | - } |
|
129 | - |
|
130 | - $_ids = tx_dlf_helper::processDBasAdmin($data); |
|
131 | - |
|
132 | - // Check for failed inserts. |
|
133 | - if (count($_ids) == $i) { |
|
134 | - |
|
135 | - // Fine. |
|
136 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
137 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
138 | - tx_dlf_helper::getLL('flash.metadataAddedMsg'), |
|
139 | - tx_dlf_helper::getLL('flash.metadataAdded', TRUE), |
|
140 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
141 | - FALSE |
|
142 | - ); |
|
109 | + $data['tx_dlf_metadata'][uniqid('NEW')] = array ( |
|
110 | + 'pid' => intval($this->id), |
|
111 | + 'label' => $GLOBALS['LANG']->getLL($index_name), |
|
112 | + 'index_name' => $index_name, |
|
113 | + 'format' => implode(',', $formatIds), |
|
114 | + 'default_value' => $values['default_value'], |
|
115 | + 'wrap' => (!empty($values['wrap']) ? $values['wrap'] : $GLOBALS['TCA']['tx_dlf_metadata']['columns']['wrap']['config']['default']), |
|
116 | + 'index_tokenized' => $values['index_tokenized'], |
|
117 | + 'index_stored' => $values['index_stored'], |
|
118 | + 'index_indexed' => $values['index_indexed'], |
|
119 | + 'index_boost' => $values['index_boost'], |
|
120 | + 'is_sortable' => $values['is_sortable'], |
|
121 | + 'is_facet' => $values['is_facet'], |
|
122 | + 'is_listed' => $values['is_listed'], |
|
123 | + 'index_autocomplete' => $values['index_autocomplete'], |
|
124 | + ); |
|
125 | + |
|
126 | + $i++; |
|
127 | + |
|
128 | + } |
|
129 | + |
|
130 | + $_ids = tx_dlf_helper::processDBasAdmin($data); |
|
131 | + |
|
132 | + // Check for failed inserts. |
|
133 | + if (count($_ids) == $i) { |
|
134 | + |
|
135 | + // Fine. |
|
136 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
137 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
138 | + tx_dlf_helper::getLL('flash.metadataAddedMsg'), |
|
139 | + tx_dlf_helper::getLL('flash.metadataAdded', TRUE), |
|
140 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
141 | + FALSE |
|
142 | + ); |
|
143 | 143 | |
144 | - } else { |
|
144 | + } else { |
|
145 | 145 | |
146 | - // Something went wrong. |
|
147 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
148 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
149 | - tx_dlf_helper::getLL('flash.metadataNotAddedMsg'), |
|
150 | - tx_dlf_helper::getLL('flash.metadataNotAdded', TRUE), |
|
151 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
152 | - FALSE |
|
153 | - ); |
|
154 | - |
|
155 | - } |
|
156 | - |
|
157 | - tx_dlf_helper::addMessage($_message); |
|
158 | - |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * Add Solr core |
|
163 | - * |
|
164 | - * @access protected |
|
165 | - * |
|
166 | - * @return void |
|
167 | - */ |
|
168 | - protected function cmdAddSolrCore() { |
|
146 | + // Something went wrong. |
|
147 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
148 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
149 | + tx_dlf_helper::getLL('flash.metadataNotAddedMsg'), |
|
150 | + tx_dlf_helper::getLL('flash.metadataNotAdded', TRUE), |
|
151 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
152 | + FALSE |
|
153 | + ); |
|
154 | + |
|
155 | + } |
|
156 | + |
|
157 | + tx_dlf_helper::addMessage($_message); |
|
158 | + |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * Add Solr core |
|
163 | + * |
|
164 | + * @access protected |
|
165 | + * |
|
166 | + * @return void |
|
167 | + */ |
|
168 | + protected function cmdAddSolrCore() { |
|
169 | 169 | |
170 | - // Build data array. |
|
171 | - $data['tx_dlf_solrcores'][uniqid('NEW')] = array ( |
|
172 | - 'pid' => intval($this->id), |
|
173 | - 'label' => $GLOBALS['LANG']->getLL('solrcore').' (PID '.$this->id.')', |
|
174 | - 'index_name' => '', |
|
175 | - ); |
|
176 | - |
|
177 | - $_ids = tx_dlf_helper::processDBasAdmin($data); |
|
178 | - |
|
179 | - // Check for failed inserts. |
|
180 | - if (count($_ids) == 1) { |
|
181 | - |
|
182 | - // Fine. |
|
183 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
184 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
185 | - tx_dlf_helper::getLL('flash.solrcoreAddedMsg'), |
|
186 | - tx_dlf_helper::getLL('flash.solrcoreAdded', TRUE), |
|
187 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
188 | - FALSE |
|
189 | - ); |
|
190 | - |
|
191 | - } else { |
|
192 | - |
|
193 | - // Something went wrong. |
|
194 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
195 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
196 | - tx_dlf_helper::getLL('flash.solrcoreNotAddedMsg'), |
|
197 | - tx_dlf_helper::getLL('flash.solrcoreNotAdded', TRUE), |
|
198 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
199 | - FALSE |
|
200 | - ); |
|
201 | - |
|
202 | - } |
|
203 | - |
|
204 | - tx_dlf_helper::addMessage($_message); |
|
205 | - |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * Add structure configuration |
|
210 | - * |
|
211 | - * @access protected |
|
212 | - * |
|
213 | - * @return void |
|
214 | - */ |
|
215 | - protected function cmdAddStructure() { |
|
170 | + // Build data array. |
|
171 | + $data['tx_dlf_solrcores'][uniqid('NEW')] = array ( |
|
172 | + 'pid' => intval($this->id), |
|
173 | + 'label' => $GLOBALS['LANG']->getLL('solrcore').' (PID '.$this->id.')', |
|
174 | + 'index_name' => '', |
|
175 | + ); |
|
176 | + |
|
177 | + $_ids = tx_dlf_helper::processDBasAdmin($data); |
|
178 | + |
|
179 | + // Check for failed inserts. |
|
180 | + if (count($_ids) == 1) { |
|
181 | + |
|
182 | + // Fine. |
|
183 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
184 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
185 | + tx_dlf_helper::getLL('flash.solrcoreAddedMsg'), |
|
186 | + tx_dlf_helper::getLL('flash.solrcoreAdded', TRUE), |
|
187 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
188 | + FALSE |
|
189 | + ); |
|
190 | + |
|
191 | + } else { |
|
192 | + |
|
193 | + // Something went wrong. |
|
194 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
195 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
196 | + tx_dlf_helper::getLL('flash.solrcoreNotAddedMsg'), |
|
197 | + tx_dlf_helper::getLL('flash.solrcoreNotAdded', TRUE), |
|
198 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
199 | + FALSE |
|
200 | + ); |
|
201 | + |
|
202 | + } |
|
203 | + |
|
204 | + tx_dlf_helper::addMessage($_message); |
|
205 | + |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * Add structure configuration |
|
210 | + * |
|
211 | + * @access protected |
|
212 | + * |
|
213 | + * @return void |
|
214 | + */ |
|
215 | + protected function cmdAddStructure() { |
|
216 | 216 | |
217 | - // Include structure definition file. |
|
218 | - include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'structures.inc.php'); |
|
217 | + // Include structure definition file. |
|
218 | + include_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($this->extKey).'modules/'.$this->modPath.'structures.inc.php'); |
|
219 | 219 | |
220 | - // Build data array. |
|
221 | - foreach ($structures as $index_name => $values) { |
|
220 | + // Build data array. |
|
221 | + foreach ($structures as $index_name => $values) { |
|
222 | 222 | |
223 | - $data['tx_dlf_structures'][uniqid('NEW')] = array ( |
|
224 | - 'pid' => intval($this->id), |
|
225 | - 'toplevel' => $values['toplevel'], |
|
226 | - 'label' => $GLOBALS['LANG']->getLL($index_name), |
|
227 | - 'index_name' => $index_name, |
|
228 | - 'oai_name' => $values['oai_name'], |
|
229 | - 'thumbnail' => 0, |
|
230 | - ); |
|
223 | + $data['tx_dlf_structures'][uniqid('NEW')] = array ( |
|
224 | + 'pid' => intval($this->id), |
|
225 | + 'toplevel' => $values['toplevel'], |
|
226 | + 'label' => $GLOBALS['LANG']->getLL($index_name), |
|
227 | + 'index_name' => $index_name, |
|
228 | + 'oai_name' => $values['oai_name'], |
|
229 | + 'thumbnail' => 0, |
|
230 | + ); |
|
231 | 231 | |
232 | - } |
|
233 | - |
|
234 | - $_ids = tx_dlf_helper::processDBasAdmin($data); |
|
235 | - |
|
236 | - // Check for failed inserts. |
|
237 | - if (count($_ids) == count($structures)) { |
|
232 | + } |
|
233 | + |
|
234 | + $_ids = tx_dlf_helper::processDBasAdmin($data); |
|
235 | + |
|
236 | + // Check for failed inserts. |
|
237 | + if (count($_ids) == count($structures)) { |
|
238 | 238 | |
239 | - // Fine. |
|
240 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
241 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
242 | - tx_dlf_helper::getLL('flash.structureAddedMsg'), |
|
243 | - tx_dlf_helper::getLL('flash.structureAdded', TRUE), |
|
244 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
245 | - FALSE |
|
246 | - ); |
|
239 | + // Fine. |
|
240 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
241 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
242 | + tx_dlf_helper::getLL('flash.structureAddedMsg'), |
|
243 | + tx_dlf_helper::getLL('flash.structureAdded', TRUE), |
|
244 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
245 | + FALSE |
|
246 | + ); |
|
247 | 247 | |
248 | - } else { |
|
248 | + } else { |
|
249 | 249 | |
250 | - // Something went wrong. |
|
251 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
252 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
253 | - tx_dlf_helper::getLL('flash.structureNotAddedMsg'), |
|
254 | - tx_dlf_helper::getLL('flash.structureNotAdded', TRUE), |
|
255 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
256 | - FALSE |
|
257 | - ); |
|
250 | + // Something went wrong. |
|
251 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
252 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
253 | + tx_dlf_helper::getLL('flash.structureNotAddedMsg'), |
|
254 | + tx_dlf_helper::getLL('flash.structureNotAdded', TRUE), |
|
255 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
256 | + FALSE |
|
257 | + ); |
|
258 | 258 | |
259 | - } |
|
259 | + } |
|
260 | 260 | |
261 | - tx_dlf_helper::addMessage($_message); |
|
261 | + tx_dlf_helper::addMessage($_message); |
|
262 | 262 | |
263 | - } |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * Main function of the module |
|
267 | - * |
|
268 | - * @access public |
|
269 | - * |
|
270 | - * @return void |
|
271 | - */ |
|
272 | - public function main() { |
|
265 | + /** |
|
266 | + * Main function of the module |
|
267 | + * |
|
268 | + * @access public |
|
269 | + * |
|
270 | + * @return void |
|
271 | + */ |
|
272 | + public function main() { |
|
273 | 273 | |
274 | - // Is the user allowed to access this page? |
|
275 | - $access = is_array($this->pageInfo) && $GLOBALS['BE_USER']->isAdmin(); |
|
274 | + // Is the user allowed to access this page? |
|
275 | + $access = is_array($this->pageInfo) && $GLOBALS['BE_USER']->isAdmin(); |
|
276 | 276 | |
277 | - if ($this->id && $access) { |
|
277 | + if ($this->id && $access) { |
|
278 | 278 | |
279 | - // Check if page is sysfolder. |
|
280 | - if ($this->pageInfo['doktype'] != 254) { |
|
279 | + // Check if page is sysfolder. |
|
280 | + if ($this->pageInfo['doktype'] != 254) { |
|
281 | 281 | |
282 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
283 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
284 | - tx_dlf_helper::getLL('flash.wrongPageTypeMsg'), |
|
285 | - tx_dlf_helper::getLL('flash.wrongPageType', TRUE), |
|
286 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
287 | - FALSE |
|
288 | - ); |
|
282 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
283 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
284 | + tx_dlf_helper::getLL('flash.wrongPageTypeMsg'), |
|
285 | + tx_dlf_helper::getLL('flash.wrongPageType', TRUE), |
|
286 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
287 | + FALSE |
|
288 | + ); |
|
289 | 289 | |
290 | - tx_dlf_helper::addMessage($_message); |
|
290 | + tx_dlf_helper::addMessage($_message); |
|
291 | 291 | |
292 | - $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); |
|
292 | + $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); |
|
293 | 293 | |
294 | - $this->printContent(); |
|
294 | + $this->printContent(); |
|
295 | 295 | |
296 | - return; |
|
296 | + return; |
|
297 | 297 | |
298 | - } |
|
298 | + } |
|
299 | 299 | |
300 | - // Should we do something? |
|
301 | - if (!empty($this->CMD)) { |
|
300 | + // Should we do something? |
|
301 | + if (!empty($this->CMD)) { |
|
302 | 302 | |
303 | - // Sanitize input... |
|
304 | - $_method = 'cmd'.ucfirst($this->CMD); |
|
303 | + // Sanitize input... |
|
304 | + $_method = 'cmd'.ucfirst($this->CMD); |
|
305 | 305 | |
306 | - // ...and unset to prevent infinite looping. |
|
307 | - unset ($this->CMD); |
|
306 | + // ...and unset to prevent infinite looping. |
|
307 | + unset ($this->CMD); |
|
308 | 308 | |
309 | - if (method_exists($this, $_method)) { |
|
309 | + if (method_exists($this, $_method)) { |
|
310 | 310 | |
311 | - $this->$_method(); |
|
311 | + $this->$_method(); |
|
312 | 312 | |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | - } |
|
315 | + } |
|
316 | 316 | |
317 | - // Check for existing structure configuration. |
|
318 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
319 | - 'uid', |
|
320 | - 'tx_dlf_structures', |
|
321 | - 'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_structures') |
|
322 | - ); |
|
317 | + // Check for existing structure configuration. |
|
318 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
319 | + 'uid', |
|
320 | + 'tx_dlf_structures', |
|
321 | + 'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_structures') |
|
322 | + ); |
|
323 | 323 | |
324 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
324 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
325 | 325 | |
326 | - // Fine. |
|
327 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
328 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
329 | - tx_dlf_helper::getLL('flash.structureOkayMsg'), |
|
330 | - tx_dlf_helper::getLL('flash.structureOkay', TRUE), |
|
331 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
332 | - FALSE |
|
333 | - ); |
|
326 | + // Fine. |
|
327 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
328 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
329 | + tx_dlf_helper::getLL('flash.structureOkayMsg'), |
|
330 | + tx_dlf_helper::getLL('flash.structureOkay', TRUE), |
|
331 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
332 | + FALSE |
|
333 | + ); |
|
334 | 334 | |
335 | - } else { |
|
335 | + } else { |
|
336 | 336 | |
337 | - // Configuration missing. |
|
338 | - $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addStructure'))); |
|
337 | + // Configuration missing. |
|
338 | + $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addStructure'))); |
|
339 | 339 | |
340 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
341 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
342 | - sprintf(tx_dlf_helper::getLL('flash.structureNotOkayMsg'), $_url), |
|
343 | - tx_dlf_helper::getLL('flash.structureNotOkay', TRUE), |
|
344 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
345 | - FALSE |
|
346 | - ); |
|
340 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
341 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
342 | + sprintf(tx_dlf_helper::getLL('flash.structureNotOkayMsg'), $_url), |
|
343 | + tx_dlf_helper::getLL('flash.structureNotOkay', TRUE), |
|
344 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
345 | + FALSE |
|
346 | + ); |
|
347 | 347 | |
348 | - } |
|
348 | + } |
|
349 | 349 | |
350 | - tx_dlf_helper::addMessage($_message); |
|
350 | + tx_dlf_helper::addMessage($_message); |
|
351 | 351 | |
352 | - // Check for existing metadata configuration. |
|
353 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
354 | - 'uid', |
|
355 | - 'tx_dlf_metadata', |
|
356 | - 'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_metadata') |
|
357 | - ); |
|
352 | + // Check for existing metadata configuration. |
|
353 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
354 | + 'uid', |
|
355 | + 'tx_dlf_metadata', |
|
356 | + 'pid='.intval($this->id).tx_dlf_helper::whereClause('tx_dlf_metadata') |
|
357 | + ); |
|
358 | 358 | |
359 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
359 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
360 | 360 | |
361 | - // Fine. |
|
362 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
363 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
364 | - tx_dlf_helper::getLL('flash.metadataOkayMsg'), |
|
365 | - tx_dlf_helper::getLL('flash.metadataOkay', TRUE), |
|
366 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
367 | - FALSE |
|
368 | - ); |
|
361 | + // Fine. |
|
362 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
363 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
364 | + tx_dlf_helper::getLL('flash.metadataOkayMsg'), |
|
365 | + tx_dlf_helper::getLL('flash.metadataOkay', TRUE), |
|
366 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
367 | + FALSE |
|
368 | + ); |
|
369 | 369 | |
370 | - } else { |
|
370 | + } else { |
|
371 | 371 | |
372 | - // Configuration missing. |
|
373 | - $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addMetadata'))); |
|
372 | + // Configuration missing. |
|
373 | + $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addMetadata'))); |
|
374 | 374 | |
375 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
376 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
377 | - sprintf(tx_dlf_helper::getLL('flash.metadataNotOkayMsg'), $_url), |
|
378 | - tx_dlf_helper::getLL('flash.metadataNotOkay', TRUE), |
|
379 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
380 | - FALSE |
|
381 | - ); |
|
375 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
376 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
377 | + sprintf(tx_dlf_helper::getLL('flash.metadataNotOkayMsg'), $_url), |
|
378 | + tx_dlf_helper::getLL('flash.metadataNotOkay', TRUE), |
|
379 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
380 | + FALSE |
|
381 | + ); |
|
382 | 382 | |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | - tx_dlf_helper::addMessage($_message); |
|
385 | + tx_dlf_helper::addMessage($_message); |
|
386 | 386 | |
387 | - // Check the access conditions for the command line indexer's user. |
|
388 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
389 | - 'uid,db_mountpoints', |
|
390 | - 'be_groups', |
|
391 | - 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') |
|
392 | - ); |
|
387 | + // Check the access conditions for the command line indexer's user. |
|
388 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
389 | + 'uid,db_mountpoints', |
|
390 | + 'be_groups', |
|
391 | + 'title='.$GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups').' AND '.$GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'].'=0'.\TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('be_groups') |
|
392 | + ); |
|
393 | 393 | |
394 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
394 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
395 | 395 | |
396 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
396 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
397 | 397 | |
398 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) { |
|
398 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($resArray['db_mountpoints'], $this->id)) { |
|
399 | 399 | |
400 | - // Fine. |
|
401 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
402 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
403 | - tx_dlf_helper::getLL('flash.usergroupOkayMsg'), |
|
404 | - tx_dlf_helper::getLL('flash.usergroupOkay', TRUE), |
|
405 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
406 | - FALSE |
|
407 | - ); |
|
400 | + // Fine. |
|
401 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
402 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
403 | + tx_dlf_helper::getLL('flash.usergroupOkayMsg'), |
|
404 | + tx_dlf_helper::getLL('flash.usergroupOkay', TRUE), |
|
405 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
406 | + FALSE |
|
407 | + ); |
|
408 | 408 | |
409 | - } else { |
|
409 | + } else { |
|
410 | 410 | |
411 | - // Configuration missing. |
|
412 | - $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addAccessRights'))); |
|
411 | + // Configuration missing. |
|
412 | + $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addAccessRights'))); |
|
413 | 413 | |
414 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
415 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
416 | - sprintf(tx_dlf_helper::getLL('flash.usergroupNotOkayMsg'), $_url), |
|
417 | - tx_dlf_helper::getLL('flash.usergroupNotOkay', TRUE), |
|
418 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
419 | - FALSE |
|
420 | - ); |
|
414 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
415 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
416 | + sprintf(tx_dlf_helper::getLL('flash.usergroupNotOkayMsg'), $_url), |
|
417 | + tx_dlf_helper::getLL('flash.usergroupNotOkay', TRUE), |
|
418 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
419 | + FALSE |
|
420 | + ); |
|
421 | 421 | |
422 | - } |
|
422 | + } |
|
423 | 423 | |
424 | - } else { |
|
424 | + } else { |
|
425 | 425 | |
426 | - // Usergoup missing. |
|
427 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
428 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
429 | - tx_dlf_helper::getLL('flash.usergroupMissingMsg'), |
|
430 | - tx_dlf_helper::getLL('flash.usergroupMissing', TRUE), |
|
431 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
432 | - FALSE |
|
433 | - ); |
|
426 | + // Usergoup missing. |
|
427 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
428 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
429 | + tx_dlf_helper::getLL('flash.usergroupMissingMsg'), |
|
430 | + tx_dlf_helper::getLL('flash.usergroupMissing', TRUE), |
|
431 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
432 | + FALSE |
|
433 | + ); |
|
434 | 434 | |
435 | - } |
|
435 | + } |
|
436 | 436 | |
437 | - tx_dlf_helper::addMessage($_message); |
|
437 | + tx_dlf_helper::addMessage($_message); |
|
438 | 438 | |
439 | - // Check for existing Solr core. |
|
440 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
441 | - 'uid,pid', |
|
442 | - 'tx_dlf_solrcores', |
|
443 | - 'pid IN ('.intval($this->id).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores') |
|
444 | - ); |
|
439 | + // Check for existing Solr core. |
|
440 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
441 | + 'uid,pid', |
|
442 | + 'tx_dlf_solrcores', |
|
443 | + 'pid IN ('.intval($this->id).',0)'.tx_dlf_helper::whereClause('tx_dlf_solrcores') |
|
444 | + ); |
|
445 | 445 | |
446 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
446 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
447 | 447 | |
448 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
448 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
449 | 449 | |
450 | - if ($resArray['pid']) { |
|
450 | + if ($resArray['pid']) { |
|
451 | 451 | |
452 | - // Fine. |
|
453 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
454 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
455 | - tx_dlf_helper::getLL('flash.solrcoreOkayMsg'), |
|
456 | - tx_dlf_helper::getLL('flash.solrcoreOkay', TRUE), |
|
457 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
458 | - FALSE |
|
459 | - ); |
|
452 | + // Fine. |
|
453 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
454 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
455 | + tx_dlf_helper::getLL('flash.solrcoreOkayMsg'), |
|
456 | + tx_dlf_helper::getLL('flash.solrcoreOkay', TRUE), |
|
457 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
458 | + FALSE |
|
459 | + ); |
|
460 | 460 | |
461 | - } else { |
|
461 | + } else { |
|
462 | 462 | |
463 | - // Default core available, but this is deprecated. |
|
464 | - $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore'))); |
|
463 | + // Default core available, but this is deprecated. |
|
464 | + $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore'))); |
|
465 | 465 | |
466 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
467 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
468 | - sprintf(tx_dlf_helper::getLL('flash.solrcoreDeprecatedMsg'), $_url), |
|
469 | - tx_dlf_helper::getLL('flash.solrcoreDeprecatedOkay', TRUE), |
|
470 | - \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE, |
|
471 | - FALSE |
|
472 | - ); |
|
466 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
467 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
468 | + sprintf(tx_dlf_helper::getLL('flash.solrcoreDeprecatedMsg'), $_url), |
|
469 | + tx_dlf_helper::getLL('flash.solrcoreDeprecatedOkay', TRUE), |
|
470 | + \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE, |
|
471 | + FALSE |
|
472 | + ); |
|
473 | 473 | |
474 | - } |
|
474 | + } |
|
475 | 475 | |
476 | - } else { |
|
476 | + } else { |
|
477 | 477 | |
478 | - // Solr core missing. |
|
479 | - $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore'))); |
|
478 | + // Solr core missing. |
|
479 | + $_url = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array ('id' => $this->id, 'CMD' => 'addSolrcore'))); |
|
480 | 480 | |
481 | - $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
482 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
483 | - sprintf(tx_dlf_helper::getLL('flash.solrcoreMissingMsg'), $_url), |
|
484 | - tx_dlf_helper::getLL('flash.solrcoreMissing', TRUE), |
|
485 | - \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
486 | - FALSE |
|
487 | - ); |
|
481 | + $_message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
482 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
483 | + sprintf(tx_dlf_helper::getLL('flash.solrcoreMissingMsg'), $_url), |
|
484 | + tx_dlf_helper::getLL('flash.solrcoreMissing', TRUE), |
|
485 | + \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
486 | + FALSE |
|
487 | + ); |
|
488 | 488 | |
489 | - } |
|
489 | + } |
|
490 | 490 | |
491 | - tx_dlf_helper::addMessage($_message); |
|
491 | + tx_dlf_helper::addMessage($_message); |
|
492 | 492 | |
493 | - $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); |
|
493 | + $this->markerArray['CONTENT'] .= tx_dlf_helper::renderFlashMessages(); |
|
494 | 494 | |
495 | - } else { |
|
495 | + } else { |
|
496 | 496 | |
497 | - // TODO: Ändern! |
|
498 | - $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; |
|
497 | + // TODO: Ändern! |
|
498 | + $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; |
|
499 | 499 | |
500 | - } |
|
500 | + } |
|
501 | 501 | |
502 | - $this->printContent(); |
|
502 | + $this->printContent(); |
|
503 | 503 | |
504 | - } |
|
504 | + } |
|
505 | 505 | |
506 | 506 | } |
507 | 507 |