From c00370659480d64e052aa09a7c326456e8fba91e Mon Sep 17 00:00:00 2001
From: Marien Fressinaud <dev@marienfressinaud.fr>
Date: Thu, 11 Apr 2013 21:32:52 +0200
Subject: Modif script SQL pour issue #37 : attention à bien penser à mettre la
 BDD à jour !
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 freshrss.sql | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'freshrss.sql')

diff --git a/freshrss.sql b/freshrss.sql
index 3bd680a18..b5369a7ea 100644
--- a/freshrss.sql
+++ b/freshrss.sql
@@ -72,8 +72,10 @@ CREATE TABLE IF NOT EXISTS `feed` (
   `website` text NOT NULL,
   `description` text NOT NULL,
   `lastUpdate` int(11) NOT NULL,
+  `priority` int(2) NOT NULL DEFAULT '10',
   `pathEntries` varchar(500) DEFAULT NULL,
   `httpAuth` varchar(500) DEFAULT NULL,
+  `error` int(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`),
   KEY `category` (`category`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 
cgit v1.2.3


From e58fb411f928f9000351e802f7e35c159735bdd7 Mon Sep 17 00:00:00 2001
From: Marien Fressinaud <dev@marienfressinaud.fr>
Date: Sun, 14 Apr 2013 19:26:52 +0200
Subject: Corrections fichier install.php pour qu'il soit plus portable

---
 .gitignore         |   2 ++
 freshrss.sql       | 101 -----------------------------------------------------
 public/install.php |  52 ++++++++++++++++++++-------
 3 files changed, 41 insertions(+), 114 deletions(-)
 delete mode 100644 freshrss.sql
 mode change 100755 => 100644 public/install.php

(limited to 'freshrss.sql')

diff --git a/.gitignore b/.gitignore
index 760271230..61908804a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+app/configuration/application.ini
 lib/minz
 log/application.log
 cache
+public/data
diff --git a/freshrss.sql b/freshrss.sql
deleted file mode 100644
index b5369a7ea..000000000
--- a/freshrss.sql
+++ /dev/null
@@ -1,101 +0,0 @@
--- phpMyAdmin SQL Dump
--- version 3.5.7
--- http://www.phpmyadmin.net
---
--- Client: localhost
--- Généré le: Dim 17 Mars 2013 à 15:21
--- Version du serveur: 5.5.30
--- Version de PHP: 5.4.12
-
-SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-SET time_zone = "+00:00";
-
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-
---
--- Base de données: `freshrss`
---
-
--- --------------------------------------------------------
-
---
--- Structure de la table `category`
---
-
-CREATE TABLE IF NOT EXISTS `category` (
-  `id` varchar(6) NOT NULL,
-  `name` varchar(255) NOT NULL,
-  `color` varchar(7) NOT NULL,
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Structure de la table `entry`
---
-
-CREATE TABLE IF NOT EXISTS `entry` (
-  `id` varchar(6) NOT NULL,
-  `guid` text NOT NULL,
-  `title` varchar(255) NOT NULL,
-  `author` varchar(255) NOT NULL,
-  `content` text NOT NULL,
-  `link` text NOT NULL,
-  `date` int(11) NOT NULL,
-  `is_read` int(11) NOT NULL,
-  `is_favorite` int(11) NOT NULL,
-  `is_public` int(1) NOT NULL,
-  `id_feed` varchar(6) NOT NULL,
-  `annotation` text NOT NULL,
-  `tags` text NOT NULL,
-  `lastUpdate` int(11) NOT NULL,
-  PRIMARY KEY (`id`),
-  KEY `id_feed` (`id_feed`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Structure de la table `feed`
---
-
-CREATE TABLE IF NOT EXISTS `feed` (
-  `id` varchar(6) NOT NULL,
-  `url` text NOT NULL,
-  `category` varchar(6) DEFAULT '000000',
-  `name` varchar(255) NOT NULL,
-  `website` text NOT NULL,
-  `description` text NOT NULL,
-  `lastUpdate` int(11) NOT NULL,
-  `priority` int(2) NOT NULL DEFAULT '10',
-  `pathEntries` varchar(500) DEFAULT NULL,
-  `httpAuth` varchar(500) DEFAULT NULL,
-  `error` int(1) NOT NULL DEFAULT '0',
-  PRIMARY KEY (`id`),
-  KEY `category` (`category`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
---
--- Contraintes pour les tables exportées
---
-
---
--- Contraintes pour la table `entry`
---
-ALTER TABLE `entry`
-  ADD CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`id_feed`) REFERENCES `feed` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-
---
--- Contraintes pour la table `feed`
---
-ALTER TABLE `feed`
-  ADD CONSTRAINT `feed_ibfk_4` FOREIGN KEY (`category`) REFERENCES `category` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
-
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/public/install.php b/public/install.php
old mode 100755
new mode 100644
index 512e4b5d5..fca4ff38e
--- a/public/install.php
+++ b/public/install.php
@@ -168,11 +168,14 @@ function deleteInstall () {
 
 /*** VÉRIFICATIONS ***/
 function checkStep () {
-	if (STEP > 1 && checkStep1 ()['all'] != 'ok') {
+	$s1 = checkStep1 ();
+	$s2 = checkStep2 ();
+	$s3 = checkStep3 ();
+	if (STEP > 1 && $s1['all'] != 'ok') {
 		header ('Location: index.php?step=1');
-	} elseif (STEP > 2 && checkStep2 ()['all'] != 'ok') {
+	} elseif (STEP > 2 && $s2['all'] != 'ok') {
 		header ('Location: index.php?step=2');
-	} elseif (STEP > 3 && checkStep3 ()['all'] != 'ok') {
+	} elseif (STEP > 3 && $s3['all'] != 'ok') {
 		header ('Location: index.php?step=3');
 	}
 }
@@ -182,6 +185,7 @@ function checkStep1 () {
 	$curl = extension_loaded ('curl');
 	$pdo = extension_loaded ('pdo_mysql');
 	$cache = CACHE_PATH && is_writable (CACHE_PATH);
+	$log = LOG_PATH && is_writable (LOG_PATH);
 	$conf = APP_PATH && is_writable (APP_PATH . '/configuration');
 	$data = is_writable (PUBLIC_PATH . '/data');
 
@@ -191,9 +195,10 @@ function checkStep1 () {
 		'curl' => $curl ? 'ok' : 'ko',
 		'pdo-mysql' => $pdo ? 'ok' : 'ko',
 		'cache' => $cache ? 'ok' : 'ko',
+		'log' => $log ? 'ok' : 'ko',
 		'configuration' => $conf ? 'ok' : 'ko',
 		'data' => $data ? 'ok' : 'ko',
-		'all' => $php && $minz && $curl && $pdo && $cache && $conf && $data ? 'ok' : 'ko'
+		'all' => $php && $minz && $curl && $pdo && $cache && $log && $conf && $data ? 'ok' : 'ko'
 	);
 }
 function checkStep2 () {
@@ -284,6 +289,12 @@ function printStep1 () {
 	<p class="alert alert-error"><span class="alert-head">Arf !</span> Veuillez vérifier les droits sur le répertoire <em><?php echo PUBLIC_PATH . '/../cache'; ?></em>. Le serveur HTTP doit être capable d'écrire dedans</p>
 	<?php } ?>
 
+	<?php if ($res['log'] == 'ok') { ?>
+	<p class="alert alert-success"><span class="alert-head">Ok !</span> Les droits sur le répertoire des logs sont bons</p>
+	<?php } else { ?>
+	<p class="alert alert-error"><span class="alert-head">Arf !</span> Veuillez vérifier les droits sur le répertoire <em><?php echo PUBLIC_PATH . '/../log'; ?></em>. Le serveur HTTP doit être capable d'écrire dedans</p>
+	<?php } ?>
+
 	<?php if ($res['configuration'] == 'ok') { ?>
 	<p class="alert alert-success"><span class="alert-head">Ok !</span> Les droits sur le répertoire de configuration sont bons</p>
 	<?php } else { ?>
@@ -306,7 +317,7 @@ function printStep1 () {
 
 function printStep2 () {
 ?>
-	<?php if (checkStep2 ()['all'] == 'ok') { ?>
+	<?php $s2 = checkStep2 (); if ($s2['all'] == 'ok') { ?>
 	<p class="alert alert-success"><span class="alert-head">Ok !</span> La configuration générale a été enregistrée.</p>
 	<?php } ?>
 
@@ -355,7 +366,7 @@ function printStep2 () {
 			<div class="group-controls">
 				<button type="submit" class="btn btn-important">Valider</button>
 				<button type="reset" class="btn">Annuler</button>
-				<?php if (checkStep2 ()['all'] == 'ok') { ?>
+				<?php if ($s2['all'] == 'ok') { ?>
 				<a class="btn btn-important next-step" href="?step=3">Passer à l'étape suivante</a>
 				<?php } ?>
 			</div>
@@ -366,7 +377,7 @@ function printStep2 () {
 
 function printStep3 () {
 ?>
-	<?php if (checkStep3 ()['all'] == 'ok') { ?>
+	<?php $s3 = checkStep3 (); if ($s3['all'] == 'ok') { ?>
 	<p class="alert alert-success"><span class="alert-head">Ok !</span> La configuration de la base de données a été enregistrée.</p>
 	<?php } ?>
 
@@ -404,7 +415,7 @@ function printStep3 () {
 			<div class="group-controls">
 				<button type="submit" class="btn btn-important">Valider</button>
 				<button type="reset" class="btn">Annuler</button>
-				<?php if (checkStep3 ()['all'] == 'ok') { ?>
+				<?php if ($s3['all'] == 'ok') { ?>
 				<a class="btn btn-important next-step" href="?step=4">Passer à l'étape suivante</a>
 				<?php } ?>
 			</div>
@@ -425,6 +436,26 @@ function printStep5 () {
 	<p class="alert alert-error"><span class="alert-head">Oups !</span> Quelque chose s'est mal passé, vous devriez supprimer le fichier <?php echo PUBLIC_PATH . '/install.php' ?> à la main.</p>
 <?php
 }
+
+
+checkStep ();
+
+switch (STEP) {
+case 1:
+default:
+	break;
+case 2:
+	saveStep2 ();
+	break;
+case 3:
+	saveStep3 ();
+	break;
+case 4:
+	break;
+case 5:
+	deleteInstall ();
+	break;
+}
 ?>
 <!DOCTYPE html>
 <html lang="fr">
@@ -455,26 +486,21 @@ function printStep5 () {
 
 	<div class="post">
 		<?php
-		checkStep ();
-
 		switch (STEP) {
 		case 1:
 		default:
 			printStep1 ();
 			break;
 		case 2:
-			saveStep2 ();
 			printStep2 ();
 			break;
 		case 3:
-			saveStep3 ();
 			printStep3 ();
 			break;
 		case 4:
 			printStep4 ();
 			break;
 		case 5:
-			deleteInstall ();
 			printStep5 ();
 			break;
 		}
-- 
cgit v1.2.3

