Merge lp:~sebastian-meyer/goobi-presentation/bug809828 into lp:goobi-presentation/1.0

Proposed by Sebastian Meyer
Status: Merged
Merged at revision: 31
Proposed branch: lp:~sebastian-meyer/goobi-presentation/bug809828
Merge into: lp:goobi-presentation/1.0
Diff against target: 436 lines (+110/-72)
11 files modified
dlf/cli/class.tx_dlf_cli.php (+3/-3)
dlf/common/class.tx_dlf_document.php (+28/-22)
dlf/common/class.tx_dlf_helper.php (+1/-5)
dlf/common/class.tx_dlf_indexing.php (+13/-1)
dlf/common/class.tx_dlf_plugin.php (+6/-0)
dlf/hooks/class.tx_dlf_tcemain.php (+27/-3)
dlf/modules/indexing/index.php (+3/-5)
dlf/plugins/metadata/class.tx_dlf_metadata.php (+7/-7)
dlf/plugins/navigation/class.tx_dlf_navigation.php (+3/-9)
dlf/plugins/pageview/class.tx_dlf_pageview.php (+3/-9)
dlf/plugins/toc/class.tx_dlf_toc.php (+16/-8)
To merge this branch: bzr merge lp:~sebastian-meyer/goobi-presentation/bug809828
Reviewer Review Type Date Requested Status
Sebastian Meyer Approve
Review via email: mp+71026@code.launchpad.net

Commit message

Fix Bug #809828: Collections with deleted documents can not be re-indexed.

To post a comment you must log in.
Revision history for this message
Sebastian Meyer (sebastian-meyer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dlf/cli/class.tx_dlf_cli.php'
2--- dlf/cli/class.tx_dlf_cli.php 2011-06-22 13:18:23 +0000
3+++ dlf/cli/class.tx_dlf_cli.php 2011-08-10 11:07:28 +0000
4@@ -80,11 +80,11 @@
5 $doc = tx_dlf_document::getInstance($this->cli_args['-doc'][0], 0, TRUE);
6
7 // ...save it to the database...
8- if (!($doc instanceof tx_dlf_document) || !$doc->save(intval($this->cli_args['-pid'][0]), $this->cli_args['-core'][0])) {
9+ if ($doc === NULL || !$doc->save(intval($this->cli_args['-pid'][0]), $this->cli_args['-core'][0])) {
10
11 $this->cli_echo('ERROR: Document '.$this->cli_args['-doc'][0].' not saved and indexed'.LF, TRUE);
12
13- return 1;
14+ exit (1);
15
16 }
17
18@@ -98,7 +98,7 @@
19
20 }
21
22- return 0;
23+ exit (0);
24
25 }
26
27
28=== modified file 'dlf/common/class.tx_dlf_document.php'
29--- dlf/common/class.tx_dlf_document.php 2011-06-27 09:20:36 +0000
30+++ dlf/common/class.tx_dlf_document.php 2011-08-10 11:07:28 +0000
31@@ -347,15 +347,19 @@
32 $instance = new self($uid, $pid);
33
34 // ...and save it to registry.
35- self::$registry[$instance->uid] = $instance;
36-
37- // Load extension configuration
38- $_extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
39-
40- // Save document to session if caching is enabled.
41- if (!empty($_extConf['caching'])) {
42-
43- tx_dlf_helper::saveToSession(self::$registry, get_class($instance));
44+ if ($instance !== NULL) {
45+
46+ self::$registry[$instance->uid] = $instance;
47+
48+ // Load extension configuration
49+ $_extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']);
50+
51+ // Save document to session if caching is enabled.
52+ if (!empty($_extConf['caching'])) {
53+
54+ tx_dlf_helper::saveToSession(self::$registry, get_class($instance));
55+
56+ }
57
58 }
59
60@@ -578,7 +582,7 @@
61
62 trigger_error('Invalid class/method '.$_class.'->extractMetadata()', E_USER_ERROR);
63
64- exit;
65+ return array ();
66
67 }
68
69@@ -720,8 +724,6 @@
70
71 trigger_error('No valid METS part found in document with UID '.$this->uid, E_USER_ERROR);
72
73- exit;
74-
75 }
76
77 }
78@@ -834,7 +836,7 @@
79
80 trigger_error('Saving documents is only allowed in the backend!', E_USER_ERROR);
81
82- exit;
83+ return FALSE;
84
85 }
86
87@@ -1056,14 +1058,18 @@
88
89 $superior = tx_dlf_document::getInstance($this->tableOfContents[0]['points']);
90
91- if ($superior->pid != $pid) {
92-
93- $superior->save($pid);
94+ if ($superior !== NULL) {
95+
96+ if ($superior->pid != $pid) {
97+
98+ $superior->save($pid);
99+
100+ }
101+
102+ $partof = $superior->uid;
103
104 }
105
106- $partof = $superior->uid;
107-
108 }
109
110 // Get metadata for lists.
111@@ -1234,7 +1240,7 @@
112
113 trigger_error('No PID for metadata definitions found', E_USER_ERROR);
114
115- exit;
116+ return array ();
117
118 }
119
120@@ -1646,7 +1652,7 @@
121
122 trigger_error('There is no record with UID '.$uid.' or you are not allowed to access it', E_USER_ERROR);
123
124- exit;
125+ return;
126
127 }
128
129@@ -1679,7 +1685,7 @@
130 trigger_error('Could not load XML file from '.$location, E_USER_ERROR);
131 // TODO: libxml_get_errors() || libxml_get_last_error() || libxml_clear_errors()
132
133- exit;
134+ return;
135
136 }
137
138@@ -1805,7 +1811,7 @@
139 trigger_error('Could not reload XML from session', E_USER_ERROR);
140 // TODO: libxml_get_errors() || libxml_get_last_error() || libxml_clear_errors()
141
142- exit;
143+ return;
144
145 }
146
147
148=== modified file 'dlf/common/class.tx_dlf_helper.php'
149--- dlf/common/class.tx_dlf_helper.php 2011-06-27 09:03:45 +0000
150+++ dlf/common/class.tx_dlf_helper.php 2011-08-10 11:07:28 +0000
151@@ -736,16 +736,12 @@
152
153 trigger_error('There are no entries with PID '.$pid.' in table '.$table.' or you are not allowed to access them', E_USER_ERROR);
154
155- exit;
156-
157 }
158
159 } else {
160
161 trigger_error('The table '.$table.' is not allowed for translation', E_USER_ERROR);
162
163- exit;
164-
165 }
166
167 }
168@@ -821,7 +817,7 @@
169
170 trigger_error('Unexpected TYPO3_MODE', E_USER_ERROR);
171
172- exit;
173+ return ' AND 1=-1';
174
175 }
176
177
178=== modified file 'dlf/common/class.tx_dlf_indexing.php'
179--- dlf/common/class.tx_dlf_indexing.php 2011-06-22 17:48:56 +0000
180+++ dlf/common/class.tx_dlf_indexing.php 2011-08-10 11:07:28 +0000
181@@ -147,7 +147,19 @@
182 // Handle multi-volume documents.
183 if ($doc->parentid) {
184
185- $errors = self::add(tx_dlf_document::getInstance($doc->parentid, 0, TRUE), $core);
186+ $parent = tx_dlf_document::getInstance($doc->parentid, 0, TRUE);
187+
188+ if ($parent !== NULL) {
189+
190+ $errors = self::add($parent, $core);
191+
192+ } else {
193+
194+ trigger_error('Could not load multi-volume work with UID '.$doc->parentid, E_USER_ERROR);
195+
196+ return 1;
197+
198+ }
199
200 }
201
202
203=== modified file 'dlf/common/class.tx_dlf_plugin.php'
204--- dlf/common/class.tx_dlf_plugin.php 2011-04-01 15:53:16 +0000
205+++ dlf/common/class.tx_dlf_plugin.php 2011-08-10 11:07:28 +0000
206@@ -188,6 +188,12 @@
207 // Get instance of tx_dlf_document.
208 $this->doc = tx_dlf_document::getInstance($this->piVars['id'], $pid);
209
210+ if ($this->doc === NULL) {
211+
212+ trigger_error('Failed to load document with UID '.$this->piVars['id'], E_USER_ERROR);
213+
214+ }
215+
216 } else {
217
218 trigger_error('Required parameters are not set', E_USER_ERROR);
219
220=== modified file 'dlf/hooks/class.tx_dlf_tcemain.php'
221--- dlf/hooks/class.tx_dlf_tcemain.php 2011-06-15 16:12:43 +0000
222+++ dlf/hooks/class.tx_dlf_tcemain.php 2011-08-10 11:07:28 +0000
223@@ -241,7 +241,15 @@
224 // Reindex document.
225 $doc = tx_dlf_document::getInstance($id);
226
227- $doc->save($doc->pid, $core);
228+ if ($doc !== NULL) {
229+
230+ $doc->save($doc->pid, $core);
231+
232+ } else {
233+
234+ trigger_error('Failed to reindex document with UID '.$id, E_USER_WARNING);
235+
236+ }
237
238 }
239
240@@ -303,7 +311,15 @@
241
242 $doc = tx_dlf_document::getInstance($id);
243
244- $doc->save($doc->pid, $core);
245+ if ($doc !== NULL) {
246+
247+ $doc->save($doc->pid, $core);
248+
249+ } else {
250+
251+ trigger_error('Failed to reindex document with UID '.$id, E_USER_WARNING);
252+
253+ }
254
255 break;
256
257@@ -321,7 +337,15 @@
258 // Reindex document.
259 $doc = tx_dlf_document::getInstance($id);
260
261- $doc->save($doc->pid, $core);
262+ if ($doc !== NULL) {
263+
264+ $doc->save($doc->pid, $core);
265+
266+ } else {
267+
268+ trigger_error('Failed to reindex document with UID '.$id, E_USER_WARNING);
269+
270+ }
271
272 break;
273
274
275=== modified file 'dlf/modules/indexing/index.php'
276--- dlf/modules/indexing/index.php 2011-06-23 08:24:25 +0000
277+++ dlf/modules/indexing/index.php 2011-08-10 11:07:28 +0000
278@@ -182,7 +182,7 @@
279 // Save document to database and index.
280 $doc = tx_dlf_document::getInstance($uid, 0, TRUE);
281
282- if (!$doc->save($doc->pid, $this->data['core'])) {
283+ if ($doc === NULL || !$doc->save($doc->pid, $this->data['core'])) {
284
285 $_message = t3lib_div::makeInstance(
286 't3lib_FlashMessage',
287@@ -212,8 +212,6 @@
288
289 $this->printContent();
290
291- exit;
292-
293 }
294
295 /**
296@@ -248,7 +246,7 @@
297 // Save document to database and index.
298 $doc = tx_dlf_document::getInstance($this->data['id'], 0, TRUE);
299
300- if (!$doc->save($this->id, $this->data['core'])) {
301+ if ($doc === NULL || !$doc->save($this->id, $this->data['core'])) {
302
303 $_message = t3lib_div::makeInstance(
304 't3lib_FlashMessage',
305@@ -279,7 +277,7 @@
306 'tx_dlf_relations',
307 'tx_dlf_collections',
308 'AND tx_dlf_documents.pid='.intval($this->id).' AND tx_dlf_collections.uid='.intval($this->data['collection']).tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'),
309- '',
310+ 'tx_dlf_documents.uid',
311 '',
312 ''
313 );
314
315=== modified file 'dlf/plugins/metadata/class.tx_dlf_metadata.php'
316--- dlf/plugins/metadata/class.tx_dlf_metadata.php 2011-06-07 15:32:59 +0000
317+++ dlf/plugins/metadata/class.tx_dlf_metadata.php 2011-08-10 11:07:28 +0000
318@@ -53,16 +53,16 @@
319
320 $this->init($conf);
321
322- // Quit without doing anything if required piVars are not set.
323- if (!$this->checkPIvars()) {
324-
325- return $content;
326-
327- }
328-
329 // Load current document.
330 $this->loadDocument();
331
332+ // Quit without doing anything if required variables are not set.
333+ if ($this->doc === NULL) {
334+
335+ return $content;
336+
337+ }
338+
339 $metadata = array ();
340
341 if ($this->conf['rootline'] < 2) {
342
343=== modified file 'dlf/plugins/navigation/class.tx_dlf_navigation.php'
344--- dlf/plugins/navigation/class.tx_dlf_navigation.php 2011-04-01 15:53:16 +0000
345+++ dlf/plugins/navigation/class.tx_dlf_navigation.php 2011-08-10 11:07:28 +0000
346@@ -53,17 +53,11 @@
347
348 $this->init($conf);
349
350- // Quit without doing anything if required piVars are not set.
351- if (!$this->checkPIvars()) {
352-
353- return $content;
354-
355- }
356-
357+ // Load current document.
358 $this->loadDocument();
359
360- // Check if this document has any images.
361- if ($this->doc->numPages < 1) {
362+ // Quit without doing anything if required variables are not set.
363+ if ($this->doc === NULL || $this->doc->numPages < 1) {
364
365 return $content;
366
367
368=== modified file 'dlf/plugins/pageview/class.tx_dlf_pageview.php'
369--- dlf/plugins/pageview/class.tx_dlf_pageview.php 2011-06-27 09:20:36 +0000
370+++ dlf/plugins/pageview/class.tx_dlf_pageview.php 2011-08-10 11:07:28 +0000
371@@ -149,17 +149,11 @@
372
373 $this->init($conf);
374
375- // Quit without doing anything if required piVars are not set.
376- if (!$this->checkPIvars()) {
377-
378- return $content;
379-
380- }
381-
382+ // Load current document.
383 $this->loadDocument();
384
385- // Check if this document has any images.
386- if ($this->doc->numPages < 1) {
387+ // Quit without doing anything if required variables are not set.
388+ if ($this->doc === NULL || $this->doc->numPages < 1) {
389
390 return $content;
391
392
393=== modified file 'dlf/plugins/toc/class.tx_dlf_toc.php'
394--- dlf/plugins/toc/class.tx_dlf_toc.php 2011-06-22 17:36:00 +0000
395+++ dlf/plugins/toc/class.tx_dlf_toc.php 2011-08-10 11:07:28 +0000
396@@ -85,7 +85,15 @@
397
398 $_doc = tx_dlf_document::getInstance($entry['points'], ($this->conf['excludeOther'] ? $this->conf['pages'] : 0));
399
400- $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => ($_doc->pid ? $_doc->uid : $entry['points']), 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
401+ if ($_doc !== NULL) {
402+
403+ $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('id' => ($_doc->pid ? $_doc->uid : $entry['points']), 'page' => 1), TRUE, FALSE, $this->conf['targetPid']);
404+
405+ } else {
406+
407+ $entryArray['doNotLinkIt'] = 1;
408+
409+ }
410
411 } elseif (!empty($entry['points']['doc'])) {
412
413@@ -211,16 +219,16 @@
414
415 $this->init($conf);
416
417- // Quit without doing anything if required piVars are not set.
418- if (!$this->checkPIvars()) {
419-
420- return array ();
421-
422- }
423-
424 // Load current document.
425 $this->loadDocument();
426
427+ // Quit without doing anything if required variables are not set.
428+ if ($this->doc === NULL) {
429+
430+ return array ();
431+
432+ }
433+
434 $menuArray = array ();
435
436 // Does the document have physical pages or is it an external file?

Subscribers

People subscribed via source and target branches

to all changes: