aboutsummaryrefslogtreecommitdiffhomepage
path: root/install
diff options
context:
space:
mode:
authorNicolas Frandeboeuf <nicofrand@gmail.com>2013-08-23 22:23:55 +0200
committerNicolas Frandeboeuf <nicofrand@gmail.com>2013-08-23 22:23:55 +0200
commitf3e4f109a3ae6cd58e0abc9e909ac823d5e3065a (patch)
tree7e1ede841a99b4070825b4717d17dac92c47273c /install
parent8413a63f7d9df2695653ab2ef1d77927da6ddc55 (diff)
downloadwallabag-f3e4f109a3ae6cd58e0abc9e909ac823d5e3065a.tar.gz
wallabag-f3e4f109a3ae6cd58e0abc9e909ac823d5e3065a.tar.zst
wallabag-f3e4f109a3ae6cd58e0abc9e909ac823d5e3065a.zip
Revert "Clean markup in templates"
This reverts commit 8413a63f7d9df2695653ab2ef1d77927da6ddc55.
Diffstat (limited to 'install')
-rw-r--r--install/mysql.sql34
-rwxr-xr-xinstall/poche.sqlitebin0 -> 360448 bytes
-rw-r--r--install/postgres.sql30
-rw-r--r--install/update.php79
-rw-r--r--install/update_sqlite_from_0_to_1.php72
5 files changed, 215 insertions, 0 deletions
diff --git a/install/mysql.sql b/install/mysql.sql
new file mode 100644
index 00000000..cb232a84
--- /dev/null
+++ b/install/mysql.sql
@@ -0,0 +1,34 @@
1CREATE TABLE IF NOT EXISTS `config` (
2 `id` int(11) NOT NULL AUTO_INCREMENT,
3 `name` varchar(255) NOT NULL,
4 `value` varchar(255) NOT NULL,
5 PRIMARY KEY (`id`)
6) ENGINE=InnoDB DEFAULT CHARSET=latin1;
7
8CREATE TABLE IF NOT EXISTS `entries` (
9 `id` int(11) NOT NULL AUTO_INCREMENT,
10 `title` varchar(255) NOT NULL,
11 `url` varchar(255) NOT NULL,
12 `is_read` tinyint(1) NOT NULL,
13 `is_fav` tinyint(1) NOT NULL,
14 `content` blob NOT NULL,
15 `user_id` int(11) NOT NULL,
16 PRIMARY KEY (`id`)
17) ENGINE=InnoDB DEFAULT CHARSET=latin1;
18
19CREATE TABLE IF NOT EXISTS `users` (
20 `id` int(11) NOT NULL AUTO_INCREMENT,
21 `username` varchar(255) NOT NULL,
22 `password` varchar(255) NOT NULL,
23 `name` int(255) NOT NULL,
24 `email` varchar(255) NOT NULL,
25 PRIMARY KEY (`id`)
26) ENGINE=InnoDB DEFAULT CHARSET=latin1;
27
28CREATE TABLE IF NOT EXISTS `users_config` (
29 `id` int(11) NOT NULL AUTO_INCREMENT,
30 `user_id` int(11) NOT NULL,
31 `name` varchar(255) NOT NULL,
32 `value` varchar(255) NOT NULL,
33 PRIMARY KEY (`id`)
34) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/install/poche.sqlite b/install/poche.sqlite
new file mode 100755
index 00000000..c268223d
--- /dev/null
+++ b/install/poche.sqlite
Binary files differ
diff --git a/install/postgres.sql b/install/postgres.sql
new file mode 100644
index 00000000..9e0e8276
--- /dev/null
+++ b/install/postgres.sql
@@ -0,0 +1,30 @@
1CREATE TABLE config (
2 id bigserial primary key,
3 name varchar(255) NOT NULL,
4 value varchar(255) NOT NULL
5);
6
7CREATE TABLE entries (
8 id bigserial primary key,
9 title varchar(255) NOT NULL,
10 url varchar(255) NOT NULL,
11 is_read boolean DEFAULT false,
12 is_fav boolean DEFAULT false,
13 content TEXT,
14 user_id integer NOT NULL
15);
16
17CREATE TABLE users (
18 id bigserial primary key,
19 username varchar(255) NOT NULL,
20 password varchar(255) NOT NULL,
21 name varchar(255) NOT NULL,
22 email varchar(255) NOT NULL
23);
24
25CREATE TABLE users_config (
26 id bigserial primary key,
27 user_id integer NOT NULL,
28 name varchar(255) NOT NULL,
29 value varchar(255) NOT NULL
30); \ No newline at end of file
diff --git a/install/update.php b/install/update.php
new file mode 100644
index 00000000..8c93af6d
--- /dev/null
+++ b/install/update.php
@@ -0,0 +1,79 @@
1<?php
2require_once dirname(__FILE__).'/../inc/poche/Tools.class.php';
3include dirname(__FILE__).'/../inc/poche/define.inc.php';
4require_once __DIR__ . '/../inc/poche/Database.class.php';
5$store = new Database();
6$old_salt = '464v54gLLw928uz4zUBqkRJeiPY68zCX';
7?>
8<!DOCTYPE html>
9<!--[if lte IE 6]> <html class="no-js ie6 ie67 ie678" lang="en"> <![endif]-->
10<!--[if lte IE 7]> <html class="no-js ie7 ie67 ie678" lang="en"> <![endif]-->
11<!--[if IE 8]> <html class="no-js ie8 ie678" lang="en"> <![endif]-->
12<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
13<html>
14 <head>
15 <meta charset="utf-8">
16 <title>updating poche</title>
17 </head>
18 <body>
19 <h1>update poche to 1.0-beta3</h1>
20
21 <h2>Changelog</h2>
22 <p>
23 <ul>
24 <li>this awesome updating step</li>
25 <li>error message when install folder exists</li>
26 <li>more tests before installation (write access, etc.)</li>
27 <li>updated README to make installation easier</li>
28 <li>german language thanks to HLFH</li>
29 <li>spanish language thanks to Nitche</li>
30 <li>new file ./inc/poche/myconfig.inc.php created to store language and salt</li>
31 <li><a href="https://github.com/inthepoche/poche/issues/119">#119</a>: salt is now created when installing poche</li>
32 <li><a href="https://github.com/inthepoche/poche/issues/130">#130</a>: robots.txt added</li>
33 <li><a href="https://github.com/inthepoche/poche/issues/136">#136</a>: error during readability import</li>
34 <li><a href="https://github.com/inthepoche/poche/issues/137">#137</a>: mixed content alert in https</li>
35 <li><a href="https://github.com/inthepoche/poche/issues/138">#138</a>: change pattern to parse url with #</li>
36 </ul>
37 </p>
38 <p>To update your poche, please fill the following fields.</p>
39 <p>
40 <form name="update" method="post">
41 <div><label for="login">login:</label> <input type="text" name="login" id="login" /></div>
42 <div><label for="password">password:</label> <input type="password" name="password" id="password" /></div>
43 <div><input type="hidden" name="go" value="ok" /><input type="submit" value="update" /></div>
44 </form>
45 </p>
46<?php
47if (isset($_POST['go'])) {
48 if (!empty($_POST['login']) && !empty($_POST['password'])) {
49 $user = $store->login($_POST['login'], sha1($_POST['password'] . $_POST['login'] . $old_salt));
50 if ($user != array()) {
51 $new_salt = md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand());
52 $myconfig_file = '../inc/poche/myconfig.inc.php';
53 if (!is_writable('../inc/poche/')) {
54 die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.');
55 }
56
57 if (!file_exists($myconfig_file))
58 {
59 $fp = fopen($myconfig_file, 'w');
60
61 fwrite($fp, '<?php'."\r\n");
62 fwrite($fp, "define ('POCHE_VERSION', '1.0-beta3');" . "\r\n");
63 fwrite($fp, "define ('SALT', '" . $new_salt . "');" . "\r\n");
64 fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n");
65 fclose($fp);
66 }
67 # faire une mise à jour de la table users en prenant en compte le nouveau SALT généré
68 $store->updatePassword($user['id'], sha1($_POST['password'] . $_POST['login'] . $new_salt));
69?>
70 <p><span style="color: green;">your poche is up to date!</span></p>
71 <p><span style="color: red;">don't forget to delete ./install/ folder after the update.</span></p>
72 <p><a href="../">go back to your poche</a></p>
73<?php
74 }
75 }
76}
77?>
78 </body>
79</html> \ No newline at end of file
diff --git a/install/update_sqlite_from_0_to_1.php b/install/update_sqlite_from_0_to_1.php
new file mode 100644
index 00000000..299abf48
--- /dev/null
+++ b/install/update_sqlite_from_0_to_1.php
@@ -0,0 +1,72 @@
1<?php
2# import script to upgrade from poche 0.3
3$db_path = 'sqlite:../db/poche.sqlite';
4$handle = new PDO($db_path);
5$handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
6
7# Requêtes à exécuter pour mettre à jour poche.sqlite en 1.x
8
9# ajout d'un champ user_id sur la table entries
10$sql = 'ALTER TABLE entries RENAME TO tempEntries;';
11$query = $handle->prepare($sql);
12$query->execute();
13
14$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);';
15$query = $handle->prepare($sql);
16$query->execute();
17
18$sql = 'INSERT INTO entries (id, title, url, is_read, is_fav, content) SELECT id, title, url, is_read, is_fav, content FROM tempEntries;';
19$query = $handle->prepare($sql);
20$query->execute();
21
22# Update tout pour mettre user_id = 1
23$sql = 'UPDATE entries SET user_id = 1;';
24$query = $handle->prepare($sql);
25$query->execute();
26
27# Changement des flags pour les lus / favoris
28$sql = 'UPDATE entries SET is_read = 1 WHERE is_read = -1;';
29$query = $handle->prepare($sql);
30$query->execute();
31
32$sql = 'UPDATE entries SET is_fav = 1 WHERE is_fav = -1;';
33$query = $handle->prepare($sql);
34$query->execute();
35
36# Création de la table users
37$sql = 'CREATE TABLE users (id INTEGER PRIMARY KEY, username TEXT, password TEXT, name TEXT, email TEXT);';
38$query = $handle->prepare($sql);
39$query->execute();
40
41$sql = 'INSERT INTO users (username) SELECT value FROM config WHERE name = "login";';
42$query = $handle->prepare($sql);
43$query->execute();
44
45$sql = "UPDATE users SET password = (SELECT value FROM config WHERE name = 'password')";
46$query = $handle->prepare($sql);
47$query->execute();
48
49# Création de la table users_config
50$sql = 'CREATE TABLE users_config (id INTEGER PRIMARY KEY, user_id NUMERIC, name TEXT, value TEXT);';
51$query = $handle->prepare($sql);
52$query->execute();
53
54$sql = 'INSERT INTO users_config (user_id, name, value) VALUES (1, "pager", "10");';
55$query = $handle->prepare($sql);
56$query->execute();
57
58$sql = 'INSERT INTO users_config (user_id, name, value) VALUES (1, "language", "en_EN.UTF8");';
59$query = $handle->prepare($sql);
60$query->execute();
61
62# Suppression de la table temporaire
63$sql = 'DROP TABLE tempEntries;';
64$query = $handle->prepare($sql);
65$query->execute();
66
67# Vidage de la table de config
68$sql = 'DELETE FROM config;';
69$query = $handle->prepare($sql);
70$query->execute();
71
72echo 'welcome to poche 1.0 !'; \ No newline at end of file