<?php
/**
0.4 --> 0.5
*/
if(Schema::has('users', 'email') === false) {
$sql = "alter table `users` add `email` varchar( 140 ) not null after `password`";
Migrations::query($sql);
}
if(Schema::has('posts', 'comments') === false) {
$sql = "alter table `posts` add `comments` tinyint( 1 ) not null";
Migrations::query($sql);
}
if(Schema::has('posts', 'custom_fields') === false) {
$sql = "alter table `posts` add `custom_fields` text not null after `js`";
Migrations::query($sql);
}
$sql = "create table if not exists `comments` (
`id` int(6) not null auto_increment,
`post` int(6) not null,
`status` enum('pending','published','spam') not null,
`date` int(11) not null,
`name` varchar(140) not null,
`email` varchar(140) not null,
`text` text not null,
primary key (`id`),
key `post` (`post`),
key `status` (`status`)
) engine=myisam charset=utf8 collate=utf8_general_ci";
Migrations::query($sql);
// rename show_posts
$sql = "update `meta` set `value` = 'posts_page' where `value` = 'show_posts'";
Migrations::query($sql);
// make posts_page the home page
if(Schema::has('meta', 'key', 'home_page') === false) {
$posts_page = Db::column("select `value` from meta where `key` = 'show_posts'");
$sql = "insert into `meta` (`key`, `value`) values ('home_page', '" . $posts_page . "')";
Migrations::query($sql);
}
// [BUGFIX] make sure the password field is big enough
$sql = "alter table `users` change `password` `password` text character set utf8 COLLATE utf8_general_ci not null";
Migrations::query($sql);
// update config
if(Config::get('application.admin_folder') === false) {
Config::set('application.admin_folder', 'admin');
}
if(Config::get('application.key') === false) {
Config::set('application.key', Str::random(40));
}
/**
0.5 --> 0.6
*/
$sql = "create table if not exists `sessions` (
`id` char( 32 ) not null ,
`date` datetime not null ,
`ip` varchar( 15 ) not null ,
`ua` varchar( 140 ) not null ,
`data` text not null
) engine=innodb charset=utf8 collate=utf8_general_ci;";
Migrations::query($sql);
// comments auto published option
if(Schema::has('meta', 'key', 'auto_published_comments') === false) {
$sql = "insert into `meta` (`key`, `value`) values ('auto_published_comments', '0')";
Migrations::query($sql);
}
// pagination
if(Schema::has('meta', 'key', 'posts_per_page') === false) {
$sql = "insert into `meta` (`key`, `value`) values ('posts_per_page', '10')";
Migrations::query($sql);
}
// update config
if(Config::get('session') === false) {
Config::set('session.name', 'anchorcms');
Config::set('session.expire', 3600);
Config::set('session.path', '/');
Config::set('session.domain', '');
}
if(Config::get('error') === false) {
Config::set('error.ignore', array(E_NOTICE, E_USER_NOTICE, E_DEPRECATED, E_USER_DEPRECATED));
Config::set('error.detail', true);
Config::set('error.log', false);
}
/**
0.6 --> 0.7
*/
if(Schema::has('pages', 'redirect') === false) {
$sql = "alter table `pages` add `redirect` varchar( 150 ) not null";
Migrations::query($sql);
}
Config::set('foreign_characters', array(
'/æ|ǽ/' => 'ae',
'/Å/' => 'oe',
'/Ã|Ã|Ã|Ã|Ã|Ã
|Ǻ|Ä|Ä|Ä|Ç|Ð/' => 'A',
'/à |á|â|ã|ä|Ã¥|Ç»|Ä|Ä|Ä
|Ç|ª|а/' => 'a',
'/Ð/' => 'B',
'/б/' => 'b',
'/Ã|Ä|Ä|Ä|Ä|Ц/' => 'C',
'/ç|Ä|Ä|Ä|Ä|Ñ/' => 'c',
'/Ã|Ä|Ä|Ð/' => 'Dj',
'/ð|Ä|Ä|д/' => 'dj',
'/Ã|Ã|Ã|Ã|Ä|Ä|Ä|Ä|Ä|Ð|Ð|Ð/' => 'E',
'/è|é|ê|ë|Ä|Ä|Ä|Ä|Ä|е|Ñ|Ñ/' => 'e',
'/Ф/' => 'F',
'/Æ|Ñ/' => 'f',
'/Ä|Ä|Ä |Ä¢|Ð/' => 'G',
'/Ä|Ä|Ä¡|Ä£|г/' => 'g',
'/Ĥ|Ħ|Х/' => 'H',
'/Ä¥|ħ|Ñ
/' => 'h',
'/Ã|Ã|Ã|Ã|Ĩ|Ī|Ĭ|Ç|Ä®|İ|Ð/' => 'I',
'/ì|Ã|î|ï|Ä©|Ä«|Ä|Ç|į|ı|и/' => 'i',
'/Ä´|Ð/' => 'J',
'/ĵ|й/' => 'j',
'/Ķ|Ð/' => 'K',
'/ķ|к/' => 'k',
'/Ĺ|Ä»|Ľ|Ä¿|Å|Ð/' => 'L',
'/ĺ|ļ|ľ|Å|Å|л/' => 'l',
'/Ð/' => 'M',
'/м/' => 'm',
'/Ã|Å|Å
|Å|Ð/' => 'N',
'/ñ|Å|Å|Å|Å|н/' => 'n',
'/Ã|Ã|Ã|Ã|Ã|Å|Å|Ç|Å|Æ |Ã|Ǿ|Ð/' => 'O',
'/ö|ò|ó|ô|õ|Å|Å|Ç|Å|Æ¡|ø|Ç¿|º|о/' => 'o',
'/Ð/' => 'P',
'/п/' => 'p',
'/Å|Å|Å|Ð /' => 'R',
'/Å|Å|Å|Ñ/' => 'r',
'/Å|Å|Å|È|Å |С/' => 'S',
'/Å|Å|Å|È|Å¡|Å¿|Ñ/' => 's',
'/Å¢|È|Ť|Ŧ|Т/' => 'T',
'/Å£|È|Å¥|ŧ|Ñ/' => 't',
'/Ã|Ã|Ã|Ũ|Ū|Ŭ|Å®|Ã|Ű|Ų|Ư|Ç|Ç|Ç|Ç|Ç|У/' => 'U',
'/ù|ú|û|Å©|Å«|Å|ů|ü|ű|ų|ư|Ç|Ç|Ç|Ç|Ç|Ñ/' => 'u',
'/Ð/' => 'V',
'/в/' => 'v',
'/Ã|Ÿ|Ŷ|Ы/' => 'Y',
'/ý|ÿ|Å·|Ñ/' => 'y',
'/Å´/' => 'W',
'/ŵ/' => 'w',
'/Ź|Å»|Ž|Ð/' => 'Z',
'/ź|ż|ž|з/' => 'z',
'/Ã|Ǽ/' => 'AE',
'/Ã/'=> 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Å/' => 'OE',
'/Ч/' => 'Ch',
'/Ñ/' => 'ch',
'/Ю/' => 'Ju',
'/Ñ/' => 'ju',
'/Я/' => 'Ja',
'/Ñ/' => 'ja',
'/Ш/' => 'Sh',
'/Ñ/' => 'sh',
'/Щ/' => 'Shch',
'/Ñ/' => 'shch',
'/Ð/' => 'Zh',
'/ж/' => 'zh',
));
if(Config::get('debug', null) === null) {
Config::set('debug', false);
}
if(Config::get('database.collation', null) === null) {
Config::set('database.collation', 'utf8_bin');
}