aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-19 11:23:07 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-19 11:23:07 +0200
commitd7b4b2c72cd1c9ad967ecfec668d5b0b9e794149 (patch)
treed20f88d9e9157bf9721c77913096dcd6875231b5 /src/Wallabag
parentda18a4682f124b02278860d23ac1d59dee995277 (diff)
parentf9feca5c64309a2a202258bb92ae24b7a1dbe31c (diff)
downloadwallabag-d7b4b2c72cd1c9ad967ecfec668d5b0b9e794149.tar.gz
wallabag-d7b4b2c72cd1c9ad967ecfec668d5b0b9e794149.tar.zst
wallabag-d7b4b2c72cd1c9ad967ecfec668d5b0b9e794149.zip
Merge remote-tracking branch 'origin/master' into 2.1
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php24
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php6
2 files changed, 26 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index bd7b55f9..3873d2d3 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -71,8 +71,10 @@ class InstallCommand extends ContainerAwareCommand
71 { 71 {
72 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>'); 72 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>');
73 73
74 $fulfilled = true; 74 $rows = [];
75 75
76 // testing if database driver exists
77 $fulfilled = true;
76 $label = '<comment>PDO Driver</comment>'; 78 $label = '<comment>PDO Driver</comment>';
77 $status = '<info>OK!</info>'; 79 $status = '<info>OK!</info>';
78 $help = ''; 80 $help = '';
@@ -83,7 +85,23 @@ class InstallCommand extends ContainerAwareCommand
83 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.'; 85 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.';
84 } 86 }
85 87
86 $rows = []; 88 $rows[] = [$label, $status, $help];
89
90 // testing if connection to the database can be etablished
91 $label = '<comment>Database connection</comment>';
92 $status = '<info>OK!</info>';
93 $help = '';
94
95 try {
96 $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect();
97 } catch (\Exception $e) {
98 if (false === strpos($e->getMessage(), 'Unknown database')) {
99 $fulfilled = false;
100 $status = '<error>ERROR!</error>';
101 $help = 'Can\'t connect to the database: '.$e->getMessage();
102 }
103 }
104
87 $rows[] = [$label, $status, $help]; 105 $rows[] = [$label, $status, $help];
88 106
89 foreach ($this->functionExists as $functionRequired) { 107 foreach ($this->functionExists as $functionRequired) {
@@ -451,7 +469,7 @@ class InstallCommand extends ContainerAwareCommand
451 } 469 }
452 470
453 // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite 471 // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite
454 if ('sqlite' == $schemaManager->getDatabasePlatform()->getName()) { 472 if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) {
455 $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams(); 473 $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams();
456 474
457 if (isset($params['path']) && file_exists($params['path'])) { 475 if (isset($params['path']) && file_exists($params['path'])) {
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 73276319..1dfa12c8 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -163,8 +163,12 @@ class EntriesExport
163 $book->setSubject($tag['value']); 163 $book->setSubject($tag['value']);
164 } 164 }
165 165
166 // the reader in Kobo Devices doesn't likes special caracters
167 // in filenames, we limit to A-z/0-9
168 $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle());
169
166 $chapter = $content_start.$entry->getContent().$bookEnd; 170 $chapter = $content_start.$entry->getContent().$bookEnd;
167 $book->addChapter($entry->getTitle(), htmlspecialchars($entry->getTitle()).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD); 171 $book->addChapter($entry->getTitle(), htmlspecialchars($filename).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
168 } 172 }
169 173
170 return Response::create( 174 return Response::create(