provide upgrader task for plugin upgrade
This commit is contained in:
@ -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 */
|
||||
|
@ -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']) . "<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) . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user