aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php37
-rw-r--r--engine/lib/upgrades/2011031400-1.8_svn-oauth_api-8f33ee79c3e66222.php18
2 files changed, 38 insertions, 17 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
index 1d82c4995..61f09aef5 100644
--- a/engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php
+++ b/engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php
@@ -6,23 +6,35 @@
* Updates the database for twitterservice to twitter_api changes.
*/
+
+$ia = elgg_set_ignore_access(true);
+
// 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
-$service = elgg_get_plugin_from_id('twitterservice');
-$api = elgg_get_plugin_from_id('twitter_api');
+$show_hidden = access_get_show_hidden_status();
+access_show_hidden_entities(true);
-if (!$api || !$service) {
+$db_prefix = elgg_get_config('dbprefix');
+$site_guid = elgg_get_site_entity()->getGUID();
+$old = elgg_get_plugin_from_id('twitterservice');
+$old_guid = $old->getGUID();
+$new = elgg_get_plugin_from_id('twitter_api');
+$has_settings = false;
+
+// if not loaded, don't bother.
+if (!$old || !$new) {
return true;
}
$settings = array('consumer_key', 'consumer_secret', 'sign_on', 'new_users');
foreach ($settings as $setting) {
- $api->setSetting($setting, $service->getSetting($setting));
+ $value = $old->getSetting($setting);
+ if ($value) {
+ $has_settings = true;
+ $new->setSetting($setting, $value);
+ }
}
// update the user settings
@@ -32,9 +44,12 @@ $q = "UPDATE {$db_prefix}private_settings
update_data($q);
-if ($service->isActive()) {
- $api->activate();
- $service->deactivate();
+// if there were settings, emit a notice to re-enable twitter_api
+if ($has_settings) {
+ elgg_add_admin_notice('twitter_api:disabled', elgg_echo('update:twitter_api:deactivated'));
}
-$service->delete(); \ No newline at end of file
+$old->delete();
+
+access_show_hidden_entities($show_hidden);
+elgg_set_ignore_access($ia); \ No newline at end of file
diff --git a/engine/lib/upgrades/2011031400-1.8_svn-oauth_api-8f33ee79c3e66222.php b/engine/lib/upgrades/2011031400-1.8_svn-oauth_api-8f33ee79c3e66222.php
index 98c00f506..e85268481 100644
--- a/engine/lib/upgrades/2011031400-1.8_svn-oauth_api-8f33ee79c3e66222.php
+++ b/engine/lib/upgrades/2011031400-1.8_svn-oauth_api-8f33ee79c3e66222.php
@@ -6,9 +6,14 @@
* Switches oauth_lib to oauth_api
*/
-// make sure we have the latest plugin objects.
+$ia = elgg_set_ignore_access(true);
+
+// make sure we have updated plugins
elgg_generate_plugin_entities();
+$show_hidden = access_get_show_hidden_status();
+access_show_hidden_entities(true);
+
$old = elgg_get_plugin_from_id('oauth_lib');
$new = elgg_get_plugin_from_id('oauth_api');
@@ -16,9 +21,10 @@ if (!$old || !$new) {
return true;
}
-if ($old->isActive()) {
- $old->deactivate();
- $new->activate();
-}
+$old->deactivate();
+$old->delete();
+
+elgg_add_admin_notice('oauth_api:disabled', elgg_echo('update:oauth_api:deactivated'));
-$old->delete(); \ No newline at end of file
+access_show_hidden_entities($show_hidden);
+elgg_set_ignore_access($ia);