В этой статье вкратце расскажу о том, как перевести основные доп.поля Strawberry 1.1.1 в MySQLную версию при помощи хирургического вмешательства. 
! Для тех, кто не хочет сильного вмешательства в систему, смотрите решение от ANT-Soft !
А также не забывайте делать резервные копии базы и скриптов на разных этапах переезда!
Для начала переведем дополнительные поля. Можно воспользоваться моим хаком, либо следующим методом:
1. В зависимости от количества используемых доп.полей добавляем поля в базу cute_news. Для примера возьмем 4 дополнительных поля с названием dop1, dop2, dop3, dop4.
Названия и количество дополнительных полей можно изменить под себя, как угодно!
И так, зайдем в phpmyadmin и дадим запрос для создания 4 полей:
ALTER TABLE `cute_news`
ADD `dop1` text NOT NULL,
ADD `dop2` text NOT NULL,
ADD `dop3` text NOT NULL,
ADD `dop4` text NOT NULL
т.е. после таблицы cute_news мы создаем новые поля с нужным нам текстом.
В итоге, работать с ними можно будет также, как с любыми другими значениями в таблице cute_news.
Далее, нам надо внести изменения в файл, отвечающий за соединение с базой, а именно:
\inc\db\database.inc.php
Находим:
И добавляем:
'dop1' => array('type' => 'string'),
'dop2' => array('type' => 'string'),
'dop3' => array('type' => 'string'),
'dop4' => array('type' => 'string'),
Затем приступим к редактированию админки, а именно: \inc\mod\addnews.mdu ; \inc\mod\editnews.mdu
Форма addnews (вставляется в желаемом месте):
<!-- дополнительное поле -->
<fieldset id="dop1"><legend><?=t('Дополнительное поле1'); ?></legend>
<input type="text" name="dop1">
</fieldset>
<!-- дополнительное поле -->
<fieldset id="dop2"><legend><?=t('Дополнительное поле2'); ?></legend>
<input type="text" name="dop2">
</fieldset>
<!-- дополнительное поле -->
<fieldset id="dop3"><legend><?=t('Дополнительное поле3'); ?></legend>
<input type="text" name="dop3">
</fieldset>
<!-- дополнительное поле -->
<fieldset id="dop4"><legend><?=t('Дополнительное поле4'); ?></legend>
<input type="text" name="dop4">
</fieldset>
Далее находим:
run_actions('new-save-entry');
$sql->insert(array(
'table' => 'news',
'values' => array(
'date' => $added_time,
'author' => $member['username'],
'title' => replace_news('add', $title),
И дописываем информацию о подключении к базе:
'dop1' => replace_news('add', $dop1),
'dop2' => replace_news('add', $dop2),
'dop3' => replace_news('add', $dop3),
'dop4' => replace_news('add', $dop4),
Теперь editnews форма:
<!-- дополнительное поле -->
<fieldset id="dop1"><legend><?=t('Дополнительное поле1'); ?></legend>
<input type="text" name="dop1" value="<?=htmlspecialchars(replace_news('admin', $row['dop1'])); ?>">
</fieldset>
<!-- дополнительное поле -->
<fieldset id="dop2"><legend><?=t('Дополнительное поле2'); ?></legend>
<input type="text" name="dop2" value="<?=htmlspecialchars(replace_news('admin', $row['dop2'])); ?>">
</fieldset>
<!-- дополнительное поле -->
<fieldset id="dop3"><legend><?=t('Дополнительное поле3'); ?></legend>
<input type="text" name="dop3" value="<?=htmlspecialchars(replace_news('admin', $row['dop3'])); ?>">
</fieldset>
<!-- дополнительное поле -->
<fieldset id="dop4"><legend><?=t('Дополнительное поле4'); ?></legend>
<input type="text" name="dop4" value="<?=htmlspecialchars(replace_news('admin', $row['dop4'])); ?>">
</fieldset>
И подключение к базе, аналогичное addnews:
'dop1' => replace_news('add', $dop1),
'dop2' => replace_news('add', $dop2),
'dop3' => replace_news('add', $dop3),
'dop4' => replace_news('add', $dop4),
Одну задачу по установке дополнительных полей мы выполнили!
Теперь осталось перевести ключевые поля из текстовой базы в Mysql`ную.
Для этого копируем файл xfields-data.txt в папку "для опытов" и начинаем его переделывать любым
текстовым редактором, который понимает регулярные выражения для автозамены.
Содержимое файла примерно такое:
1|>|
32|>|
33|>|pole1|5000||pole2|dhe543||year|2027||dop|n029
34|>|pole1|3000||pole2|rewywe||year|2001||dop|n027
28|>|
36|>|
37|>|pole1|1000||pole2|shehe||year|2200||dop|n025
Вначале удалим пустые строки при помощи выражения:
Затем даем запрос замены:
*[0-9]|>|pole1|*[]||pole2|*[]||year|*[]||dop|*[]$
C заменой на (вместо "наша база" прописать название mysql базы):
UPDATE `Наша-база`.`cute_news` SET `dop1` = '%2',
`dop2` = '%3',
`dop3` = '%4',
`dop4` = '%5' WHERE `cute_news`.`id` =%1 LIMIT 1 ;
В итоге получаем:
UPDATE `Наша-база`.`cute_news` SET `dop1` = '5000',
`dop2` = 'dhe543',
`dop3` = '2027',
`dop4` = 'n029' WHERE `cute_news`.`id` =33 LIMIT 1 ;
UPDATE `Наша-база`.`cute_news` SET `dop1` = '3000',
`dop2` = 'rewywe',
`dop3` = '2001',
`dop4` = 'n027' WHERE `cute_news`.`id` =34 LIMIT 1 ;
UPDATE `Наша-база`.`cute_news` SET `dop1` = '1000',
`dop2` = 'shehe',
`dop3` = '2200',
`dop4` = 'n025' WHERE `cute_news`.`id` =37 LIMIT 1 ;
Полученный код через phpmyadmin заносим в базу...
И наши ключевые слова перенесены!
Теперь надо настроить их вывод в шаблоне.
Открываем шаблон и там где у нас было, к примеру:
<?=$tpl['post']['xfields']['year']; ?>
Ставим:
<?=$tpl['post']['dop3']; ?>
Либо даже так:
<? if ($tpl['post']['dop3']){ ?>
Дополнительное поле3:
<?=$tpl['post']['dop3']; ?>
<? } ?>
C этим разобрались!
Дополнительные поля у нас перенесены в базу, добавляются и отображаются.
Теперь перейдем к плагинам (можете сами решить, какие из них вам нужны)...
Вначале возьмем format-post.php из сборки Miksar`a:
<?php
/**
* @package Plugins
* @access private
*/
/*
Plugin Name: Формат поста
Plugin URI: http://miksar.mirahost.ru/strawberry/
Description: Выбор разных форматов вывода новостей при публикации/редактировании. MySQL
база. Исправлены некоторые ошибки при ВакоТегах.
Version: 1.3
Application: Strawberry
Author: David Carrington, Mr.Miksar
Author URI: http://www.brandedthoughts.co.uk
*/
define('FS_FORMAT_XFIELD', 'fs_format');
define('FS_DEFAULT_FORMAT', 'html_with_br');
add_action('edit-advanced-options', 'fs_FormatSelectBox');
add_action('new-advanced-options', 'fs_FormatSelectBox');
add_filter('news-entry-content', 'fs_ApplyFormat', 1000);
add_filter('news-comment-content', 'fs_ApplyFormat', 1000);
function fs_FormatDropDownOptions(){
global $sql, $fs_formats, $item_db, $id, $_POST, $story;
$format = ($story['format'] ? $story['format'] : FS_DEFAULT_FORMAT);
if ($fs_formats){
$desc['text'] = t('Текст');
$desc['text_with_br'] = t('Текст с переносом строк');
$desc['html'] = t('HTML');
$desc['html_with_br'] = t('HTML с переносом строк');
foreach ($fs_formats as $fs_name => $fs_function){
$buffer .= '<option value="'.$fs_name.'"'.($format == $fs_name ? '
selected="selected"' : '').'>'.$desc[$fs_name].'</option>';
}
}
return $buffer;
}
function fs_FormatSelectBox($hook){
$buffer = '<fieldset id="news_format"><legend>'.t('Формат').'</legend><select name="fs_format"
id="cboFS_Format" style="width:210px;">'.fs_FormatDropDownOptions().'</select></fieldset>';
return $buffer;
}
function fs_ApplyFormat($content, $hook){
global $row, $fs_formats, $sql;
if ($_POST['fs_format']){
$format = $_POST['fs_format'];
} else {
$format = $row['format'];
}
// Get the function name
$format_function = $fs_formats[$format];
if (!$format_function or !function_exists($format_function)){
$format_function = $fs_formats[FS_DEFAULT_FORMAT];
}
// Run the formatting function
$content = $format_function($content);
return $content;
}
/* Default formats */
$GLOBALS['fs_formats']['text'] = 'fs_Plain';
$GLOBALS['fs_formats']['text_with_br'] = 'fs_Plain_br';
$GLOBALS['fs_formats']['html'] = 'fs_HTML';
$GLOBALS['fs_formats']['html_with_br'] = 'fs_HTML_br';
function fs_Plain($content){
$content = htmlspecialchars($content);
$content = str_replace('{nl}', '', $content);
return $content;
}
function fs_Plain_br($content){
$content = htmlspecialchars($content);
$content = str_replace('{nl}', '<br>', $content);
return $content;
}
function fs_HTML($content){
$content = str_replace('{nl}', '', $content);
return $content;
}
function fs_HTML_br($content) {
$active_plugins = loadarray(active_plugins_file);
$content = str_replace('{nl}', '<br />', $content);
if ($active_plugins['wacko.php']) {
$content = str_replace('><br><table', '><table', $content);
$content = str_replace('><br><tr', '><tr', $content);
$content = str_replace('><br><td', '><td', $content);
$content = str_replace('><br></tr', '></tr', $content);
$content = str_replace('><br></td', '></td', $content);
$content = str_replace('><br></table', '></table', $content);
$content = str_replace('table><br>', 'table>', $content);
}
return $content.$g;
}
?>
Затем второй полезный плагин post-type.php
<?php
/**
* @package Plugins
* @access private
*/
/*
Plugin Name: Тип поста
Plugin URI: http://cutenews.ru/
Description: Позволяет выбрать тип сообщения: опрос (<code>$type = 'poll';</code>), страница
(<code>$type = 'page';</code>)(отличается от обычной новости многоуровневостью), чистый PHP,
запароленный пост.
Version: 0.2
Application: Strawberry
Author: Лёха zloy и красивый
Author URI: http://lexa.cutenews.ru
*/
add_action('edit-advanced-options', 'postType_AddEdit', 18);
add_action('new-advanced-options', 'postType_AddEdit', 18);
function postType_AddEdit(){
global $sql, $id, $row;
$sql->altertable(array(
'table' => 'news',
'action' => 'insert',
'name' => 'type',
'values' => array('type' => 'string')
));
$sql->altertable(array(
'table' => 'news',
'action' => 'insert',
'name' => 'parent',
'values' => array('type' => 'int', 'default' => 0)
));
$sql->altertable(array(
'table' => 'news',
'action' => 'insert',
'name' => 'level',
'values' => array('type' => 'int', 'default' => 0)
));
$sql->altertable(array(
'table' => 'news',
'action' => 'insert',
'name' => 'password',
'values' => array('type' => 'string')
));
$types = array('' => '...', 'poll' => t('Опрос'), 'page' => t('Страница'), 'private' =>
t('Запароленый'));
if (straw_get_rights('full')){
$types['php'] = t('PHP');
}
$buffer = '<fieldset id="post_type"><legend>'.t('Тип поста').'</legend>';
$buffer .= makeDropDown($types, 'type" onChange="this.value == \'page\' ?
_getElementById(\'postparent\').style.display = \'\' : _getElementById(\'postparent\').style.display
= \'none\'; this.value == \'private\' ? _getElementById(\'postpassword\').style.display = \'\' :
_getElementById(\'postpassword\').style.display = \'none\';', $row['type']);
$buffer .= '<br /><select size="1" id="postparent" name="postparent" style="display:
'.($row['type'] != 'page' ? 'none' : '').';" title="'.t('Родитель').'"><option
value="0">...</option>';
if ($row['parent']){
$buffer .= page_get_tree('- ', '<option
value="{id}"[php]tmp_page_selected({id}, '.$row['parent'].')[/php]>{prefix}{title}</option>',
false);
} else {
$buffer .= page_get_tree('- ', '<option value="{id}">{prefix}{title}</option>',
false);
}
$buffer .= '</select>';
if ($row['type'] == 'private'){
$buffer .= '<input id="password" name="postpassword" type="text"
value="'.$row['password'].'" style="display: ;" title="'.t('Пароль').'">';
} else {
$buffer .= '<input id="password" name="postpassword" type="text" value="" style="display:
none;" title="'.t('Пароль').'">';
}
$buffer .= '</fieldset>';
return $buffer;
}
add_action('new-save-entry', 'postType_saveType', 18);
add_action('edit-save-entry', 'postType_saveType', 18);
function postType_saveType(){
global $sql, $id;
$values = array('type' => $_POST['type'], 'password' => '', 'parent' => '', 'level' => '');
if ($_POST['type'] == 'page'){
$query = end($sql->select(array('table' => 'news', 'where' => array('id =
'.$_POST['postparent']))));
$values['parent'] = $_POST['postparent'];
$values['level'] = ($query['level'] + 1);
} elseif ($_POST['type'] == 'private'){
$values['password'] = $_POST['postpassword'];
}
$sql->update(array(
'table' => 'news',
'where' => array("id = $id"),
'values' => $values
));
}
add_filter('news-where', 'postType_where', 18);
function postType_where($where){
global $type;
if ($type == 'page'){
$where[] = 'type = page';
$where[] = 'and';
} elseif ($type == 'poll'){
$where[] = 'type = poll';
$where[] = 'and';
} elseif ($type == 'news'){
$where[] = 'type != page';
$where[] = 'and';
$where[] = 'type != poll';
$where[] = 'and';
} else {
$where[] = 'type != page';
$where[] = 'and';
}
return $where;
}
add_filter('constructor-variables', 'postType_constructor', 18);
function postType_constructor($variables){
$variables['type'] = array('string', makeDropDown(array(t('новости и опросы'), 'news' =>
t('новости'), 'poll' => t('опросы'), 'page' => t('страницы')), 'type'));
return $variables;
}
add_action('head', 'postType_define', 18);
function postType_define(){
global $cache, $type, $_pages, $sql;
if (!$_pages = $cache->unserialize('_pages')){
if ($query = $sql->select(array('table' => 'news', 'where' => array('type = page')))){
foreach ($query as $row){
$_pages[$row['id']] = $row;
}
}
$_pages = $cache->serialize($_pages);
}
unset($type, $_GET['type']);
}
add_filter('unset', 'postType_typeUnset', 18);
function postType_typeUnset($unset){
$unset[] = 'type';
return $unset;
}
add_filter('cute-get-link', 'postType_put_link', 18);
function postType_put_link($output){
if ($output['arr']['parent']){
$output['link'] = str_replace('{title}', page_get_link($output['arr']['id']),
$output['link']);
}
return $output;
}
add_filter('htaccess-rules-replace', 'postType_rules_replace', 18);
function postType_rules_replace($output){
global $config, $_pages;
if ($config['mod_rewrite'] and $_pages){
foreach ($_pages as $row){
if ($row['parent']){
$page[] = page_get_link($row['id']);
}
}
if ($page){
$output = str_replace('{title}', '('.join('|', $page).'|[_0-9a-z-]+)', $output);
}
}
return $output;
}
add_action('head', 'postType_idClean', 18);
function postType_idClean(){
global $id;
if (!is_numeric($id) and chicken_dick(strstr($id, '/'))){
$id = $_GET['id'] = end($id = explode('/', chicken_dick($id)));
}
}
add_action('head', 'postType_updatePoll', 18);
function postType_updatePoll(){
global $sql;
if ($_POST['poll']){
foreach ($_POST['poll'] as $pid => $vid){
if (!$_COOKIE['cnpostpoll'.$pid]){
straw_setcookie('cnpostpoll'.$pid, 'voted', (time() + 3600 * 24), '/');
$row = reset($sql->select(array('table' => 'story', 'where' => array("post_id =
$pid"))));
foreach (explode('{nl}', $row['short']) as $k => $v){
$v_arr = explode('{', $v);
$vote[$k] = (int)$v_arr[1];
$poll[$k] = $v_arr[0];
}
foreach ($poll as $k => $v){
if ($k == $vid){
$vote[$k] = ($vote[$k] + 1);
}
$story[] = $poll[$k].'{'.$vote[$k].'}';
}
$sql->update(array(
'table' => 'story',
'where' => array("post_id = $pid"),
'values' => array('short' => join('{nl}', $story))
));
}
}
header('Location: '.$_SERVER['REQUEST_URI']);
exit;
}
}
add_filter('news-show-generic', 'postType_makePoll', 18);
function postType_makePoll($tpl){
if ($tpl['_']['type'] == 'poll'){
foreach (explode('{nl}', $tpl['_']['short']) as $k => $v){
$v_arr = explode('{', $v);
$vote[$k] = (int)$v_arr[1];
$poll[$k] = $v_arr[0];
$votes += $vote[$k];
}
foreach ($poll as $k => $v){
$short .= '<label for="poll['.$tpl['id'].']['.$k.']"><input
name="poll['.$tpl['id'].']" type="radio" id="poll['.$tpl['id'].']['.$k.']"
value="'.$k.'">'.$poll[$k].'</label><br />';
$full .= '<div><b>'.$poll[$k].'</b></div><div style="width:
'.@round($vote[$k] / ($votes / 100)).'%;" class="straw_poll">'.@round($vote[$k] / ($votes /
100)).'%</div>';
}
$tpl['short-story'] = ($_COOKIE['cnpostpoll'.$tpl['id']] ? $full : '<form name="cnpostpoll"
method="post">'.$short.'<input type="submit" value=" ok "></form>');
$tpl['full-story'] = $full;
}
return $tpl;
}
add_filter('news-show-generic', 'postType_parsePHP', 18);
function postType_parsePHP($tpl){
if ($tpl['_']['type'] == 'php'){
$evalshort = replace_news('admin', str_replace('<br />', '', $tpl['_']['short']));
$evalfull = replace_news('admin', str_replace('<br />', '', $tpl['_']['full']));
if ($evalshort){
ob_start();
eval($evalshort);
$tpl['short-story'] = ob_get_clean();
}
if ($evalfull){
ob_start();
eval($evalfull);
$tpl['full-story'] = ob_get_clean();
}
}
return $tpl;
}
add_action('head', 'postType_updatePrivate', 18);
function postType_updatePrivate(){
if ($_POST['cnpostpassword']){
straw_setcookie('cnpostpassword'.$_POST['passtopost'], $_POST['cnpostpassword'], (time() +
3600 * 24 * 365), '/');
header('Location: '.$_SERVER['REQUEST_URI']);
exit;
}
}
add_filter('news-show-generic', 'postType_makePrivate', 18);
function postType_makePrivate($tpl){
if ($tpl['_']['type'] == 'private' and $_COOKIE['cnpostpassword'.$tpl['id']] !=
$tpl['_']['password']){
$tpl['short-story'] = '<form method="post"><input name="cnpostpassword" type="password"
value=""><input name="passtopost" type="hidden" value="'.$tpl['id'].'"><input type="submit" value="
ok "></form>';
$tpl['full-story'] = ($tpl['full-story'] ? $tpl['short-story'] : '');
}
return $tpl;
}
#-------------------------------------------------------------------------------
function page_get_link($id, $link = ''){
global $_pages;
if ($_pages[$id]['url']){
$link = $_pages[$id]['url'].($link ? '/'.$link : '');
}
if ($_pages[$id]['parent']){
$link = page_get_link($_pages[$id]['parent'], $link);
}
return chicken_dick($link);
}
function page_get_title($id, $separator = ' » ', $title = ''){
global $_pages;
if ($_pages[$id]['title']){
$title = $_pages[$id]['title'].($title ? $separator.$title : '');
}
if ($_pages[$id]['parent']){
$title = page_get_title($_pages[$id]['parent'], $separator, $title);
}
return chicken_dick($title);
}
function page_get_tree($prefix = '', $tpl = '{name}', $no_prefix = true, $id = 0, $level = 0,
$johnny_left_teat = ''){
global $sql;
$level++;
foreach ($sql->select(array('table' => 'news', 'where' => array("parent = $id", 'and', 'type
= page'), 'orderby' => array('id', 'DESC'))) as $row){
$pref = ($prefix ? ($no_prefix ? preg_replace('/('.preg_quote($prefix,
'/').'{1})$/i', '', str_repeat($prefix, $level)) : str_repeat($prefix, $level)) : '');
$find = array('/{id}/i', '/{title}/i', '/{parent}/i', '/{url}/i', '/{prefix}/i',
'/\[php\](.*?)\[\/php\]/ie');
$repl = array($row['id'], $row['title'], $row['parent'], $row['url'], $pref, '\\1');
$johnny_left_teat .= $pref.preg_replace($find, $repl, $tpl);
$johnny_left_teat = page_get_tree($prefix, $tpl, $no_prefix, $row['id'], $level,
$johnny_left_teat);
}
return $johnny_left_teat;
}
function tmp_page_selected($id, $parent){
if ($id == $parent){
return ' selected';
}
}
?>
И на последок tepmplate-for-news.php
<?php
/**
* @package Plugins
* @access private
*/
/*
Plugin Name: Индивидуальный шаблон
Plugin URI: http://cutenews.ru
Description: Новость может быть с любым шаблоном. MySQL
Version: 1.2
Application: Strawberry
Author: Лёха zloy и красивый
Author URI: http://lexa.cutenews.ru
*/
// Cartman find you and kill you!
add_action('new-advanced-options', 'change_template', 24);
add_action('edit-advanced-options', 'change_template', 24);
function change_template(){
global $id, $post;
$result = array('' => '...');
$handle = opendir(templates_directory);
while ($file = readdir($handle)){
if (file_exists(templates_directory.'/'.$file.'/active.tpl') and
file_exists(templates_directory.'/'.$file.'/full.tpl')){
$result[$file] = $file;
}
}
$result = '<fieldset id="news_template"><legend>'.t('Шаблон').'</legend>'.makeDropDown($result,
'template', $post['template']).'</fieldset>';
return $result;
}
add_filter('news-show-generic', 'apply_template', 24);
function apply_template($array){
global $tpl, $row, $static, $post;
$template = $row['template'];
if (
$template and
!$static and
!strstr($_SERVER['PHP_SELF'], 'rss.php')
and
!strstr($_SERVER['PHP_SELF'], 'print.php')
and
!is_file(templates_directory.'/'.$template)
and
is_dir(templates_directory.'/'.$template)
) {
$tpl['template'] = $template;
}
return $array;
}
?>
Для их работы опять обращаемся к файлу \inc\db\database.inc.php
Находим:
И добавляем:
'type' => array('type' => 'string'),
'parent' => array('type' => 'int'),
'level' => array('type' => 'int'),
'password' => array('type' => 'string'),
'template' => array('type' => 'string'),
Находим:
И добавляем:
'format' => array('type' => 'string'),
Теперь заходим в phpmyadmin и добавляем нужные поля:
ALTER TABLE `cute_news`
ADD `type` text NOT NULL,
ADD `password` text NOT NULL,
ADD `parent` int(11) NOT NULL,
ADD `level` int(11) NOT NULL,
ADD `template` text NOT NULL;
ALTER TABLE `cute_story`
ADD `format` text NOT NULL
Порядок!
Теперь в админке проверяем, чтобы плагины были включены и переносим данные из файла xfields-data.php
в базу.
Поскольку этот файл может быть индивидуальным у каждого, то приведу краткий пример на двух шаблонах.
* если ваш файл содержит дополнительные данные, мета-теги, комментарии и т.д...
То переносите данные и информацию из плагинов по аналогии! *
1 =>
array (
'template' => '',
'fs_format' => 'html_with_br',
),
3 =>
array (
'template' => 'Default',
'fs_format' => 'html_with_br',
),
25 =>
array (
'template' => 'page',
'fs_format' => 'html',
),
27 =>
array (
'template' => 'page',
'fs_format' => 'html',
),
Удаляем все "array (" и "),"
Код поиска:
*[0-9] =>
'template' => '*[]',
'fs_format' => '*[]',
Код замены:
UPDATE `Наша-база`.`cute_news` SET `template` = '%2' WHERE `cute_news`.`id` =%1 LIMIT 1 ;
UPDATE `Наша-база`.`cute_story` SET `format` = '%3' WHERE `cute_story`.`post_id` =%1 LIMIT 1 ;
Получаем и вводим в phpmyadmin:
UPDATE `Наша-база`.`cute_news` SET `template` = '' WHERE `cute_news`.`id` =1 LIMIT 1 ;
UPDATE `Наша-база`.`cute_story` SET `format` = 'html_with_br' WHERE `cute_story`.`id` =1 LIMIT 1 ;
UPDATE `Наша-база`.`cute_news` SET `template` = 'Default' WHERE `cute_news`.`id` =3 LIMIT 1 ;
UPDATE `Наша-база`.`cute_story` SET `format` = 'html_with_br' WHERE `cute_story`.`id` =3 LIMIT 1 ;
UPDATE `Наша-база`.`cute_news` SET `template` = 'page' WHERE `cute_news`.`id` =25 LIMIT 1 ;
UPDATE `Наша-база`.`cute_story` SET `format` = 'html' WHERE `cute_story`.`id` =25 LIMIT 1 ;
UPDATE `Наша-база`.`cute_news` SET `template` = 'page' WHERE `cute_news`.`id` =27 LIMIT 1 ;
UPDATE `Наша-база`.`cute_story` SET `format` = 'html' WHERE `cute_story`.`id` =27 LIMIT 1 ;
Ну и теперь осталось только внести изменения в addnews и editnews:
В addnews и editnews после:
run_actions('new-save-entry');
$sql->insert(array(
'table' => 'news',
'values' => array(
Добавляем:
После:
$sql->insert(array(
'table' => 'story',
'values' => array(
Добавляем:
Всё!
Заходим в админку и радуемся жизни с MySQL`ной базой!
...и если все данные из текстовой базы перенесли, то можем смело удалить файлы "xfield".
Главное не забудьте убрать (физически) все старые плагины, дабы избежать конфликта с новыми.