diff options
author | Brion Vibber <brion@pobox.com> | 2010-04-06 15:22:23 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-04-06 15:22:23 -0700 |
commit | 5dc169260dc36209dd5ad0d4d4cac2bdaaefe62c (patch) | |
tree | c5fb50f7fbf6ff20b581c1ad5b50f2e19e6d7584 /plugins | |
parent | a3314f483ec3250b322666a769a10197fb9dfff0 (diff) | |
parent | 4bb75d1c8e22b7bfc689a9e582ef846515a90383 (diff) |
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Facebook/locale/Facebook.pot (renamed from plugins/Facebook/locale/Facebook.po) | 0 | ||||
-rw-r--r-- | plugins/GeonamesPlugin.php | 18 | ||||
-rw-r--r-- | plugins/Gravatar/locale/Gravatar.pot (renamed from plugins/Gravatar/locale/Gravatar.po) | 0 | ||||
-rw-r--r-- | plugins/Mapstraction/locale/Mapstraction.pot (renamed from plugins/Mapstraction/locale/Mapstraction.po) | 0 | ||||
-rw-r--r-- | plugins/Meteor/MeteorPlugin.php | 20 | ||||
-rw-r--r-- | plugins/MobileProfile/MobileProfilePlugin.php | 36 | ||||
-rw-r--r-- | plugins/OStatus/locale/OStatus.pot (renamed from plugins/OStatus/locale/OStatus.po) | 0 | ||||
-rw-r--r-- | plugins/OStatus/scripts/fixup-shadow.php | 39 | ||||
-rw-r--r-- | plugins/OpenID/locale/OpenID.pot (renamed from plugins/OpenID/locale/OpenID.po) | 0 | ||||
-rw-r--r-- | plugins/PoweredByStatusNet/locale/PoweredByStatusNet.pot (renamed from plugins/PoweredByStatusNet/locale/PoweredByStatusNet.po) | 0 | ||||
-rw-r--r-- | plugins/RequireValidatedEmail/locale/RequireValidatedEmail.pot (renamed from plugins/RequireValidatedEmail/locale/RequireValidatedEmail.po) | 0 | ||||
-rw-r--r-- | plugins/Sample/locale/Sample.pot (renamed from plugins/Sample/locale/Sample.po) | 0 | ||||
-rw-r--r-- | plugins/TwitterBridge/locale/TwitterBridge.pot (renamed from plugins/TwitterBridge/locale/TwitterBridge.po) | 0 |
13 files changed, 97 insertions, 16 deletions
diff --git a/plugins/Facebook/locale/Facebook.po b/plugins/Facebook/locale/Facebook.pot index 4bc00248c..4bc00248c 100644 --- a/plugins/Facebook/locale/Facebook.po +++ b/plugins/Facebook/locale/Facebook.pot diff --git a/plugins/GeonamesPlugin.php b/plugins/GeonamesPlugin.php index f018e2694..718af9e0b 100644 --- a/plugins/GeonamesPlugin.php +++ b/plugins/GeonamesPlugin.php @@ -55,9 +55,13 @@ class GeonamesPlugin extends Plugin public $username = null; public $token = null; public $expiry = 7776000; // 90-day expiry + public $timeout = 2; // Web service timeout in seconds. + public $timeoutWindow = 60; // Further lookups in this process will be disabled for N seconds after a timeout. public $cachePrefix = null; // Optional shared memcache prefix override // to share lookups between local instances. + protected $lastTimeout = null; // timestamp of last web service timeout + /** * convert a name into a Location object * @@ -437,9 +441,21 @@ class GeonamesPlugin extends Plugin function getGeonames($method, $params) { + if ($this->lastTimeout && (time() - $this->lastTimeout < $this->timeoutWindow)) { + throw new Exception("skipping due to recent web service timeout"); + } + $client = HTTPClient::start(); + $client->setConfig('connect_timeout', $this->timeout); + $client->setConfig('timeout', $this->timeout); - $result = $client->get($this->wsUrl($method, $params)); + try { + $result = $client->get($this->wsUrl($method, $params)); + } catch (Exception $e) { + common_log(LOG_ERR, __METHOD__ . ": " . $e->getMessage()); + $this->lastTimeout = time(); + throw $e; + } if (!$result->isOk()) { throw new Exception("HTTP error code " . $result->code); diff --git a/plugins/Gravatar/locale/Gravatar.po b/plugins/Gravatar/locale/Gravatar.pot index d7275b929..d7275b929 100644 --- a/plugins/Gravatar/locale/Gravatar.po +++ b/plugins/Gravatar/locale/Gravatar.pot diff --git a/plugins/Mapstraction/locale/Mapstraction.po b/plugins/Mapstraction/locale/Mapstraction.pot index 1dd5dbbcc..1dd5dbbcc 100644 --- a/plugins/Mapstraction/locale/Mapstraction.po +++ b/plugins/Mapstraction/locale/Mapstraction.pot diff --git a/plugins/Meteor/MeteorPlugin.php b/plugins/Meteor/MeteorPlugin.php index 5b345d7c2..5600d5fcc 100644 --- a/plugins/Meteor/MeteorPlugin.php +++ b/plugins/Meteor/MeteorPlugin.php @@ -65,6 +65,26 @@ class MeteorPlugin extends RealtimePlugin parent::__construct(); } + /** + * Pull settings from config file/database if set. + */ + function initialize() + { + $settings = array('webserver', + 'webport', + 'controlport', + 'controlserver', + 'channelbase'); + foreach ($settings as $name) { + $val = common_config('meteor', $name); + if ($val !== false) { + $this->$name = $val; + } + } + + return parent::initialize(); + } + function _getScripts() { $scripts = parent::_getScripts(); diff --git a/plugins/MobileProfile/MobileProfilePlugin.php b/plugins/MobileProfile/MobileProfilePlugin.php index 0b37734b7..60bb3b68f 100644 --- a/plugins/MobileProfile/MobileProfilePlugin.php +++ b/plugins/MobileProfile/MobileProfilePlugin.php @@ -73,9 +73,11 @@ class MobileProfilePlugin extends WAP20Plugin $this->serveMobile = true; } else { // If they like the WAP 2.0 mimetype, serve them MP - if (strstr('application/vnd.wap.xhtml+xml', $type) !== false) { - $this->serveMobile = true; - } else { + // @fixme $type is undefined, making this if case useless and spewing errors. + // What's the intent? + //if (strstr('application/vnd.wap.xhtml+xml', $type) !== false) { + // $this->serveMobile = true; + //} else { // If they are a mobile device that supports WAP 2.0, // serve them MP @@ -139,8 +141,19 @@ class MobileProfilePlugin extends WAP20Plugin 'windows ce' ); + $blacklist = array( + 'ipad', // Larger screen handles the full theme fairly well. + ); + $httpuseragent = strtolower($_SERVER['HTTP_USER_AGENT']); + foreach ($blacklist as $md) { + if (strstr($httpuseragent, $md) !== false) { + $this->serveMobile = false; + return true; + } + } + foreach ($this->mobiledevices as $md) { if (strstr($httpuseragent, $md) !== false) { $this->setMobileFeatures($httpuseragent); @@ -149,7 +162,7 @@ class MobileProfilePlugin extends WAP20Plugin break; } } - } + //} // If they are okay with MP, and the site has a mobile server, // redirect there @@ -167,7 +180,9 @@ class MobileProfilePlugin extends WAP20Plugin return true; } - if (!$type) { + // @fixme $type is undefined, making this if case useless and spewing errors. + // What's the intent? + //if (!$type) { $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null; @@ -180,7 +195,7 @@ class MobileProfilePlugin extends WAP20Plugin throw new ClientException(_('This page is not available in a '. 'media type you accept'), 406); } - } + //} header('Content-Type: '.$type); @@ -221,9 +236,12 @@ class MobileProfilePlugin extends WAP20Plugin function onStartShowHeadElements($action) { - if (!$action->serveMobile) { - return true; - } + // @fixme nothing appears to set a serveMobile on any action, + // so this is useless and spews errors. Is this supposed to be + // checking $this? + //if (!$action->serveMobile) { + // return true; + //} $action->showTitle(); $action->showShortcutIcon(); diff --git a/plugins/OStatus/locale/OStatus.po b/plugins/OStatus/locale/OStatus.pot index 7e33a0eed..7e33a0eed 100644 --- a/plugins/OStatus/locale/OStatus.po +++ b/plugins/OStatus/locale/OStatus.pot diff --git a/plugins/OStatus/scripts/fixup-shadow.php b/plugins/OStatus/scripts/fixup-shadow.php index ec014c787..6522ca240 100644 --- a/plugins/OStatus/scripts/fixup-shadow.php +++ b/plugins/OStatus/scripts/fixup-shadow.php @@ -50,20 +50,47 @@ $encGroup = str_replace($marker, '%', $encGroup); $sql = "SELECT * FROM ostatus_profile WHERE uri LIKE '%s' OR uri LIKE '%s'"; $oprofile->query(sprintf($sql, $encProfile, $encGroup)); -echo "Found $oprofile->N bogus ostatus_profile entries for local users and groups:\n"; +$count = $oprofile->N; +echo "Found $count bogus ostatus_profile entries shadowing local users and groups:\n"; while ($oprofile->fetch()) { - echo "$oprofile->uri"; - + $uri = $oprofile->uri; + if (preg_match('!/group/(\d+)/id!', $oprofile->uri, $matches)) { + $id = intval($matches[1]); + $group = Local_group::staticGet('group_id', $id); + if ($group) { + $nick = $group->nickname; + } else { + $nick = '<deleted>'; + } + echo "group $id ($nick) hidden by $uri"; + } else if (preg_match('!/user/(\d+)!', $uri, $matches)) { + $id = intval($matches[1]); + $user = User::staticGet('id', $id); + if ($user) { + $nick = $user->nickname; + } else { + $nick = '<deleted>'; + } + echo "user $id ($nick) hidden by $uri"; + } else { + echo "$uri matched query, but we don't recognize it.\n"; + continue; + } + if ($dry) { - echo " (unchanged)\n"; + echo " - skipping\n"; } else { - echo " removing bogus ostatus_profile entry..."; + echo " - removing bogus ostatus_profile entry..."; $evil = clone($oprofile); $evil->delete(); echo " ok\n"; } } -echo "done.\n"; +if ($count && $dry) { + echo "NO CHANGES MADE -- To delete the bogus entries, run again without --dry-run option.\n"; +} else { + echo "done.\n"; +} diff --git a/plugins/OpenID/locale/OpenID.po b/plugins/OpenID/locale/OpenID.pot index 7ed879835..7ed879835 100644 --- a/plugins/OpenID/locale/OpenID.po +++ b/plugins/OpenID/locale/OpenID.pot diff --git a/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.po b/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.pot index 8f8434a85..8f8434a85 100644 --- a/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.po +++ b/plugins/PoweredByStatusNet/locale/PoweredByStatusNet.pot diff --git a/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.po b/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.pot index 49ac4f6f4..49ac4f6f4 100644 --- a/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.po +++ b/plugins/RequireValidatedEmail/locale/RequireValidatedEmail.pot diff --git a/plugins/Sample/locale/Sample.po b/plugins/Sample/locale/Sample.pot index a52c4ec01..a52c4ec01 100644 --- a/plugins/Sample/locale/Sample.po +++ b/plugins/Sample/locale/Sample.pot diff --git a/plugins/TwitterBridge/locale/TwitterBridge.po b/plugins/TwitterBridge/locale/TwitterBridge.pot index eff125579..eff125579 100644 --- a/plugins/TwitterBridge/locale/TwitterBridge.po +++ b/plugins/TwitterBridge/locale/TwitterBridge.pot |