provide upgrader task for plugin upgrade

This commit is contained in:
garvinhicking 2014-02-10 15:12:56 +01:00
parent b3eb11b9f0
commit df92e08671
5 changed files with 30 additions and 2 deletions

View File

@ -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)
------------------------------------------------------------------------

View File

@ -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

View File

@ -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".<br /><div style="font-size: x-small; margin: 15px">' . implode(', ', $dead_smarty_files) . '</div>'),
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 */

View File

@ -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) . " &gt;&gt; " . htmlspecialchars($plugin['name']) . "<br />\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) . "'");
}
}
}

View File

@ -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'])) {