aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-03-28 20:00:02 +0100
committertcit <tcit@tcit.fr>2014-03-28 20:00:02 +0100
commitfecb62a3967eefda9880ce37e13693713385a093 (patch)
tree539cd02f04ff9ee5b06ff228130ac206b5844a89
parentad697686c00432964528226588a8cbea909c9e36 (diff)
downloadwallabag-fecb62a3967eefda9880ce37e13693713385a093.tar.gz
wallabag-fecb62a3967eefda9880ce37e13693713385a093.tar.zst
wallabag-fecb62a3967eefda9880ce37e13693713385a093.zip
Improvements to install script
* automatically remove install/ folder * go easier though the compatibility test <-> install script pages * Small fixes which raised php warnings
-rw-r--r--install/index.php36
-rw-r--r--wallabag_compatibility_test.php20
2 files changed, 46 insertions, 10 deletions
diff --git a/install/index.php b/install/index.php
index b21cec52..35c21fbe 100644
--- a/install/index.php
+++ b/install/index.php
@@ -1,7 +1,28 @@
1<?php 1<?php
2$errors = array(); 2$errors = array();
3$successes = array(); 3$successes = array();
4if ($_POST['download']) { 4
5/* Function taken from at http://php.net/manual/en/function.rmdir.php#110489
6 * Idea : nbari at dalmp dot com
7 * Rights unknown
8 * Here in case of .gitignore files
9 */
10function delTree($dir) {
11 $files = array_diff(scandir($dir), array('.','..'));
12 foreach ($files as $file) {
13 (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file");
14 }
15 return rmdir($dir);
16 }
17
18if (isset($_GET['clean'])) {
19 if (is_dir('install')){
20 delTree('install');
21 header('Location: index.php');
22 }
23}
24
25if (isset($_POST['download'])) {
5 if (!file_put_contents("cache/vendor.zip", fopen("http://static.wallabag.org/files/vendor.zip", 'r'))) { 26 if (!file_put_contents("cache/vendor.zip", fopen("http://static.wallabag.org/files/vendor.zip", 'r'))) {
6 $errors[] = 'Impossible to download vendor.zip. Please <a href="http://wllbg.org/vendor">download it manually<∕a> and unzip it in your wallabag folder.'; 27 $errors[] = 'Impossible to download vendor.zip. Please <a href="http://wllbg.org/vendor">download it manually<∕a> and unzip it in your wallabag folder.';
7 } 28 }
@@ -25,7 +46,7 @@ if ($_POST['download']) {
25 } 46 }
26 } 47 }
27} 48}
28else if ($_POST['install']) { 49else if (isset($_POST['install'])) {
29 if (!is_dir('vendor')) { 50 if (!is_dir('vendor')) {
30 $errors[] = 'You must install twig before.'; 51 $errors[] = 'You must install twig before.';
31 } 52 }
@@ -64,6 +85,7 @@ else if ($_POST['install']) {
64 else { 85 else {
65 $db_path = 'sqlite:' . realpath('') . '/db/poche.sqlite'; 86 $db_path = 'sqlite:' . realpath('') . '/db/poche.sqlite';
66 $handle = new PDO($db_path); 87 $handle = new PDO($db_path);
88 $sql_structure = "";
67 } 89 }
68 } 90 }
69 else { 91 else {
@@ -129,7 +151,7 @@ else if ($_POST['install']) {
129 $params = array($id_user, 'language', 'en_EN.UTF8'); 151 $params = array($id_user, 'language', 'en_EN.UTF8');
130 $query = executeQuery($handle, $sql, $params); 152 $query = executeQuery($handle, $sql, $params);
131 153
132 $successes[] = 'wallabag is now installed. Don\'t forget to delete install folder. Then, <a href="index.php">reload this page</a>.'; 154 $successes[] = 'wallabag is now installed. You can now <a href="index.php?clean=0">access it !</a>';
133 } 155 }
134 } 156 }
135 } 157 }
@@ -198,18 +220,18 @@ else if ($_POST['install']) {
198 <?php if (file_exists('inc/poche/config.inc.php') && is_dir('vendor')) : ?> 220 <?php if (file_exists('inc/poche/config.inc.php') && is_dir('vendor')) : ?>
199 <div class='messages success install'> 221 <div class='messages success install'>
200 <p> 222 <p>
201 wallabag seems already installed. If you want to update it, you only have to delete install folder. 223 wallabag seems already installed. If you want to update it, you only have to delete install folder, then <a href="index.php">reload this page</a>.
202 </p> 224 </p>
203 </div> 225 </div>
204 <?php endif; ?> 226 <?php endif; ?>
205 <?php endif; ?> 227 <?php endif; ?>
206 <p>To install wallabag, you just have to fill the following fields. That's all.</p> 228 <p>To install wallabag, you just have to fill the following fields. That's all.</p>
207 <p>Don't forget to check your server compatibility <a href="wallabag_compatibility_test.php">here</a>.</p> 229 <p>Don't forget to check your server compatibility <a href="wallabag_compatibility_test.php?from=install">here</a>.</p>
208 <form method="post"> 230 <form method="post">
209 <fieldset> 231 <fieldset>
210 <legend><strong>Technical settings</strong></legend> 232 <legend><strong>Technical settings</strong></legend>
211 <?php if (!is_dir('vendor')) : ?> 233 <?php if (!is_dir('vendor')) : ?>
212 <div class='messages notice install'>wallabag needs twig, a template engine (<a href="http://twig.sensiolabs.org/">?</a>). Two ways to install it: 234 <div class='messages notice install'>wallabag needs twig, a template engine (<a href="http://twig.sensiolabs.org/">?</a>). Two ways to install it:<br />
213 <ul> 235 <ul>
214 <li>automatically download and extract vendor.zip into your wallabag folder. 236 <li>automatically download and extract vendor.zip into your wallabag folder.
215 <p><input type="submit" name="download" value="Download vendor.zip" /></p> 237 <p><input type="submit" name="download" value="Download vendor.zip" /></p>
@@ -245,7 +267,7 @@ php composer.phar install</code></pre></li>
245 <li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li> 267 <li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li>
246 <li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li> 268 <li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li>
247 <li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li> 269 <li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li>
248 id <li><label for="pg_password">Password</label> <input type="text" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li> 270 <li><label for="pg_password">Password</label> <input type="text" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li>
249 </ul> 271 </ul>
250 </li> 272 </li>
251 </ul> 273 </ul>
diff --git a/wallabag_compatibility_test.php b/wallabag_compatibility_test.php
index 51ea31e1..7a52767c 100644
--- a/wallabag_compatibility_test.php
+++ b/wallabag_compatibility_test.php
@@ -171,7 +171,13 @@ background-color:#FF9500;
171</head> 171</head>
172 172
173<body> 173<body>
174 174<?php
175$frominstall = false;
176if (isset($_GET['from'])){
177 if ($_GET['from'] == 'install'){
178 $frominstall = true;
179 }}
180?>
175<div id="site"> 181<div id="site">
176 <div id="content"> 182 <div id="content">
177 183
@@ -337,15 +343,23 @@ background-color:#FF9500;
337 <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $allow_url_fopen_ok && $gettext_ok) { ?> 343 <?php if ($php_ok && $xml_ok && $pcre_ok && $filter_ok && $allow_url_fopen_ok && $gettext_ok) { ?>
338 <h3>Bottom Line: Yes, you can!</h3> 344 <h3>Bottom Line: Yes, you can!</h3>
339 <p><em>Your webhost has its act together!</em></p> 345 <p><em>Your webhost has its act together!</em></p>
346 <?php if (!$frominstall) { ?>
340 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p> 347 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p>
341 <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and start using wallabag</p> 348 <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and/or start using wallabag</p>
349 <?php } else { ?>
350 <p>You can now <a href="index.php">return to the installation section</a>.</p>
351 <?php } ?>
342 <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost &mdash; it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p> 352 <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost &mdash; it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p>
343 <?php //} else if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $allow_url_fopen_ok && $filter_ok) { ?> 353 <?php //} else if ($php_ok && $xml_ok && $pcre_ok && $mbstring_ok && $allow_url_fopen_ok && $filter_ok) { ?>
344 <?php } else if ($php_ok && $xml_ok && $pcre_ok && $allow_url_fopen_ok && $filter_ok && $gettext_ok) { ?> 354 <?php } else if ($php_ok && $xml_ok && $pcre_ok && $allow_url_fopen_ok && $filter_ok && $gettext_ok) { ?>
345 <h3>Bottom Line: Yes, you can!</h3> 355 <h3>Bottom Line: Yes, you can!</h3>
346 <p><em>For most feeds, it'll run with no problems.</em> There are certain languages that you might have a hard time with though.</p> 356 <p><em>For most feeds, it'll run with no problems.</em> There are certain languages that you might have a hard time with though.</p>
357 <?php if (!$frominstall) { ?>
347 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p> 358 <p>You can download the latest version of <?php echo $app_name; ?> from <a href="http://wallabag.org/download">wallabag.org</a>.</p>
348 <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and start using wallabag</p> 359 <p>If you already have done that, you should access <a href="index.php">the index.php file</a> of your installation to configure and/or start using wallabag</p>
360 <?php } else { ?>
361 <p>You can now <a href="index.php">return to the installation section</a>.</p>
362 <?php } ?>
349 <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost &mdash; it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p> 363 <p><strong>Note</strong>: Passing this test does not guarantee that <?php echo $app_name; ?> will run on your webhost &mdash; it only ensures that the basic requirements have been addressed. If you experience any problems, please let us know.</p>
350 <?php } else { ?> 364 <?php } else { ?>
351 <h3>Bottom Line: We're sorry…</h3> 365 <h3>Bottom Line: We're sorry…</h3>