diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-21 12:23:45 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-31 14:48:26 +0100 |
commit | d6ba77e888064dcf5757fb008426eb8bfcd6dd4c (patch) | |
tree | 211af8242a6fe1f342fc8e3393eb1ad7808cf0d3 /src/Wallabag/CoreBundle/Command | |
parent | 278b221e6545c5990e9d79a4c6bb4491b22a7a85 (diff) | |
download | wallabag-d6ba77e888064dcf5757fb008426eb8bfcd6dd4c.tar.gz wallabag-d6ba77e888064dcf5757fb008426eb8bfcd6dd4c.tar.zst wallabag-d6ba77e888064dcf5757fb008426eb8bfcd6dd4c.zip |
Create internal setting on install & fixtures
Diffstat (limited to 'src/Wallabag/CoreBundle/Command')
-rw-r--r-- | src/Wallabag/CoreBundle/Command/InstallCommand.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 7a7e3a64..f6c85cf9 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -12,6 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface; | |||
12 | use Symfony\Component\Console\Question\ConfirmationQuestion; | 12 | use Symfony\Component\Console\Question\ConfirmationQuestion; |
13 | use Symfony\Component\Console\Question\Question; | 13 | use Symfony\Component\Console\Question\Question; |
14 | use Wallabag\CoreBundle\Entity\Config; | 14 | use Wallabag\CoreBundle\Entity\Config; |
15 | use Craue\ConfigBundle\Entity\Setting; | ||
15 | 16 | ||
16 | class InstallCommand extends ContainerAwareCommand | 17 | class InstallCommand extends ContainerAwareCommand |
17 | { | 18 | { |
@@ -212,6 +213,95 @@ class InstallCommand extends ContainerAwareCommand | |||
212 | 213 | ||
213 | $em->persist($config); | 214 | $em->persist($config); |
214 | 215 | ||
216 | // cleanup before insert new stuff | ||
217 | $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute(); | ||
218 | |||
219 | $settings = [ | ||
220 | [ | ||
221 | 'name' => 'download_pictures', | ||
222 | 'value' => '1', | ||
223 | 'section' => 'entry', | ||
224 | ], | ||
225 | [ | ||
226 | 'name' => 'carrot', | ||
227 | 'value' => '1', | ||
228 | 'section' => 'entry', | ||
229 | ], | ||
230 | [ | ||
231 | 'name' => 'share_diaspora', | ||
232 | 'value' => '1', | ||
233 | 'section' => 'entry', | ||
234 | ], | ||
235 | [ | ||
236 | 'name' => 'diaspora_url', | ||
237 | 'value' => 'http://diasporapod.com', | ||
238 | 'section' => 'entry', | ||
239 | ], | ||
240 | [ | ||
241 | 'name' => 'share_shaarli', | ||
242 | 'value' => '1', | ||
243 | 'section' => 'entry', | ||
244 | ], | ||
245 | [ | ||
246 | 'name' => 'shaarli_url', | ||
247 | 'value' => 'http://myshaarli.com', | ||
248 | 'section' => 'entry', | ||
249 | ], | ||
250 | [ | ||
251 | 'name' => 'share_mail', | ||
252 | 'value' => '1', | ||
253 | 'section' => 'entry', | ||
254 | ], | ||
255 | [ | ||
256 | 'name' => 'share_twitter', | ||
257 | 'value' => '1', | ||
258 | 'section' => 'entry', | ||
259 | ], | ||
260 | [ | ||
261 | 'name' => 'export_epub', | ||
262 | 'value' => '1', | ||
263 | 'section' => 'export', | ||
264 | ], | ||
265 | [ | ||
266 | 'name' => 'export_mobi', | ||
267 | 'value' => '1', | ||
268 | 'section' => 'export', | ||
269 | ], | ||
270 | [ | ||
271 | 'name' => 'export_pdf', | ||
272 | 'value' => '1', | ||
273 | 'section' => 'export', | ||
274 | ], | ||
275 | [ | ||
276 | 'name' => 'pocket_consumer_key', | ||
277 | 'value' => NULL, | ||
278 | 'section' => 'import', | ||
279 | ], | ||
280 | [ | ||
281 | 'name' => 'show_printlink', | ||
282 | 'value' => '1', | ||
283 | 'section' => 'entry', | ||
284 | ], | ||
285 | [ | ||
286 | 'name' => 'wallabag_support_url', | ||
287 | 'value' => 'https://www.wallabag.org/pages/support.html', | ||
288 | 'section' => 'misc', | ||
289 | ], | ||
290 | [ | ||
291 | 'name' => 'wallabag_url', | ||
292 | 'value' => 'http://v2.wallabag.org', | ||
293 | 'section' => 'misc', | ||
294 | ], | ||
295 | ]; | ||
296 | |||
297 | foreach ($settings as $setting) { | ||
298 | $newSetting = new Setting(); | ||
299 | $newSetting->setName($setting['name']); | ||
300 | $newSetting->setValue($setting['value']); | ||
301 | $newSetting->setSection($setting['section']); | ||
302 | $em->persist($newSetting); | ||
303 | } | ||
304 | |||
215 | $em->flush(); | 305 | $em->flush(); |
216 | 306 | ||
217 | $this->defaultOutput->writeln(''); | 307 | $this->defaultOutput->writeln(''); |