From df92e086719c3c4c178221aba18d119925bcd543 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Mon, 10 Feb 2014 15:12:56 +0100 Subject: [PATCH] provide upgrader task for plugin upgrade --- docs/NEWS | 5 +++++ docs/NEWS-2.0-temp | 2 +- include/admin/upgrader.inc.php | 5 +++++ include/functions_upgrader.inc.php | 18 ++++++++++++++++++ serendipity_config.inc.php | 2 +- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index 4ebc8a28..e233cfa5 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -19,6 +19,11 @@ Version 2.0 () * Use Smarty for backend display output +Version 1.7.8 (February 9th, 2014) +------------------------------------------------------------------------ + + * Fixed POST for db entry insert, caused by 1.7.6 security feature + Version 1.7.7 (February 6th, 2014) ------------------------------------------------------------------------ diff --git a/docs/NEWS-2.0-temp b/docs/NEWS-2.0-temp index 2854e40e..c9a9f63f 100644 --- a/docs/NEWS-2.0-temp +++ b/docs/NEWS-2.0-temp @@ -39,7 +39,7 @@ trackback-functions still use echo for messages"): serendipity_generateImageSelectorParams * All internal plugins got extracted from plugin_internal.inc.php and moved to plugins/. - They are renamed to work there (TODO: Fix that and rename back or add upgrader task): + They are renamed to work there (upgrader task provides migration): serendipity_calendar_plugin became serendipity_plugin_calendar serendipity_quicksearch_plugin became serendipity_plugin_quicksearch serendipity_archives_plugin became serendipity_plugin_archives diff --git a/include/admin/upgrader.inc.php b/include/admin/upgrader.inc.php index 9a2a8e9e..1bfb4a48 100644 --- a/include/admin/upgrader.inc.php +++ b/include/admin/upgrader.inc.php @@ -204,6 +204,11 @@ $tasks = array(array('version' => '0.5.1', 'arguments' => array($serendipity['serendipityPath'] . 'bundled-libs/Smarty', $dead_smarty_files, array('internals'), true), 'desc' => 'Smarty 3.x brought a new file structure. The following dead files will be removed from "bundled-libs/Smarty/libs".
' . implode(', ', $dead_smarty_files) . '
'), + array('version' => '2.0-alpha3', + 'function' => 'serendipity_upgrader_rename_plugins', + 'title' => 'Move internal plugins to "normal" plugin directory structure.', + 'desc' => 'A list of internal plugins that previously lived in include/plugin_internal.inc.php were moved into the proper plugins/ subdirectory structure. This task will migrate any possible references to such plugins to the new format.'), + ); /* Fetch SQL files which needs to be run */ diff --git a/include/functions_upgrader.inc.php b/include/functions_upgrader.inc.php index 640c7e89..aafd88b0 100644 --- a/include/functions_upgrader.inc.php +++ b/include/functions_upgrader.inc.php @@ -282,3 +282,21 @@ function serendipity_removeDeadFiles_SPL($dir=null, $deadfiles=null, $purgedir=n } } } + +function serendipity_upgrader_rename_plugins() { + global $serendipity; + + $plugs = serendipity_db_query("SELECT name FROM {$serendipity['dbPrefix']}plugins WHERE name LIKE '@%'"); + + if (is_array($plugs)) { + foreach($plugs AS $plugin) { + $origname = $plugin['name']; + $plugin['name'] = str_replace('@', '', $plugin['name']); + $plugin['name'] = preg_replace('@serendipity_([^_]+)_plugin@i', 'serendipity_plugin_\1', $plugin['name']); + $pluginparts = explode(':', $plugin['name']); + + echo htmlspecialchars($origname) . " >> " . htmlspecialchars($plugin['name']) . "
\n"; + serendipity_db_query("UPDATE {$serendipity['dbPrefix']}plugins SET name = '" . serendipity_db_escape_string($plugin['name']) . "', path = '" . serendipity_db_escape_string($pluginparts[0]) . "' WHERE name = '" . serendipity_db_escape_string($origname) . "'"); + } + } +} diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php index dc05d9ff..6622c002 100644 --- a/serendipity_config.inc.php +++ b/serendipity_config.inc.php @@ -45,7 +45,7 @@ if (defined('USE_MEMSNAP')) { } // The version string -$serendipity['version'] = '2.0-alpha2'; +$serendipity['version'] = '2.0-alpha3'; // Setting this to 'false' will enable debugging output. All alpha/beta/cvs snapshot versions will emit debug information by default. To increase the debug level (to enable Smarty debugging), set this flag to 'debug'. if (!isset($serendipity['production'])) {