mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
bug fix #268: move POCHE_VERSION in index.php and change the name to avoid conflicts when updating
This commit is contained in:
parent
9d3b88b379
commit
031df528b6
7 changed files with 6 additions and 158 deletions
|
@ -366,8 +366,8 @@ class Poche
|
|||
case 'config':
|
||||
$dev = $this->getPocheVersion('dev');
|
||||
$prod = $this->getPocheVersion('prod');
|
||||
$compare_dev = version_compare(POCHE_VERSION, $dev);
|
||||
$compare_prod = version_compare(POCHE_VERSION, $prod);
|
||||
$compare_dev = version_compare(POCHE, $dev);
|
||||
$compare_prod = version_compare(POCHE, $prod);
|
||||
$themes = $this->getInstalledThemes();
|
||||
$tpl_vars = array(
|
||||
'themes' => $themes,
|
||||
|
|
|
@ -49,8 +49,6 @@ define ('CACHE', ROOT . '/cache');
|
|||
|
||||
define ('PAGINATION', '10');
|
||||
|
||||
define ('POCHE_VERSION', '1.0.0');
|
||||
|
||||
define ('POCKET_FILE', '/ril_export.html');
|
||||
define ('READABILITY_FILE', '/readability');
|
||||
define ('INSTAPAPER_FILE', '/instapaper-export.html');
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* @license http://www.wtfpl.net/ see COPYING file
|
||||
*/
|
||||
|
||||
define ('POCHE', '1.0.0');
|
||||
require_once 'inc/poche/global.inc.php';
|
||||
|
||||
# Start Poche
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
# import script to upgrade from poche 0.3
|
||||
$db_path = 'sqlite:../db/poche.sqlite';
|
||||
$handle = new PDO($db_path);
|
||||
$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
# Requêtes à exécuter pour mettre à jour poche.sqlite en 1.x
|
||||
|
||||
# ajout d'un champ user_id sur la table entries
|
||||
$sql = 'ALTER TABLE entries RENAME TO tempEntries;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'CREATE TABLE entries (id INTEGER PRIMARY KEY, title TEXT, url TEXT, is_read NUMERIC DEFAULT 0, is_fav NUMERIC DEFAULT 0, content BLOB, user_id NUMERIC);';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO entries (id, title, url, is_read, is_fav, content) SELECT id, title, url, is_read, is_fav, content FROM tempEntries;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Update tout pour mettre user_id = 1
|
||||
$sql = 'UPDATE entries SET user_id = 1;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Changement des flags pour les lus / favoris
|
||||
$sql = 'UPDATE entries SET is_read = 1 WHERE is_read = -1;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'UPDATE entries SET is_fav = 1 WHERE is_fav = -1;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Création de la table users
|
||||
$sql = 'CREATE TABLE users (id INTEGER PRIMARY KEY, username TEXT, password TEXT, name TEXT, email TEXT);';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO users (username) SELECT value FROM config WHERE name = "login";';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = "UPDATE users SET password = (SELECT value FROM config WHERE name = 'password')";
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Création de la table users_config
|
||||
$sql = 'CREATE TABLE users_config (id INTEGER PRIMARY KEY, user_id NUMERIC, name TEXT, value TEXT);';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO users_config (user_id, name, value) VALUES (1, "pager", "10");';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
$sql = 'INSERT INTO users_config (user_id, name, value) VALUES (1, "language", "en_EN.UTF8");';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Suppression de la table temporaire
|
||||
$sql = 'DROP TABLE tempEntries;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
# Vidage de la table de config
|
||||
$sql = 'DELETE FROM config;';
|
||||
$query = $handle->prepare($sql);
|
||||
$query->execute();
|
||||
|
||||
echo 'welcome to poche 1.0 !';
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
require_once dirname(__FILE__).'/../inc/poche/Tools.class.php';
|
||||
include dirname(__FILE__).'/../inc/poche/define.inc.php';
|
||||
require_once __DIR__ . '/../inc/poche/Database.class.php';
|
||||
$store = new Database();
|
||||
$old_salt = '464v54gLLw928uz4zUBqkRJeiPY68zCX';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<!--[if lte IE 6]> <html class="no-js ie6 ie67 ie678" lang="en"> <![endif]-->
|
||||
<!--[if lte IE 7]> <html class="no-js ie7 ie67 ie678" lang="en"> <![endif]-->
|
||||
<!--[if IE 8]> <html class="no-js ie8 ie678" lang="en"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>updating poche</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>update poche to 1.0-beta3</h1>
|
||||
|
||||
<h2>Changelog</h2>
|
||||
<p>
|
||||
<ul>
|
||||
<li>this awesome updating step</li>
|
||||
<li>error message when install folder exists</li>
|
||||
<li>more tests before installation (write access, etc.)</li>
|
||||
<li>updated README to make installation easier</li>
|
||||
<li>german language thanks to HLFH</li>
|
||||
<li>spanish language thanks to Nitche</li>
|
||||
<li>new file ./inc/poche/myconfig.inc.php created to store language and salt</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/119">#119</a>: salt is now created when installing poche</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/130">#130</a>: robots.txt added</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/136">#136</a>: error during readability import</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/137">#137</a>: mixed content alert in https</li>
|
||||
<li><a href="https://github.com/inthepoche/poche/issues/138">#138</a>: change pattern to parse url with #</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>To update your poche, please fill the following fields.</p>
|
||||
<p>
|
||||
<form name="update" method="post">
|
||||
<div><label for="login">login:</label> <input type="text" name="login" id="login" /></div>
|
||||
<div><label for="password">password:</label> <input type="password" name="password" id="password" /></div>
|
||||
<div><input type="hidden" name="go" value="ok" /><input type="submit" value="update" /></div>
|
||||
</form>
|
||||
</p>
|
||||
<?php
|
||||
if (isset($_POST['go'])) {
|
||||
if (!empty($_POST['login']) && !empty($_POST['password'])) {
|
||||
$user = $store->login($_POST['login'], sha1($_POST['password'] . $_POST['login'] . $old_salt));
|
||||
if ($user != array()) {
|
||||
$new_salt = md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand());
|
||||
$myconfig_file = '../inc/poche/myconfig.inc.php';
|
||||
if (!is_writable('../inc/poche/')) {
|
||||
die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.');
|
||||
}
|
||||
|
||||
if (!file_exists($myconfig_file))
|
||||
{
|
||||
$fp = fopen($myconfig_file, 'w');
|
||||
|
||||
fwrite($fp, '<?php'."\r\n");
|
||||
fwrite($fp, "define ('POCHE_VERSION', '1.0-beta3');" . "\r\n");
|
||||
fwrite($fp, "define ('SALT', '" . $new_salt . "');" . "\r\n");
|
||||
fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n");
|
||||
fclose($fp);
|
||||
}
|
||||
# faire une mise à jour de la table users en prenant en compte le nouveau SALT généré
|
||||
$store->updatePassword($user['id'], sha1($_POST['password'] . $_POST['login'] . $new_salt));
|
||||
?>
|
||||
<p><span style="color: green;">your poche is up to date!</span></p>
|
||||
<p><span style="color: red;">don't forget to delete ./install/ folder after the update.</span></p>
|
||||
<p><a href="../">go back to your poche</a></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +1,4 @@
|
|||
<footer class="w600p center mt3 mb3 smaller txtright">
|
||||
<p>{% trans "powered by" %} <a href="http://inthepoche.com">poche</a></p>
|
||||
{% if constant('DEBUG_POCHE') == 1 %}<p><strong>{% trans "debug mode is on so cache is off." %} {% trans "your poche version:" %}{{constant('POCHE_VERSION')}}. {% trans "storage:" %} {{constant('STORAGE')}}</strong></p>{% endif %}
|
||||
{% if constant('DEBUG_POCHE') == 1 %}<p><strong>{% trans "debug mode is on so cache is off." %} {% trans "your poche version:" %}{{constant('POCHE')}}. {% trans "storage:" %} {{constant('STORAGE')}}</strong></p>{% endif %}
|
||||
</footer>
|
|
@ -5,7 +5,7 @@
|
|||
{% include '_menu.twig' %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h2>{% trans "Poching a link" %}</h2>
|
||||
<h2>{% trans "Poching a link" %}</h2>F
|
||||
<p>{% trans "You can poche a link by several methods:" %} (<a href="http://inthepoche.com/doc" title="{% trans "read the documentation" %}">?</a>)</p>
|
||||
<ul>
|
||||
<li>firefox: <a href="https://bitbucket.org/jogaulupeau/poche/downloads/poche.xpi" title="download the firefox extension">{% trans "download the extension" %}</a></li>
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
<h2>{% trans "Updating poche" %}</h2>
|
||||
<ul>
|
||||
<li>{% trans "your version" %} : <strong>{{ constant('POCHE_VERSION') }}</strong></li>
|
||||
<li>{% trans "your version" %} : <strong>{{ constant('POCHE') }}</strong></li>
|
||||
<li>{% trans "latest stable version" %} : {{ prod }}. {% if compare_prod == -1 %}<strong><a href="http://inthepoche.com/">{% trans "a more recent stable version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>
|
||||
{% if constant('DEBUG_POCHE') == 1 %}<li>{% trans "latest dev version" %} : {{ dev }}. {% if compare_dev == -1 %}<strong><a href="http://inthepoche.com/">{% trans "a more recent development version is available." %}</a></strong>{% else %}{% trans "you are up to date." %}{% endif %}</li>{% endif %}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue