aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-14 02:06:04 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-14 02:06:04 +0000
commit444611b49a56b2b282d0f9b9290d17aecd9ae321 (patch)
treeaccdc8b21c5b6c3612bad4c78512c5a7b23c9f3a /engine/lib
parente62ce5cca46c015629b39c3356bdb5df65f1369e (diff)
downloadelgg-444611b49a56b2b282d0f9b9290d17aecd9ae321.tar.gz
elgg-444611b49a56b2b282d0f9b9290d17aecd9ae321.tar.bz2
Refs #3115. Migrated twitterservice to twitter_api. Added upgrade to migrate plugin and user settings.
git-svn-id: http://code.elgg.org/elgg/trunk@8699 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php b/engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php
new file mode 100644
index 000000000..0774cbea4
--- /dev/null
+++ b/engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Elgg 1.8-svn upgrade 2011031300
+ * twitter_api
+ *
+ * Updates the database for twitterservice to twitter_api changes.
+ */
+
+// make sure we have updated plugins
+elgg_generate_plugin_entities();
+
+$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];
+
+$api = elgg_get_plugin_from_id('twitter_api');
+
+if (!$api) {
+ return true;
+}
+
+$settings = array('consumer_key', 'consumer_secret', 'sign_on', 'new_users');
+
+foreach ($settings as $setting) {
+ $api->setSetting($setting, $service->getSetting($setting));
+}
+
+// update the user settings
+$q = "UPDATE {$db_prefix}private_settings
+ SET name = replace('twitterservice', 'twitter_api', name)
+ WHERE name like '%twitterservice%'";
+
+update_data($q);
+
+if ($service->isActive()) {
+ $api->activate();
+ $service->deactivate();
+}