Alba-desarrollo
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
July 2007
- 7 participants
- 103 discussions
[Pressenter - SVN Alba] #106: Cambio relación actividad/materia con
by Pressenter - SVN Alba 22 Aug '07
by Pressenter - SVN Alba 22 Aug '07
22 Aug '07
#106: Cambio relación actividad/materia con
----------------------------+-----------------------------------------------
Reporter: verox | Owner: somebody
Type: defecto | Status: new
Priority: alta | Milestone:
Component: alba-actividad | Version: 1.0b
Severity: normal | Keywords:
----------------------------+-----------------------------------------------
La relación entre las actividades/materias debe hacerse con el combo
año+división y no con el año únicamente. (Recordar que esto permite
utilizar divisiones/secciones que tengan diferentes materias en su
currícula, caso secundarios).
principal_dev.php/relAnioActividad
--
Ticket URL: <http://alba.pressenter.com.ar/cgi-bin/trac.cgi/ticket/106>
Pressenter - SVN Alba <http://wwww.proyectoalba.com.ar/>
Proyecto Alba
1
4
15 Aug '07
#235: Modificar el sistema de layouts
---------------------+------------------------------------------------------
Reporter: josx | Owner: somebody
Type: defecto | Status: new
Priority: normal | Milestone: version 1.0
Component: alba | Version: desarollo
Severity: normal | Keywords: layout
---------------------+------------------------------------------------------
Modificar el '''layout''''''' de la aplicación y los templates que tienen
lógica asociada al modo actual.
--
Ticket URL: <http://alba.pressenter.com.ar/cgi-bin/trac.cgi/ticket/235>
Pressenter - SVN Alba <http://wwww.proyectoalba.com.ar/>
Proyecto Alba - Sistema Informático Abierto de Gestión Unificada para Unidades Educacionales
3
6
[Pressenter - SVN Alba] #124: Agregar dato en la carga relActividadDocente
by Pressenter - SVN Alba 13 Aug '07
by Pressenter - SVN Alba 13 Aug '07
13 Aug '07
#124: Agregar dato en la carga relActividadDocente
--------------------------+-------------------------------------------------
Reporter: verox | Owner: somebody
Type: mejora | Status: new
Priority: normal | Milestone:
Component: alba-docente | Version: 1.0b
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
Agregar el dato del año/grado en la carga de rel. Actividad y Docente.
(Esto es para que las materias se asocien al nivel, pero sin mostrarlo en
los boletines).
--
Ticket URL: <http://alba.pressenter.com.ar/cgi-bin/trac.cgi/ticket/124>
Pressenter - SVN Alba <http://wwww.proyectoalba.com.ar/>
Proyecto Alba
1
4
#182: MODULO GESTION ESCOLAR
---------------------+------------------------------------------------------
Reporter: Akela | Owner: somebody
Type: defecto | Status: new
Priority: normal | Milestone:
Component: alba | Version:
Severity: normal | Keywords:
---------------------+------------------------------------------------------
MODULO GESTION ESCOLAR
-CUANDO QUIERO LIGAR ACTIVIDAD/MATERIA A AÑO/DIVISIÒN ESPECÌFICO/CARGA
HORARIA NO ME APARECEN LOS AÑOS/DIVISIONES (1ªINFORMATICA, 2ªMERCANTIL)
COMO OPCIONES. SÒLO PUEDO LIGAR LA MATERIA/ACTIVIDAD A UNA ASIGNATURA
GENÈRICA
--
Ticket URL: <http://alba.pressenter.com.ar/cgi-bin/trac.cgi/ticket/182>
Pressenter - SVN Alba <http://wwww.proyectoalba.com.ar/>
Proyecto Alba
1
3
08 Aug '07
#203: Validación en Docente Horarios
---------------------------------+------------------------------------------
Reporter: josx | Owner: somebody
Type: defecto | Status: new
Priority: normal | Milestone: version 1.0
Component: alba-docenteHorario | Version: desarollo
Severity: normal | Keywords:
---------------------------------+------------------------------------------
En alba/principal_dev.php/docenteHorario al dar de alta un registro no
validad que los horarios entrados sean correctos. ( horario de inicio <
horario de finalizacion )
Ya esta implementado el helper para esto, ( ver turnos por ejemplo )
--
Ticket URL: <http://alba.pressenter.com.ar/cgi-bin/trac.cgi/ticket/203>
Pressenter - SVN Alba <http://wwww.proyectoalba.com.ar/>
Proyecto Alba.
1
4
[Pressenter - SVN Alba] #143: la clase Turnos quedo mal nombrada , deberia ser Turno, en singular
by Pressenter - SVN Alba 06 Aug '07
by Pressenter - SVN Alba 06 Aug '07
06 Aug '07
#143: la clase Turnos quedo mal nombrada , deberia ser Turno, en singular
-------------------------+--------------------------------------------------
Reporter: ftoledo | Owner: somebody
Type: tarea | Status: new
Priority: baja | Milestone:
Component: alba-turnos | Version: desarollo
Severity: menor | Keywords:
-------------------------+--------------------------------------------------
El problema que ocurre es que los metodos del modelo quedan mal
ej:
$ciclolectivo->countTurnoss();
* renombrar la tabla de la base
* agregar al actualizar.sql
* verificar si va algo en datos_desde_cero.sql
* verificar datos de ejemplo .sql
* generar de nuevo el modelo
* renombrar el modulo
* en las acciones, el nombre de la clase
* en los templates, las variables referentes
* en el validate, nombre de los campos
* links que existas hacia ese modulo (ej. desde el menu)
modulos que manejan turnos:
* boletin
* calendario
* ciclolectivo
* division
* horarioescolar
* informes
* relAlumnoDivision
''pd: adjunto un grep donde aparece turnos''
--
Ticket URL: <http://alba.pressenter.com.ar/cgi-bin/trac.cgi/ticket/143>
Pressenter - SVN Alba <http://wwww.proyectoalba.com.ar/>
Proyecto Alba
1
4
Author: ftoledo
Date: 2007-07-30 18:41:42 -0300 (Mon, 30 Jul 2007)
New Revision: 4883
Modified:
prosistem/alba/trunk/alba/web/instalar.php
Log:
cambios de paths
Modified: prosistem/alba/trunk/alba/web/instalar.php
===================================================================
--- prosistem/alba/trunk/alba/web/instalar.php 2007-07-30 21:03:58 UTC (rev 4882)
+++ prosistem/alba/trunk/alba/web/instalar.php 2007-07-30 21:41:42 UTC (rev 4883)
@@ -54,8 +54,8 @@
define("SCHEMA", ALBA_CONFIG."schema.yml");
- define("IMG_OK", "<img src='installer/images/save.png'>");
- define("IMG_NOT_OK", "<img src='installer/images/delete.png'>");
+ define("IMG_OK", "<img src='images/installer/save.png'>");
+ define("IMG_NOT_OK", "<img src='images/installer/delete.png'>");
define("SQL_CREATE_DB", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."create-db.sql");
define("SQL_CREATE", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."lib.model.schema.sql");
1
0
SVN Alba r4882 - prosistem/alba/trunk/alba/apps/principal/templates
by commits@pressenter.com.ar 30 Jul '07
by commits@pressenter.com.ar 30 Jul '07
30 Jul '07
Author: ftoledo
Date: 2007-07-30 18:03:58 -0300 (Mon, 30 Jul 2007)
New Revision: 4882
Modified:
prosistem/alba/trunk/alba/apps/principal/templates/layout.php
Log:
leyenda para avisar el modo demo
Modified: prosistem/alba/trunk/alba/apps/principal/templates/layout.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/templates/layout.php 2007-07-30 20:05:31 UTC (rev 4881)
+++ prosistem/alba/trunk/alba/apps/principal/templates/layout.php 2007-07-30 21:03:58 UTC (rev 4882)
@@ -143,6 +143,13 @@
</ul>
</div>
<?php endif;?>
+ <?php if ($sf_user->isAuthenticated() && SF_ENVIRONMENT =='demo'):?>
+ <div class="form-errors">
+ <ul>
+ <li>El sistema está funcionando en modo Demostración.</li>
+ </ul>
+ </div>
+ <?php endif;?>
<br/>
<div id="content"><?php echo $content ?></div>
</td>
1
0
El modulo actual que usamos para visualizar el calendario es una aproximación
al phpicalendar que no termina de funcionar bien.
Deberiamos investigar que soluciones hay para integrar una visualización de
calendario tales como las que usan:
http://www.egroupware.org/
http://www.simple-groupware.de/
http://www.horde.org/kronolith/
http://www.phpgroupware.org/
--
Di Biase José Luis
Blog --> [http://www.joseluisdibiase.com.ar]
"viaja hasta tu ideal, sembra tu flor, labra tu libertad, rega tu voz
cerra tus ojos que sobra lugar en idilia para los dos"
1
0
SVN Alba r4881 - in prosistem/alba/trunk/alba: config data/sql web
by commits@pressenter.com.ar 30 Jul '07
by commits@pressenter.com.ar 30 Jul '07
30 Jul '07
Author: ftoledo
Date: 2007-07-30 17:05:31 -0300 (Mon, 30 Jul 2007)
New Revision: 4881
Added:
prosistem/alba/trunk/alba/web/instalar.php
Removed:
prosistem/alba/trunk/alba/data/sql/schema.sql
prosistem/alba/trunk/alba/web/install.php
Modified:
prosistem/alba/trunk/alba/config/propel.ini.dist
prosistem/alba/trunk/alba/data/sql/sqldb.map
prosistem/alba/trunk/alba/data/sql/updatedb.sh
Log:
cambiando nombre del schema
Modified: prosistem/alba/trunk/alba/config/propel.ini.dist
===================================================================
--- prosistem/alba/trunk/alba/config/propel.ini.dist 2007-07-30 19:27:08 UTC (rev 4880)
+++ prosistem/alba/trunk/alba/config/propel.ini.dist 2007-07-30 20:05:31 UTC (rev 4881)
@@ -1,4 +1,4 @@
-propel.targetPackage = lib.model
+propel.targetPackage = alba
propel.project = alba
propel.database = mysql
propel.database.createUrl = mysql://USERDB:PASSDB@SERVER/
Deleted: prosistem/alba/trunk/alba/data/sql/schema.sql
===================================================================
--- prosistem/alba/trunk/alba/data/sql/schema.sql 2007-07-30 19:27:08 UTC (rev 4880)
+++ prosistem/alba/trunk/alba/data/sql/schema.sql 2007-07-30 20:05:31 UTC (rev 4881)
@@ -1,1411 +0,0 @@
-
-# This is a fix for InnoDB in MySQL >= 4.1.x
-# It "suspends judgement" for fkey relationships until are tables are set.
-SET FOREIGN_KEY_CHECKS = 0;
-
-#-----------------------------------------------------------------------------
-#-- locacion
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `locacion`;
-
-
-CREATE TABLE `locacion`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255),
- `direccion` VARCHAR(128) default 'null' NOT NULL,
- `ciudad` VARCHAR(128) default 'null' NOT NULL,
- `codigo_postal` VARCHAR(20) default 'null',
- `fk_provincia_id` INTEGER default 0 NOT NULL,
- `fk_tipolocacion_id` INTEGER default 0 NOT NULL,
- `telefono` VARCHAR(20),
- `fax` VARCHAR(20),
- `encargado` VARCHAR(128),
- `encargado_telefono` VARCHAR(20),
- `principal` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `locacion_FI_1` (`fk_provincia_id`),
- CONSTRAINT `locacion_FK_1`
- FOREIGN KEY (`fk_provincia_id`)
- REFERENCES `provincia` (`id`),
- INDEX `locacion_FI_2` (`fk_tipolocacion_id`),
- CONSTRAINT `locacion_FK_2`
- FOREIGN KEY (`fk_tipolocacion_id`)
- REFERENCES `tipolocacion` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- modulo
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `modulo`;
-
-
-CREATE TABLE `modulo`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `titulo` VARCHAR(128),
- `descripcion` VARCHAR(255),
- `activo` INTEGER default 1 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- espacio
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `espacio`;
-
-
-CREATE TABLE `espacio`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `m2` FLOAT,
- `capacidad` VARCHAR(255),
- `descripcion` VARCHAR(255),
- `estado` VARCHAR(255),
- `fk_tipoespacio_id` INTEGER(11),
- `fk_locacion_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `espacio_FI_1` (`fk_tipoespacio_id`),
- CONSTRAINT `espacio_FK_1`
- FOREIGN KEY (`fk_tipoespacio_id`)
- REFERENCES `tipoespacio` (`id`),
- INDEX `espacio_FI_2` (`fk_locacion_id`),
- CONSTRAINT `espacio_FK_2`
- FOREIGN KEY (`fk_locacion_id`)
- REFERENCES `locacion` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- tipoespacio
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `tipoespacio`;
-
-
-CREATE TABLE `tipoespacio`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- tipolocacion
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `tipolocacion`;
-
-
-CREATE TABLE `tipolocacion`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- distritoescolar
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `distritoescolar`;
-
-
-CREATE TABLE `distritoescolar`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `direccion` VARCHAR(128),
- `telefono` VARCHAR(20),
- `ciudad` VARCHAR(128),
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- establecimiento
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `establecimiento`;
-
-
-CREATE TABLE `establecimiento`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255),
- `fk_distritoescolar_id` INTEGER default 0 NOT NULL,
- `fk_organizacion_id` INTEGER default 0 NOT NULL,
- `fk_niveltipo_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `establecimiento_FI_1` (`fk_distritoescolar_id`),
- CONSTRAINT `establecimiento_FK_1`
- FOREIGN KEY (`fk_distritoescolar_id`)
- REFERENCES `distritoescolar` (`id`),
- INDEX `establecimiento_FI_2` (`fk_organizacion_id`),
- CONSTRAINT `establecimiento_FK_2`
- FOREIGN KEY (`fk_organizacion_id`)
- REFERENCES `organizacion` (`id`),
- INDEX `establecimiento_FI_3` (`fk_niveltipo_id`),
- CONSTRAINT `establecimiento_FK_3`
- FOREIGN KEY (`fk_niveltipo_id`)
- REFERENCES `niveltipo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- niveltipo
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `niveltipo`;
-
-
-CREATE TABLE `niveltipo`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255),
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- organizacion
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `organizacion`;
-
-
-CREATE TABLE `organizacion`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255),
- `razon_social` VARCHAR(128) default 'null' NOT NULL,
- `cuit` VARCHAR(20) default 'null' NOT NULL,
- `direccion` VARCHAR(128) default 'null' NOT NULL,
- `ciudad` VARCHAR(128) default 'null' NOT NULL,
- `codigo_postal` VARCHAR(20) default 'null' NOT NULL,
- `telefono` VARCHAR(20) default 'null',
- `fk_provincia_id` INTEGER default 0 NOT NULL,
- `fk_tipoiva_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `organizacion_FI_1` (`fk_provincia_id`),
- CONSTRAINT `organizacion_FK_1`
- FOREIGN KEY (`fk_provincia_id`)
- REFERENCES `provincia` (`id`),
- INDEX `organizacion_FI_2` (`fk_tipoiva_id`),
- CONSTRAINT `organizacion_FK_2`
- FOREIGN KEY (`fk_tipoiva_id`)
- REFERENCES `tipoiva` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- pais
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `pais`;
-
-
-CREATE TABLE `pais`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre_largo` VARCHAR(128) default 'null' NOT NULL,
- `nombre_corto` VARCHAR(32) default 'null' NOT NULL,
- `orden` INTEGER default 0,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- permiso
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `permiso`;
-
-
-CREATE TABLE `permiso`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255),
- `fk_modulo_id` INTEGER default 0 NOT NULL,
- `credencial` VARCHAR(32),
- PRIMARY KEY (`id`),
- INDEX `permiso_FI_1` (`fk_modulo_id`),
- CONSTRAINT `permiso_FK_1`
- FOREIGN KEY (`fk_modulo_id`)
- REFERENCES `modulo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- preferencia
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `preferencia`;
-
-
-CREATE TABLE `preferencia`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `valor_por_defecto` VARCHAR(128),
- `activo` INTEGER default 1 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_establecimiento_locacion
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_establecimiento_locacion`;
-
-
-CREATE TABLE `rel_establecimiento_locacion`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `fk_establecimiento_id` INTEGER default 0 NOT NULL,
- `fk_locacion_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `rel_establecimiento_locacion_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `rel_establecimiento_locacion_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`),
- INDEX `rel_establecimiento_locacion_FI_2` (`fk_locacion_id`),
- CONSTRAINT `rel_establecimiento_locacion_FK_2`
- FOREIGN KEY (`fk_locacion_id`)
- REFERENCES `locacion` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_rol_permiso
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_rol_permiso`;
-
-
-CREATE TABLE `rel_rol_permiso`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `fk_rol_id` INTEGER default 0 NOT NULL,
- `fk_permiso_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `rel_rol_permiso_FI_1` (`fk_rol_id`),
- CONSTRAINT `rel_rol_permiso_FK_1`
- FOREIGN KEY (`fk_rol_id`)
- REFERENCES `rol` (`id`),
- INDEX `rel_rol_permiso_FI_2` (`fk_permiso_id`),
- CONSTRAINT `rel_rol_permiso_FK_2`
- FOREIGN KEY (`fk_permiso_id`)
- REFERENCES `permiso` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_usuario_permiso
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_usuario_permiso`;
-
-
-CREATE TABLE `rel_usuario_permiso`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `fk_usuario_id` INTEGER default 0 NOT NULL,
- `fk_permiso_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `rel_usuario_permiso_FI_1` (`fk_usuario_id`),
- CONSTRAINT `rel_usuario_permiso_FK_1`
- FOREIGN KEY (`fk_usuario_id`)
- REFERENCES `usuario` (`id`),
- INDEX `rel_usuario_permiso_FI_2` (`fk_permiso_id`),
- CONSTRAINT `rel_usuario_permiso_FK_2`
- FOREIGN KEY (`fk_permiso_id`)
- REFERENCES `permiso` (`id`)
- ON DELETE CASCADE
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_usuario_preferencia
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_usuario_preferencia`;
-
-
-CREATE TABLE `rel_usuario_preferencia`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `fk_usuario_id` INTEGER default 0 NOT NULL,
- `fk_preferencia_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rol
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rol`;
-
-
-CREATE TABLE `rol`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- `activo` INTEGER default 1 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- usuario
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `usuario`;
-
-
-CREATE TABLE `usuario`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `usuario` VARCHAR(32) default 'null' NOT NULL,
- `clave` VARCHAR(48) default 'null' NOT NULL,
- `correo_publico` INTEGER default 1,
- `activo` INTEGER default 1 NOT NULL,
- `fecha_creado` DATETIME NOT NULL,
- `fecha_actualizado` DATETIME NOT NULL,
- `seguridad_pregunta` VARCHAR(128),
- `seguridad_respuesta` VARCHAR(128),
- `email` VARCHAR(128),
- `fk_establecimiento_id` INTEGER default 0 NOT NULL,
- `borrado` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `usuario_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `usuario_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- tipoiva
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `tipoiva`;
-
-
-CREATE TABLE `tipoiva`
-(
- `id` INTEGER NOT NULL,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- `orden` INTEGER default 0,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- provincia
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `provincia`;
-
-
-CREATE TABLE `provincia`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre_corto` VARCHAR(32) default 'null' NOT NULL,
- `nombre_largo` VARCHAR(128) default 'null' NOT NULL,
- `fk_pais_id` INTEGER default 0 NOT NULL,
- `orden` INTEGER default 0,
- PRIMARY KEY (`id`),
- INDEX `provincia_FI_1` (`fk_pais_id`),
- CONSTRAINT `provincia_FK_1`
- FOREIGN KEY (`fk_pais_id`)
- REFERENCES `pais` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- cuenta
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `cuenta`;
-
-
-CREATE TABLE `cuenta`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `razon_social` VARCHAR(128) default 'null' NOT NULL,
- `cuit` VARCHAR(20) default 'null' NOT NULL,
- `direccion` VARCHAR(128) default 'null' NOT NULL,
- `ciudad` VARCHAR(128) default 'null' NOT NULL,
- `codigo_postal` VARCHAR(20) default 'null' NOT NULL,
- `telefono` VARCHAR(20) default 'null',
- `fk_provincia_id` INTEGER default 0 NOT NULL,
- `fk_tipoiva_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `cuenta_FI_1` (`fk_provincia_id`),
- CONSTRAINT `cuenta_FK_1`
- FOREIGN KEY (`fk_provincia_id`)
- REFERENCES `provincia` (`id`),
- INDEX `cuenta_FI_2` (`fk_tipoiva_id`),
- CONSTRAINT `cuenta_FK_2`
- FOREIGN KEY (`fk_tipoiva_id`)
- REFERENCES `tipoiva` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- alumno
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `alumno`;
-
-
-CREATE TABLE `alumno`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `apellido` VARCHAR(128) default 'null' NOT NULL,
- `fecha_nacimiento` DATETIME NOT NULL,
- `direccion` VARCHAR(128) default 'null' NOT NULL,
- `ciudad` VARCHAR(128) default 'null' NOT NULL,
- `codigo_postal` VARCHAR(20) default 'null' NOT NULL,
- `fk_provincia_id` INTEGER default 0 NOT NULL,
- `telefono` VARCHAR(20) default 'null',
- `lugar_nacimiento` VARCHAR(128) default 'null',
- `fk_tipodocumento_id` INTEGER(11) default 0 NOT NULL,
- `nro_documento` VARCHAR(16) default 'null' NOT NULL,
- `sexo` CHAR(1) NOT NULL,
- `email` VARCHAR(128) default 'null' NOT NULL,
- `distancia_escuela` INTEGER default 0,
- `hermanos_escuela` INTEGER default 0 NOT NULL,
- `hijo_maestro_escuela` INTEGER default 0 NOT NULL,
- `fk_establecimiento_id` INTEGER default 0 NOT NULL,
- `fk_cuenta_id` INTEGER default 0 NOT NULL,
- `certificado_medico` INTEGER default 0 NOT NULL,
- `activo` INTEGER default 1 NOT NULL,
- `fk_conceptobaja_id` INTEGER,
- `fk_pais_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `alumno_FI_1` (`fk_provincia_id`),
- CONSTRAINT `alumno_FK_1`
- FOREIGN KEY (`fk_provincia_id`)
- REFERENCES `provincia` (`id`),
- INDEX `alumno_FI_2` (`fk_tipodocumento_id`),
- CONSTRAINT `alumno_FK_2`
- FOREIGN KEY (`fk_tipodocumento_id`)
- REFERENCES `tipodocumento` (`id`),
- INDEX `alumno_FI_3` (`fk_establecimiento_id`),
- CONSTRAINT `alumno_FK_3`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`),
- INDEX `alumno_FI_4` (`fk_cuenta_id`),
- CONSTRAINT `alumno_FK_4`
- FOREIGN KEY (`fk_cuenta_id`)
- REFERENCES `cuenta` (`id`),
- INDEX `alumno_FI_5` (`fk_conceptobaja_id`),
- CONSTRAINT `alumno_FK_5`
- FOREIGN KEY (`fk_conceptobaja_id`)
- REFERENCES `conceptobaja` (`id`),
- INDEX `alumno_FI_6` (`fk_pais_id`),
- CONSTRAINT `alumno_FK_6`
- FOREIGN KEY (`fk_pais_id`)
- REFERENCES `pais` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- responsable
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `responsable`;
-
-
-CREATE TABLE `responsable`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `apellido` VARCHAR(128) default 'null' NOT NULL,
- `direccion` VARCHAR(128) default 'null',
- `ciudad` VARCHAR(128) default 'null',
- `codigo_postal` VARCHAR(20) default 'null',
- `fk_provincia_id` INTEGER default 0 NOT NULL,
- `telefono` VARCHAR(20) default 'null',
- `telefono_movil` VARCHAR(20) default 'null',
- `nro_documento` VARCHAR(20) default 'null' NOT NULL,
- `fk_tipodocumento_id` INTEGER default 0 NOT NULL,
- `sexo` CHAR(1) NOT NULL,
- `email` VARCHAR(128) default 'null',
- `observacion` VARCHAR(255) default 'null',
- `autorizacion_retiro` INTEGER default 0 NOT NULL,
- `fk_cuenta_id` INTEGER default 0 NOT NULL,
- `fk_rolresponsable_id` INTEGER default 1 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `responsable_FI_1` (`fk_provincia_id`),
- CONSTRAINT `responsable_FK_1`
- FOREIGN KEY (`fk_provincia_id`)
- REFERENCES `provincia` (`id`),
- INDEX `responsable_FI_2` (`fk_tipodocumento_id`),
- CONSTRAINT `responsable_FK_2`
- FOREIGN KEY (`fk_tipodocumento_id`)
- REFERENCES `tipodocumento` (`id`),
- INDEX `responsable_FI_3` (`fk_cuenta_id`),
- CONSTRAINT `responsable_FK_3`
- FOREIGN KEY (`fk_cuenta_id`)
- REFERENCES `cuenta` (`id`),
- INDEX `responsable_FI_4` (`fk_rolresponsable_id`),
- CONSTRAINT `responsable_FK_4`
- FOREIGN KEY (`fk_rolresponsable_id`)
- REFERENCES `rol_responsable` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- ciclolectivo
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `ciclolectivo`;
-
-
-CREATE TABLE `ciclolectivo`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_establecimiento_id` INTEGER(11) NOT NULL,
- `fecha_inicio` DATETIME NOT NULL,
- `fecha_fin` DATETIME NOT NULL,
- `descripcion` VARCHAR(255) default 'null' NOT NULL,
- `actual` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `ciclolectivo_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `ciclolectivo_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- turnos
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `turnos`;
-
-
-CREATE TABLE `turnos`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_ciclolectivo_id` INTEGER(11) NOT NULL,
- `hora_inicio` TIME NOT NULL,
- `hora_fin` TIME NOT NULL,
- `descripcion` VARCHAR(255) default 'null' NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `turnos_FI_1` (`fk_ciclolectivo_id`),
- CONSTRAINT `turnos_FK_1`
- FOREIGN KEY (`fk_ciclolectivo_id`)
- REFERENCES `ciclolectivo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- periodo
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `periodo`;
-
-
-CREATE TABLE `periodo`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_ciclolectivo_id` INTEGER(11) NOT NULL,
- `fecha_inicio` DATETIME NOT NULL,
- `fecha_fin` DATETIME NOT NULL,
- `descripcion` VARCHAR(255) default 'null' NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `periodo_FI_1` (`fk_ciclolectivo_id`),
- CONSTRAINT `periodo_FK_1`
- FOREIGN KEY (`fk_ciclolectivo_id`)
- REFERENCES `ciclolectivo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- conceptobaja
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `conceptobaja`;
-
-
-CREATE TABLE `conceptobaja`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- tipodocente
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `tipodocente`;
-
-
-CREATE TABLE `tipodocente`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- cargobaja
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `cargobaja`;
-
-
-CREATE TABLE `cargobaja`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- calendariovacunacion
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `calendariovacunacion`;
-
-
-CREATE TABLE `calendariovacunacion`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) NOT NULL,
- `descripcion` VARCHAR(255),
- `periodo` VARCHAR(128),
- `observacion` VARCHAR(255) default 'null',
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_calendariovacunacion_alumno
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_calendariovacunacion_alumno`;
-
-
-CREATE TABLE `rel_calendariovacunacion_alumno`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_alumno_id` INTEGER(11) NOT NULL,
- `fk_calendariovacunacion_id` INTEGER(11) NOT NULL,
- `observacion` VARCHAR(255),
- `comprobante` INTEGER default 0 NOT NULL,
- `fecha` DATETIME,
- PRIMARY KEY (`id`),
- INDEX `rel_calendariovacunacion_alumno_FI_1` (`fk_alumno_id`),
- CONSTRAINT `rel_calendariovacunacion_alumno_FK_1`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`),
- INDEX `rel_calendariovacunacion_alumno_FI_2` (`fk_calendariovacunacion_id`),
- CONSTRAINT `rel_calendariovacunacion_alumno_FK_2`
- FOREIGN KEY (`fk_calendariovacunacion_id`)
- REFERENCES `calendariovacunacion` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- legajopedagogico
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `legajopedagogico`;
-
-
-CREATE TABLE `legajopedagogico`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_alumno_id` INTEGER(11) NOT NULL,
- `titulo` VARCHAR(255) NOT NULL,
- `resumen` LONGBLOB NOT NULL,
- `texto` LONGBLOB NOT NULL,
- `fecha` DATETIME NOT NULL,
- `fk_usuario_id` INTEGER(11) NOT NULL,
- `fk_legajocategoria_id` INTEGER(11) NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `legajopedagogico_FI_1` (`fk_alumno_id`),
- CONSTRAINT `legajopedagogico_FK_1`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`),
- INDEX `legajopedagogico_FI_2` (`fk_usuario_id`),
- CONSTRAINT `legajopedagogico_FK_2`
- FOREIGN KEY (`fk_usuario_id`)
- REFERENCES `usuario` (`id`),
- INDEX `legajopedagogico_FI_3` (`fk_legajocategoria_id`),
- CONSTRAINT `legajopedagogico_FK_3`
- FOREIGN KEY (`fk_legajocategoria_id`)
- REFERENCES `legajocategoria` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- legajocategoria
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `legajocategoria`;
-
-
-CREATE TABLE `legajocategoria`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `descripcion` VARCHAR(255) NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- legajoadjunto
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `legajoadjunto`;
-
-
-CREATE TABLE `legajoadjunto`
-(
- `fk_legajopedagogico_id` INTEGER(11) NOT NULL,
- `fk_adjunto_id` INTEGER(11) NOT NULL,
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`id`),
- INDEX `legajoadjunto_FI_1` (`fk_legajopedagogico_id`),
- CONSTRAINT `legajoadjunto_FK_1`
- FOREIGN KEY (`fk_legajopedagogico_id`)
- REFERENCES `legajopedagogico` (`id`),
- INDEX `legajoadjunto_FI_2` (`fk_adjunto_id`),
- CONSTRAINT `legajoadjunto_FK_2`
- FOREIGN KEY (`fk_adjunto_id`)
- REFERENCES `adjunto` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- adjunto
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `adjunto`;
-
-
-CREATE TABLE `adjunto`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `descripcion` VARCHAR(255),
- `titulo` VARCHAR(255),
- `nombre_archivo` VARCHAR(255) NOT NULL,
- `tipo_archivo` VARCHAR(64) NOT NULL,
- `ruta` VARCHAR(255) NOT NULL,
- `fecha` DATETIME NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- asistencia
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `asistencia`;
-
-
-CREATE TABLE `asistencia`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_alumno_id` INTEGER(11) NOT NULL,
- `fk_tipoasistencia_id` INTEGER(11) NOT NULL,
- `fecha` DATETIME NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `asistencia_FI_1` (`fk_alumno_id`),
- CONSTRAINT `asistencia_FK_1`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`),
- INDEX `asistencia_FI_2` (`fk_tipoasistencia_id`),
- CONSTRAINT `asistencia_FK_2`
- FOREIGN KEY (`fk_tipoasistencia_id`)
- REFERENCES `tipoasistencia` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- concepto
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `concepto`;
-
-
-CREATE TABLE `concepto`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_establecimiento_id` INTEGER(11) default 0 NOT NULL,
- `nombre` VARCHAR(128) NOT NULL,
- `descripcion` VARCHAR(255),
- PRIMARY KEY (`id`),
- INDEX `concepto_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `concepto_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- escalanota
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `escalanota`;
-
-
-CREATE TABLE `escalanota`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_establecimiento_id` INTEGER(11) default 0 NOT NULL,
- `nombre` VARCHAR(128) NOT NULL,
- `descripcion` VARCHAR(255),
- `orden` INTEGER(11) NOT NULL,
- `aprobado` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `escalanota_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `escalanota_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- boletin_conceptual
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `boletin_conceptual`;
-
-
-CREATE TABLE `boletin_conceptual`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_escalanota_id` INTEGER(11) default 0 NOT NULL,
- `fk_alumno_id` INTEGER(11) default 0 NOT NULL,
- `fk_concepto_id` INTEGER(11) default 0 NOT NULL,
- `fk_periodo_id` INTEGER(11) default 0 NOT NULL,
- `observacion` LONGBLOB NOT NULL,
- `fecha` DATETIME NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `boletin_conceptual_FI_1` (`fk_escalanota_id`),
- CONSTRAINT `boletin_conceptual_FK_1`
- FOREIGN KEY (`fk_escalanota_id`)
- REFERENCES `escalanota` (`id`),
- INDEX `boletin_conceptual_FI_2` (`fk_alumno_id`),
- CONSTRAINT `boletin_conceptual_FK_2`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`),
- INDEX `boletin_conceptual_FI_3` (`fk_concepto_id`),
- CONSTRAINT `boletin_conceptual_FK_3`
- FOREIGN KEY (`fk_concepto_id`)
- REFERENCES `concepto` (`id`),
- INDEX `boletin_conceptual_FI_4` (`fk_periodo_id`),
- CONSTRAINT `boletin_conceptual_FK_4`
- FOREIGN KEY (`fk_periodo_id`)
- REFERENCES `periodo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- boletin_actividades
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `boletin_actividades`;
-
-
-CREATE TABLE `boletin_actividades`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_escalanota_id` INTEGER(11) default 0 NOT NULL,
- `fk_alumno_id` INTEGER(11) default 0 NOT NULL,
- `fk_actividad_id` INTEGER(11) default 0 NOT NULL,
- `fk_periodo_id` INTEGER(11) default 0 NOT NULL,
- `observacion` LONGBLOB NOT NULL,
- `fecha` DATETIME NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `boletin_actividades_FI_1` (`fk_escalanota_id`),
- CONSTRAINT `boletin_actividades_FK_1`
- FOREIGN KEY (`fk_escalanota_id`)
- REFERENCES `escalanota` (`id`),
- INDEX `boletin_actividades_FI_2` (`fk_alumno_id`),
- CONSTRAINT `boletin_actividades_FK_2`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`),
- INDEX `boletin_actividades_FI_3` (`fk_actividad_id`),
- CONSTRAINT `boletin_actividades_FK_3`
- FOREIGN KEY (`fk_actividad_id`)
- REFERENCES `actividad` (`id`),
- INDEX `boletin_actividades_FI_4` (`fk_periodo_id`),
- CONSTRAINT `boletin_actividades_FK_4`
- FOREIGN KEY (`fk_periodo_id`)
- REFERENCES `periodo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- examen
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `examen`;
-
-
-CREATE TABLE `examen`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_escalanota_id` INTEGER(11) default 0 NOT NULL,
- `fk_alumno_id` INTEGER(11) default 0 NOT NULL,
- `fk_actividad_id` INTEGER(11) default 0 NOT NULL,
- `fk_periodo_id` INTEGER(11) default 0 NOT NULL,
- `nombre` VARCHAR(255) default 'null' NOT NULL,
- `observacion` LONGBLOB NOT NULL,
- `fecha` DATETIME NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `examen_FI_1` (`fk_escalanota_id`),
- CONSTRAINT `examen_FK_1`
- FOREIGN KEY (`fk_escalanota_id`)
- REFERENCES `escalanota` (`id`),
- INDEX `examen_FI_2` (`fk_alumno_id`),
- CONSTRAINT `examen_FK_2`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`),
- INDEX `examen_FI_3` (`fk_actividad_id`),
- CONSTRAINT `examen_FK_3`
- FOREIGN KEY (`fk_actividad_id`)
- REFERENCES `actividad` (`id`),
- INDEX `examen_FI_4` (`fk_periodo_id`),
- CONSTRAINT `examen_FK_4`
- FOREIGN KEY (`fk_periodo_id`)
- REFERENCES `periodo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- anio
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `anio`;
-
-
-CREATE TABLE `anio`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_establecimiento_id` INTEGER(11) default 0 NOT NULL,
- `descripcion` VARCHAR(255) default 'null' NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `anio_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `anio_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- division
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `division`;
-
-
-CREATE TABLE `division`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_anio_id` INTEGER(11) default 0 NOT NULL,
- `descripcion` VARCHAR(255) default 'null' NOT NULL,
- `fk_turnos_id` INTEGER(11) default 0 NOT NULL,
- `orden` INTEGER default 0,
- PRIMARY KEY (`id`),
- INDEX `division_FI_1` (`fk_anio_id`),
- CONSTRAINT `division_FK_1`
- FOREIGN KEY (`fk_anio_id`)
- REFERENCES `anio` (`id`),
- INDEX `division_FI_2` (`fk_turnos_id`),
- CONSTRAINT `division_FK_2`
- FOREIGN KEY (`fk_turnos_id`)
- REFERENCES `turnos` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- repeticion
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `repeticion`;
-
-
-CREATE TABLE `repeticion`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `descripcion` VARCHAR(255) default 'null' NOT NULL,
- `orden` INTEGER(11) default 0 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- actividad
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `actividad`;
-
-
-CREATE TABLE `actividad`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_establecimiento_id` INTEGER(11) default 0 NOT NULL,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255),
- PRIMARY KEY (`id`),
- INDEX `actividad_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `actividad_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_anio_actividad
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_anio_actividad`;
-
-
-CREATE TABLE `rel_anio_actividad`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_anio_id` INTEGER(11) default 0 NOT NULL,
- `fk_actividad_id` INTEGER(11) default 0 NOT NULL,
- `horas` DECIMAL(10,2) default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `rel_anio_actividad_FI_1` (`fk_anio_id`),
- CONSTRAINT `rel_anio_actividad_FK_1`
- FOREIGN KEY (`fk_anio_id`)
- REFERENCES `anio` (`id`),
- INDEX `rel_anio_actividad_FI_2` (`fk_actividad_id`),
- CONSTRAINT `rel_anio_actividad_FK_2`
- FOREIGN KEY (`fk_actividad_id`)
- REFERENCES `actividad` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_alumno_division
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_alumno_division`;
-
-
-CREATE TABLE `rel_alumno_division`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_division_id` INTEGER(11) default 0 NOT NULL,
- `fk_alumno_id` INTEGER(11) default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `rel_alumno_division_FI_1` (`fk_division_id`),
- CONSTRAINT `rel_alumno_division_FK_1`
- FOREIGN KEY (`fk_division_id`)
- REFERENCES `division` (`id`),
- INDEX `rel_alumno_division_FI_2` (`fk_alumno_id`),
- CONSTRAINT `rel_alumno_division_FK_2`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_division_actividad_docente
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_division_actividad_docente`;
-
-
-CREATE TABLE `rel_division_actividad_docente`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_division_id` INTEGER(11) default 0,
- `fk_actividad_id` INTEGER(11) default 0 NOT NULL,
- `fk_docente_id` INTEGER(11) default 0,
- `fk_evento_id` INTEGER(11) default 0,
- PRIMARY KEY (`id`),
- INDEX `rel_division_actividad_docente_FI_1` (`fk_division_id`),
- CONSTRAINT `rel_division_actividad_docente_FK_1`
- FOREIGN KEY (`fk_division_id`)
- REFERENCES `division` (`id`),
- INDEX `rel_division_actividad_docente_FI_2` (`fk_actividad_id`),
- CONSTRAINT `rel_division_actividad_docente_FK_2`
- FOREIGN KEY (`fk_actividad_id`)
- REFERENCES `actividad` (`id`),
- INDEX `rel_division_actividad_docente_FI_3` (`fk_docente_id`),
- CONSTRAINT `rel_division_actividad_docente_FK_3`
- FOREIGN KEY (`fk_docente_id`)
- REFERENCES `docente` (`id`),
- INDEX `rel_division_actividad_docente_FI_4` (`fk_evento_id`),
- CONSTRAINT `rel_division_actividad_docente_FK_4`
- FOREIGN KEY (`fk_evento_id`)
- REFERENCES `evento` (`id`)
- ON DELETE CASCADE
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- docente
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `docente`;
-
-
-CREATE TABLE `docente`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `apellido` VARCHAR(128) default 'null' NOT NULL,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `sexo` CHAR(1) NOT NULL,
- `fecha_nacimiento` DATETIME NOT NULL,
- `fk_tipodocumento_id` INTEGER(11) default 0 NOT NULL,
- `nro_documento` VARCHAR(16) default 'null' NOT NULL,
- `direccion` VARCHAR(128) default 'null',
- `ciudad` VARCHAR(128) default 'null',
- `codigo_postal` VARCHAR(20) default 'null',
- `email` VARCHAR(255) default 'null',
- `telefono` VARCHAR(20) default 'null',
- `telefono_movil` VARCHAR(20) default 'null',
- `titulo` VARCHAR(128) default 'null' NOT NULL,
- `libreta_sanitaria` INTEGER default 0,
- `psicofisico` INTEGER default 0,
- `activo` INTEGER default 1,
- `fk_provincia_id` INTEGER(11) default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `docente_FI_1` (`fk_tipodocumento_id`),
- CONSTRAINT `docente_FK_1`
- FOREIGN KEY (`fk_tipodocumento_id`)
- REFERENCES `tipodocumento` (`id`),
- INDEX `docente_FI_2` (`fk_provincia_id`),
- CONSTRAINT `docente_FK_2`
- FOREIGN KEY (`fk_provincia_id`)
- REFERENCES `provincia` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_docente_establecimiento
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_docente_establecimiento`;
-
-
-CREATE TABLE `rel_docente_establecimiento`
-(
- `fk_establecimiento_id` INTEGER(11) default 0 NOT NULL,
- `fk_docente_id` INTEGER(11) default 0 NOT NULL,
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (`id`),
- INDEX `rel_docente_establecimiento_FI_1` (`fk_establecimiento_id`),
- CONSTRAINT `rel_docente_establecimiento_FK_1`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`),
- INDEX `rel_docente_establecimiento_FI_2` (`fk_docente_id`),
- CONSTRAINT `rel_docente_establecimiento_FK_2`
- FOREIGN KEY (`fk_docente_id`)
- REFERENCES `docente` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- tipodocumento
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `tipodocumento`;
-
-
-CREATE TABLE `tipodocumento`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- `orden` INTEGER(11) default 0,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_actividad_docente
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_actividad_docente`;
-
-
-CREATE TABLE `rel_actividad_docente`
-(
- `fk_actividad_id` INTEGER(11) NOT NULL,
- `fk_docente_id` INTEGER(11) NOT NULL,
- PRIMARY KEY (`fk_actividad_id`,`fk_docente_id`),
- CONSTRAINT `rel_actividad_docente_FK_1`
- FOREIGN KEY (`fk_actividad_id`)
- REFERENCES `actividad` (`id`),
- INDEX `rel_actividad_docente_FI_2` (`fk_docente_id`),
- CONSTRAINT `rel_actividad_docente_FK_2`
- FOREIGN KEY (`fk_docente_id`)
- REFERENCES `docente` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- docente_horario
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `docente_horario`;
-
-
-CREATE TABLE `docente_horario`
-(
- `fk_docente_id` INTEGER(11) NOT NULL,
- `fk_evento_id` INTEGER(11) NOT NULL,
- PRIMARY KEY (`fk_docente_id`,`fk_evento_id`),
- CONSTRAINT `docente_horario_FK_1`
- FOREIGN KEY (`fk_docente_id`)
- REFERENCES `docente` (`id`),
- INDEX `docente_horario_FI_2` (`fk_evento_id`),
- CONSTRAINT `docente_horario_FK_2`
- FOREIGN KEY (`fk_evento_id`)
- REFERENCES `evento` (`id`)
- ON DELETE CASCADE
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- feriado
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `feriado`;
-
-
-CREATE TABLE `feriado`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) NOT NULL,
- `fecha` DATETIME NOT NULL,
- `repeticion_anual` INTEGER default 0,
- `inamovible` INTEGER default 0,
- `fk_ciclolectivo_id` INTEGER(11) default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `feriado_FI_1` (`fk_ciclolectivo_id`),
- CONSTRAINT `feriado_FK_1`
- FOREIGN KEY (`fk_ciclolectivo_id`)
- REFERENCES `ciclolectivo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- horarioescolar
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `horarioescolar`;
-
-
-CREATE TABLE `horarioescolar`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) NOT NULL,
- `descripcion` VARCHAR(255),
- `fk_evento_id` INTEGER default 0 NOT NULL,
- `fk_establecimiento_id` INTEGER default 0 NOT NULL,
- `fk_turnos_id` INTEGER default 0 NOT NULL,
- `fk_horarioescolartipo_id` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`),
- INDEX `horarioescolar_FI_1` (`fk_evento_id`),
- CONSTRAINT `horarioescolar_FK_1`
- FOREIGN KEY (`fk_evento_id`)
- REFERENCES `evento` (`id`)
- ON DELETE CASCADE,
- INDEX `horarioescolar_FI_2` (`fk_establecimiento_id`),
- CONSTRAINT `horarioescolar_FK_2`
- FOREIGN KEY (`fk_establecimiento_id`)
- REFERENCES `establecimiento` (`id`),
- INDEX `horarioescolar_FI_3` (`fk_turnos_id`),
- CONSTRAINT `horarioescolar_FK_3`
- FOREIGN KEY (`fk_turnos_id`)
- REFERENCES `turnos` (`id`),
- INDEX `horarioescolar_FI_4` (`fk_horarioescolartipo_id`),
- CONSTRAINT `horarioescolar_FK_4`
- FOREIGN KEY (`fk_horarioescolartipo_id`)
- REFERENCES `horarioescolartipo` (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- horarioescolartipo
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `horarioescolartipo`;
-
-
-CREATE TABLE `horarioescolartipo`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255),
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- tipoasistencia
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `tipoasistencia`;
-
-
-CREATE TABLE `tipoasistencia`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(10) NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- `valor` DECIMAL(4,2) default 1 NOT NULL,
- `grupo` VARCHAR(30) default 'null',
- `defecto` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rol_responsable
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rol_responsable`;
-
-
-CREATE TABLE `rol_responsable`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `nombre` VARCHAR(128) default 'null' NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- `activo` INTEGER default 1 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- evento
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `evento`;
-
-
-CREATE TABLE `evento`
-(
- `id` INTEGER NOT NULL AUTO_INCREMENT,
- `titulo` VARCHAR(128) NOT NULL,
- `fecha_inicio` DATETIME NOT NULL,
- `fecha_fin` DATETIME NOT NULL,
- `tipo` INTEGER default 0 NOT NULL,
- `frecuencia` INTEGER default 0 NOT NULL,
- `frecuencia_intervalo` INTEGER default 0 NOT NULL,
- `recurrencia_fin` VARCHAR(16) default 'null',
- `recurrencia_dias` INTEGER default 0 NOT NULL,
- `estado` INTEGER default 0 NOT NULL,
- PRIMARY KEY (`id`)
-)Type=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- rel_rolresponsable_responsable
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `rel_rolresponsable_responsable`;
-
-
-CREATE TABLE `rel_rolresponsable_responsable`
-(
- `id` INTEGER(11) NOT NULL AUTO_INCREMENT,
- `fk_rolresponsable_id` INTEGER(11) default 0 NOT NULL,
- `fk_responsable_id` INTEGER(11) default 0 NOT NULL,
- `fk_alumno_id` INTEGER(11) default 0 NOT NULL,
- `descripcion` VARCHAR(255) default 'null',
- PRIMARY KEY (`id`),
- INDEX `rel_rolresponsable_responsable_FI_1` (`fk_rolresponsable_id`),
- CONSTRAINT `rel_rolresponsable_responsable_FK_1`
- FOREIGN KEY (`fk_rolresponsable_id`)
- REFERENCES `rol_responsable` (`id`),
- INDEX `rel_rolresponsable_responsable_FI_2` (`fk_responsable_id`),
- CONSTRAINT `rel_rolresponsable_responsable_FK_2`
- FOREIGN KEY (`fk_responsable_id`)
- REFERENCES `responsable` (`id`),
- INDEX `rel_rolresponsable_responsable_FI_3` (`fk_alumno_id`),
- CONSTRAINT `rel_rolresponsable_responsable_FK_3`
- FOREIGN KEY (`fk_alumno_id`)
- REFERENCES `alumno` (`id`)
-)Type=InnoDB;
-
-# This restores the fkey checks, after having unset them earlier
-SET FOREIGN_KEY_CHECKS = 1;
Modified: prosistem/alba/trunk/alba/data/sql/sqldb.map
===================================================================
--- prosistem/alba/trunk/alba/data/sql/sqldb.map 2007-07-30 19:27:08 UTC (rev 4880)
+++ prosistem/alba/trunk/alba/data/sql/sqldb.map 2007-07-30 20:05:31 UTC (rev 4881)
@@ -2,3 +2,4 @@
schema.sql=alba
lib.model.schema.sql=alba
generated-schema.sql=alba
+alba.schema.sql=alba
Modified: prosistem/alba/trunk/alba/data/sql/updatedb.sh
===================================================================
--- prosistem/alba/trunk/alba/data/sql/updatedb.sh 2007-07-30 19:27:08 UTC (rev 4880)
+++ prosistem/alba/trunk/alba/data/sql/updatedb.sh 2007-07-30 20:05:31 UTC (rev 4881)
@@ -1,7 +1,7 @@
#!/bin/bash
CONFIGURACIONDB="../../config/databases.yml"
-SCHEMA="schema.sql"
+SCHEMA="ib.model.schema.sql"
EJEMPLO="datos_ejemplo.sql"
DSNARCHIVO=`cat ../../config/databases.yml | grep dsn: | tr -d " "`
DSN=${DSNARCHIVO#dsn:*}
Copied: prosistem/alba/trunk/alba/web/instalar.php (from rev 4876, prosistem/alba/trunk/alba/web/install.php)
===================================================================
--- prosistem/alba/trunk/alba/web/install.php 2007-07-30 14:58:43 UTC (rev 4876)
+++ prosistem/alba/trunk/alba/web/instalar.php 2007-07-30 20:05:31 UTC (rev 4881)
@@ -0,0 +1,655 @@
+<?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(a)interorganic.com.ar>
+ * @author Héctor Sanchez <hsanchez(a)pressenter.com.ar>
+ * @author Fernando Toledo <ftoledo(a)pressenter.com.ar>
+ * @version SVN: $Id$
+ * @filesource
+ * @license GPL
+ */
+
+
+ define("OS_WINDOWS",((strtoupper(substr(PHP_OS,0,3))=='WIN'))?true:false);
+
+ define("APACHE_REQUIRED_VERSION","2.0.0");
+ define("PHP_REQUIRED_VERSION","5.0.0");
+ define("MEMORY_LIMIT_REQUIRED", "16");
+ define("MYSQL_REQUIRED_VERSION","4.1.0");
+
+ define("INSTALL_DIR", realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR). DIRECTORY_SEPARATOR);
+ define("DEBUG_LOG",INSTALL_DIR."log".DIRECTORY_SEPARATOR."install.log");
+ define("ALBA_WEB",INSTALL_DIR."web" . DIRECTORY_SEPARATOR);
+ define("ALBA_CONFIG", INSTALL_DIR."config".DIRECTORY_SEPARATOR);
+
+ define("APACHE_CONFIG_DIST", ALBA_CONFIG."apache.conf.dist");
+ define("DATABASE_CONFIG_DIST", ALBA_CONFIG."databases.yml.dist");
+ define("PROPEL_CONFIG_DIST", ALBA_CONFIG."propel.ini.dist");
+ define("HTACCESS_DIST", ALBA_WEB.".htaccess.dist");
+
+ define("DATABASE_CONFIG", ALBA_CONFIG."databases.yml");
+ define("PROPEL_CONFIG", ALBA_CONFIG."propel.ini");
+ define("HTACCESS", ALBA_WEB.".htaccess");
+ define("SCHEMA", ALBA_CONFIG."schema.yml");
+
+
+ define("IMG_OK", "<img src='installer/images/save.png'>");
+ define("IMG_NOT_OK", "<img src='installer/images/delete.png'>");
+
+ define("SQL_CREATE_DB", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."create-db.sql");
+ define("SQL_CREATE", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."lib.model.schema.sql");
+ define("SQL_INSERT_INICIAL", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."datos_desde_cero.sql");
+ define("SQL_INSERT_EJEMPLO", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."datos_ejemplo.sql");
+
+ if(!file_exists(INSTALL_COMPLETE_FILE)) {
+
+ $fp = fopen(DEBUG_LOG, "at" );
+ fputs( $fp,date( "d/m/Y H:m:s")." ---- INICIO DE VERIFICACIONES ----\n\n" );
+
+ if(OS_WINDOWS) {
+ @unlink(ALBA_PATH.".htaccess");
+ @unlink(INSTALL_DIR."dist/.htaccess");
+ fputs( $fp,date( "d/m/Y H:m:s")." SO: Windows \n\n" );
+ }
+ else
+ fputs( $fp,date( "d/m/Y H:m:s")." SO: Linux \n\n" );
+
+ //muchas veces tarda demasiado por lo que es prudente ponerle un infinito tiempo de ejecucion
+ set_time_limit(0);
+
+
+
+
+ $f_phpversion = function_exists ("phpversion");
+ $f_apache_get_version = function_exists ("apache_get_version");
+ $f_get_magic_quotes_gpc = function_exists ("get_magic_quotes_gpc");
+ $f_mysql_module = function_exists ("mysql_connect");
+
+ $msg_phpversion = "";
+ $msg_apache_get_version = "";
+ $msg_mysql_module = "";
+ $msg_mod_rewrite = "";
+ $msg_get_magic_quotes_gpc = "";
+
+ $bool_mysql_module = false;
+ $bool_phpversion = false;
+ $bool_apache_get_version = false;
+ $bool_gd = estaExtensionPHP("gd");
+ $bool_mod_rewrite = false;
+ $bool_get_magic_quotes_gpc = false;
+
+ $memory_limit = ini_get('memory_limit');
+ if($memory_limit != '') {
+ $bool_memory_limit = compruebaMemoriaMaxima($memory_limit);
+ $bool_memory_no_chequeo = true;
+ } else {
+ $bool_memory_limit = true;
+ $memory_limit = "No se pudo conocer la cantidad de memoria disponible en su PHP.";
+ $bool_memory_no_chequeo = false;
+ }
+ fputs( $fp,date( "d/m/Y H:m:s")." memory_limit: $memory_limit\n\n" );
+
+ $bool_cache = tienePermisoEscritura(ALBA_PATH."cache");
+ $bool_log = tienePermisoEscritura(ALBA_PATH."log");
+ $bool_upload = tienePermisoEscritura(ALBA_WEB."uploads");
+ $bool_tmp = tienePermisoEscritura(ALBA_WEB."tmp");
+ $bool_config = tienePermisoEscritura(ALBA_PATH."config");
+
+ if($f_phpversion) {
+ $bool_phpversion = compruebaVersion(phpversion(),PHP_REQUIRED_VERSION);
+ $msg_phpversion = "Su versión de PHP es ".phpversion();
+ } else {
+ $msg_phpversion = "No se pudo verificar la versión de PHP";
+
+ }
+ fputs( $fp,date( "d/m/Y H:m:s")." phpversion: $msg_phpversion\n\n" );
+
+ if($f_apache_get_version) {
+ preg_match('!Apache/(.*) !U', apache_get_version(), $v);
+ $apache_installed_version = $v[1];
+ $bool_apache_get_version = compruebaVersion($apache_installed_version, APACHE_REQUIRED_VERSION);
+ $msg_apache_get_version = "Su versión de APACHE es ".$apache_installed_version;
+ $bool_mod_rewrite = estaExtensionApache("mod_rewrite");
+
+ if($bool_mod_rewrite) {
+ $msg_mod_rewrite = "";
+ } else {
+ $msg_mod_rewrite = "Por favor instale el mod_rewrite en el apache";
+ }
+
+ } else {
+ $msg_apache_get_version = "No se pudo verificar la versión de APACHE";
+ $msg_mod_rewrite = "( Al no poder verificar la versión de APACHE, tampoco pudo hacerlo para el mod_rewrite )";
+ }
+ fputs( $fp,date( "d/m/Y H:m:s")." apache_get_version: $msg_apache_get_version\n\n" );
+ fputs( $fp,date( "d/m/Y H:m:s")." mod_rewrite: $msg_mod_rewrite\n\n" );
+
+ if($f_mysql_module) {
+ $bool_mysql_module = true;
+ $msg_mysql_module = "Tiene instalado el modulo MYSQL en PHP";
+ } else
+ $msg_mysql_module = "No tiene instalado el modulo MYSQL en PHP";
+
+ fputs( $fp,date( "d/m/Y H:m:s")." mysql_module: $msg_mysql_module\n\n" );
+
+ if($f_get_magic_quotes_gpc) {
+ $bool_get_magic_quotes_gpc = get_magic_quotes_gpc();
+ if(!$bool_get_magic_quotes_gpc) {
+ $bool_get_magic_quotes_gpc = true;
+ $msg_get_magic_quotes_gpc = "";
+ } else {
+ $msg_get_magic_quotes_gpc = "Tiene que cambiar el valor de la variable magic_quotes_gpc de On a Off";
+ }
+ } else {
+ $msg_get_magic_quotes_gpc = " No se pudo verificar si usted tiene (magic_quotes_gpc = off) en el php.ini";
+ }
+ fputs( $fp,date( "d/m/Y H:m:s")." magic_quotes: $msg_get_magic_quotes_gpc\n\n" );
+
+ $hasErrors = false;
+ $aError = array();
+ $aDb = array( 'server' => '', 'user' => '', 'password' => '', 'name' => '', 'createdb' => '' ) ;
+
+ if(!file_exists(SQL_CREATE)) {
+ $hasErrors = true;
+ $aError['sql_files'] = 'El archivo para el SQL no puede abrirse';
+ fputs( $fp,date( "d/m/Y H:m:s")." SQL_CREATE: ".$aError['sql_files']."\n\n" );
+ }
+ else
+ fputs( $fp,date( "d/m/Y H:m:s")." SQL_CREATE: OK \n\n" );
+
+ if(!file_exists(SQL_INSERT_INICIAL)){
+ $hasErrors = true;
+ $aError['sql_files'] = 'El archivo para el SQL no puede abrirse';
+ fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_INICIAL: ".$aError['sql_files']."\n\n" );
+ }
+ else
+ fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_INICIAL: OK \n\n" );
+
+ if(!file_exists(SQL_INSERT_EJEMPLO)){
+ $hasErrors = true;
+ $aError['sql_files'] = 'El archivo para el SQL no puede abrirse';
+ fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_EJEMPLO: ".$aError['sql_files']."\n\n" );
+ }
+ else
+ fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_EJEMPLO: OK \n\n" );
+
+ fputs( $fp,date( "d/m/Y H:m:s")." ---- FIN DE VERIFICACIONES ----\n\n" );
+ fputs( $fp,date( "d/m/Y H:m:s")." ---- INICIO DB ----\n\n" );
+ if ($_SERVER['REQUEST_METHOD'] == "POST") {
+
+ if(!isset($_POST['db']['createdb']))
+ $_POST['db']['createdb'] = false;
+
+ $db_connection = @mysql_connect( $_POST['db']['server'], $_POST['db']['user'], $_POST['db']['password']);
+ if ($db_connection) {
+ $mysql_server_version = mysql_get_server_info();
+ fputs( $fp,date( "d/m/Y H:m:s")." mysql_server_version: ".$mysql_server_version ."\n\n" );
+ if(compruebaVersion($mysql_server_version, MYSQL_REQUIRED_VERSION)) {
+ if($_POST['db']['createdb']) {
+ fputs( $fp,date( "d/m/Y H:m:s")." -- Create DB --\n\n" );
+ if(!@mysql_query('CREATE DATABASE '.$_POST['db']['name'].' DEFAULT CHARACTER SET utf8 COLLATE utf8_bin')) {
+ $hasErrors = true;
+ $aError['newdb'] = 'No se pudo crear la base de datos ('.mysql_error().')';
+ fputs( $fp,date( "d/m/Y H:m:s")." newdb: ".$aError['newdb']."\n\n" );
+ $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb']) ;
+ } else {
+ fputs( $fp,date( "d/m/Y H:m:s")." Se creo la base de datos OK--\n\n" );
+ if(doInstall($fp)) {
+ fputs( $fp,date( "d/m/Y H:m:s")." Fin doInstall (create_db): OK \n\n" );
+ fclose( $fp );
+ header("Location: ".REDIRECT_URL);
+ } else {
+ fputs( $fp,date( "d/m/Y H:m:s")." Fin doInstall (create_db): con Error \n\n" );
+ if (!@mysql_query('DROP DATABASE '.$_POST['db']['name'])){
+ $aError['insert_create'] = 'No se pudo eliminar la base de datos creada ('.mysql_error().')';
+ fputs( $fp,date( "d/m/Y H:m:s")." insert_create (create_db): ".$aError['insert_create']."\n\n" );
+ }
+ else {
+ $aError['insert_create'] = 'Se elimino la base de datos creada ('.mysql_error().')';
+ fputs( $fp,date( "d/m/Y H:m:s")." insert_create (create_db): ".$aError['insert_create']."\n\n" );
+ }
+ $hasErrors = true;
+ }
+ }
+ } else {
+ fputs( $fp,date( "d/m/Y H:m:s")." -- Select DB --\n\n" );
+ if(@mysql_select_db($_POST['db']['name'])) {
+ if(doInstall($fp)) {
+ fputs( $fp,date( "d/m/Y H:m:s")." Fin doInstall (select_db): OK \n\n" );
+ fclose( $fp );
+ header("Location: ".REDIRECT_URL);
+ } else {
+ $aError['insert_create'] = 'No se pudo agregar los datos a la base de datos existente ('.mysql_error().')';
+ fputs( $fp,date( "d/m/Y H:m:s")." insert_create (select_db): ".$aError['insert_create']."\n\n" );
+ $hasErrors = true;
+ }
+ } else {
+ $hasErrors = true;
+ $aError['currentdb'] = 'No se pudo usar la base de datos ('.mysql_error().')';
+ fputs( $fp,date( "d/m/Y H:m:s")." currentdb (select_db): ".$aError['currentdb']."\n\n" );
+ $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb']) ;
+ }
+ }
+ } else {
+ $hasErrors = true;
+ $aError['mysql_version'] = 'Usted tiene una versión de MYSQL inferior a la'.MYSQL_REQUIRED_VERSION. '(Su versión actual es '.$mysql_server_version. ')';
+ fputs( $fp,date( "d/m/Y H:m:s")." mysql_server_version: ".$aError['mysql_version']."\n\n" );
+ $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb'] );
+ }
+
+ mysql_close($db_connection);
+ } else {
+ $hasErrors = true;
+ $aError['connect'] = 'No pudo conectarse al Servidor de Base de datos ('.mysql_error().')';
+ fputs( $fp,date( "d/m/Y H:m:s")." connect: ".$aError['connect']."\n\n" );
+ $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb'] );
+ }
+
+ }
+ fclose( $fp );
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-200000126/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <meta name="title" content="Proyecto ALBA" />
+ <meta name="robots" content="index, follow" />
+ <meta name="description" content="Proyecto de Gestión Educativa ALBA" />
+ <meta name="keywords" content="alba, proyecto, software libre, educacion" />
+ <meta name="language" content="es" />
+ <title>Proyecto ALBA</title>
+ <link rel="stylesheet" type="text/css" href="installer/css/main.css"/>
+</head>
+
+<body>
+<div id ="sf_admin_container">
+<h2>Verificaciones necesarias para la instalación</h2>
+<br>
+<h2>Programas</h2>
+
+<table border="0" cellpadding="3" width="600" class="sf_admin_list">
+ <thead>
+ <tr>
+ <th id="sf_admin_list_th_verfica">Verificación</th>
+ <th id="sf_admin_list_th_resultado">Resultado</th>
+ </tr>
+ </thead>
+ <tr class="sf_admin_row_0" >
+ <td>Versión de PHP >= 5.0.0</td>
+ <td>
+ <?=($bool_phpversion)?IMG_OK:IMG_NOT_OK?>(<?=$msg_phpversion?>)
+ </td>
+ </tr>
+
+ <tr class="sf_admin_row_1" >
+ <td>¿ Esta instalado MYSQL en PHP ?</td>
+ <td>
+ <?=($bool_mysql_module)?IMG_OK:IMG_NOT_OK?>(<?=$msg_mysql_module?>)
+ </td>
+ </tr>
+
+
+ <tr class="sf_admin_row_0">
+ <td>¿ Esta Instalado GD en PHP ? (optativo) </td>
+ <td><?=($bool_gd)?IMG_OK:IMG_NOT_OK." (Si queres ver los gráficos de estadísticas necesitas instalar GD - http://www.php.net/manual/es/ref.image.php)";?></td>
+ </tr>
+
+ <tr class="sf_admin_row_1">
+ <td>En php.ini memory_limit >= 32</td>
+ <td><?=($bool_memory_limit AND $bool_memory_no_chequeo)?IMG_OK:IMG_NOT_OK;?>(<?=$memory_limit?>)</td>
+ </tr>
+
+ <tr class="sf_admin_row_1">
+ <td>En php.ini magic_quotes_gpc = off</td>
+ <td><?=($bool_get_magic_quotes_gpc)?IMG_OK:IMG_NOT_OK;?><?=$msg_get_magic_quotes_gpc?></td>
+ </tr>
+
+
+
+ <tr class="sf_admin_row_0">
+ <td>Versióon de APACHE >= 2.0</td>
+ <td><?=($bool_apache_get_version)?IMG_OK:IMG_NOT_OK?>(<?=$msg_apache_get_version?>)</td>
+ </tr>
+
+ <tr class="sf_admin_row_1">
+ <td>¿ Esta instalado MOD_REWRITE en APACHE ?</td>
+ <td><?=($bool_mod_rewrite)?IMG_OK:IMG_NOT_OK.$msg_mod_rewrite?></td>
+ </tr>
+
+</table>
+<br>
+<h2>Directorios con permisos para escritura:</h2>
+<table border="0" cellpadding="3" width="600" class="sf_admin_list">
+ <thead>
+ <tr>
+ <th id="sf_admin_list_th_dir">Directorios</th>
+ <th id="sf_admin_list_th_resultado">Resultados</th>
+ </tr>
+ </thead>
+ <tr class="sf_admin_row_0" >
+ <td>/cache</td>
+ <td><?=($bool_cache)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/cache)";?></td>
+ </tr>
+ <tr class="sf_admin_row_1">
+ <td>/log</td>
+ <td><?=($bool_log)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/logs)";?></td>
+ </tr>
+ <tr class="sf_admin_row_0">
+ <td>/uploads</td>
+ <td><?=($bool_upload)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/web/uploads)";?></td>
+ </tr>
+ <tr class="sf_admin_row_1">
+ <td>/config</td>
+ <td><?=($bool_config)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/config)";?></td>
+<?php // Aqui no deberiamos probar si tienen permisos los archivos databases.yml, propel.ini y web/.htaccess ?>
+ </tr>
+ <tr class="sf_admin_row_0">
+ <td>/tmp</td>
+ <td><?=($bool_tmp)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/web/tmp)";?></td>
+ </tr>
+
+</table>
+
+<?php if($bool_config AND $bool_upload AND $bool_tmp AND $bool_log AND $bool_cache AND $bool_memory_limit AND $bool_apache_get_version AND $bool_phpversion AND $bool_mysql_module AND $bool_mod_rewrite AND $bool_get_magic_quotes_gpc) { ?>
+
+<?php if($hasErrors) { ?>
+ <br><br>
+ <div class="form-errors">
+ <h2>Arreglar errores para continuar</h2>
+ <ul>
+ <?php foreach ($aError as $idx => $name) { ?>
+ <li><?php echo $name; ?></li>
+ <?php } ?>
+ </ul>
+ </div>
+<?php } ?>
+
+
+
+<br>
+<h2>Datos para la instalación</h2>
+<form action="<?=$_SERVER['PHP_SELF']?>" method="POST" >
+ <fieldset id="sf_fieldset_base_de_datos" class="">
+ <h2>Conección a la base de datos</h2>
+ <div class="form-row">
+ <label for="db_server" class="required">Servidor:</label><div class="content"><input type="text" name="db[server]" value="<?=$aDb['server']?>" size="64" /></div>
+ </div>
+ <div class="form-row">
+ <label for="db_user" class="required">Usuario:</label><div class="content"><input type="text" name="db[user]" value="<?=$aDb['user']?>" size="64" /></div>
+ </div>
+ <div class="form-row">
+ <label for="db_password" class="required">Contraseña:</label><div class="content"><input type="password" name="db[password]" value="<?=$aDb['password']?>" size="64" /></div>
+ </div>
+ <div class="form-row">
+ <label for="db_name" class="required">Nombre de base de datos:</label><div class="content"><input type="text" name="db[name]" value="<?=$aDb['name']?>" size="64" />
+ Crear Base de datos <input type="checkbox" name="db[createdb]" value="crear" <?=($aDb['createdb'])?'checked':''?>>
+ </div>
+
+ <div class="form-row">
+ <label for="db_name" class="required">¿Que datos quiere por defecto?:</label>
+ <div class="content">
+ Datos mínimos<input type="radio" name="db[datos]" value="minimos" checked >
+ Caso de Ejemplo<input type="radio" name="db[datos]" value="ejemplo">
+ </div>
+ </div>
+ </fieldset>
+
+ <ul class="sf_admin_actions">
+ <li><input type="submit" name="instalar" value="Instalar" class="sf_admin_action_instalar" /></li>
+ <li><input type="reset" name="borrar" value="Borrar" class="sf_admin_action_borrar" /></li>
+ </ul>
+</form>
+<? } else { ?>
+<br>
+<div align="center"><h2 style="color: #FF0000;">Para poder seguir con la instalción debe pasar completa la verificación.</h2></div>
+<? } ?>
+</div>
+</body>
+</html>
+
+
+<?
+// si existe el archivo de flag para la instacion
+} else { ?>
+<html>
+<body>
+Usted ya ha instalado el Proyetco ALBA. Si quiere volver a instalarlo debe borra el archivo alba/log/instalacion_completa.
+</body>
+</html>
+<? } ?>
+
+
+<?php
+
+/**
+* Funciones del instalador
+*/
+
+function compruebaVersion($instalada, $requireda) {
+ return (version_compare($instalada, $requireda, ">="));
+}
+
+
+function compruebaMemoriaMaxima($php_memory) {
+ $memory_limit = eregi_replace('[gmk]','',$php_memory);
+ return ($memory_limit >= MEMORY_LIMIT_REQUIRED);
+
+}
+
+function estaExtensionPHP($ext) {
+ $aExtension = get_loaded_extensions();
+ if(count($aExtension)>0) {
+ $res = array_search($ext, $aExtension);
+ if($res === false) {
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+}
+
+
+function estaExtensionApache($ext) {
+ $aApacheModulos = apache_get_modules();
+ if(count($aApacheModulos)>0) {
+ $res = array_search($ext, $aApacheModulos);
+ if($res === false) {
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+}
+
+
+function tienePermisoEscritura($dir) {
+ $octalPermiso = substr(sprintf('%o', @fileperms($dir)), -4);
+ return ($octalPermiso == "0777" OR $octalPermiso == "1777");
+}
+
+
+function reemplzarArchivo($archivo, $aReemplazo) {
+ $contenido = "";
+ if(file_exists($archivo)) {
+ $contenido = file_get_contents ($archivo);
+ foreach($aReemplazo as $indice => $reemplazo) {
+ $contenido = str_replace($indice, $reemplazo, $contenido);
+ }
+ }
+ return $contenido;
+}
+
+
+
+// ojo que esto no funciona para cualquier cosa si dentro de un string de un insert hay un dato con ;\n se separa por eso tambien
+function dump2Array($file) {
+ $aSql = array();
+ $res_sql = "";
+ if(file_exists($file)) {
+ $sql = file($file);
+ foreach($sql as $sql_line) {
+ $sql_line = trim($sql_line);
+ if (($sql_line != "") && (substr($sql_line, 0, 2) != "--") && (substr($sql_line, 0, 1) != "#") ) {
+ $res_sql .= $sql_line."\n";
+ }
+ }
+ $aSql= array_slice(explode(";\n", $res_sql),0,-1);
+ }
+ return $aSql;
+}
+
+function executeDump($file, $db,$fp) {
+ fputs( $fp,date( "d/m/Y H:m:s")." Entrando ExecuteDump: $file - $db \n\n" );
+ $aSql = dump2Array($file);
+ $error = false;
+ if(count($aSql) > 0 AND file_exists($file)) {
+ if(mysql_select_db($db)) {
+ fputs( $fp,date( "d/m/Y H:m:s")." ejecutando BEGIN \n\n" );
+ mysql_query("BEGIN");
+ foreach($aSql as $sql_line) {
+ $res = mysql_query(trim($sql_line));
+ if(!$res) {
+ fputs( $fp,date( "d/m/Y H:m:s")." Fallo SQL: $sql_line \n\n" );
+ fputs( $fp,date( "d/m/Y H:m:s")." error:". mysql_error()." \n\n" );
+ $error = true;
+ }
+ }
+ if($error == true) {
+ fputs( $fp,date( "d/m/Y H:m:s")." Se encontraron errores ejecutando ROLLBACK y saliendo \n\n" );
+ mysql_query("ROLLBACK");
+ return false;
+ } else {
+ fputs( $fp,date( "d/m/Y H:m:s")." Sin errores ejecutando COMMIT y saliendo \n\n" );
+ mysql_query("COMMIT");
+ return true;
+ }
+ }
+ else {
+ fputs( $fp,date( "d/m/Y H:m:s")." Error al seleccionar la base: $db \n\n" );
+ return false;
+ }
+ } else {
+ fputs( $fp,date( "d/m/Y H:m:s")." Devuele false no ejecuta nada : $db \n\n" );
+ return false;
+ }
+
+}
+
+function doInstall($fp) {
+ global $_POST;
+ fputs( $fp,date( "d/m/Y H:m:s")." Entrando doInstall() \n\n" );
+ //verifica que base de datos instalar si la del ejemplo o solamente la
+ //de los datos_desde_cero iniciales
+ switch($_POST['db']['datos']) {
+ case "ejemplo": $sql_insert = SQL_INSERT_INICIAL; break;
+ case "minimos": $sql_insert = SQL_INSERT_EJEMPLO; break;
+ default: $sql_insert = SQL_INSERT_EJEMPLO;
+ }
+ fputs( $fp,date( "d/m/Y H:m:s")." Utilizando SQL: $sql_insert \n\n" );
+ if(executeDump(SQL_CREATE, $_POST['db']['name'],$fp)) {
+ if(executeDump($sql_insert, $_POST['db']['name'],$fp)) {
+ $aReemplazo = array( 'USERDB' => $_POST['db']['user'], 'PASSDB' => $_POST['db']['password'], 'SERVER' => $_POST['db']['server'], 'DBNAME'=> $_POST['db']['name']);
+ $contenido_archivo = reemplzarArchivo(DATABASE_CONFIG_DIST,$aReemplazo);
+ file_put_contents(DATABASE_CONFIG, $contenido_archivo);
+
+ $aReemplazo = array( 'USERDB' => $_POST['db']['user'], 'PASSDB' => $_POST['db']['password'], 'SERVER' => $_POST['db']['server'], 'DBNAME'=> $_POST['db']['name']);
+ $contenido_archivo = reemplzarArchivo(PROPEL_CONFIG_DIST,$aReemplazo);
+ file_put_contents(PROPEL_CONFIG, $contenido_archivo);
+
+
+ _symlink(INSTALL_DIR."dist/".SYMFONY_DIR."/data/", ALBA_PATH."data/symfony");
+ _symlink(INSTALL_DIR."dist/pake/", ALBA_PATH."lib/pake");
+ _symlink(INSTALL_DIR."dist/phing.sandbox/", ALBA_PATH."lib/phing");
+ _symlink(INSTALL_DIR."dist/".SYMFONY_DIR."/lib/", ALBA_PATH."lib/symfony");
+ _symlink(INSTALL_DIR."alba/data/symfony/web/sf/", ALBA_WEB."sf");
+ fputs( $fp,date( "d/m/Y H:m:s")." Creando Links \n\n" );
+
+ $rewrite_path = (OS_WINDOWS)?CURRENT_WEB_DIR.SYMFONY_WINDOWS_WEB_DIR:CURRENT_WEB_DIR.SYMFONY_WEB_DIR;
+
+ if(!OS_WINDOWS)
+ _symlink(ALBA_WEB, INSTALL_DIR.SYMFONY_WEB_DIR); // crea nuevo link afuera de la estructura de alba
+
+ $aReemplazo = Array('REWRITE_PATH' => $rewrite_path);
+ $contenido_archivo = reemplzarArchivo(HTACCESS_DIST,$aReemplazo);
+ file_put_contents(HTACCESS, $contenido_archivo);
+ touch(INSTALL_COMPLETE_FILE);
+ fputs( $fp,date( "d/m/Y H:m:s")." Creando bandera INSTALL_COMPLETE_FILE \n\n" );
+ return true;
+ }
+ fputs( $fp,date( "d/m/Y H:m:s")." Fallo ejecutando: $sql_insert \n\n" );
+ return false;
+ } else {
+ fputs( $fp,date( "d/m/Y H:m:s")." Fallo ejecutando: SQL_CREATE \n\n" );
+ return false;
+ }
+
+}
+
+
+function doUninstall() {
+
+}
+
+function _symlink( $target, $link ) {
+ if (OS_WINDOWS) {
+ @dircopy($target, $link);
+ } else {
+ @symlink($target,$link);
+ }
+}
+
+
+function dircopy($srcdir, $dstdir, $verbose = false) {
+ $num = 0;
+ if(!is_dir($dstdir)) mkdir($dstdir);
+ if($curdir = opendir($srcdir)) {
+ while($file = readdir($curdir)) {
+ if($file != '.' && $file != '..') {
+ $srcfile = $srcdir . DIRECTORY_SEPARATOR . $file;
+ $dstfile = $dstdir . DIRECTORY_SEPARATOR . $file;
+ if(is_file($srcfile)) {
+ if(is_file($dstfile)) $ow = filemtime($srcfile) - filemtime($dstfile); else $ow = 1;
+ if($ow > 0) {
+ if($verbose) echo "Copying '$srcfile' to '$dstfile'...";
+ if(copy($srcfile, $dstfile)) {
+ touch($dstfile, filemtime($srcfile)); $num++;
+ if($verbose) echo "OK\n";
+ }
+ else echo "Error: File '$srcfile' could not be copied!\n";
+ }
+ }
+ else if(is_dir($srcfile)) {
+ $num += dircopy($srcfile, $dstfile, $verbose);
+ }
+ }
+ }
+ closedir($curdir);
+ }
+ return $num;
+}
+?>
\ No newline at end of file
Deleted: prosistem/alba/trunk/alba/web/install.php
===================================================================
--- prosistem/alba/trunk/alba/web/install.php 2007-07-30 19:27:08 UTC (rev 4880)
+++ prosistem/alba/trunk/alba/web/install.php 2007-07-30 20:05:31 UTC (rev 4881)
@@ -1,655 +0,0 @@
-<?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(a)interorganic.com.ar>
- * @author Héctor Sanchez <hsanchez(a)pressenter.com.ar>
- * @author Fernando Toledo <ftoledo(a)pressenter.com.ar>
- * @version SVN: $Id$
- * @filesource
- * @license GPL
- */
-
-
- define("OS_WINDOWS",((strtoupper(substr(PHP_OS,0,3))=='WIN'))?true:false);
-
- define("APACHE_REQUIRED_VERSION","2.0.0");
- define("PHP_REQUIRED_VERSION","5.0.0");
- define("MEMORY_LIMIT_REQUIRED", "16");
- define("MYSQL_REQUIRED_VERSION","4.1.0");
-
- define("INSTALL_DIR", realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR). DIRECTORY_SEPARATOR);
- define("DEBUG_LOG",INSTALL_DIR."log".DIRECTORY_SEPARATOR."install.log");
- define("ALBA_WEB",INSTALL_DIR."web" . DIRECTORY_SEPARATOR);
- define("ALBA_CONFIG", INSTALL_DIR."config".DIRECTORY_SEPARATOR);
-
- define("APACHE_CONFIG_DIST", ALBA_CONFIG."apache.conf.dist");
- define("DATABASE_CONFIG_DIST", ALBA_CONFIG."databases.yml.dist");
- define("PROPEL_CONFIG_DIST", ALBA_CONFIG."propel.ini.dist");
- define("HTACCESS_DIST", ALBA_WEB.".htaccess.dist");
-
- define("DATABASE_CONFIG", ALBA_CONFIG."databases.yml");
- define("PROPEL_CONFIG", ALBA_CONFIG."propel.ini");
- define("HTACCESS", ALBA_WEB.".htaccess");
- define("SCHEMA", ALBA_CONFIG."schema.xml");
-
-
- define("IMG_OK", "<img src='installer/images/save.png'>");
- define("IMG_NOT_OK", "<img src='installer/images/delete.png'>");
-
- define("SQL_CREATE_DB", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."create-db.sql");
- define("SQL_CREATE", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."schema.sql");
- define("SQL_INSERT_INICIAL", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."datos_desde_cero.sql");
- define("SQL_INSERT_EJEMPLO", INSTALL_DIR."data".DIRECTORY_SEPARATOR."sql".DIRECTORY_SEPARATOR."datos_ejemplo.sql");
-
- if(!file_exists(INSTALL_COMPLETE_FILE)) {
-
- $fp = fopen(DEBUG_LOG, "at" );
- fputs( $fp,date( "d/m/Y H:m:s")." ---- INICIO DE VERIFICACIONES ----\n\n" );
-
- if(OS_WINDOWS) {
- @unlink(ALBA_PATH.".htaccess");
- @unlink(INSTALL_DIR."dist/.htaccess");
- fputs( $fp,date( "d/m/Y H:m:s")." SO: Windows \n\n" );
- }
- else
- fputs( $fp,date( "d/m/Y H:m:s")." SO: Linux \n\n" );
-
- //muchas veces tarda demasiado por lo que es prudente ponerle un infinito tiempo de ejecucion
- set_time_limit(0);
-
-
-
-
- $f_phpversion = function_exists ("phpversion");
- $f_apache_get_version = function_exists ("apache_get_version");
- $f_get_magic_quotes_gpc = function_exists ("get_magic_quotes_gpc");
- $f_mysql_module = function_exists ("mysql_connect");
-
- $msg_phpversion = "";
- $msg_apache_get_version = "";
- $msg_mysql_module = "";
- $msg_mod_rewrite = "";
- $msg_get_magic_quotes_gpc = "";
-
- $bool_mysql_module = false;
- $bool_phpversion = false;
- $bool_apache_get_version = false;
- $bool_gd = estaExtensionPHP("gd");
- $bool_mod_rewrite = false;
- $bool_get_magic_quotes_gpc = false;
-
- $memory_limit = ini_get('memory_limit');
- if($memory_limit != '') {
- $bool_memory_limit = compruebaMemoriaMaxima($memory_limit);
- $bool_memory_no_chequeo = true;
- } else {
- $bool_memory_limit = true;
- $memory_limit = "No se pudo conocer la cantidad de memoria disponible en su PHP.";
- $bool_memory_no_chequeo = false;
- }
- fputs( $fp,date( "d/m/Y H:m:s")." memory_limit: $memory_limit\n\n" );
-
- $bool_cache = tienePermisoEscritura(ALBA_PATH."cache");
- $bool_log = tienePermisoEscritura(ALBA_PATH."log");
- $bool_upload = tienePermisoEscritura(ALBA_WEB."uploads");
- $bool_tmp = tienePermisoEscritura(ALBA_WEB."tmp");
- $bool_config = tienePermisoEscritura(ALBA_PATH."config");
-
- if($f_phpversion) {
- $bool_phpversion = compruebaVersion(phpversion(),PHP_REQUIRED_VERSION);
- $msg_phpversion = "Su versión de PHP es ".phpversion();
- } else {
- $msg_phpversion = "No se pudo verificar la versión de PHP";
-
- }
- fputs( $fp,date( "d/m/Y H:m:s")." phpversion: $msg_phpversion\n\n" );
-
- if($f_apache_get_version) {
- preg_match('!Apache/(.*) !U', apache_get_version(), $v);
- $apache_installed_version = $v[1];
- $bool_apache_get_version = compruebaVersion($apache_installed_version, APACHE_REQUIRED_VERSION);
- $msg_apache_get_version = "Su versión de APACHE es ".$apache_installed_version;
- $bool_mod_rewrite = estaExtensionApache("mod_rewrite");
-
- if($bool_mod_rewrite) {
- $msg_mod_rewrite = "";
- } else {
- $msg_mod_rewrite = "Por favor instale el mod_rewrite en el apache";
- }
-
- } else {
- $msg_apache_get_version = "No se pudo verificar la versión de APACHE";
- $msg_mod_rewrite = "( Al no poder verificar la versión de APACHE, tampoco pudo hacerlo para el mod_rewrite )";
- }
- fputs( $fp,date( "d/m/Y H:m:s")." apache_get_version: $msg_apache_get_version\n\n" );
- fputs( $fp,date( "d/m/Y H:m:s")." mod_rewrite: $msg_mod_rewrite\n\n" );
-
- if($f_mysql_module) {
- $bool_mysql_module = true;
- $msg_mysql_module = "Tiene instalado el modulo MYSQL en PHP";
- } else
- $msg_mysql_module = "No tiene instalado el modulo MYSQL en PHP";
-
- fputs( $fp,date( "d/m/Y H:m:s")." mysql_module: $msg_mysql_module\n\n" );
-
- if($f_get_magic_quotes_gpc) {
- $bool_get_magic_quotes_gpc = get_magic_quotes_gpc();
- if(!$bool_get_magic_quotes_gpc) {
- $bool_get_magic_quotes_gpc = true;
- $msg_get_magic_quotes_gpc = "";
- } else {
- $msg_get_magic_quotes_gpc = "Tiene que cambiar el valor de la variable magic_quotes_gpc de On a Off";
- }
- } else {
- $msg_get_magic_quotes_gpc = " No se pudo verificar si usted tiene (magic_quotes_gpc = off) en el php.ini";
- }
- fputs( $fp,date( "d/m/Y H:m:s")." magic_quotes: $msg_get_magic_quotes_gpc\n\n" );
-
- $hasErrors = false;
- $aError = array();
- $aDb = array( 'server' => '', 'user' => '', 'password' => '', 'name' => '', 'createdb' => '' ) ;
-
- if(!file_exists(SQL_CREATE)) {
- $hasErrors = true;
- $aError['sql_files'] = 'El archivo para el SQL no puede abrirse';
- fputs( $fp,date( "d/m/Y H:m:s")." SQL_CREATE: ".$aError['sql_files']."\n\n" );
- }
- else
- fputs( $fp,date( "d/m/Y H:m:s")." SQL_CREATE: OK \n\n" );
-
- if(!file_exists(SQL_INSERT_INICIAL)){
- $hasErrors = true;
- $aError['sql_files'] = 'El archivo para el SQL no puede abrirse';
- fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_INICIAL: ".$aError['sql_files']."\n\n" );
- }
- else
- fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_INICIAL: OK \n\n" );
-
- if(!file_exists(SQL_INSERT_EJEMPLO)){
- $hasErrors = true;
- $aError['sql_files'] = 'El archivo para el SQL no puede abrirse';
- fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_EJEMPLO: ".$aError['sql_files']."\n\n" );
- }
- else
- fputs( $fp,date( "d/m/Y H:m:s")." SQL_INSERT_EJEMPLO: OK \n\n" );
-
- fputs( $fp,date( "d/m/Y H:m:s")." ---- FIN DE VERIFICACIONES ----\n\n" );
- fputs( $fp,date( "d/m/Y H:m:s")." ---- INICIO DB ----\n\n" );
- if ($_SERVER['REQUEST_METHOD'] == "POST") {
-
- if(!isset($_POST['db']['createdb']))
- $_POST['db']['createdb'] = false;
-
- $db_connection = @mysql_connect( $_POST['db']['server'], $_POST['db']['user'], $_POST['db']['password']);
- if ($db_connection) {
- $mysql_server_version = mysql_get_server_info();
- fputs( $fp,date( "d/m/Y H:m:s")." mysql_server_version: ".$mysql_server_version ."\n\n" );
- if(compruebaVersion($mysql_server_version, MYSQL_REQUIRED_VERSION)) {
- if($_POST['db']['createdb']) {
- fputs( $fp,date( "d/m/Y H:m:s")." -- Create DB --\n\n" );
- if(!@mysql_query('CREATE DATABASE '.$_POST['db']['name'].' DEFAULT CHARACTER SET utf8 COLLATE utf8_bin')) {
- $hasErrors = true;
- $aError['newdb'] = 'No se pudo crear la base de datos ('.mysql_error().')';
- fputs( $fp,date( "d/m/Y H:m:s")." newdb: ".$aError['newdb']."\n\n" );
- $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb']) ;
- } else {
- fputs( $fp,date( "d/m/Y H:m:s")." Se creo la base de datos OK--\n\n" );
- if(doInstall($fp)) {
- fputs( $fp,date( "d/m/Y H:m:s")." Fin doInstall (create_db): OK \n\n" );
- fclose( $fp );
- header("Location: ".REDIRECT_URL);
- } else {
- fputs( $fp,date( "d/m/Y H:m:s")." Fin doInstall (create_db): con Error \n\n" );
- if (!@mysql_query('DROP DATABASE '.$_POST['db']['name'])){
- $aError['insert_create'] = 'No se pudo eliminar la base de datos creada ('.mysql_error().')';
- fputs( $fp,date( "d/m/Y H:m:s")." insert_create (create_db): ".$aError['insert_create']."\n\n" );
- }
- else {
- $aError['insert_create'] = 'Se elimino la base de datos creada ('.mysql_error().')';
- fputs( $fp,date( "d/m/Y H:m:s")." insert_create (create_db): ".$aError['insert_create']."\n\n" );
- }
- $hasErrors = true;
- }
- }
- } else {
- fputs( $fp,date( "d/m/Y H:m:s")." -- Select DB --\n\n" );
- if(@mysql_select_db($_POST['db']['name'])) {
- if(doInstall($fp)) {
- fputs( $fp,date( "d/m/Y H:m:s")." Fin doInstall (select_db): OK \n\n" );
- fclose( $fp );
- header("Location: ".REDIRECT_URL);
- } else {
- $aError['insert_create'] = 'No se pudo agregar los datos a la base de datos existente ('.mysql_error().')';
- fputs( $fp,date( "d/m/Y H:m:s")." insert_create (select_db): ".$aError['insert_create']."\n\n" );
- $hasErrors = true;
- }
- } else {
- $hasErrors = true;
- $aError['currentdb'] = 'No se pudo usar la base de datos ('.mysql_error().')';
- fputs( $fp,date( "d/m/Y H:m:s")." currentdb (select_db): ".$aError['currentdb']."\n\n" );
- $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb']) ;
- }
- }
- } else {
- $hasErrors = true;
- $aError['mysql_version'] = 'Usted tiene una versión de MYSQL inferior a la'.MYSQL_REQUIRED_VERSION. '(Su versión actual es '.$mysql_server_version. ')';
- fputs( $fp,date( "d/m/Y H:m:s")." mysql_server_version: ".$aError['mysql_version']."\n\n" );
- $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb'] );
- }
-
- mysql_close($db_connection);
- } else {
- $hasErrors = true;
- $aError['connect'] = 'No pudo conectarse al Servidor de Base de datos ('.mysql_error().')';
- fputs( $fp,date( "d/m/Y H:m:s")." connect: ".$aError['connect']."\n\n" );
- $aDb = array( 'server' => $_POST['db']['server'] , 'user' => $_POST['db']['user'], 'password' => $_POST['db']['password'], 'name' => $_POST['db']['name'], 'createdb' => $_POST['db']['createdb'] );
- }
-
- }
- fclose( $fp );
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-200000126/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <meta name="title" content="Proyecto ALBA" />
- <meta name="robots" content="index, follow" />
- <meta name="description" content="Proyecto de Gestión Educativa ALBA" />
- <meta name="keywords" content="alba, proyecto, software libre, educacion" />
- <meta name="language" content="es" />
- <title>Proyecto ALBA</title>
- <link rel="stylesheet" type="text/css" href="installer/css/main.css"/>
-</head>
-
-<body>
-<div id ="sf_admin_container">
-<h2>Verificaciones necesarias para la instalación</h2>
-<br>
-<h2>Programas</h2>
-
-<table border="0" cellpadding="3" width="600" class="sf_admin_list">
- <thead>
- <tr>
- <th id="sf_admin_list_th_verfica">Verificación</th>
- <th id="sf_admin_list_th_resultado">Resultado</th>
- </tr>
- </thead>
- <tr class="sf_admin_row_0" >
- <td>Versión de PHP >= 5.0.0</td>
- <td>
- <?=($bool_phpversion)?IMG_OK:IMG_NOT_OK?>(<?=$msg_phpversion?>)
- </td>
- </tr>
-
- <tr class="sf_admin_row_1" >
- <td>¿ Esta instalado MYSQL en PHP ?</td>
- <td>
- <?=($bool_mysql_module)?IMG_OK:IMG_NOT_OK?>(<?=$msg_mysql_module?>)
- </td>
- </tr>
-
-
- <tr class="sf_admin_row_0">
- <td>¿ Esta Instalado GD en PHP ? (optativo) </td>
- <td><?=($bool_gd)?IMG_OK:IMG_NOT_OK." (Si queres ver los gráficos de estadísticas necesitas instalar GD - http://www.php.net/manual/es/ref.image.php)";?></td>
- </tr>
-
- <tr class="sf_admin_row_1">
- <td>En php.ini memory_limit >= 32</td>
- <td><?=($bool_memory_limit AND $bool_memory_no_chequeo)?IMG_OK:IMG_NOT_OK;?>(<?=$memory_limit?>)</td>
- </tr>
-
- <tr class="sf_admin_row_1">
- <td>En php.ini magic_quotes_gpc = off</td>
- <td><?=($bool_get_magic_quotes_gpc)?IMG_OK:IMG_NOT_OK;?><?=$msg_get_magic_quotes_gpc?></td>
- </tr>
-
-
-
- <tr class="sf_admin_row_0">
- <td>Versióon de APACHE >= 2.0</td>
- <td><?=($bool_apache_get_version)?IMG_OK:IMG_NOT_OK?>(<?=$msg_apache_get_version?>)</td>
- </tr>
-
- <tr class="sf_admin_row_1">
- <td>¿ Esta instalado MOD_REWRITE en APACHE ?</td>
- <td><?=($bool_mod_rewrite)?IMG_OK:IMG_NOT_OK.$msg_mod_rewrite?></td>
- </tr>
-
-</table>
-<br>
-<h2>Directorios con permisos para escritura:</h2>
-<table border="0" cellpadding="3" width="600" class="sf_admin_list">
- <thead>
- <tr>
- <th id="sf_admin_list_th_dir">Directorios</th>
- <th id="sf_admin_list_th_resultado">Resultados</th>
- </tr>
- </thead>
- <tr class="sf_admin_row_0" >
- <td>/cache</td>
- <td><?=($bool_cache)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/cache)";?></td>
- </tr>
- <tr class="sf_admin_row_1">
- <td>/log</td>
- <td><?=($bool_log)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/logs)";?></td>
- </tr>
- <tr class="sf_admin_row_0">
- <td>/uploads</td>
- <td><?=($bool_upload)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/web/uploads)";?></td>
- </tr>
- <tr class="sf_admin_row_1">
- <td>/config</td>
- <td><?=($bool_config)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/config)";?></td>
-<?php // Aqui no deberiamos probar si tienen permisos los archivos databases.yml, propel.ini y web/.htaccess ?>
- </tr>
- <tr class="sf_admin_row_0">
- <td>/tmp</td>
- <td><?=($bool_tmp)?IMG_OK:IMG_NOT_OK." (chmod 777 ./alba/web/tmp)";?></td>
- </tr>
-
-</table>
-
-<?php if($bool_config AND $bool_upload AND $bool_tmp AND $bool_log AND $bool_cache AND $bool_memory_limit AND $bool_apache_get_version AND $bool_phpversion AND $bool_mysql_module AND $bool_mod_rewrite AND $bool_get_magic_quotes_gpc) { ?>
-
-<?php if($hasErrors) { ?>
- <br><br>
- <div class="form-errors">
- <h2>Arreglar errores para continuar</h2>
- <ul>
- <?php foreach ($aError as $idx => $name) { ?>
- <li><?php echo $name; ?></li>
- <?php } ?>
- </ul>
- </div>
-<?php } ?>
-
-
-
-<br>
-<h2>Datos para la instalación</h2>
-<form action="<?=$_SERVER['PHP_SELF']?>" method="POST" >
- <fieldset id="sf_fieldset_base_de_datos" class="">
- <h2>Conección a la base de datos</h2>
- <div class="form-row">
- <label for="db_server" class="required">Servidor:</label><div class="content"><input type="text" name="db[server]" value="<?=$aDb['server']?>" size="64" /></div>
- </div>
- <div class="form-row">
- <label for="db_user" class="required">Usuario:</label><div class="content"><input type="text" name="db[user]" value="<?=$aDb['user']?>" size="64" /></div>
- </div>
- <div class="form-row">
- <label for="db_password" class="required">Contraseña:</label><div class="content"><input type="password" name="db[password]" value="<?=$aDb['password']?>" size="64" /></div>
- </div>
- <div class="form-row">
- <label for="db_name" class="required">Nombre de base de datos:</label><div class="content"><input type="text" name="db[name]" value="<?=$aDb['name']?>" size="64" />
- Crear Base de datos <input type="checkbox" name="db[createdb]" value="crear" <?=($aDb['createdb'])?'checked':''?>>
- </div>
-
- <div class="form-row">
- <label for="db_name" class="required">¿Que datos quiere por defecto?:</label>
- <div class="content">
- Datos mínimos<input type="radio" name="db[datos]" value="minimos" checked >
- Caso de Ejemplo<input type="radio" name="db[datos]" value="ejemplo">
- </div>
- </div>
- </fieldset>
-
- <ul class="sf_admin_actions">
- <li><input type="submit" name="instalar" value="Instalar" class="sf_admin_action_instalar" /></li>
- <li><input type="reset" name="borrar" value="Borrar" class="sf_admin_action_borrar" /></li>
- </ul>
-</form>
-<? } else { ?>
-<br>
-<div align="center"><h2 style="color: #FF0000;">Para poder seguir con la instalción debe pasar completa la verificación.</h2></div>
-<? } ?>
-</div>
-</body>
-</html>
-
-
-<?
-// si existe el archivo de flag para la instacion
-} else { ?>
-<html>
-<body>
-Usted ya ha instalado el Proyetco ALBA. Si quiere volver a instalarlo debe borra el archivo alba/log/instalacion_completa.
-</body>
-</html>
-<? } ?>
-
-
-<?php
-
-/**
-* Funciones del instalador
-*/
-
-function compruebaVersion($instalada, $requireda) {
- return (version_compare($instalada, $requireda, ">="));
-}
-
-
-function compruebaMemoriaMaxima($php_memory) {
- $memory_limit = eregi_replace('[gmk]','',$php_memory);
- return ($memory_limit >= MEMORY_LIMIT_REQUIRED);
-
-}
-
-function estaExtensionPHP($ext) {
- $aExtension = get_loaded_extensions();
- if(count($aExtension)>0) {
- $res = array_search($ext, $aExtension);
- if($res === false) {
- return false;
- } else {
- return true;
- }
- } else {
- return false;
- }
-}
-
-
-function estaExtensionApache($ext) {
- $aApacheModulos = apache_get_modules();
- if(count($aApacheModulos)>0) {
- $res = array_search($ext, $aApacheModulos);
- if($res === false) {
- return false;
- } else {
- return true;
- }
- } else {
- return false;
- }
-}
-
-
-function tienePermisoEscritura($dir) {
- $octalPermiso = substr(sprintf('%o', @fileperms($dir)), -4);
- return ($octalPermiso == "0777" OR $octalPermiso == "1777");
-}
-
-
-function reemplzarArchivo($archivo, $aReemplazo) {
- $contenido = "";
- if(file_exists($archivo)) {
- $contenido = file_get_contents ($archivo);
- foreach($aReemplazo as $indice => $reemplazo) {
- $contenido = str_replace($indice, $reemplazo, $contenido);
- }
- }
- return $contenido;
-}
-
-
-
-// ojo que esto no funciona para cualquier cosa si dentro de un string de un insert hay un dato con ;\n se separa por eso tambien
-function dump2Array($file) {
- $aSql = array();
- $res_sql = "";
- if(file_exists($file)) {
- $sql = file($file);
- foreach($sql as $sql_line) {
- $sql_line = trim($sql_line);
- if (($sql_line != "") && (substr($sql_line, 0, 2) != "--") && (substr($sql_line, 0, 1) != "#") ) {
- $res_sql .= $sql_line."\n";
- }
- }
- $aSql= array_slice(explode(";\n", $res_sql),0,-1);
- }
- return $aSql;
-}
-
-function executeDump($file, $db,$fp) {
- fputs( $fp,date( "d/m/Y H:m:s")." Entrando ExecuteDump: $file - $db \n\n" );
- $aSql = dump2Array($file);
- $error = false;
- if(count($aSql) > 0 AND file_exists($file)) {
- if(mysql_select_db($db)) {
- fputs( $fp,date( "d/m/Y H:m:s")." ejecutando BEGIN \n\n" );
- mysql_query("BEGIN");
- foreach($aSql as $sql_line) {
- $res = mysql_query(trim($sql_line));
- if(!$res) {
- fputs( $fp,date( "d/m/Y H:m:s")." Fallo SQL: $sql_line \n\n" );
- fputs( $fp,date( "d/m/Y H:m:s")." error:". mysql_error()." \n\n" );
- $error = true;
- }
- }
- if($error == true) {
- fputs( $fp,date( "d/m/Y H:m:s")." Se encontraron errores ejecutando ROLLBACK y saliendo \n\n" );
- mysql_query("ROLLBACK");
- return false;
- } else {
- fputs( $fp,date( "d/m/Y H:m:s")." Sin errores ejecutando COMMIT y saliendo \n\n" );
- mysql_query("COMMIT");
- return true;
- }
- }
- else {
- fputs( $fp,date( "d/m/Y H:m:s")." Error al seleccionar la base: $db \n\n" );
- return false;
- }
- } else {
- fputs( $fp,date( "d/m/Y H:m:s")." Devuele false no ejecuta nada : $db \n\n" );
- return false;
- }
-
-}
-
-function doInstall($fp) {
- global $_POST;
- fputs( $fp,date( "d/m/Y H:m:s")." Entrando doInstall() \n\n" );
- //verifica que base de datos instalar si la del ejemplo o solamente la
- //de los datos_desde_cero iniciales
- switch($_POST['db']['datos']) {
- case "ejemplo": $sql_insert = SQL_INSERT_INICIAL; break;
- case "minimos": $sql_insert = SQL_INSERT_EJEMPLO; break;
- default: $sql_insert = SQL_INSERT_EJEMPLO;
- }
- fputs( $fp,date( "d/m/Y H:m:s")." Utilizando SQL: $sql_insert \n\n" );
- if(executeDump(SQL_CREATE, $_POST['db']['name'],$fp)) {
- if(executeDump($sql_insert, $_POST['db']['name'],$fp)) {
- $aReemplazo = array( 'USERDB' => $_POST['db']['user'], 'PASSDB' => $_POST['db']['password'], 'SERVER' => $_POST['db']['server'], 'DBNAME'=> $_POST['db']['name']);
- $contenido_archivo = reemplzarArchivo(DATABASE_CONFIG_DIST,$aReemplazo);
- file_put_contents(DATABASE_CONFIG, $contenido_archivo);
-
- $aReemplazo = array( 'USERDB' => $_POST['db']['user'], 'PASSDB' => $_POST['db']['password'], 'SERVER' => $_POST['db']['server'], 'DBNAME'=> $_POST['db']['name']);
- $contenido_archivo = reemplzarArchivo(PROPEL_CONFIG_DIST,$aReemplazo);
- file_put_contents(PROPEL_CONFIG, $contenido_archivo);
-
-
- _symlink(INSTALL_DIR."dist/".SYMFONY_DIR."/data/", ALBA_PATH."data/symfony");
- _symlink(INSTALL_DIR."dist/pake/", ALBA_PATH."lib/pake");
- _symlink(INSTALL_DIR."dist/phing.sandbox/", ALBA_PATH."lib/phing");
- _symlink(INSTALL_DIR."dist/".SYMFONY_DIR."/lib/", ALBA_PATH."lib/symfony");
- _symlink(INSTALL_DIR."alba/data/symfony/web/sf/", ALBA_WEB."sf");
- fputs( $fp,date( "d/m/Y H:m:s")." Creando Links \n\n" );
-
- $rewrite_path = (OS_WINDOWS)?CURRENT_WEB_DIR.SYMFONY_WINDOWS_WEB_DIR:CURRENT_WEB_DIR.SYMFONY_WEB_DIR;
-
- if(!OS_WINDOWS)
- _symlink(ALBA_WEB, INSTALL_DIR.SYMFONY_WEB_DIR); // crea nuevo link afuera de la estructura de alba
-
- $aReemplazo = Array('REWRITE_PATH' => $rewrite_path);
- $contenido_archivo = reemplzarArchivo(HTACCESS_DIST,$aReemplazo);
- file_put_contents(HTACCESS, $contenido_archivo);
- touch(INSTALL_COMPLETE_FILE);
- fputs( $fp,date( "d/m/Y H:m:s")." Creando bandera INSTALL_COMPLETE_FILE \n\n" );
- return true;
- }
- fputs( $fp,date( "d/m/Y H:m:s")." Fallo ejecutando: $sql_insert \n\n" );
- return false;
- } else {
- fputs( $fp,date( "d/m/Y H:m:s")." Fallo ejecutando: SQL_CREATE \n\n" );
- return false;
- }
-
-}
-
-
-function doUninstall() {
-
-}
-
-function _symlink( $target, $link ) {
- if (OS_WINDOWS) {
- @dircopy($target, $link);
- } else {
- @symlink($target,$link);
- }
-}
-
-
-function dircopy($srcdir, $dstdir, $verbose = false) {
- $num = 0;
- if(!is_dir($dstdir)) mkdir($dstdir);
- if($curdir = opendir($srcdir)) {
- while($file = readdir($curdir)) {
- if($file != '.' && $file != '..') {
- $srcfile = $srcdir . DIRECTORY_SEPARATOR . $file;
- $dstfile = $dstdir . DIRECTORY_SEPARATOR . $file;
- if(is_file($srcfile)) {
- if(is_file($dstfile)) $ow = filemtime($srcfile) - filemtime($dstfile); else $ow = 1;
- if($ow > 0) {
- if($verbose) echo "Copying '$srcfile' to '$dstfile'...";
- if(copy($srcfile, $dstfile)) {
- touch($dstfile, filemtime($srcfile)); $num++;
- if($verbose) echo "OK\n";
- }
- else echo "Error: File '$srcfile' could not be copied!\n";
- }
- }
- else if(is_dir($srcfile)) {
- $num += dircopy($srcfile, $dstfile, $verbose);
- }
- }
- }
- closedir($curdir);
- }
- return $num;
-}
-?>
\ No newline at end of file
1
0