Skip to content

Commit 0c7b99b

Browse files
committed
Merge pull request #487 from niol/opml-export-logging
more opml export logging
2 parents 1b23b3f + 4b1b18d commit 0c7b99b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

controllers/Opml.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ private function writeSource($source) {
247247
$this->writer->writeAttributeNS('selfoss', 'params', null, html_entity_decode($source['params']));
248248

249249
$this->writer->endElement(); // outline
250+
\F3::get('logger')->log("done exporting source ".$source['title'], \DEBUG);
250251
}
251252

252253

@@ -259,6 +260,7 @@ public function export() {
259260
$this->sourcesDao = new \daos\Sources();
260261
$this->tagsDao = new \daos\Tags();
261262

263+
\F3::get('logger')->log('start OPML export', \DEBUG);
262264
$this->writer = new \XMLWriter();
263265
$this->writer->openMemory();
264266
$this->writer->setIndent(1);
@@ -276,11 +278,13 @@ public function export() {
276278
$this->writer->writeAttribute('version', '1.0');
277279
$this->writer->writeAttribute('createdOn', date('r'));
278280
$this->writer->endElement(); // meta
281+
\F3::get('logger')->log('OPML export: finished writing meta', \DEBUG);
279282

280283
$this->writer->startElement('head');
281284
$user = \F3::get('username');
282285
$this->writer->writeElement('title', ($user?$user.'\'s':'My') . ' subscriptions in selfoss');
283286
$this->writer->endElement(); // head
287+
\F3::get('logger')->log('OPML export: finished writing head', \DEBUG);
284288

285289
$this->writer->startElement('body');
286290

@@ -298,11 +302,13 @@ public function export() {
298302
// create associative array with tag names as keys, colors as values
299303
$tagColors = array();
300304
foreach ($this->tagsDao->get() as $key => $tag) {
305+
\F3::get('logger')->log("OPML export: tag ".$tag['tag']." has color ".$tag['color'], \DEBUG);
301306
$tagColors[$tag['tag']] = $tag['color'];
302307
}
303308

304309
// generate outline elements for all sources
305310
foreach ($sources['tagged'] as $tag => $children) {
311+
\F3::get('logger')->log("OPML export: exporting tag $tag sources", \DEBUG);
306312
$this->writer->startElement('outline');
307313
$this->writer->writeAttribute('title', $tag);
308314
$this->writer->writeAttribute('text', $tag);
@@ -315,13 +321,16 @@ public function export() {
315321

316322
$this->writer->endElement(); // outline
317323
}
324+
325+
\F3::get('logger')->log("OPML export: exporting untagged sources", \DEBUG);
318326
foreach ($sources['untagged'] as $key => $source) {
319327
$this->writeSource($source);
320328
}
321329

322330
$this->writer->endElement(); // body
323331

324332
$this->writer->endDocument();
333+
\F3::get('logger')->log('finished OPML export', \DEBUG);
325334

326335
// save content as file and suggest file name
327336
header('Content-Disposition: attachment; filename="selfoss-subscriptions.xml"');

0 commit comments

Comments
 (0)