Add migration

This commit is contained in:
Nicolas Lœuillet 2016-04-10 21:48:11 +02:00
parent f3d0cb9106
commit d0545b6bd6
6 changed files with 42 additions and 4 deletions

View file

@ -0,0 +1,26 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
class Version20160410190541 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE wallabag_entry ADD uuid LONGTEXT DEFAULT NULL');
$this->addSql('UPDATE wallabag_entry SET uuid = uuid()');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE `wallabag_entry` DROP uuid');
}
}

View file

@ -241,6 +241,11 @@ class InstallCommand extends ContainerAwareCommand
$em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute(); $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute();
$settings = [ $settings = [
[
'name' => 'share_public',
'value' => '1',
'section' => 'entry',
],
[ [
'name' => 'carrot', 'name' => 'carrot',
'value' => '1', 'value' => '1',

View file

@ -451,10 +451,9 @@ class EntryController extends Controller
private function checkIfEntryAlreadyExists(Entry $entry) private function checkIfEntryAlreadyExists(Entry $entry)
{ {
return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId());
} }
/* /**
* Share entry content. * Share entry content.
* *
* @param Entry $entry * @param Entry $entry
@ -463,7 +462,7 @@ class EntryController extends Controller
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function shareEntry(Entry $entry) public function shareEntryAction(Entry $entry)
{ {
return $this->render( return $this->render(
'@WallabagCore/themes/share.html.twig', '@WallabagCore/themes/share.html.twig',

View file

@ -15,6 +15,11 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
public function load(ObjectManager $manager) public function load(ObjectManager $manager)
{ {
$settings = [ $settings = [
[
'name' => 'share_public',
'value' => '1',
'section' => 'entry',
],
[ [
'name' => 'carrot', 'name' => 'carrot',
'value' => '1', 'value' => '1',

View file

@ -17,6 +17,9 @@
<li><a title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span></a></li> <li><a title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span></a></li>
<li><a id="nav-btn-add-tag" title="{{ 'entry.view.left_menu.add_a_tag'|trans }}"><span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span></a></li> <li><a id="nav-btn-add-tag" title="{{ 'entry.view.left_menu.add_a_tag'|trans }}"><span>{{ 'entry.view.left_menu.add_a_tag'|trans }}</span></a></li>
<li><a title="{{ 'entry.view.left_menu.delete'|trans }}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.delete'|trans }}</span></a></li> <li><a title="{{ 'entry.view.left_menu.delete'|trans }}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{{ 'entry.view.left_menu.delete'|trans }}</span></a></li>
{% if craue_setting('share_public') %}
<li><a href="{{ path('share', {'uuid': entry.uuid }) }}" target="_blank" class="tool public" title="public"><span>public</span></a></li>
{% endif %}
{% if craue_setting('share_twitter') %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="Tweet"><span>Tweet</span></a></li>{% endif %} {% if craue_setting('share_twitter') %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="Tweet"><span>Tweet</span></a></li>{% endif %}
{% if craue_setting('share_mail') %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="Email"><span>Email</span></a></li>{% endif %} {% if craue_setting('share_mail') %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="Email"><span>Email</span></a></li>{% endif %}
{% if craue_setting('share_shaarli') %}<li><a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="shaarli"><span>shaarli</span></a></li>{% endif %} {% if craue_setting('share_shaarli') %}<li><a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="shaarli"><span>shaarli</span></a></li>{% endif %}

View file

@ -99,7 +99,7 @@
</a> </a>
<div class="collapsible-body"> <div class="collapsible-body">
<ul> <ul>
{% if craue_setting('share_twitter') %} {% if craue_setting('share_public') %}
<li> <li>
<a href="{{ path('share', {'uuid': entry.uuid }) }}" target="_blank" class="tool public" title="public"> <a href="{{ path('share', {'uuid': entry.uuid }) }}" target="_blank" class="tool public" title="public">
<span>public</span> <span>public</span>