diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-05-15 12:22:47 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-05-15 12:22:47 +0200 |
commit | 7abe3b1989c4645c1fc7604c562194308961fe40 (patch) | |
tree | 77ac6e2b8af5a85b0ccc0dd497ea268782b423be /lib | |
parent | 3daaf6ba4f3acd68fcefade97f622c08ee245d21 (diff) | |
parent | d8020c3506b3f09d090b427dcfa4c5a6ed3e0476 (diff) | |
download | nextcloud-server-7abe3b1989c4645c1fc7604c562194308961fe40.tar.gz nextcloud-server-7abe3b1989c4645c1fc7604c562194308961fe40.zip |
Merge pull request #8587 from Raydiation/master
Small cleanup and language detection for apps
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/l10n.php | 17 | ||||
-rw-r--r-- | lib/private/server.php | 2 | ||||
-rw-r--r-- | lib/public/appframework/db/mapper.php | 6 | ||||
-rw-r--r-- | lib/public/il10n.php | 14 |
4 files changed, 35 insertions, 4 deletions
diff --git a/lib/private/l10n.php b/lib/private/l10n.php index c9d9e8131b1..40eeb98d6bb 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -401,6 +401,23 @@ class OC_L10N implements \OCP\IL10N { self::$language = $lang; } + + /** + * @brief find the best language + * @param array|string $app details below + * @returns string language + * + * If $app is an array, ownCloud assumes that these are the available + * languages. Otherwise ownCloud tries to find the files in the l10n + * folder. + * + * If nothing works it returns 'en' + */ + public function getLanguageCode($app=null) { + return self::findLanguage($app); + } + + /** * @brief find the best language * @param array|string $app details below diff --git a/lib/private/server.php b/lib/private/server.php index fd8c2c38ad0..47bdee4b0f8 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -186,7 +186,7 @@ class Server extends SimpleContainer implements IServerContainer { } return $router; }); - $this['Db'] = $this->share(function($c){ + $this->registerService('Db', function($c){ return new Db(); }); } diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php index 21ccb686221..a23149e796b 100644 --- a/lib/public/appframework/db/mapper.php +++ b/lib/public/appframework/db/mapper.php @@ -225,12 +225,12 @@ abstract class Mapper { */ protected function findOneQuery($sql, array $params=array(), $limit=null, $offset=null){ $result = $this->execute($sql, $params, $limit, $offset); - $row = $result->fetchRow(); + $row = $result->fetch(); if($row === false || $row === null){ throw new DoesNotExistException('No matching entry found'); } - $row2 = $result->fetchRow(); + $row2 = $result->fetch(); //MDB2 returns null, PDO and doctrine false when no row is available if( ! ($row2 === false || $row2 === null )) { throw new MultipleObjectsReturnedException('More than one result'); @@ -264,7 +264,7 @@ abstract class Mapper { $entities = array(); - while($row = $result->fetchRow()){ + while($row = $result->fetch()){ $entities[] = $this->mapRowToEntity($row); } diff --git a/lib/public/il10n.php b/lib/public/il10n.php index c228be6a0a3..7649a1ea538 100644 --- a/lib/public/il10n.php +++ b/lib/public/il10n.php @@ -72,4 +72,18 @@ interface IL10N { * - params: timestamp (int/string) */ public function l($type, $data); + + + /** + * @brief find the best language + * @param array|string $app details below + * @returns string language + * + * If $app is an array, ownCloud assumes that these are the available + * languages. Otherwise ownCloud tries to find the files in the l10n + * folder. + * + * If nothing works it returns 'en' + */ + public function getLanguageCode($app=null); } |