summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/activitycontext.php5
-rw-r--r--lib/apiaction.php2
-rw-r--r--lib/installer.php2
-rw-r--r--lib/language.php7
-rw-r--r--lib/mysqlschema.php15
-rw-r--r--lib/schema.php37
-rw-r--r--lib/util.php10
7 files changed, 38 insertions, 40 deletions
diff --git a/lib/activitycontext.php b/lib/activitycontext.php
index 2df7613f7..5afbb7fd2 100644
--- a/lib/activitycontext.php
+++ b/lib/activitycontext.php
@@ -51,6 +51,7 @@ class ActivityContext
const POINT = 'point';
const ATTENTION = 'ostatus:attention';
+ const MENTIONED = 'mentioned';
const CONVERSATION = 'ostatus:conversation';
function __construct($element)
@@ -76,8 +77,12 @@ class ActivityContext
$linkRel = $link->getAttribute(ActivityUtils::REL);
+ // XXX: Deprecate this in favour of "mentioned" from Salmon spec
+ // http://salmon-protocol.googlecode.com/svn/trunk/draft-panzer-salmon-00.html#SALR
if ($linkRel == self::ATTENTION) {
$this->attention[] = $link->getAttribute(self::HREF);
+ } elseif ($linkRel == self::MENTIONED) {
+ $this->attention[] = $link->getAttribute(self::HREF);
}
}
}
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 7868ecab1..479a86ad8 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -27,7 +27,7 @@
* @author Jeffery To <jeffery.to@gmail.com>
* @author Toby Inkster <mail@tobyinkster.co.uk>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-2010 StatusNet, Inc.
* @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
diff --git a/lib/installer.php b/lib/installer.php
index bd9d69cd4..ff2bed140 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -91,7 +91,7 @@ abstract class Installer
}
if (version_compare(PHP_VERSION, '5.2.3', '<')) {
- $errors[] = 'Require PHP version 5.2.3 or greater.';
+ $this->warning('Require PHP version 5.2.3 or greater.');
$pass = false;
}
diff --git a/lib/language.php b/lib/language.php
index 1805707ad..d93e4e0ad 100644
--- a/lib/language.php
+++ b/lib/language.php
@@ -213,16 +213,16 @@ function _mdomain($backtrace)
$plug = strpos($path, '/plugins/');
if ($plug === false) {
// We're not in a plugin; return default domain.
- return 'statusnet';
+ $final = 'statusnet';
} else {
$cut = $plug + 9;
$cut2 = strpos($path, '/', $cut);
if ($cut2) {
- $cached[$path] = substr($path, $cut, $cut2 - $cut);
+ $final = substr($path, $cut, $cut2 - $cut);
} else {
// We might be running directly from the plugins dir?
// If so, there's no place to store locale info.
- return 'statusnet';
+ $final = 'statusnet';
}
}
$cached[$path] = $final;
@@ -307,6 +307,7 @@ function get_all_languages() {
'br' => array('q' => 0.8, 'lang' => 'br', 'name' => 'Breton', 'direction' => 'ltr'),
'ca' => array('q' => 0.5, 'lang' => 'ca', 'name' => 'Catalan', 'direction' => 'ltr'),
'cs' => array('q' => 0.5, 'lang' => 'cs', 'name' => 'Czech', 'direction' => 'ltr'),
+ 'da' => array('q' => 0.8, 'lang' => 'da', 'name' => 'Danish', 'direction' => 'ltr'),
'de' => array('q' => 0.8, 'lang' => 'de', 'name' => 'German', 'direction' => 'ltr'),
'el' => array('q' => 0.1, 'lang' => 'el', 'name' => 'Greek', 'direction' => 'ltr'),
'en-us' => array('q' => 1, 'lang' => 'en', 'name' => 'English (US)', 'direction' => 'ltr'),
diff --git a/lib/mysqlschema.php b/lib/mysqlschema.php
index 455695366..464c718f9 100644
--- a/lib/mysqlschema.php
+++ b/lib/mysqlschema.php
@@ -50,21 +50,6 @@ class MysqlSchema extends Schema
static $_single = null;
protected $conn = null;
- /**
- * Constructor. Only run once for singleton object.
- */
-
- protected function __construct()
- {
- // XXX: there should be an easier way to do this.
- $user = new User();
-
- $this->conn = $user->getDatabaseConnection();
-
- $user->free();
-
- unset($user);
- }
/**
* Main public entry point. Use this to get
diff --git a/lib/schema.php b/lib/schema.php
index 1503c96d4..e5def514e 100644
--- a/lib/schema.php
+++ b/lib/schema.php
@@ -47,40 +47,47 @@ if (!defined('STATUSNET')) {
class Schema
{
- static $_single = null;
+ static $_static = null;
protected $conn = null;
/**
* Constructor. Only run once for singleton object.
*/
- protected function __construct()
+ protected function __construct($conn = null)
{
- // XXX: there should be an easier way to do this.
- $user = new User();
-
- $this->conn = $user->getDatabaseConnection();
-
- $user->free();
+ if (is_null($conn)) {
+ // XXX: there should be an easier way to do this.
+ $user = new User();
+ $conn = $user->getDatabaseConnection();
+ $user->free();
+ unset($user);
+ }
- unset($user);
+ $this->conn = $conn;
}
/**
* Main public entry point. Use this to get
- * the singleton object.
+ * the schema object.
*
- * @return Schema the (single) Schema object
+ * @return Schema the Schema object for the connection
*/
- static function get()
+ static function get($conn = null)
{
+ if (is_null($conn)) {
+ $key = 'default';
+ } else {
+ $key = md5(serialize($conn->dsn));
+ }
+
$type = common_config('db', 'type');
- if (empty(self::$_single)) {
+ if (empty(self::$_static[$key])) {
$schemaClass = ucfirst($type).'Schema';
- self::$_single = new $schemaClass();
+ self::$_static[$key] = new $schemaClass($conn);
}
- return self::$_single;
+ return self::$_static[$key];
}
/**
diff --git a/lib/util.php b/lib/util.php
index 2a90b56a9..9f62097d5 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -88,8 +88,8 @@ function common_init_language()
// don't do the job. en_US.UTF-8 should be there most of the
// time, but not guaranteed.
$ok = common_init_locale("en_US");
- if (!$ok) {
- // Try to find a complete, working locale...
+ if (!$ok && strtolower(substr(PHP_OS, 0, 3)) != 'win') {
+ // Try to find a complete, working locale on Unix/Linux...
// @fixme shelling out feels awfully inefficient
// but I don't think there's a more standard way.
$all = `locale -a`;
@@ -101,9 +101,9 @@ function common_init_language()
}
}
}
- if (!$ok) {
- common_log(LOG_ERR, "Unable to find a UTF-8 locale on this system; UI translations may not work.");
- }
+ }
+ if (!$ok) {
+ common_log(LOG_ERR, "Unable to find a UTF-8 locale on this system; UI translations may not work.");
}
$locale_set = common_init_locale($language);
}