diff --git a/lib/private/l10n.php b/lib/private/l10n.php index c9d9e8131b1d5b84df850b593896b532150afea7..40eeb98d6bb27bb6ce4536d08a5893aabfb0ca93 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 fd8c2c38ad0f07d4082b8b228f7ce00f3cdf5db4..47bdee4b0f8bbbbeec3d666efc7147c3c6bebbd4 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 21ccb686221669b1c7535259fc5080a6be15803e..a23149e796b52c82cb1cba564875565313114443 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 c228be6a0a34799b6a334c3127fac6821eae0f80..7649a1ea538bd12ea17527551458907c72e56907 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); } diff --git a/tests/lib/appframework/db/MapperTestUtility.php b/tests/lib/appframework/db/MapperTestUtility.php index 4c81d4cd27bdc849e74ec1e83af9070283b2db9f..fc0e5c2c445e6213aa758d69fc2a6cd064120cee 100644 --- a/tests/lib/appframework/db/MapperTestUtility.php +++ b/tests/lib/appframework/db/MapperTestUtility.php @@ -51,7 +51,7 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase { ->getMock(); $this->query = $this->getMock('Query', array('execute', 'bindValue')); - $this->pdoResult = $this->getMock('Result', array('fetchRow')); + $this->pdoResult = $this->getMock('Result', array('fetch')); $this->queryAt = 0; $this->prepareAt = 0; $this->iterators = array(); @@ -65,7 +65,7 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase { * @param array $arguments the expected arguments for the prepare query * method * @param array $returnRows the rows that should be returned for the result - * of the database query. If not provided, it wont be assumed that fetchRow + * of the database query. If not provided, it wont be assumed that fetch * will be called on the result */ protected function setMapperResult($sql, $arguments=array(), $returnRows=array(), @@ -77,7 +77,7 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase { $fetchAt = $this->fetchAt; $this->pdoResult->expects($this->any()) - ->method('fetchRow') + ->method('fetch') ->will($this->returnCallback( function() use ($iterators, $fetchAt){ $iterator = $iterators[$fetchAt];