]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3141. Disabling twitter_api and oauth_api upon upgrade because we can't check...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Mar 2011 01:16:48 +0000 (01:16 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Thu, 17 Mar 2011 01:16:48 +0000 (01:16 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8742 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/upgrades/2011031300-1.8_svn-twitter_api-12b832a5a7a3e1bd.php
engine/lib/upgrades/2011031400-1.8_svn-oauth_api-8f33ee79c3e66222.php
languages/en.php
mod/oauth_api/manifest.xml
mod/twitter_api/manifest.xml

index 1d82c4995ff9b9c8db3ee2b93fb5f9567232c340..61f09aef584fe9799fa9b09cb10bf772512aa575 100644 (file)
@@ -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
index 98c00f50611398a0a02e9c7571c23254d9bfb1ef..e852684811c74b1dfd2feb9e413dc80cc1781862 100644 (file)
@@ -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);
index ad052870ad3f3717a7d0a64ee7e6aac8ca744d3c..6efc4da3f4c713a3845297865d8f9de1576897f3 100644 (file)
@@ -973,7 +973,8 @@ Once you have logged in, we highly recommend that you change your password.
                Upgrading Elgg documentation</a>.  If you require assistance, please post to the
                <a href="http://community.elgg.org/pg/groups/discussion/">Community Support Forums</a>.',
 
-       'update:twitter_api:settings_found_unknown_status' => 'Twitter API (previously Twitter Service) settings were found, but its status could not be determined. Please re-activate it manually.',
+       'update:twitter_api:deactivated' => 'Twitter API (previously Twitter Service) was deactivated during the upgrade. Please activate it manually if required.',
+       'update:oauth_api:deactivated' => 'OAuth API (previously OAuth Lib) was deactivated during the upgrade.  Please activate it manually if required.',
 
        'deprecated:function' => '%s() was deprecated by %s()',
 
index 1d743fdabc1e6494b5dddd53794284b0971972e8..121c2e774c7200b0bbf777edb2d0be5bf7c745d1 100644 (file)
@@ -12,4 +12,9 @@
                <type>elgg_version</type>
                <version>2010040201</version>
        </requires>
+
+       <conflicts>
+               <type>plugin</type>
+               <name>oauth_lib</name>
+       </conflicts>
 </plugin_manifest>
index 28af93328a9b8b7d02dded9f9551c2aebd271b0d..51306c98e3d5d74d5fea648ac3913e34f3addc72 100644 (file)
@@ -21,4 +21,9 @@
                <type>php_extension</type>
                <name>curl</name>
        </requires>
+
+       <conflicts>
+               <type>plugin</type>
+               <name>twitterservice</name>
+       </conflicts>
 </plugin_manifest>