$db_prefix = elgg_get_config('dbprefix');
// find the old settings for twitterservice and copy them to the new one
-$options = array(
- 'type' => 'object',
- 'subtype' => 'plugin',
- 'joins' => array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid"),
- 'wheres' => array('title = "twitterservice"')
-);
-
-$objs = elgg_get_entities($options);
-
-if (!$objs) {
- return true;
-}
-
-$service = $objs[0];
-
+$service = elgg_get_plugin_from_id('twitterservice');
$api = elgg_get_plugin_from_id('twitter_api');
-if (!$api) {
+if (!$api || !$service) {
return true;
}
// update the user settings
$q = "UPDATE {$db_prefix}private_settings
- SET name = replace('twitterservice', 'twitter_api', name)
+ SET name = replace(name, 'twitterservice', 'twitter_api')
WHERE name like '%twitterservice%'";
update_data($q);
$api->activate();
$service->deactivate();
}
+
+$service->delete();
\ No newline at end of file