[Alba-desarrollo] SVN Alba r5158 - prosistem/alba/trunk/alba/web/instalar

commits en pressenter.com.ar commits en pressenter.com.ar
Mie Sep 26 18:41:18 CEST 2007


Author: ftoledo
Date: 2007-09-26 13:41:16 -0300 (Wed, 26 Sep 2007)
New Revision: 5158

Added:
   prosistem/alba/trunk/alba/web/instalar/ver_log.php
Modified:
   prosistem/alba/trunk/alba/web/instalar/funciones.php
   prosistem/alba/trunk/alba/web/instalar/instalar.php
   prosistem/alba/trunk/alba/web/instalar/paso1.php
   prosistem/alba/trunk/alba/web/instalar/paso3.php
   prosistem/alba/trunk/alba/web/instalar/paso6.php
Log:
visor del log de isntalacion 
detectar la instalacion si existe databases.yml



Modified: prosistem/alba/trunk/alba/web/instalar/funciones.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/funciones.php	2007-09-26 16:25:08 UTC (rev 5157)
+++ prosistem/alba/trunk/alba/web/instalar/funciones.php	2007-09-26 16:41:16 UTC (rev 5158)
@@ -32,12 +32,12 @@
     return realpath(dirname(__FILE__) .DIRECTORY_SEPARATOR. ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR);
 }
 
-function DebugLog($str) {
+function DebugLog($str,$modo = 'I') {
     date_default_timezone_set('America/Argentina/Buenos_Aires');
     $log = AlbaPath() . DIRECTORY_SEPARATOR . "log" . DIRECTORY_SEPARATOR . "install.log";
     $fp = fopen($log,"a+");
     if ($fp) {
-        fwrite($fp,date('d/m/Y H:i:s') . " $str\n");
+        fwrite($fp,date('d/m/Y H:i:s') . " $modo: $str\n");
         fclose($fp);
     }
 }
@@ -115,7 +115,7 @@
 */
 function generate_databases_yml($host,$user,$pass,$db) {
     $yml = AlbaPath() . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "databases.yml";
-    DebugLog ("generate_databases_yml(): generando archivo de cnonexion $yml");
+    DebugLog ("generate_databases_yml(): generando archivo de conexion $yml");
     if ($fp = @fopen ($yml,'w')) {
         fwrite ($fp,"#Archivo generando por el instalador " . date('m/d/Y H:i:s') . "\n");
         fwrite ($fp,"all:\n");

Modified: prosistem/alba/trunk/alba/web/instalar/instalar.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/instalar.php	2007-09-26 16:25:08 UTC (rev 5157)
+++ prosistem/alba/trunk/alba/web/instalar/instalar.php	2007-09-26 16:41:16 UTC (rev 5158)
@@ -66,31 +66,42 @@
         <h1>Instalaci&oacute;n de ALBA</h1>
         </div>
         <div id="contenido">
-            <?php
-                switch ($paso) {
-                    case 1:
-                        include ("paso1.php");
-                        break;
-                    case 2:
-                        include ("paso2.php");
-                        break;
-                    case 3:
-                        include ("paso3.php");
-                        break;
-                    case 4:
-                        include ("paso4.php");
-                        break;
-                    case 5:
-                        include ("paso5.php");
-                        break;
-                    case 6:
-                        include ("paso6.php");
-                        break;
-                    default:
-                        die("Uhmmm, error del instalador =(");
-                        break;
-                }
-            ?>
+            <?php if (file_exists(AlbaPath() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR .'databases.yml')): ?>
+                <?php $error_flag = true;?>
+                <p>El sistema se encuentra instalado.</p>
+                <p>Si desea volver a iniciar la instalaci&oacute;n, por favor elimine el archivo
+                 de configuracion <b>databases.yml</b> que<br/>
+                se encuentra en el directorio de <b>config</b> de la aplicaci&oacute;n.
+                </p>
+                    
+            <?php else: ?>
+            <?php   
+                    switch ($paso) {
+                        case 1:
+                            include ("paso1.php");
+                            break;
+                        case 2:
+                            include ("paso2.php");
+                            break;
+                        case 3:
+                            include ("paso3.php");
+                            break;
+                        case 4:
+                            include ("paso4.php");
+                            break;
+                        case 5:
+                            include ("paso5.php");
+                            break;
+                        case 6:
+                            include ("paso6.php");
+                            break;
+                        default:
+                            die("Uhmmm, error del instalador =(");
+                            break;
+                    }
+                    
+             ?>
+             <?php endif; ?>
         </div>
         <br/>
         <?php if (!$error_flag && !$completo): ?>

Modified: prosistem/alba/trunk/alba/web/instalar/paso1.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/paso1.php	2007-09-26 16:25:08 UTC (rev 5157)
+++ prosistem/alba/trunk/alba/web/instalar/paso1.php	2007-09-26 16:41:16 UTC (rev 5158)
@@ -55,10 +55,14 @@
               
 <p>Directorio base: <?php echo $alba_path?></p> 
 <table>
+<?php DebugLog("Comprobacion de los permisos de los directorios");?>
 <?php foreach($dirs as $dir):?>
     <?php
-    if (!is_writable($alba_path .DIRECTORY_SEPARATOR . $dir))
+    DebugLog("Directorio: $dir");
+    if (!is_writable($alba_path .DIRECTORY_SEPARATOR . $dir)) {
+        DebugLog("El directorio $dir no tiene permisos de escritura",'E');
         $error_flag = true;
+    }
     ?>
     <tr>
         <td>Comprobando permisos en: <?php echo $dir ?></td>

Modified: prosistem/alba/trunk/alba/web/instalar/paso3.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/paso3.php	2007-09-26 16:25:08 UTC (rev 5157)
+++ prosistem/alba/trunk/alba/web/instalar/paso3.php	2007-09-26 16:41:16 UTC (rev 5158)
@@ -48,17 +48,20 @@
     $pass = $_POST['pass'];
     $db = $_POST['db'];    
     $creardb = (isset($_POST['creardb']) && $_POST['creardb'] == 1);
-    
+    DebugLog('Probando conexión'); 
     $conn = @mysql_connect($host,$user,$pass);
     if (!$conn) {
         $cnx_error_flag = true;
+        DebugLog('Error al conectar con la base de datos','E');
         $cnx_error_msg = "No se puede conectar a la base de datos: <br>" . mysql_error();
     }
     else {
+        DebugLog('Probando crear base de datos');
         if ($creardb) {
             $ret = @mysql_query('CREATE DATABASE ' . $db , $conn);
             if (!$ret) {
                 $cnx_error_flag = true;
+                DebugLog('No se puede crear la base de datos: ' . mysql_error() ,'E');
                 $cnx_error_msg = "No se puede crear la base de datos: <br>" . mysql_error();
                 $error_flag = true;
             }

Modified: prosistem/alba/trunk/alba/web/instalar/paso6.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/paso6.php	2007-09-26 16:25:08 UTC (rev 5157)
+++ prosistem/alba/trunk/alba/web/instalar/paso6.php	2007-09-26 16:41:16 UTC (rev 5158)
@@ -32,12 +32,13 @@
 
 if (!defined('ALBA_INSTALLER')) die();
 
-    $host = $_SESSION['albainstall']['host'];
-    $user = $_SESSION['albainstall']['user'];
-    $pass = $_SESSION['albainstall']['pass'];
-    $db = $_SESSION['albainstall']['db'];
-    $tipo_base = $_SESSION ['albainstall']['tipo_base']; 
+$host = $_SESSION['albainstall']['host'];
+$user = $_SESSION['albainstall']['user'];
+$pass = $_SESSION['albainstall']['pass'];
+$db = $_SESSION['albainstall']['db'];
+$tipo_base = $_SESSION ['albainstall']['tipo_base']; 
  
+$error_flag = false;    
 ?>
 <div id="detalle">
 <p>Resultado de la instalaci&oacute;n:</p>
@@ -46,13 +47,21 @@
     <tr>
         <td>Generando archivo de configuraci&oacute;n:</td>
         <td>
-            <?php echo generate_databases_yml($host,$user,$pass,$db) ? IMG_OK : IMG_ERROR?>
+            <?php 
+                $ret = generate_databases_yml($host,$user,$pass,$db);
+                echo $ret ? IMG_OK : IMG_ERROR;
+                if (!$ret) ; $error_flag = true;
+            ?>
         </td>
     </tr>
     <tr>
         <td>Creando esquema de base de datos:</td>
         <td>
-            <?php echo crear_schema('lib.model.schema.sql', $host, $user, $pass, $db) ? IMG_OK : IMG_ERROR?>
+            <?php 
+                $ret = crear_schema('lib.model.schema.sql', $host, $user, $pass, $db);
+                echo $ret ? IMG_OK : IMG_ERROR;
+                if (!$ret) ; $error_flag = true;
+            ?>
         </td>
     </tr>
     <tr>
@@ -66,18 +75,32 @@
                 else
                     $archivo = "";
             ?>
-            <?php echo crear_base_modelo($archivo,$host,$user,$pass,$db) ? IMG_OK : IMG_ERROR?>
+            <?php 
+                $ret = crear_base_modelo($archivo,$host,$user,$pass,$db);
+                echo $ret ? IMG_OK : IMG_ERROR;
+                if (!$ret) ; $error_flag = true;
+            ?>
         </td>
     </tr>
 </table>
 
 <p>La instalaci&oacute;n ha finalizado!</p>
 
+<?php if ($error_flag):?>
+<div class="error">
+<p>
+Se encontraron errores en la instalación, es posible que debe realizar algun paso<br/>
+de forma manual, por favor revise el registro de la instalaci&oacute;n haciendo click <br/>
+en el siguiente enlace:
+</p>
+<p><a href ="ver_log.php" target="_blank">Ver Registro de Instalaci&oacute;n</a></p>
+</div>
+<?php endif;?>
 <p><a href="../">Ingresar al Sistema de Gesti&oacute;n Educactiva Alba</a></p>
 <p><i>* Recuerde que para ingresar al sistema el nombre de usuario por defecto es <b>admin</b> y la clave es <b>admin</b>.</i></p>
 <?php 
 // ir al siguiente paso
     $completo = true;
-   $paso = 7;
+    $paso = 7;
    
 ?>
\ No newline at end of file

Added: prosistem/alba/trunk/alba/web/instalar/ver_log.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar/ver_log.php	2007-09-26 16:25:08 UTC (rev 5157)
+++ prosistem/alba/trunk/alba/web/instalar/ver_log.php	2007-09-26 16:41:16 UTC (rev 5158)
@@ -0,0 +1,53 @@
+<?php
+/**
+ *    This file is part of Alba.
+ * 
+ *    Alba is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    Alba is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with Alba; if not, write to the Free Software
+ *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+
+/**
+ * instalador
+ *
+ * @package    alba
+ * @author     José Luis Di Biase <josx en interorganic.com.ar>
+ * @author     Héctor Sanchez <hsanchez en pressenter.com.ar>
+ * @author     Fernando Toledo <ftoledo en pressenter.com.ar>
+ * @version    SVN: $Id: instalar.php 4883 2007-07-30 21:41:42Z ftoledo $
+ * @filesource
+ * @license GPL
+ */
+ 
+require ("funciones.php"); 
+$alba_path = AlbaPath();
+
+?>
+<html>
+<body>
+<pre>
+<?php
+$fp = @fopen ($alba_path . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR . 'install.log','r');
+if ($fp) {
+    while ($linea = fread($fp,1024)) {
+        echo $linea;
+    }
+}
+else {
+    echo "No se puede acceder al archivo install.log";
+}
+?>
+</pre>
+</body>
+</html>
\ No newline at end of file


Property changes on: prosistem/alba/trunk/alba/web/instalar/ver_log.php
___________________________________________________________________
Name: svn:keywords
   + "Id Author URL Date Rev"




Más información sobre la lista de distribución Alba-desarrollo