Permalink
Browse files

Fixed : Database setup bug. Lowki pull request

  • Loading branch information...
wakdev committed May 11, 2013
1 parent dc6610e commit 317b7ea84f9717b7d6845998537d56c1301466e7
Showing with 49 additions and 46 deletions.
  1. +1 −0 .gitignore
  2. +5 −2 setup/SlSetup.php
  3. +5 −5 setup/sql/demodatas.sql
  4. +38 −39 setup/sql/slashcms.sql
@@ -4,3 +4,4 @@
.buildpath
sl_config.php
.dev
sftp-config.json
@@ -191,7 +191,9 @@ private function install(){
$db = $this->getConnector();
if(!$db->connect($_SESSION['bdd_host'],$_SESSION['bdd_name'],$_SESSION['bdd_user'],$_SESSION['bdd_pwd'],$_SESSION['bdd_prefix'])) $fatals[] = "Erreur de connexion à la base de donn&eacute;es<br>". $db->getError();
// $db->autocommit(FALSE);
$error_reporting = error_reporting();
// temporary disable error reporting
error_reporting(0);
// Create tables
foreach ($queries as $query) {
if(!$db->setQuery($query)->execute()) $fatals[] = "Erreur lors de l'ex&eacute;cution de la requ&ecirc;te<br>". $db->getError();
@@ -214,6 +216,7 @@ private function install(){
}
}
error_reporting($error_reporting);
// if(empty($fatals)) if(!$db->commit()) $fatals[] = "Erreur lors de la cr&eacute;ation des tables<br>".$db_error;
// else $db->rollback();
@@ -278,7 +281,7 @@ private function SplitSQL($file,$table_prefix = "sl_", $delimiter = ';'){
while (feof($file) === false){
$query[] = fgets($file);
if (preg_match('~' . preg_quote($delimiter, '~') . '\s*$~iS', end($query)) === 1){
$query = preg_replace("/(DROP TABLE IF EXISTS|CREATE TABLE IF NOT EXISTS|INSERT INTO) `(.*)`/", "$1 `".$table_prefix."$2`", $query);
$query = str_replace("bdd_prefix_", $table_prefix, $query);
$query = trim(implode('', $query));
$ret[] = $query;
}
@@ -2,7 +2,7 @@
-- Contenu de la table `categories`
--

INSERT INTO `categories` (`id`, `id_user`, `title`, `description`) VALUES
INSERT INTO `bdd_prefix_categories` (`id`, `id_user`, `title`, `description`) VALUES
(1, 1, 'Wiki', '<p>\r\n Articles du wiki</p>\r\n'),
(2, 1, 'Projet', '<p>\r\n Articles du projet</p>\r\n');

@@ -11,7 +11,7 @@ INSERT INTO `categories` (`id`, `id_user`, `title`, `description`) VALUES
-- Contenu de la table `joins`
--

INSERT INTO `joins` (`id_mod1`, `id_mod2`, `id_mod3`, `id1`, `id2`, `id3`, `item_data`, `item_order`, `item_enabled`) VALUES
INSERT INTO `bdd_prefix_joins` (`id_mod1`, `id_mod2`, `id_mod3`, `id1`, `id2`, `id3`, `item_data`, `item_order`, `item_enabled`) VALUES
(13, 7, 0, 3, 2, 0, '', 0, 0),
(13, 7, 0, 3, 1, 0, '', 0, 0),
(13, 7, 0, 4, 2, 0, '', 0, 0);
@@ -20,7 +20,7 @@ INSERT INTO `joins` (`id_mod1`, `id_mod2`, `id_mod3`, `id1`, `id2`, `id3`, `item
-- Contenu de la table `menu`
--

INSERT INTO `menu` (`id`, `menu_id`, `pri_type`, `sec_type`, `parent`, `position`, `title`, `action`, `home`, `enabled`) VALUES
INSERT INTO `bdd_prefix_menu` (`id`, `menu_id`, `pri_type`, `sec_type`, `parent`, `position`, `title`, `action`, `home`, `enabled`) VALUES
(1, 0, 1, 'horizontal', 0, 0, 'Principal', '#', 0, 1),
(2, 1, 2, 'url_self', 0, 0, 'Presentation', 'index.php?mod=sl_pages&id=1', 1, 1),
(3, 1, 2, 'url_self', 0, 1, 'Actualites', 'index.php?mod=sl_pages&id=2', 0, 1),
@@ -32,15 +32,15 @@ INSERT INTO `menu` (`id`, `menu_id`, `pri_type`, `sec_type`, `parent`, `position
-- Contenu de la table `news`
--

INSERT INTO `news` (`id`, `id_user`, `datein`, `dateout`, `title`, `content`, `date`, `enabled`) VALUES
INSERT INTO `bdd_prefix_news` (`id`, `id_user`, `datein`, `dateout`, `title`, `content`, `date`, `enabled`) VALUES
(1, 1, '2013-01-30 13:37:00', '0000-00-00 00:00:00', 'Mise en ligne du cms', '<p>\r\n J&#39;ai le plaisir de vous annoncer la mise en ligne</p>\r\n', '2013-01-29 13:18:21', 1),
(2, 1, '2013-02-01 10:10:00', '2013-02-22 20:00:00', 'Aenean nisl odio', '<p>\r\n ornare eu suscipit sed, congue vestibulum tortor. Aliquam sit amet velit odio. In porttitor bibendum nibh, eu convallis leo tincidunt nec. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In vel leo dui, nec egestas lacus. Donec mi magna, fringilla vel ornare commodo, ultricies vel leo. Praesent tincidunt, orci non ornare ullamcorper, massa tortor tempor sem, sit amet bibendum libero erat eu eros.</p>\r\n', '2013-02-01 12:36:19', 1);

--
-- Contenu de la table `pages`
--

INSERT INTO `pages` (`id`, `id_user`, `title`, `content`, `date`, `responsive_images`,`enabled`) VALUES
INSERT INTO `bdd_prefix_pages` (`id`, `id_user`, `title`, `content`, `date`, `responsive_images`,`enabled`) VALUES
(1, 1, 'Presentation', '<p>\r\n Slash CMS, est une application web open source qui va vous permettre de cr&eacute;er<br />\r\n et g&eacute;rer votre site internet tr&egrave;s simplement.<br />\r\n <br />\r\n Avec ce syst&egrave;me de gestion de contenu sur internet, vous allez pouvoir mettre a disposition des visiteurs toutes les informations dont vous avez besoin de communiquer.<br />\r\n <br />\r\n Allant de la simple page &agrave; la galerie photo, en passant par des news flash et bien d&#39;autres modules,<br />\r\n vous pourrez afficher toutes vos donn&eacute;es sur votre site, sans avoir la moindre connaissance technique.</p>\r\n', '2013-01-29 13:08:34', 1, 1),
(2, 1, 'Actualites', '<p>\r\n A venir</p>\r\n', '2013-01-29 13:08:52', 1, 1),
(3, 1, 'Telechargement', '<p>\r\n A venir.</p>\r\n', '2013-01-29 13:09:06', 1, 1),
@@ -25,8 +25,8 @@ SET time_zone = "+00:00";
--
-- Structure de la table `admmenu`
--
DROP TABLE IF EXISTS `admmenu`;
CREATE TABLE IF NOT EXISTS `admmenu` (
DROP TABLE IF EXISTS `bdd_prefix_admmenu`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_admmenu` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(50) NOT NULL,
`parent` int(11) unsigned NOT NULL,
@@ -44,8 +44,7 @@ CREATE TABLE IF NOT EXISTS `admmenu` (
--
-- Contenu de la table `admmenu`
--
DROP TABLE IF EXISTS `articles`;
INSERT INTO `admmenu` (`id`, `type`, `parent`, `position`, `title_fr`, `title_en`, `icon`, `action`, `enabled`) VALUES
INSERT INTO `bdd_prefix_admmenu` (`id`, `type`, `parent`, `position`, `title_fr`, `title_en`, `icon`, `action`, `enabled`) VALUES
(1, 'none', 0, 1, 'Site', 'Website', 'site.png', '#', 1),
(2, 'none', 0, 3, 'Configuration', 'Config', 'config.png', '#', 1),
(3, 'url_self', 1, 3, 'Gestion des articles', 'Articles', 'articles.png', 'index.php?mod=sla_articles', 1),
@@ -71,8 +70,8 @@ INSERT INTO `admmenu` (`id`, `type`, `parent`, `position`, `title_fr`, `title_en
--
-- Structure de la table `articles`
--
DROP TABLE IF EXISTS `articles`;
CREATE TABLE IF NOT EXISTS `articles` (
DROP TABLE IF EXISTS `bdd_prefix_articles`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_articles` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_user` int(11) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
@@ -94,8 +93,8 @@ CREATE TABLE IF NOT EXISTS `articles` (
--
-- Structure de la table `attachments`
--
DROP TABLE IF EXISTS `attachments`;
CREATE TABLE IF NOT EXISTS `attachments` (
DROP TABLE IF EXISTS `bdd_prefix_attachments`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_attachments` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_user` int(11) unsigned NOT NULL,
`id_module` int(11) unsigned NOT NULL,
@@ -117,8 +116,8 @@ CREATE TABLE IF NOT EXISTS `attachments` (
--
-- Structure de la table `categories`
--
DROP TABLE IF EXISTS `categories`;
CREATE TABLE IF NOT EXISTS `categories` (
DROP TABLE IF EXISTS `bdd_prefix_categories`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_categories` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_user` int(11) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
@@ -130,8 +129,8 @@ CREATE TABLE IF NOT EXISTS `categories` (
--
-- Structure de la table `config`
--
DROP TABLE IF EXISTS `config`;
CREATE TABLE IF NOT EXISTS `config` (
DROP TABLE IF EXISTS `bdd_prefix_config`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_config` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`config_name` varchar(50) NOT NULL,
`config_value` varchar(50) NOT NULL,
@@ -142,7 +141,7 @@ CREATE TABLE IF NOT EXISTS `config` (
-- Contenu de la table `config`
--

INSERT INTO `config` (`id`, `config_name`, `config_value`) VALUES
INSERT INTO `bdd_prefix_config` (`id`, `config_name`, `config_value`) VALUES
(1, 'site_name', 'slash cms'),
(2, 'global_description', 'slash : le cms intuitif'),
(3, 'global_keywords', 'cms, slash, slash-cms, siteweb'),
@@ -159,8 +158,8 @@ INSERT INTO `config` (`id`, `config_name`, `config_value`) VALUES
--
-- Structure de la table `country`
--
DROP TABLE IF EXISTS `country`;
CREATE TABLE IF NOT EXISTS `country` (
DROP TABLE IF EXISTS `bdd_prefix_country`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_country` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(40) NOT NULL,
`shortname` varchar(8) NOT NULL,
@@ -172,16 +171,16 @@ CREATE TABLE IF NOT EXISTS `country` (
-- Contenu de la table `country`
--

INSERT INTO `country` (`id`, `name`, `shortname`, `enabled`) VALUES
INSERT INTO `bdd_prefix_country` (`id`, `name`, `shortname`, `enabled`) VALUES
(1, 'France', 'Fr', 1);

-- --------------------------------------------------------

--
-- Structure de la table `joins`
--
DROP TABLE IF EXISTS `joins`;
CREATE TABLE IF NOT EXISTS `joins` (
DROP TABLE IF EXISTS `bdd_prefix_joins`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_joins` (
`id_mod1` int(10) unsigned NOT NULL,
`id_mod2` int(10) unsigned NOT NULL,
`id_mod3` int(10) unsigned NOT NULL,
@@ -207,8 +206,8 @@ CREATE TABLE IF NOT EXISTS `joins` (
--
-- Structure de la table `lang`
--
DROP TABLE IF EXISTS `lang`;
CREATE TABLE IF NOT EXISTS `lang` (
DROP TABLE IF EXISTS `bdd_prefix_lang`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_lang` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(40) NOT NULL,
`shortname` varchar(8) NOT NULL,
@@ -220,7 +219,7 @@ CREATE TABLE IF NOT EXISTS `lang` (
-- Contenu de la table `lang`
--

INSERT INTO `lang` (`id`, `name`, `shortname`, `enabled`) VALUES
INSERT INTO `bdd_prefix_lang` (`id`, `name`, `shortname`, `enabled`) VALUES
(2, 'Anglais', 'en', 0),
(1, 'Fran&ccedil;ais', 'fr', 1),
(4, 'Italien', 'it', 0),
@@ -238,8 +237,8 @@ INSERT INTO `lang` (`id`, `name`, `shortname`, `enabled`) VALUES
-- Structure de la table `logs`
--

DROP TABLE IF EXISTS `logs`;
CREATE TABLE IF NOT EXISTS `logs` (
DROP TABLE IF EXISTS `bdd_prefix_logs`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_logs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`log_type` varchar(45) NOT NULL,
`log_url` varchar(255) NOT NULL,
@@ -255,8 +254,8 @@ CREATE TABLE IF NOT EXISTS `logs` (
--
-- Structure de la table `menu`
--
DROP TABLE IF EXISTS `menu`;
CREATE TABLE IF NOT EXISTS `menu` (
DROP TABLE IF EXISTS `bdd_prefix_menu`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_menu` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`menu_id` int(11) unsigned NOT NULL,
`pri_type` tinyint(4) unsigned NOT NULL,
@@ -282,8 +281,8 @@ CREATE TABLE IF NOT EXISTS `menu` (
--
-- Structure de la table `modules`
--
DROP TABLE IF EXISTS `modules`;
CREATE TABLE IF NOT EXISTS `modules` (
DROP TABLE IF EXISTS `bdd_prefix_modules`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_modules` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(20) NOT NULL,
`name` varchar(20) NOT NULL,
@@ -298,25 +297,25 @@ CREATE TABLE IF NOT EXISTS `modules` (
-- Contenu de la table `modules`
--

INSERT INTO `modules` (`id`, `type`, `name`, `url`, `params`, `initialize_order`, `enabled`) VALUES
(1, 'site', 'header', 'modules/header/', '', 1, 1),
(2, 'site', 'menu', 'modules/menu/', '', 2, 1),
INSERT INTO `bdd_prefix_modules` (`id`, `type`, `name`, `url`, `params`, `initialize_order`, `enabled`) VALUES
(1, 'site', 'sl_header', 'modules/sl_header/', '', 1, 1),
(2, 'site', 'sl_menu', 'modules/sl_menu/', '', 2, 1),
(3, 'admin', 'sla_secure', 'modules/sla_secure/', '', 1, 1),
(4, 'admin', 'sla_admmenu', 'modules/sla_admmenu/', '', 3, 1),
(5, 'admin', 'sla_header', 'modules/sla_header/', '', 2, 1),
(6, 'admin', 'sla_panel', 'modules/sla_panel/', '', 4, 1),
(7, 'admin', 'sla_categories', 'modules/sla_categories/', '', 0, 1),
(10, 'site', 'error', 'modules/error/', '', 3, 1),
(10, 'site', 'sl_error', 'modules/sl_error/', '', 3, 1),
(12, 'admin', 'sla_menu', 'modules/sla_menu/', '', 0, 1),
(13, 'admin', 'sla_articles', 'modules/sla_articles/', 'param1=test&param2=test2', 0, 1),
(14, 'admin', 'sla_users', 'modules/sla_users/', '', 0, 1),
(22, 'admin', 'sla_modules', 'modules/sla_modules/', '', 0, 1),
(27, 'admin', 'sla_news', 'modules/sla_news/', '', 0, 1),
(41, 'site', 'pages', 'modules/pages/', '', 0, 1),
(41, 'site', 'sl_pages', 'modules/sl_pages/', '', 0, 1),
(42, 'admin', 'sla_pages', 'modules/sla_pages/', '', 0, 1),
(44, 'admin', 'sla_country', 'modules/sla_country/', '', 0, 1),
(46, 'admin', 'sla_lang', 'modules/sla_lang/', '', 0, 1),
(56, 'site', 'articles', 'modules/articles/', '', 0, 1),
(56, 'site', 'sl_articles', 'modules/sl_articles/', '', 0, 1),
(59, 'admin', 'sla_config', 'modules/sla_config/', '', 0, 1),
(60, 'admin', 'sla_medias', 'modules/sla_medias/', '', 0, 1),
(61, 'admin', 'sla_logs', 'modules/sla_logs/', '', 0, 1);
@@ -326,8 +325,8 @@ INSERT INTO `modules` (`id`, `type`, `name`, `url`, `params`, `initialize_order`
--
-- Structure de la table `news`
--
DROP TABLE IF EXISTS `news`;
CREATE TABLE IF NOT EXISTS `news` (
DROP TABLE IF EXISTS `bdd_prefix_news`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_news` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_user` int(11) unsigned NOT NULL,
`datein` datetime NOT NULL,
@@ -345,8 +344,8 @@ CREATE TABLE IF NOT EXISTS `news` (
--
-- Structure de la table `pages`
--
DROP TABLE IF EXISTS `pages`;
CREATE TABLE IF NOT EXISTS `pages` (
DROP TABLE IF EXISTS `bdd_prefix_pages`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_pages` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_user` int(11) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
@@ -365,8 +364,8 @@ CREATE TABLE IF NOT EXISTS `pages` (
--
-- Structure de la table `users`
--
DROP TABLE IF EXISTS `users`;
CREATE TABLE IF NOT EXISTS `users` (
DROP TABLE IF EXISTS `bdd_prefix_users`;
CREATE TABLE IF NOT EXISTS `bdd_prefix_users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`login` varchar(50) NOT NULL,

0 comments on commit 317b7ea

Please sign in to comment.