From ac24978984ea69a91d24d46fca32337d4cee84d9 Mon Sep 17 00:00:00 2001 From: onli Date: Mon, 7 Jul 2014 01:36:45 +0200 Subject: [PATCH] Upgrader task for syndication plugin (#196) --- include/admin/upgrader.inc.php | 5 +++++ include/functions_upgrader.inc.php | 30 ++++++++++++++++++++++++++++++ include/tpl/config_local.inc.php | 2 +- rss.php | 2 +- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/admin/upgrader.inc.php b/include/admin/upgrader.inc.php index 8a86f1a0..61d7d957 100644 --- a/include/admin/upgrader.inc.php +++ b/include/admin/upgrader.inc.php @@ -220,6 +220,11 @@ $tasks = array(array('version' => '0.5.1', 'title' => 'Removal of obsolete and dead htmlarea directories', 'arguments' => array($dead_htmlarea_dirs), 'desc' => 'Serendipity 2.0 replaces old WYSIWYG-Editors in htmlarea directory with CKEDITOR. The following dead directories will be completely removed from "/htmlarea".
' . implode(', ', $dead_htmlarea_dirs) . '
'), + + array('version' => '2.0-beta3', + 'function' => 'serendipity_upgrader_move_syndication_config', + 'title' => 'Export syndication plugin options', + 'desc' => 'Serendipity 2.0 moved the more generic feed option from the syndication plugin into the core. They will be set equivalent to their old configuration.'), ); diff --git a/include/functions_upgrader.inc.php b/include/functions_upgrader.inc.php index 91e8848b..abe1a16e 100644 --- a/include/functions_upgrader.inc.php +++ b/include/functions_upgrader.inc.php @@ -368,3 +368,33 @@ function serendipity_upgrader_rename_plugins() { } } + +function serendipity_upgrader_move_syndication_config() { + global $serendipity; + $optionsToPort = array( 'bannerURL' => 'feedBannerURL', + 'fullfeed' => 'feedFull', + 'bannerWidth' => 'feedBannerWidth', + 'bannerHeight' => 'feedBannerHeight', + 'show_mail' => 'feedShowMail', + 'field_managingEditor' => 'feedManagingEditor', + 'field_webMaster' => 'feedWebmaster', + 'field_ttl' => 'feedTtl', + 'field_pubDate' => 'feedPubDate' + ); + foreach ($optionsToPort as $oldPluginOption => $newGeneralOption) { + $value = serendipity_db_query("SELECT value FROM {$serendipity['dbPrefix']}config WHERE NAME LIKE 'serendipity_plugin_syndication%{$oldPluginOption}'", true); + if (is_array($value)) { + $value = $value[0]; + } + serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}config('name', 'value') VALUES ('$newGeneralOption', '". serendipity_db_escape_string($value) ."')"); + } + + $fbid = serendipity_db_query("SELECT value FROM {$serendipity['dbPrefix']}config WHERE NAME LIKE 'serendipity_plugin_syndication%fb_id'"); + $show_feedburner = serendipity_db_query("SELECT value FROM {$serendipity['dbPrefix']}config WHERE NAME LIKE 'serendipity_plugin_syndication%show_feedburner'"); + if ($show_feedburner == "force") { + if (! empty($fbid) ) { + $fburl = 'http://feeds.feedburner.com/' . $fbid; + serendipity_db_query("INSERT INTO {$serendipity['dbPrefix']}config('name', 'value') VALUES ('feedCustom', '" . serendipity_db_escape_string($fburl) ."')"); + } + } +} \ No newline at end of file diff --git a/include/tpl/config_local.inc.php b/include/tpl/config_local.inc.php index ee4bdbe3..bf50ce22 100644 --- a/include/tpl/config_local.inc.php +++ b/include/tpl/config_local.inc.php @@ -542,7 +542,7 @@ array('title' => INSTALL_CAT_FEEDS, 'description' => INSTALL_CAT_FEEDS_DESC, 'items' => array( - array('var' => 'fullfeed', + array('var' => 'feedFull', 'title' => SYNDICATION_PLUGIN_FULLFEED, 'description' => '', 'type' => 'list', diff --git a/rss.php b/rss.php index 13747bae..73828add 100644 --- a/rss.php +++ b/rss.php @@ -212,7 +212,7 @@ if (is_array($metadata['additional_fields'])) { $metadata['additional_fields'][$aid] = $af; } } -$metadata['fullFeed'] = serendipity_get_config_var('fullfeed', false); +$metadata['fullFeed'] = serendipity_get_config_var('feedFull', false); if ($metadata['fullFeed'] === 'client') { if ($_GET['fullFeed'] || $serendipity['GET']['fullFeed']) { $metadata['fullFeed'] = true;