From: Maryana Rozhankivska Date: Wed, 2 Apr 2014 19:33:06 +0000 (+0300) Subject: import without cron X-Git-Tag: 1.6.0^2~6 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=a4585f7eaa74d5f705c1622ac2419ea1198a7aba;p=github%2Fwallabag%2Fwallabag.git import without cron --- a4585f7eaa74d5f705c1622ac2419ea1198a7aba diff --cc inc/poche/Database.class.php index 9adb1644,2257f281..6244df88 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@@ -407,14 -388,15 +407,15 @@@ class Database public function getLastId($column = '') { return $this->getHandle()->lastInsertId($column); } - - public function search($term){ - $search = '%'.$term.'%'; - $query = $this->getHandle()->prepare("SELECT * FROM entries WHERE content LIKE ? OR title LIKE ? OR url LIKE ?"); //searches in content, title and URL - $query->execute(array($search,$search,$search)); - $entries = $query->fetchAll(); - return $entries; - } + - public function search($term,$id,$limit = ''){ - $search = '%'.$term.'%'; - $sql_action = ("SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "); //searches in content, title and URL - $sql_action .= $this->getEntriesOrder().' ' . $limit; - $params_action = array($id,$search,$search,$search); - $query = $this->executeQuery($sql_action, $params_action); - return $query->fetchAll(); - } ++ public function search($term, $user_id, $limit = '') { ++ $search = '%'.$term.'%'; ++ $sql_action = "SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "; //searches in content, title and URL ++ $sql_action .= $this->getEntriesOrder().' ' . $limit; ++ $params_action = array($user_id, $search, $search, $search); ++ $query = $this->executeQuery($sql_action, $params_action); ++ return $query->fetchAll(); ++ } public function retrieveAllTags($user_id, $term = null) { $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags diff --cc inc/poche/Poche.class.php index d1b0c945,42a2dd9a..ee3b2ac2 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@@ -597,14 -603,20 +597,19 @@@ class Poch 'tags' => $tags, ); break; - - case 'search': - if (isset($_GET['search'])){ - $search = $_GET['search']; - $tpl_vars['entries'] = $this->store->search($search); - $tpl_vars['nb_results'] = count($tpl_vars['entries']); - } - - case 'search': - if (isset($_GET['search'])){ - $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING); - $tpl_vars['entries'] = $this->store->search($search,$this->user->getId()); - $count = count($tpl_vars['entries']); - $this->pagination->set_total($count); - $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), - $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&' )); - $tpl_vars['page_links'] = $page_links; - $tpl_vars['nb_results'] = $count; - $tpl_vars['search_term'] = $search; - } -- break; ++ case 'search': ++ if (isset($_GET['search'])) { ++ $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING); ++ $tpl_vars['entries'] = $this->store->search($search, $this->user->getId()); ++ $count = count($tpl_vars['entries']); ++ $this->pagination->set_total($count); ++ $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), ++ $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&' )); ++ $tpl_vars['page_links'] = $page_links; ++ $tpl_vars['nb_results'] = $count; ++ $tpl_vars['search_term'] = $search; ++ } ++ break; case 'view': $entry = $this->store->retrieveOneById($id, $this->user->getId()); if ($entry != NULL) { diff --cc themes/baggy/config.twig index a13af0c8,a13af0c8..fc7890ec mode 100644,100644..100755 --- a/themes/baggy/config.twig +++ b/themes/baggy/config.twig @@@ -105,37 -105,37 +105,20 @@@ {% endif %}

{% trans "Import" %}

--

{% trans "Importing from other services can be quite long, and webservers default configuration often prevents long scripts execution time, so it must be done in multiple parts." %}

--

1. {% trans "First, select the export file on your computer and upload it." %}

--
++

{% trans "You can import your Pocket, Readability, Instapaper, Wallabag or any data in appropriate json or html format." %}

++

{% trans "Please select export file on your computer:" %}

++
-- ++
-- --
--

2. {% trans "Then, click on the right link below." %}

-- -- -- {% if token == '' %} --

{% trans "3. Your feed token is currently empty and must first be generated to fetch content. Click here to generate it." %}

-- {% else %} --

3. {% trans "Finally, you have to fetch content for imported items." %} {% trans "Click here" %} {% trans "to fetch content for 10 articles" %}.

--

{% trans "If you have console access to your server, you can also create a cron task:" %}

--
0 */4 * * *  cd /path/to/wallabag && php cron.php --limit=10 --user-id={{user_id}} --token={{token}} >/dev/null 2>&1
-- {% endif %} -- ++

{% trans "Export your wallabag data" %}

{% if constant('STORAGE') == 'sqlite' %}

{% trans "Click here" %} {% trans "to download your database." %}

{% endif %} diff --cc themes/baggy/css/main.css index 6e328ba1,6e328ba1..9a45544b --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@@ -777,7 -777,7 +777,7 @@@ margin-top:1em } .warning { -- font-size: 3em; ++ /* font-size: 3em; color: #999; font-style: italic; position: absolute; @@@ -786,7 -786,7 +786,10 @@@ width: 100%; text-align: center; padding-right: 5%; -- margin-top: -2em; ++ margin-top: -2em;*/ ++ font-weight: bold; ++ display: block; ++ width: 100%; } /* ========================================================================== diff --cc themes/baggy/layout.twig index dfebc3ea,dfebc3ea..8de12749 mode 100644,100644..100755 --- a/themes/baggy/layout.twig +++ b/themes/baggy/layout.twig @@@ -21,6 -21,6 +21,9 @@@ {% block precontent %}{% endblock %} {% block messages %} {% include '_messages.twig' %} ++ {% if includeImport %} ++ {% include '_import.twig' %} ++ {% endif %} {% endblock %}
{% block content %}{% endblock %}