public function procede() { try { $oMysqli = Database::getInstance(); //Création de la table tks_ranks $this->sBuffer .= 'Création de la table <b>tks_ranks</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_ranks` (\r\n `id` int(11) NOT NULL AUTO_INCREMENT,\r\n `name` varchar(15) NOT NULL,\r\n `default` tinyint(1) NOT NULL,\r\n PRIMARY KEY (`id`)\r\n ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $oResult = $oMysqli->query("INSERT INTO `tks_ranks` (`id`, `name`, `default`) VALUES\r\n (1, 'Administrateur', 0),\r\n (2, 'VIP', 0),\r\n (3, 'Membre', 1);"); $this->sBuffer .= "DONE !<br/>"; //Création de la table tks_modules $this->sBuffer .= 'Création de la table <b>tks_modules</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_modules` (\r\n `id` int(11) NOT NULL AUTO_INCREMENT,\r\n `name` varchar(32) NOT NULL,\r\n PRIMARY KEY (`id`)\r\n ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4024); } $oResult = $oMysqli->query("INSERT INTO `tks_modules` (`id`, `name`) VALUES\r\n (1, 'search'),\r\n (2, 'stats'),\r\n (3, 'profil'),\r\n (4, 'autogetit'),\r\n (5, 'rss'),\r\n (6, 'adminusers'),\r\n (7, 'adminranks'),\r\n (8, 'adminpermissions'),\r\n (9, 'admincategories'),\r\n (10, 'admintrackers'),\r\n (11, 'adminrss'),\r\n (12, 'adminparser'),\r\n (13, 'adminapi'),\r\n (14, 'purgebdd'),\r\n (15, 'invites');"); $this->sBuffer .= "DONE !<br/>"; //Création de la table tks_permissions $this->sBuffer .= 'Création de la table <b>tks_permissions</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_permissions` (\r\n `id_rank` int(11) NOT NULL,\r\n `id_module` int(11) NOT NULL,\r\n UNIQUE KEY `unique` (`id_rank`,`id_module`)\r\n ) DEFAULT CHARSET=utf8;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4034); } $oResult = $oMysqli->query("INSERT INTO `tks_permissions` (`id_rank`, `id_module`) VALUES\r\n (1, 1),\r\n (1, 2),\r\n (1, 3),\r\n (1, 4),\r\n (1, 5),\r\n (1, 6),\r\n (1, 7),\r\n (1, 8),\r\n (1, 9),\r\n (1, 10),\r\n (1, 11),\r\n (1, 12),\r\n (1, 13),\r\n (1, 14),\r\n (1, 15),\r\n (2, 1),\r\n (2, 2),\r\n (2, 3),\r\n (2, 4),\r\n (2, 5),\r\n (2, 15),\r\n (3, 1),\r\n (3, 2),\r\n (3, 3),\r\n (3, 4),\r\n (3, 5);"); $this->sBuffer .= "DONE !<br/>"; //Modification de la table tks_users $this->sBuffer .= 'Modification de la table <b>tks_users</b> ... '; $oResult = $oMysqli->query("ALTER TABLE `tks_users` CHANGE `admin` `id_rank` INT( 11 ) NOT NULL"); if ($oResult == false) { throw new Error('Impossible de modifier la table', 4044); } $oResult = $oMysqli->query("UPDATE `tks_users` SET id_rank=3 WHERE id_rank <> 1"); $this->sBuffer .= "DONE !<br/>"; Config::setVersion('1.2.1'); } catch (Error $ex) { echo "erreur " . $ex->__toString(); $this->oView->addAlert($ex, 'danger'); } finally { $this->oView->addData('titre', 'Mise à jours 1.2.0 vers 1.2.1'); $this->oView->addData('content', $this->sBuffer); $this->oView->create(); } }
public function procede() { try { $oMysqli = Database::getInstance(); //Création de la table tks_ranks $this->sBuffer .= 'Création de la table <b>tks_fiches</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_fiches` (\r\n `id_release` varchar(36) NOT NULL,\r\n `type` varchar(12) NOT NULL,\r\n `id_fiche` varchar(36) NOT NULL,\r\n `verified` tinyint(1) NOT NULL,\r\n UNIQUE KEY `unique` (`id_release`,`id_fiche`)\r\n ) DEFAULT CHARSET=utf8;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $this->sBuffer .= "DONE !<br/>"; //Création de la table tks_fiches_film $this->sBuffer .= 'Création de la table <b>tks_fiches_film</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_fiches_film` (\r\n `id` int(11) NOT NULL,\r\n `title` varchar(50) NOT NULL,\r\n `originaltitle` varchar(50) NOT NULL,\r\n `year` int(4) NOT NULL,\r\n `synopsis` text NOT NULL,\r\n `genres` varchar(150) NOT NULL,\r\n `director` varchar(150) NOT NULL,\r\n `actor` text NOT NULL,\r\n `poster` varchar(150) NOT NULL,\r\n `trailer` varchar(150) NOT NULL,\r\n PRIMARY KEY (`id`)\r\n )DEFAULT CHARSET=utf8;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $this->sBuffer .= "DONE !<br/>"; //Création de la table tks_fiches_music $this->sBuffer .= 'Création de la table <b>tks_fiches_music</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_fiches_music` (\r\n `id` varchar(36) NOT NULL,\r\n `name` varchar(50) NOT NULL,\r\n `artist` varchar(50) NOT NULL,\r\n `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\r\n `tracks` text NOT NULL,\r\n `cover` varchar(150) NOT NULL,\r\n PRIMARY KEY (`id`)\r\n ) DEFAULT CHARSET=utf8;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $this->sBuffer .= "DONE !<br/>"; //Création de la table tks_fiches_serie $this->sBuffer .= 'Création de la table <b>tks_fiches_serie</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_fiches_serie` (\r\n `id` int(11) NOT NULL,\r\n `title` varchar(50) NOT NULL,\r\n `network` varchar(50) NOT NULL,\r\n `synopsis` text NOT NULL,\r\n `genres` varchar(150) NOT NULL,\r\n `status` varchar(50) NOT NULL,\r\n `poster` varchar(150) NOT NULL,\r\n PRIMARY KEY (`id`)\r\n ) DEFAULT CHARSET=utf8;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $this->sBuffer .= "DONE !<br/>"; //Modification de la table tks_releases $this->sBuffer .= 'Modification de la table <b>tks_releases</b> ... '; $oResult = $oMysqli->query("UPDATE `tks_releases` SET id_categorie = 0 WHERE 1"); $this->sBuffer .= "DONE!<br/>"; //Modification de la table tks_categories $this->sBuffer .= 'Modification de la table <b>tks_categories</b> ... '; $oResult = $oMysqli->query("DROP TABLE tks_categories"); $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_categories` (\r\n `id` int(2) NOT NULL AUTO_INCREMENT,\r\n `name` varchar(25) NOT NULL,\r\n PRIMARY KEY (`id`)\r\n ) DEFAULT CHARSET = utf8 AUTO_INCREMENT = 10;\r\n "); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $oResult = $oMysqli->query("INSERT INTO `tks_categories` (`id`, `name`) VALUES\r\n (1, 'Films'),\r\n (2, 'Séries'),\r\n (3, 'Musique'),\r\n (4, 'Jeux'),\r\n (5, 'Applications'),\r\n (6, 'Books'),\r\n (7, 'XXX'),\r\n (8, 'Sport'),\r\n (9, 'Inconnu');\r\n "); $this->sBuffer .= "DONE!<br/>"; //Modification de la table tks_regex $this->sBuffer .= 'Modification de la table <b>tks_regex</b> ... '; $oResult = $oMysqli->query("DROP TABLE tks_regex"); $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_regex` (\r\n `id` int(3) NOT NULL AUTO_INCREMENT,\r\n `name` varchar(30) NOT NULL,\r\n `regex` varchar(100) NOT NULL,\r\n `id_categorie` int(11) NOT NULL DEFAULT '0',\r\n PRIMARY KEY (`id`)\r\n ) DEFAULT CHARSET = utf8 AUTO_INCREMENT = 31;\r\n "); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $oResult = $oMysqli->query("INSERT INTO `tks_regex` (`id`, `name`, `regex`, `id_categorie`) VALUES\r\n (1, 'FR', 'french|truefrench|vff|vfq|vf|français', 0),\r\n (2, 'VO', 'vo|english|anglais', 0),\r\n (3, 'VOSTFR', 'vostfr', 0),\r\n (4, 'MULTI', 'multi', 0),\r\n (5, 'BDRip', 'bdrip|brrip', 0),\r\n (6, 'DVDRip', 'dvdrip', 0),\r\n (7, 'HDTV', 'hdtv', 0),\r\n (8, 'WebDL', 'web-dl|webdl', 0),\r\n (9, '1080p', '1080p', 0),\r\n (10, '720p', '720p', 0),\r\n (11, 'x264', 'x264|h264', 0),\r\n (12, 'XviD', 'xvid', 0),\r\n (13, 'FLAC', 'flac', 3),\r\n (14, 'MP3', 'mp3', 3),\r\n (15, '320kbps', '320|320kbps', 0),\r\n (16, '264kbps', '264|264kbps', 0),\r\n (17, 'PDF', 'pdf', 6),\r\n (18, 'ePub', 'epub', 6),\r\n (19, 'Scan', 'jpg|pgn', 0),\r\n (20, 'Basket', 'nba|fiba|ncaa|asketball', 8),\r\n (21, 'Football américain', 'nfl|ncca', 8),\r\n (22, 'Football', 'epl|fifa', 8),\r\n (23, 'Tennis', 'tennis|atp', 8),\r\n (24, 'Baseball', 'mlb', 8),\r\n (25, 'NHL', 'nhl', 8),\r\n (26, 'AutoMoto', 'motogp|f1|formula1', 8),\r\n (27, 'Combat', 'ufc|wwe', 8),\r\n (29, 'BR', 'bluray', 0),\r\n (30, 'DVD', 'dvd-r|dvd', 0);\r\n "); $this->sBuffer .= "DONE!<br/>"; //Ajout des nouveaux modules $this->sBuffer .= 'Ajout des nouveaux modules ... '; $oResult = $oMysqli->query("UPDATE tks_modules SET name = 'fiches' WHERE name = 'admincategories'"); $oResult = $oMysqli->query("INSERT INTO `tks_modules` (`id`, `name`) VALUES\r\n ('', 'fichedetail'),\r\n ('', 'modrelease'),\r\n ('', 'modwarnings');\r\n "); $this->sBuffer .= "DONE!<br/>"; //Ajout des nouveaux modules $this->sBuffer .= 'Modification de la table tks_rss ... '; $oResult = $oMysqli->query("ALTER TABLE `tks_rss` DROP `id_categorie` ;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $this->sBuffer .= "DONE!<br/>"; //Création de la table tks_signaled_fiches $this->sBuffer .= 'Création de la table <b>tks_signaled_fiches</b> ... '; $oResult = $oMysqli->query("CREATE TABLE IF NOT EXISTS `tks_signaled_fiches` (\r\n `id_fiche` varchar(36) NOT NULL,\r\n `type` varchar(12) NOT NULL,\r\n `id_user` int(11) NOT NULL,\r\n `comment` text NOT NULL,\r\n `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n UNIQUE KEY `unique` (`id_fiche`,`id_user`)\r\n ) DEFAULT CHARSET=utf8;"); if ($oResult == false) { throw new Error('Impossible de créer la table', 4004); } $this->sBuffer .= "DONE !<br/>"; //Envoie du message d'information : $this->oView->addAlert("N'oubliez pas de donner les droits en écriture au dossier <b><i>saves</i></b>", 'warning'); $this->oView->addAlert("N'oubliez pas de donner les droits en écriture au dossier <b><i>hostpics</i></b>", 'warning'); $this->oView->addAlert("N'oubliez pas de donner les droits en écriture au dossier <b><i>logs</i></b>", 'warning'); $this->oView->addAlert("N'oubliez pas de d'ajouter une tâche CRON pointant sur la page (toutes les 1 à 5 minutes) : <b><i>" . Config::get('installdir') . "index.php?p=scrapper&key=" . Config::get('ingestkey') . "</i></b>", "warning"); $this->oView->addAlert('Copier le contenu suivant à la fin du fichier <b><i>include/config.inc.php</i></b> : <br/> //APIKey pour theTVDB<br/> $sTVDBApiKey = "ma clé";<br/> <br/> //APIKey pour Last.FM<br/> $sLastFMApiKey = "ma clé";<br/>', 'warning'); Config::setVersion('1.2.2'); } catch (Error $ex) { echo "erreur " . $ex->__toString(); $this->oView->addAlert($ex, 'danger'); } finally { $this->oView->addData('titre', 'Mise à jours 1.2.0 vers 1.2.1'); $this->oView->addData('content', $this->sBuffer); $this->oView->create(); } }