summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php10
-rw-r--r--lib/cache/file.php16
-rw-r--r--lib/db.php443
-rw-r--r--lib/db/adapter.php72
-rw-r--r--lib/db/adapteroci8.php28
-rw-r--r--lib/db/adapterpgsql.php23
-rw-r--r--lib/db/adaptersqlite.php60
-rw-r--r--lib/db/adaptersqlsrv.php28
-rw-r--r--lib/db/connection.php197
-rw-r--r--lib/db/mdb2schemamanager.php (renamed from lib/db/schema.php)90
-rw-r--r--lib/db/statementwrapper.php4
-rw-r--r--lib/files/cache/scanner.php4
-rw-r--r--lib/group.php2
-rw-r--r--lib/l10n.php167
-rw-r--r--lib/l10n/af_ZA.php5
-rw-r--r--lib/l10n/ar.php5
-rw-r--r--lib/l10n/bg_BG.php5
-rw-r--r--lib/l10n/bn_BD.php5
-rw-r--r--lib/l10n/ca.php5
-rw-r--r--lib/l10n/cs_CZ.php39
-rw-r--r--lib/l10n/cy_GB.php5
-rw-r--r--lib/l10n/da.php5
-rw-r--r--lib/l10n/de.php5
-rw-r--r--lib/l10n/de_CH.php58
-rw-r--r--lib/l10n/de_DE.php5
-rw-r--r--lib/l10n/el.php9
-rw-r--r--lib/l10n/en@pirate.php4
-rw-r--r--lib/l10n/eo.php5
-rw-r--r--lib/l10n/es.php5
-rw-r--r--lib/l10n/es_AR.php5
-rw-r--r--lib/l10n/et_EE.php5
-rw-r--r--lib/l10n/eu.php5
-rw-r--r--lib/l10n/fa.php5
-rw-r--r--lib/l10n/fi.php4
-rw-r--r--lib/l10n/fi_FI.php5
-rw-r--r--lib/l10n/fr.php5
-rw-r--r--lib/l10n/gl.php5
-rw-r--r--lib/l10n/he.php5
-rw-r--r--lib/l10n/hi.php7
-rw-r--r--lib/l10n/hr.php5
-rw-r--r--lib/l10n/hu_HU.php5
-rw-r--r--lib/l10n/ia.php5
-rw-r--r--lib/l10n/id.php5
-rw-r--r--lib/l10n/is.php5
-rw-r--r--lib/l10n/it.php5
-rw-r--r--lib/l10n/ja_JP.php9
-rw-r--r--lib/l10n/ka.php4
-rw-r--r--lib/l10n/ka_GE.php5
-rw-r--r--lib/l10n/ko.php5
-rw-r--r--lib/l10n/ku_IQ.php5
-rw-r--r--lib/l10n/lb.php5
-rw-r--r--lib/l10n/lt_LT.php5
-rw-r--r--lib/l10n/lv.php5
-rw-r--r--lib/l10n/mk.php5
-rw-r--r--lib/l10n/ms_MY.php5
-rw-r--r--lib/l10n/my_MM.php5
-rw-r--r--lib/l10n/nb_NO.php5
-rw-r--r--lib/l10n/nl.php5
-rw-r--r--lib/l10n/nn_NO.php5
-rw-r--r--lib/l10n/oc.php5
-rw-r--r--lib/l10n/pl.php5
-rw-r--r--lib/l10n/pl_PL.php4
-rw-r--r--lib/l10n/pt_BR.php5
-rw-r--r--lib/l10n/pt_PT.php5
-rw-r--r--lib/l10n/ro.php5
-rw-r--r--lib/l10n/ru.php5
-rw-r--r--lib/l10n/ru_RU.php4
-rw-r--r--lib/l10n/si_LK.php5
-rw-r--r--lib/l10n/sk_SK.php9
-rw-r--r--lib/l10n/sl.php5
-rw-r--r--lib/l10n/sq.php5
-rw-r--r--lib/l10n/sr.php5
-rw-r--r--lib/l10n/sr@latin.php5
-rw-r--r--lib/l10n/string.php39
-rw-r--r--lib/l10n/sv.php5
-rw-r--r--lib/l10n/ta_LK.php5
-rw-r--r--lib/l10n/te.php4
-rw-r--r--lib/l10n/th_TH.php5
-rw-r--r--lib/l10n/tr.php5
-rw-r--r--lib/l10n/ug.php5
-rw-r--r--lib/l10n/uk.php5
-rw-r--r--lib/l10n/ur_PK.php5
-rw-r--r--lib/l10n/vi.php5
-rw-r--r--lib/l10n/zh_CN.GB2312.php5
-rw-r--r--lib/l10n/zh_CN.php5
-rw-r--r--lib/l10n/zh_HK.php5
-rw-r--r--lib/l10n/zh_TW.php5
-rw-r--r--lib/template/functions.php10
-rw-r--r--lib/user.php1
89 files changed, 1078 insertions, 571 deletions
diff --git a/lib/app.php b/lib/app.php
index 2437896157a..5fa650044f3 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -401,15 +401,7 @@ class OC_App{
// if the user is an admin
if(OC_User::isAdminUser(OC_User::getUser())) {
- // admin apps menu
- $settings[] = array(
- "id" => "core_apps",
- "order" => 3,
- "href" => OC_Helper::linkToRoute( "settings_apps" ).'?installed',
- "name" => $l->t("Apps"),
- "icon" => OC_Helper::imagePath( "settings", "apps.svg" )
- );
-
+ // admin settings
$settings[]=array(
"id" => "admin",
"order" => 1000,
diff --git a/lib/cache/file.php b/lib/cache/file.php
index 531e1d50f40..ba3dedaf8f3 100644
--- a/lib/cache/file.php
+++ b/lib/cache/file.php
@@ -29,22 +29,30 @@ class OC_Cache_File{
}
public function get($key) {
+ $result = null;
+ $proxyStatus = \OC_FileProxy::$enabled;
+ \OC_FileProxy::$enabled = false;
if ($this->hasKey($key)) {
$storage = $this->getStorage();
- return $storage->file_get_contents($key);
+ $result = $storage->file_get_contents($key);
}
- return null;
+ \OC_FileProxy::$enabled = $proxyStatus;
+ return $result;
}
public function set($key, $value, $ttl=0) {
$storage = $this->getStorage();
+ $result = false;
+ $proxyStatus = \OC_FileProxy::$enabled;
+ \OC_FileProxy::$enabled = false;
if ($storage and $storage->file_put_contents($key, $value)) {
if ($ttl === 0) {
$ttl = 86400; // 60*60*24
}
- return $storage->touch($key, time() + $ttl);
+ $result = $storage->touch($key, time() + $ttl);
}
- return false;
+ \OC_FileProxy::$enabled = $proxyStatus;
+ return $result;
}
public function hasKey($key) {
diff --git a/lib/db.php b/lib/db.php
index 311cdcfecf5..ebd012c72f8 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -41,68 +41,25 @@ class DatabaseException extends Exception {
* Doctrine with some adaptions.
*/
class OC_DB {
- const BACKEND_DOCTRINE=2;
-
- static private $preparedQueries = array();
- static private $cachingEnabled = true;
-
/**
- * @var \Doctrine\DBAL\Connection
+ * @var \OC\DB\Connection $connection
*/
- static private $connection; //the preferred connection to use, only Doctrine
- static private $backend=null;
- /**
- * @var \Doctrine\DBAL\Connection
- */
- static private $DOCTRINE=null;
+ static private $connection; //the prefered connection to use, only Doctrine
static private $prefix=null;
static private $type=null;
/**
- * check which backend we should use
- * @return int BACKEND_DOCTRINE
- */
- private static function getDBBackend() {
- return self::BACKEND_DOCTRINE;
- }
-
- /**
* @brief connects to the database
- * @param int $backend
* @return bool true if connection can be established or false on error
*
* Connects to the database as specified in config.php
*/
- public static function connect($backend=null) {
+ public static function connect() {
if(self::$connection) {
return true;
}
- if(is_null($backend)) {
- $backend=self::getDBBackend();
- }
- if($backend==self::BACKEND_DOCTRINE) {
- $success = self::connectDoctrine();
- self::$connection=self::$DOCTRINE;
- self::$backend=self::BACKEND_DOCTRINE;
- }
- return $success;
- }
- /**
- * connect to the database using doctrine
- *
- * @return bool
- */
- public static function connectDoctrine() {
- if(self::$connection) {
- if(self::$backend!=self::BACKEND_DOCTRINE) {
- self::disconnect();
- } else {
- return true;
- }
- }
- self::$preparedQueries = array();
// The global data we need
$name = OC_Config::getValue( "dbname", "owncloud" );
$host = OC_Config::getValue( "dbhost", "" );
@@ -116,7 +73,7 @@ class OC_DB {
}
// do nothing if the connection already has been established
- if(!self::$DOCTRINE) {
+ if (!self::$connection) {
$config = new \Doctrine\DBAL\Configuration();
switch($type) {
case 'sqlite':
@@ -128,6 +85,7 @@ class OC_DB {
'path' => $datadir.'/'.$name.'.db',
'driver' => 'pdo_sqlite',
);
+ $connectionParams['adapter'] = '\OC\DB\AdapterSqlite';
break;
case 'mysql':
$connectionParams = array(
@@ -139,6 +97,7 @@ class OC_DB {
'charset' => 'UTF8',
'driver' => 'pdo_mysql',
);
+ $connectionParams['adapter'] = '\OC\DB\Adapter';
break;
case 'pgsql':
$connectionParams = array(
@@ -149,6 +108,7 @@ class OC_DB {
'dbname' => $name,
'driver' => 'pdo_pgsql',
);
+ $connectionParams['adapter'] = '\OC\DB\AdapterPgSql';
break;
case 'oci':
$connectionParams = array(
@@ -162,6 +122,7 @@ class OC_DB {
if (!empty($port)) {
$connectionParams['port'] = $port;
}
+ $connectionParams['adapter'] = '\OC\DB\AdapterOCI8';
break;
case 'mssql':
$connectionParams = array(
@@ -173,12 +134,20 @@ class OC_DB {
'charset' => 'UTF8',
'driver' => 'pdo_sqlsrv',
);
+ $connectionParams['adapter'] = '\OC\DB\AdapterSQLSrv';
break;
default:
return false;
}
+ $connectionParams['wrapperClass'] = 'OC\DB\Connection';
+ $connectionParams['tablePrefix'] = OC_Config::getValue('dbtableprefix', 'oc_' );
try {
- self::$DOCTRINE = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
+ self::$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
+ if ($type === 'sqlite' || $type === 'sqlite3') {
+ // Sqlite doesn't handle query caching and schema changes
+ // TODO: find a better way to handle this
+ self::$connection->disableQueryStatementCaching();
+ }
} catch(\Doctrine\DBAL\DBALException $e) {
OC_Log::write('core', $e->getMessage(), OC_Log::FATAL);
OC_User::setUserId(null);
@@ -194,6 +163,24 @@ class OC_DB {
}
/**
+ * @return \OC\DB\Connection
+ */
+ static public function getConnection() {
+ self::connect();
+ return self::$connection;
+ }
+
+ /**
+ * get MDB2 schema manager
+ *
+ * @return \OC\DB\MDB2SchemaManager
+ */
+ private static function getMDB2SchemaManager()
+ {
+ return new \OC\DB\MDB2SchemaManager(self::getConnection());
+ }
+
+ /**
* @brief Prepare a SQL query
* @param string $query Query string
* @param int $limit
@@ -205,25 +192,6 @@ class OC_DB {
* SQL query via Doctrine prepare(), needs to be execute()'d!
*/
static public function prepare( $query , $limit = null, $offset = null, $isManipulation = null) {
-
- if (!is_null($limit) && $limit != -1) {
- if ($limit === -1) {
- $limit = null;
- }
- $platform = self::$connection->getDatabasePlatform();
- $query = $platform->modifyLimitQuery($query, $limit, $offset);
- } else {
- if (isset(self::$preparedQueries[$query]) and self::$cachingEnabled) {
- return self::$preparedQueries[$query];
- }
- }
- $rawQuery = $query;
-
- // Optimize the query
- $query = self::processQuery( $query );
- if(OC_Config::getValue( "log_query", false)) {
- OC_Log::write('core', 'DB prepare : '.$query, OC_Log::DEBUG);
- }
self::connect();
if ($isManipulation === null) {
@@ -232,45 +200,38 @@ class OC_DB {
}
// return the result
- if (self::$backend == self::BACKEND_DOCTRINE) {
- try {
- $result=self::$connection->prepare($query);
- } catch(\Doctrine\DBAL\DBALException $e) {
- throw new \DatabaseException($e->getMessage(), $query);
- }
- // differentiate between query and manipulation
- $result=new OC_DB_StatementWrapper($result, $isManipulation);
- }
- if ((is_null($limit) || $limit == -1) and self::$cachingEnabled ) {
- $type = OC_Config::getValue( "dbtype", "sqlite" );
- if( $type != 'sqlite' && $type != 'sqlite3' ) {
- self::$preparedQueries[$rawQuery] = $result;
- }
+ try {
+ $result = self::$connection->prepare($query, $limit, $offset);
+ } catch (\Doctrine\DBAL\DBALException $e) {
+ throw new \DatabaseException($e->getMessage(), $query);
}
+ // differentiate between query and manipulation
+ $result = new OC_DB_StatementWrapper($result, $isManipulation);
return $result;
}
-
+
/**
* tries to guess the type of statement based on the first 10 characters
* the current check allows some whitespace but does not work with IF EXISTS or other more complex statements
*
* @param string $sql
+ * @return bool
*/
static public function isManipulation( $sql ) {
- $selectOccurence = stripos ($sql, "SELECT");
- if ($selectOccurence !== false && $selectOccurence < 10) {
+ $selectOccurrence = stripos($sql, 'SELECT');
+ if ($selectOccurrence !== false && $selectOccurrence < 10) {
return false;
}
- $insertOccurence = stripos ($sql, "INSERT");
- if ($insertOccurence !== false && $insertOccurence < 10) {
+ $insertOccurrence = stripos($sql, 'INSERT');
+ if ($insertOccurrence !== false && $insertOccurrence < 10) {
return true;
}
- $updateOccurence = stripos ($sql, "UPDATE");
- if ($updateOccurence !== false && $updateOccurence < 10) {
+ $updateOccurrence = stripos($sql, 'UPDATE');
+ if ($updateOccurrence !== false && $updateOccurrence < 10) {
return true;
}
- $deleteOccurance = stripos ($sql, "DELETE");
- if ($deleteOccurance !== false && $deleteOccurance < 10) {
+ $deleteOccurrence = stripos($sql, 'DELETE');
+ if ($deleteOccurrence !== false && $deleteOccurrence < 10) {
return true;
}
return false;
@@ -288,7 +249,7 @@ class OC_DB {
static public function executeAudited( $stmt, array $parameters = null) {
if (is_string($stmt)) {
// convert to an array with 'sql'
- if (stripos($stmt,'LIMIT') !== false) { //OFFSET requires LIMIT, se we only neet to check for LIMIT
+ if (stripos($stmt, 'LIMIT') !== false) { //OFFSET requires LIMIT, so we only need to check for LIMIT
// TODO try to convert LIMIT OFFSET notation to parameters, see fixLimitClauseForMSSQL
$message = 'LIMIT and OFFSET are forbidden for portability reasons,'
. ' pass an array with \'limit\' and \'offset\' instead';
@@ -296,7 +257,7 @@ class OC_DB {
}
$stmt = array('sql' => $stmt, 'limit' => null, 'offset' => null);
}
- if (is_array($stmt)){
+ if (is_array($stmt)) {
// convert to prepared statement
if ( ! array_key_exists('sql', $stmt) ) {
$message = 'statement array must at least contain key \'sql\'';
@@ -338,65 +299,59 @@ class OC_DB {
*/
public static function insertid($table=null) {
self::connect();
- $type = OC_Config::getValue( "dbtype", "sqlite" );
- if( $type === 'pgsql' ) {
- $result = self::executeAudited('SELECT lastval() AS id');
- $row = $result->fetchRow();
- self::raiseExceptionOnError($row, 'fetching row for insertid failed');
- return (int)$row['id'];
- } else if( $type === 'mssql') {
- if($table !== null) {
- $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
- $table = str_replace( '*PREFIX*', $prefix, $table );
- }
- return self::$connection->lastInsertId($table);
- }
- if( $type === 'oci' ) {
- if($table !== null) {
- $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
- $suffix = '_SEQ';
- $table = '"'.str_replace( '*PREFIX*', $prefix, $table ).$suffix.'"';
- }
- return self::$connection->lastInsertId($table);
- } else {
- if($table !== null) {
- $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
- $suffix = OC_Config::getValue( "dbsequencesuffix", "_id_seq" );
- $table = str_replace( '*PREFIX*', $prefix, $table ).$suffix;
- }
- $result = self::$connection->lastInsertId($table);
- }
- self::raiseExceptionOnError($result, 'insertid failed');
- return (int)$result;
+ return self::$connection->lastInsertId($table);
+ }
+
+ /**
+ * @brief Insert a row if a matching row doesn't exists.
+ * @param string $table. The table to insert into in the form '*PREFIX*tableName'
+ * @param array $input. An array of fieldname/value pairs
+ * @return int number of updated rows
+ */
+ public static function insertIfNotExist($table, $input) {
+ self::connect();
+ return self::$connection->insertIfNotExist($table, $input);
+ }
+
+ /**
+ * Start a transaction
+ */
+ public static function beginTransaction() {
+ self::connect();
+ self::$connection->beginTransaction();
+ }
+
+ /**
+ * Commit the database changes done during a transaction that is in progress
+ */
+ public static function commit() {
+ self::connect();
+ self::$connection->commit();
}
/**
* @brief Disconnect
- * @return bool
*
* This is good bye, good bye, yeah!
*/
public static function disconnect() {
// Cut connection if required
if(self::$connection) {
- self::$connection=false;
- self::$DOCTRINE=false;
+ self::$connection->close();
}
-
- return true;
}
- /** else {
- * @brief saves database scheme to xml file
+ /**
+ * @brief saves database schema to xml file
* @param string $file name of file
* @param int $mode
* @return bool
*
* TODO: write more documentation
*/
- public static function getDbStructure( $file, $mode=MDB2_SCHEMA_DUMP_STRUCTURE) {
- self::connectDoctrine();
- return OC_DB_Schema::getDbStructure(self::$DOCTRINE, $file);
+ public static function getDbStructure( $file, $mode = 0) {
+ $schemaManager = self::getMDB2SchemaManager();
+ return $schemaManager->getDbStructure($file);
}
/**
@@ -407,20 +362,21 @@ class OC_DB {
* TODO: write more documentation
*/
public static function createDbFromStructure( $file ) {
- self::connectDoctrine();
- return OC_DB_Schema::createDbFromStructure(self::$DOCTRINE, $file);
+ $schemaManager = self::getMDB2SchemaManager();
+ $result = $schemaManager->createDbFromStructure($file);
+ return $result;
}
/**
- * @brief update the database scheme
+ * @brief update the database schema
* @param string $file file to read structure from
* @throws Exception
* @return bool
*/
public static function updateDbFromStructure($file) {
- self::connectDoctrine();
+ $schemaManager = self::getMDB2SchemaManager();
try {
- $result = OC_DB_Schema::updateDbFromStructure(self::$DOCTRINE, $file);
+ $result = $schemaManager->updateDbFromStructure($file);
} catch (Exception $e) {
OC_Log::write('core', 'Failed to update database structure ('.$e.')', OC_Log::FATAL);
throw $e;
@@ -429,178 +385,12 @@ class OC_DB {
}
/**
- * @brief Insert a row if a matching row doesn't exists.
- * @param string $table. The table to insert into in the form '*PREFIX*tableName'
- * @param array $input. An array of fieldname/value pairs
- * @returns int number of updated rows
- */
- public static function insertIfNotExist($table, $input) {
- self::connect();
- $prefix = OC_Config::getValue( "dbtableprefix", "oc_" );
- $table = str_replace( '*PREFIX*', $prefix, $table );
-
- if(is_null(self::$type)) {
- self::$type=OC_Config::getValue( "dbtype", "sqlite" );
- }
- $type = self::$type;
-
- $query = '';
- $inserts = array_values($input);
- // differences in escaping of table names ('`' for mysql) and getting the current timestamp
- if( $type == 'sqlite' || $type == 'sqlite3' ) {
- // NOTE: For SQLite we have to use this clumsy approach
- // otherwise all fieldnames used must have a unique key.
- $query = 'SELECT * FROM `' . $table . '` WHERE ';
- foreach($input as $key => $value) {
- $query .= '`' . $key . '` = ? AND ';
- }
- $query = substr($query, 0, strlen($query) - 5);
- try {
- $result = self::executeAudited($query, $inserts);
- } catch(DatabaseException $e) {
- OC_Template::printExceptionErrorPage( $e );
- }
-
- if((int)$result->numRows() === 0) {
- $query = 'INSERT INTO `' . $table . '` (`'
- . implode('`,`', array_keys($input)) . '`) VALUES('
- . str_repeat('?,', count($input)-1).'? ' . ')';
- } else {
- return 0; //no rows updated
- }
- } elseif( $type == 'pgsql' || $type == 'oci' || $type == 'mysql' || $type == 'mssql') {
- $query = 'INSERT INTO `' .$table . '` (`'
- . implode('`,`', array_keys($input)) . '`) SELECT '
- . str_repeat('?,', count($input)-1).'? ' // Is there a prettier alternative?
- . 'FROM `' . $table . '` WHERE ';
-
- foreach($input as $key => $value) {
- $query .= '`' . $key . '` = ? AND ';
- }
- $query = substr($query, 0, strlen($query) - 5);
- $query .= ' HAVING COUNT(*) = 0';
- $inserts = array_merge($inserts, $inserts);
- }
-
- try {
- $result = self::executeAudited($query, $inserts);
- } catch(\Doctrine\DBAL\DBALException $e) {
- OC_Template::printExceptionErrorPage( $e );
- }
-
- return $result;
- }
-
- /**
- * @brief does minor changes to query
- * @param string $query Query string
- * @return string corrected query string
- *
- * This function replaces *PREFIX* with the value of $CONFIG_DBTABLEPREFIX
- * and replaces the ` with ' or " according to the database driver.
- */
- private static function processQuery( $query ) {
- self::connect();
- // We need Database type and table prefix
- if(is_null(self::$type)) {
- self::$type=OC_Config::getValue( "dbtype", "sqlite" );
- }
- $type = self::$type;
- if(is_null(self::$prefix)) {
- self::$prefix=OC_Config::getValue( "dbtableprefix", "oc_" );
- }
- $prefix = self::$prefix;
-
- // differences in escaping of table names ('`' for mysql) and getting the current timestamp
- if( $type == 'sqlite' || $type == 'sqlite3' ) {
- $query = str_replace( '`', '"', $query );
- $query = str_ireplace( 'NOW()', 'datetime(\'now\')', $query );
- $query = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $query );
- } elseif( $type == 'pgsql' ) {
- $query = str_replace( '`', '"', $query );
- $query = str_ireplace( 'UNIX_TIMESTAMP()', 'cast(extract(epoch from current_timestamp) as integer)',
- $query );
- } elseif( $type == 'oci' ) {
- $query = str_replace( '`', '"', $query );
- $query = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $query );
- $query = str_ireplace( 'UNIX_TIMESTAMP()', "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400", $query );
- }elseif( $type == 'mssql' ) {
- $query = preg_replace( "/\`(.*?)`/", "[$1]", $query );
- $query = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $query );
- $query = str_replace( 'LENGTH(', 'LEN(', $query );
- $query = str_replace( 'SUBSTR(', 'SUBSTRING(', $query );
- $query = str_ireplace( 'UNIX_TIMESTAMP()', 'DATEDIFF(second,{d \'1970-01-01\'},GETDATE())', $query );
-
- $query = self::fixLimitClauseForMSSQL($query);
- }
-
- // replace table name prefix
- $query = str_replace( '*PREFIX*', $prefix, $query );
-
- return $query;
- }
-
- private static function fixLimitClauseForMSSQL($query) {
- $limitLocation = stripos ($query, "LIMIT");
-
- if ( $limitLocation === false ) {
- return $query;
- }
-
- // total == 0 means all results - not zero results
- //
- // First number is either total or offset, locate it by first space
- //
- $offset = substr ($query, $limitLocation + 5);
- $offset = substr ($offset, 0, stripos ($offset, ' '));
- $offset = trim ($offset);
-
- // check for another parameter
- if (stripos ($offset, ',') === false) {
- // no more parameters
- $offset = 0;
- $total = intval ($offset);
- } else {
- // found another parameter
- $offset = intval ($offset);
-
- $total = substr ($query, $limitLocation + 5);
- $total = substr ($total, stripos ($total, ','));
-
- $total = substr ($total, 0, stripos ($total, ' '));
- $total = intval ($total);
- }
-
- $query = trim (substr ($query, 0, $limitLocation));
-
- if ($offset == 0 && $total !== 0) {
- if (strpos($query, "SELECT") === false) {
- $query = "TOP {$total} " . $query;
- } else {
- $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP '.$total, $query);
- }
- } else if ($offset > 0) {
- $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP(10000000) ', $query);
- $query = 'SELECT *
- FROM (SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3
- FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3';
-
- if ($total > 0) {
- $query .= ' WHERE line3 BETWEEN ' . ($offset + 1) . ' AND ' . ($offset + $total);
- } else {
- $query .= ' WHERE line3 > ' . $offset;
- }
- }
- return $query;
- }
-
- /**
* @brief drop a table
* @param string $tableName the table to drop
*/
public static function dropTable($tableName) {
- self::connectDoctrine();
- OC_DB_Schema::dropTable(self::$DOCTRINE, $tableName);
+ $schemaManager = self::getMDB2SchemaManager();
+ $schemaManager->dropTable($tableName);
}
/**
@@ -608,8 +398,8 @@ class OC_DB {
* @param string $file the xml file describing the tables
*/
public static function removeDBStructure($file) {
- self::connectDoctrine();
- OC_DB_Schema::removeDBStructure(self::$DOCTRINE, $file);
+ $schemaManager = self::getMDB2SchemaManager();
+ $schemaManager->removeDBStructure($file);
}
/**
@@ -617,24 +407,8 @@ class OC_DB {
* @param $file string path to the MDB2 xml db export file
*/
public static function replaceDB( $file ) {
- self::connectDoctrine();
- OC_DB_Schema::replaceDB(self::$DOCTRINE, $file);
- }
-
- /**
- * Start a transaction
- */
- public static function beginTransaction() {
- self::connect();
- self::$connection->beginTransaction();
- }
-
- /**
- * Commit the database changes done during a transaction that is in progress
- */
- public static function commit() {
- self::connect();
- self::$connection->commit();
+ $schemaManager = self::getMDB2SchemaManager();
+ $schemaManager->replaceDB($file);
}
/**
@@ -675,17 +449,9 @@ class OC_DB {
* @return string
*/
public static function getErrorMessage($error) {
- if (self::$backend==self::BACKEND_DOCTRINE and self::$DOCTRINE) {
- $msg = self::$DOCTRINE->errorCode() . ': ';
- $errorInfo = self::$DOCTRINE->errorInfo();
- if (is_array($errorInfo)) {
- $msg .= 'SQLSTATE = '.$errorInfo[0] . ', ';
- $msg .= 'Driver Code = '.$errorInfo[1] . ', ';
- $msg .= 'Driver Message = '.$errorInfo[2];
- }
- return $msg;
+ if (self::$connection) {
+ return self::$connection->getError();
}
-
return '';
}
@@ -693,9 +459,10 @@ class OC_DB {
* @param bool $enabled
*/
static public function enableCaching($enabled) {
- if (!$enabled) {
- self::$preparedQueries = array();
+ if ($enabled) {
+ self::$connection->enableQueryStatementCaching();
+ } else {
+ self::$connection->disableQueryStatementCaching();
}
- self::$cachingEnabled = $enabled;
}
}
diff --git a/lib/db/adapter.php b/lib/db/adapter.php
new file mode 100644
index 00000000000..6b31f37dd98
--- /dev/null
+++ b/lib/db/adapter.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\DB;
+
+/**
+ * This handles the way we use to write queries, into something that can be
+ * handled by the database abstraction layer.
+ */
+class Adapter {
+
+ /**
+ * @var \OC\DB\Connection $conn
+ */
+ protected $conn;
+
+ public function __construct($conn) {
+ $this->conn = $conn;
+ }
+
+ /**
+ * @param string $table name
+ * @return int id of last insert statement
+ */
+ public function lastInsertId($table) {
+ return $this->conn->realLastInsertId($table);
+ }
+
+ /**
+ * @param string $statement that needs to be changed so the db can handle it
+ * @return string changed statement
+ */
+ public function fixupStatement($statement) {
+ return $statement;
+ }
+
+ /**
+ * @brief insert the @input values when they do not exist yet
+ * @param string $table name
+ * @param array $input key->value pairs
+ * @return int count of inserted rows
+ */
+ public function insertIfNotExist($table, $input) {
+ $query = 'INSERT INTO `' .$table . '` (`'
+ . implode('`,`', array_keys($input)) . '`) SELECT '
+ . str_repeat('?,', count($input)-1).'? ' // Is there a prettier alternative?
+ . 'FROM `' . $table . '` WHERE ';
+
+ foreach($input as $key => $value) {
+ $query .= '`' . $key . '` = ? AND ';
+ }
+ $query = substr($query, 0, strlen($query) - 5);
+ $query .= ' HAVING COUNT(*) = 0';
+ $inserts = array_values($input);
+ $inserts = array_merge($inserts, $inserts);
+
+ try {
+ return $this->conn->executeUpdate($query, $inserts);
+ } catch(\Doctrine\DBAL\DBALException $e) {
+ $entry = 'DB Error: "'.$e->getMessage() . '"<br />';
+ $entry .= 'Offending command was: ' . $query.'<br />';
+ \OC_Log::write('core', $entry, \OC_Log::FATAL);
+ error_log('DB error: ' . $entry);
+ \OC_Template::printErrorPage( $entry );
+ }
+ }
+}
diff --git a/lib/db/adapteroci8.php b/lib/db/adapteroci8.php
new file mode 100644
index 00000000000..bc226e979ec
--- /dev/null
+++ b/lib/db/adapteroci8.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+
+namespace OC\DB;
+
+class AdapterOCI8 extends Adapter {
+ public function lastInsertId($table) {
+ if($table !== null) {
+ $suffix = '_SEQ';
+ $table = '"'.$table.$suffix.'"';
+ }
+ return $this->conn->realLastInsertId($table);
+ }
+
+ const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400";
+ public function fixupStatement($statement) {
+ $statement = str_replace( '`', '"', $statement );
+ $statement = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $statement );
+ $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement );
+ return $statement;
+ }
+}
diff --git a/lib/db/adapterpgsql.php b/lib/db/adapterpgsql.php
new file mode 100644
index 00000000000..990d71c9f29
--- /dev/null
+++ b/lib/db/adapterpgsql.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+
+namespace OC\DB;
+
+class AdapterPgSql extends Adapter {
+ public function lastInsertId($table) {
+ return $this->conn->fetchColumn('SELECT lastval()');
+ }
+
+ const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)';
+ public function fixupStatement($statement) {
+ $statement = str_replace( '`', '"', $statement );
+ $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement );
+ return $statement;
+ }
+}
diff --git a/lib/db/adaptersqlite.php b/lib/db/adaptersqlite.php
new file mode 100644
index 00000000000..fa6d308ae32
--- /dev/null
+++ b/lib/db/adaptersqlite.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+
+namespace OC\DB;
+
+class AdapterSqlite extends Adapter {
+ public function fixupStatement($statement) {
+ $statement = str_replace( '`', '"', $statement );
+ $statement = str_ireplace( 'NOW()', 'datetime(\'now\')', $statement );
+ $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'strftime(\'%s\',\'now\')', $statement );
+ return $statement;
+ }
+
+ public function insertIfNotExist($table, $input) {
+ // NOTE: For SQLite we have to use this clumsy approach
+ // otherwise all fieldnames used must have a unique key.
+ $query = 'SELECT COUNT(*) FROM `' . $table . '` WHERE ';
+ foreach($input as $key => $value) {
+ $query .= '`' . $key . '` = ? AND ';
+ }
+ $query = substr($query, 0, strlen($query) - 5);
+ try {
+ $stmt = $this->conn->prepare($query);
+ $result = $stmt->execute(array_values($input));
+ } catch(\Doctrine\DBAL\DBALException $e) {
+ $entry = 'DB Error: "'.$e->getMessage() . '"<br />';
+ $entry .= 'Offending command was: ' . $query . '<br />';
+ \OC_Log::write('core', $entry, \OC_Log::FATAL);
+ error_log('DB error: '.$entry);
+ \OC_Template::printErrorPage( $entry );
+ }
+
+ if ($stmt->fetchColumn() === '0') {
+ $query = 'INSERT INTO `' . $table . '` (`'
+ . implode('`,`', array_keys($input)) . '`) VALUES('
+ . str_repeat('?,', count($input)-1).'? ' . ')';
+ } else {
+ return 0; //no rows updated
+ }
+
+ try {
+ $statement = $this->conn->prepare($query);
+ $result = $statement->execute(array_values($input));
+ } catch(\Doctrine\DBAL\DBALException $e) {
+ $entry = 'DB Error: "'.$e->getMessage() . '"<br />';
+ $entry .= 'Offending command was: ' . $query.'<br />';
+ \OC_Log::write('core', $entry, \OC_Log::FATAL);
+ error_log('DB error: ' . $entry);
+ \OC_Template::printErrorPage( $entry );
+ }
+
+ return $result;
+ }
+}
diff --git a/lib/db/adaptersqlsrv.php b/lib/db/adaptersqlsrv.php
new file mode 100644
index 00000000000..d0a67af28a7
--- /dev/null
+++ b/lib/db/adaptersqlsrv.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+
+namespace OC\DB;
+
+class AdapterSQLSrv extends Adapter {
+ public function lastInsertId($table) {
+ if($table !== null) {
+ $table = $this->conn->replaceTablePrefix( $table );
+ }
+ return $this->conn->lastInsertId($table);
+ }
+
+ public function fixupStatement($statement) {
+ $statement = preg_replace( "/\`(.*?)`/", "[$1]", $statement );
+ $statement = str_ireplace( 'NOW()', 'CURRENT_TIMESTAMP', $statement );
+ $statement = str_replace( 'LENGTH(', 'LEN(', $statement );
+ $statement = str_replace( 'SUBSTR(', 'SUBSTRING(', $statement );
+ $statement = str_ireplace( 'UNIX_TIMESTAMP()', 'DATEDIFF(second,{d \'1970-01-01\'},GETDATE())', $statement );
+ return $statement;
+ }
+}
diff --git a/lib/db/connection.php b/lib/db/connection.php
new file mode 100644
index 00000000000..2581969dbd0
--- /dev/null
+++ b/lib/db/connection.php
@@ -0,0 +1,197 @@
+<?php
+/**
+ * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\DB;
+use Doctrine\DBAL\Driver;
+use Doctrine\DBAL\Configuration;
+use Doctrine\DBAL\Cache\QueryCacheProfile;
+use Doctrine\Common\EventManager;
+
+class Connection extends \Doctrine\DBAL\Connection {
+ /**
+ * @var string $tablePrefix
+ */
+ protected $tablePrefix;
+
+ /**
+ * @var \OC\DB\Adapter $adapter
+ */
+ protected $adapter;
+
+ /**
+ * @var \Doctrine\DBAL\Driver\Statement[] $preparedQueries
+ */
+ protected $preparedQueries = array();
+
+ protected $cachingQueryStatementEnabled = true;
+
+ /**
+ * Initializes a new instance of the Connection class.
+ *
+ * @param array $params The connection parameters.
+ * @param \Doctrine\DBAL\Driver $driver
+ * @param \Doctrine\DBAL\Configuration $config
+ * @param \Doctrine\Common\EventManager $eventManager
+ * @throws \Exception
+ */
+ public function __construct(array $params, Driver $driver, Configuration $config = null,
+ EventManager $eventManager = null)
+ {
+ if (!isset($params['adapter'])) {
+ throw new \Exception('adapter not set');
+ }
+ if (!isset($params['tablePrefix'])) {
+ throw new \Exception('tablePrefix not set');
+ }
+ parent::__construct($params, $driver, $config, $eventManager);
+ $this->adapter = new $params['adapter']($this);
+ $this->tablePrefix = $params['tablePrefix'];
+ }
+
+ /**
+ * Prepares an SQL statement.
+ *
+ * @param string $statement The SQL statement to prepare.
+ * @param int $limit
+ * @param int $offset
+ * @return \Doctrine\DBAL\Driver\Statement The prepared statement.
+ */
+ public function prepare( $statement, $limit=null, $offset=null ) {
+ if ($limit === -1) {
+ $limit = null;
+ }
+ if (!is_null($limit)) {
+ $platform = $this->getDatabasePlatform();
+ $statement = $platform->modifyLimitQuery($statement, $limit, $offset);
+ } else {
+ if (isset($this->preparedQueries[$statement]) && $this->cachingQueryStatementEnabled) {
+ return $this->preparedQueries[$statement];
+ }
+ $origStatement = $statement;
+ }
+ $statement = $this->replaceTablePrefix($statement);
+ $statement = $this->adapter->fixupStatement($statement);
+
+ if(\OC_Config::getValue( 'log_query', false)) {
+ \OC_Log::write('core', 'DB prepare : '.$statement, \OC_Log::DEBUG);
+ }
+ $result = parent::prepare($statement);
+ if (is_null($limit) && $this->cachingQueryStatementEnabled) {
+ $this->preparedQueries[$origStatement] = $result;
+ }
+ return $result;
+ }
+
+ /**
+ * Executes an, optionally parameterized, SQL query.
+ *
+ * If the query is parameterized, a prepared statement is used.
+ * If an SQLLogger is configured, the execution is logged.
+ *
+ * @param string $query The SQL query to execute.
+ * @param array $params The parameters to bind to the query, if any.
+ * @param array $types The types the previous parameters are in.
+ * @param QueryCacheProfile $qcp
+ * @return \Doctrine\DBAL\Driver\Statement The executed statement.
+ * @internal PERF: Directly prepares a driver statement, not a wrapper.
+ */
+ public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null)
+ {
+ $query = $this->replaceTablePrefix($query);
+ $query = $this->adapter->fixupStatement($query);
+ return parent::executeQuery($query, $params, $types, $qcp);
+ }
+
+ /**
+ * Executes an SQL INSERT/UPDATE/DELETE query with the given parameters
+ * and returns the number of affected rows.
+ *
+ * This method supports PDO binding types as well as DBAL mapping types.
+ *
+ * @param string $query The SQL query.
+ * @param array $params The query parameters.
+ * @param array $types The parameter types.
+ * @return integer The number of affected rows.
+ * @internal PERF: Directly prepares a driver statement, not a wrapper.
+ */
+ public function executeUpdate($query, array $params = array(), array $types = array())
+ {
+ $query = $this->replaceTablePrefix($query);
+ $query = $this->adapter->fixupStatement($query);
+ return parent::executeUpdate($query, $params, $types);
+ }
+
+ /**
+ * Returns the ID of the last inserted row, or the last value from a sequence object,
+ * depending on the underlying driver.
+ *
+ * Note: This method may not return a meaningful or consistent result across different drivers,
+ * because the underlying database may not even support the notion of AUTO_INCREMENT/IDENTITY
+ * columns or sequences.
+ *
+ * @param string $seqName Name of the sequence object from which the ID should be returned.
+ * @return string A string representation of the last inserted ID.
+ */
+ public function lastInsertId($seqName = null)
+ {
+ if ($seqName) {
+ $seqName = $this->replaceTablePrefix($seqName);
+ }
+ return $this->adapter->lastInsertId($seqName);
+ }
+
+ // internal use
+ public function realLastInsertId($seqName = null)
+ {
+ return parent::lastInsertId($seqName);
+ }
+
+ /**
+ * @brief Insert a row if a matching row doesn't exists.
+ * @param string $table. The table to insert into in the form '*PREFIX*tableName'
+ * @param array $input. An array of fieldname/value pairs
+ * @return bool The return value from execute()
+ */
+ public function insertIfNotExist($table, $input) {
+ return $this->adapter->insertIfNotExist($table, $input);
+ }
+
+ /**
+ * returns the error code and message as a string for logging
+ * works with DoctrineException
+ * @return string
+ */
+ public function getError() {
+ $msg = $this->errorCode() . ': ';
+ $errorInfo = $this->errorInfo();
+ if (is_array($errorInfo)) {
+ $msg .= 'SQLSTATE = '.$errorInfo[0] . ', ';
+ $msg .= 'Driver Code = '.$errorInfo[1] . ', ';
+ $msg .= 'Driver Message = '.$errorInfo[2];
+ }
+ return $msg;
+ }
+
+ // internal use
+ /**
+ * @param string $statement
+ * @return string
+ */
+ protected function replaceTablePrefix($statement) {
+ return str_replace( '*PREFIX*', $this->tablePrefix, $statement );
+ }
+
+ public function enableQueryStatementCaching() {
+ $this->cachingQueryStatementEnabled = true;
+ }
+
+ public function disableQueryStatementCaching() {
+ $this->cachingQueryStatementEnabled = false;
+ $this->preparedQueries = array();
+ }
+}
diff --git a/lib/db/schema.php b/lib/db/mdb2schemamanager.php
index bc82249609d..8e76f46c78f 100644
--- a/lib/db/schema.php
+++ b/lib/db/mdb2schemamanager.php
@@ -6,47 +6,58 @@
* See the COPYING-README file.
*/
-class OC_DB_Schema {
+namespace OC\DB;
+
+class MDB2SchemaManager {
+ /**
+ * @var \OC\DB\Connection $conn
+ */
+ protected $conn;
+
+ /**
+ * @param \OC\DB\Connection $conn
+ */
+ public function __construct($conn) {
+ $this->conn = $conn;
+ }
+
/**
* @brief saves database scheme to xml file
- * @param \Doctrine\DBAL\Connection $conn
* @param string $file name of file
* @param int|string $mode
* @return bool
*
* TODO: write more documentation
*/
- public static function getDbStructure( $conn, $file, $mode=MDB2_SCHEMA_DUMP_STRUCTURE) {
- $sm = $conn->getSchemaManager();
+ public function getDbStructure( $file, $mode = MDB2_SCHEMA_DUMP_STRUCTURE) {
+ $sm = $this->conn->getSchemaManager();
- return OC_DB_MDB2SchemaWriter::saveSchemaToFile($file, $sm);
+ return \OC_DB_MDB2SchemaWriter::saveSchemaToFile($file, $sm);
}
/**
* @brief Creates tables from XML file
- * @param \Doctrine\DBAL\Connection $conn
* @param string $file file to read structure from
* @return bool
*
* TODO: write more documentation
*/
- public static function createDbFromStructure( $conn, $file ) {
- $schemaReader = new \OC\DB\MDB2SchemaReader(\OC_Config::getObject(), $conn->getDatabasePlatform());
+ public function createDbFromStructure( $file ) {
+ $schemaReader = new MDB2SchemaReader(\OC_Config::getObject(), $this->conn->getDatabasePlatform());
$toSchema = $schemaReader->loadSchemaFromFile($file);
- return self::executeSchemaChange($conn, $toSchema);
+ return $this->executeSchemaChange($toSchema);
}
/**
* @brief update the database scheme
- * @param \Doctrine\DBAL\Connection $conn
* @param string $file file to read structure from
* @return bool
*/
- public static function updateDbFromStructure($conn, $file) {
- $sm = $conn->getSchemaManager();
+ public function updateDbFromStructure($file) {
+ $sm = $this->conn->getSchemaManager();
$fromSchema = $sm->createSchema();
- $schemaReader = new \OC\DB\MDB2SchemaReader(\OC_Config::getObject(), $conn->getDatabasePlatform());
+ $schemaReader = new MDB2SchemaReader(\OC_Config::getObject(), $this->conn->getDatabasePlatform());
$toSchema = $schemaReader->loadSchemaFromFile($file);
// remove tables we don't know about
@@ -65,43 +76,34 @@ class OC_DB_Schema {
$comparator = new \Doctrine\DBAL\Schema\Comparator();
$schemaDiff = $comparator->compare($fromSchema, $toSchema);
- $platform = $conn->getDatabasePlatform();
+ $platform = $this->conn->getDatabasePlatform();
$tables = $schemaDiff->newTables + $schemaDiff->changedTables + $schemaDiff->removedTables;
foreach($tables as $tableDiff) {
$tableDiff->name = $platform->quoteIdentifier($tableDiff->name);
}
-
- //$from = $fromSchema->toSql($conn->getDatabasePlatform());
- //$to = $toSchema->toSql($conn->getDatabasePlatform());
- //echo($from[9]);
- //echo '<br>';
- //echo($to[9]);
- //var_dump($from, $to);
- return self::executeSchemaChange($conn, $schemaDiff);
+ return $this->executeSchemaChange($schemaDiff);
}
/**
* @brief drop a table
- * @param \Doctrine\DBAL\Connection $conn
* @param string $tableName the table to drop
*/
- public static function dropTable($conn, $tableName) {
- $sm = $conn->getSchemaManager();
+ public function dropTable($tableName) {
+ $sm = $this->conn->getSchemaManager();
$fromSchema = $sm->createSchema();
$toSchema = clone $fromSchema;
$toSchema->dropTable($tableName);
- $sql = $fromSchema->getMigrateToSql($toSchema, $conn->getDatabasePlatform());
- $conn->execute($sql);
+ $sql = $fromSchema->getMigrateToSql($toSchema, $this->conn->getDatabasePlatform());
+ $this->conn->executeQuery($sql);
}
/**
* remove all tables defined in a database structure xml file
- * @param \Doctrine\DBAL\Connection $conn
* @param string $file the xml file describing the tables
*/
- public static function removeDBStructure($conn, $file) {
- $schemaReader = new \OC\DB\MDB2SchemaReader(\OC_Config::getObject(), $conn->getDatabasePlatform());
+ public function removeDBStructure($file) {
+ $schemaReader = new MDB2SchemaReader(\OC_Config::getObject(), $this->conn->getDatabasePlatform());
$fromSchema = $schemaReader->loadSchemaFromFile($file);
$toSchema = clone $fromSchema;
foreach($toSchema->getTables() as $table) {
@@ -109,42 +111,40 @@ class OC_DB_Schema {
}
$comparator = new \Doctrine\DBAL\Schema\Comparator();
$schemaDiff = $comparator->compare($fromSchema, $toSchema);
- self::executeSchemaChange($conn, $schemaDiff);
+ $this->executeSchemaChange($schemaDiff);
}
/**
* @brief replaces the ownCloud tables with a new set
- * @param \Doctrine\DBAL\Connection $conn
* @param $file string path to the MDB2 xml db export file
*/
- public static function replaceDB( $conn, $file ) {
- $apps = OC_App::getAllApps();
- self::beginTransaction();
+ public function replaceDB( $file ) {
+ $apps = \OC_App::getAllApps();
+ $this->conn->beginTransaction();
// Delete the old tables
- self::removeDBStructure( $conn, OC::$SERVERROOT . '/db_structure.xml' );
+ $this->removeDBStructure( \OC::$SERVERROOT . '/db_structure.xml' );
foreach($apps as $app) {
- $path = OC_App::getAppPath($app).'/appinfo/database.xml';
+ $path = \OC_App::getAppPath($app).'/appinfo/database.xml';
if(file_exists($path)) {
- self::removeDBStructure( $conn, $path );
+ $this->removeDBStructure( $path );
}
}
// Create new tables
- self::commit();
+ $this->conn->commit();
}
/**
- * @param \Doctrine\DBAL\Connection $conn
* @param \Doctrine\DBAL\Schema\Schema $schema
* @return bool
*/
- private static function executeSchemaChange($conn, $schema) {
- $conn->beginTransaction();
- foreach($schema->toSql($conn->getDatabasePlatform()) as $sql) {
- $conn->query($sql);
+ private function executeSchemaChange($schema) {
+ $this->conn->beginTransaction();
+ foreach($schema->toSql($this->conn->getDatabasePlatform()) as $sql) {
+ $this->conn->query($sql);
}
- $conn->commit();
+ $this->conn->commit();
return true;
}
}
diff --git a/lib/db/statementwrapper.php b/lib/db/statementwrapper.php
index f7bc45e068f..b8da1afc0e5 100644
--- a/lib/db/statementwrapper.php
+++ b/lib/db/statementwrapper.php
@@ -53,7 +53,7 @@ class OC_DB_StatementWrapper {
*/
public function execute($input=array()) {
if(OC_Config::getValue( "log_query", false)) {
- $params_str = str_replace("\n"," ",var_export($input,true));
+ $params_str = str_replace("\n", " ", var_export($input, true));
OC_Log::write('core', 'DB execute with arguments : '.$params_str, OC_Log::DEBUG);
}
$this->lastArguments = $input;
@@ -134,7 +134,7 @@ class OC_DB_StatementWrapper {
$host = OC_Config::getValue( "dbhost", "" );
$user = OC_Config::getValue( "dbuser", "" );
$pass = OC_Config::getValue( "dbpassword", "" );
- if (strpos($host,':')) {
+ if (strpos($host, ':')) {
list($host, $port) = explode(':', $host, 2);
} else {
$port = false;
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index dd212d84cc5..597eabecf54 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -98,7 +98,7 @@ class Scanner extends BasicEmitter {
$newData = $data;
if ($reuseExisting and $cacheData = $this->cache->get($file)) {
// only reuse data if the file hasn't explicitly changed
- if ($data['mtime'] === $cacheData['mtime']) {
+ if (isset($data['mtime']) && isset($cacheData['mtime']) && $data['mtime'] === $cacheData['mtime']) {
if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) {
$data['size'] = $cacheData['size'];
}
@@ -184,7 +184,7 @@ class Scanner extends BasicEmitter {
}
\OC_DB::commit();
foreach ($childQueue as $child) {
- $childSize = $this->scanChildren($child, self::SCAN_RECURSIVE);
+ $childSize = $this->scanChildren($child, self::SCAN_RECURSIVE, $reuse);
if ($childSize === -1) {
$size = -1;
} else {
diff --git a/lib/group.php b/lib/group.php
index 8fbf5f86418..ba93dc129a1 100644
--- a/lib/group.php
+++ b/lib/group.php
@@ -230,7 +230,7 @@ class OC_Group {
public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
$group = self::getManager()->get($gid);
if ($group) {
- $users = $group->searchUsers($search . $limit, $offset);
+ $users = $group->searchUsers($search, $limit, $offset);
$userIds = array();
foreach ($users as $user) {
$userIds[] = $user->getUID();
diff --git a/lib/l10n.php b/lib/l10n.php
index a28aa89c5f1..f93443b886a 100644
--- a/lib/l10n.php
+++ b/lib/l10n.php
@@ -2,8 +2,10 @@
/**
* ownCloud
*
+ * @author Frank Karlitschek
* @author Jakob Sack
* @copyright 2012 Frank Karlitschek frank@owncloud.org
+ * @copyright 2013 Jakob Sack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
@@ -23,7 +25,7 @@
/**
* This class is for i18n and l10n
*/
-class OC_L10N{
+class OC_L10N {
/**
* cached instances
*/
@@ -55,6 +57,16 @@ class OC_L10N{
private $translations = array();
/**
+ * Plural forms (string)
+ */
+ private $plural_form_string = 'nplurals=2; plural=(n != 1);';
+
+ /**
+ * Plural forms (function)
+ */
+ private $plural_form_function = null;
+
+ /**
* Localization
*/
private $localizations = array(
@@ -66,6 +78,8 @@ class OC_L10N{
/**
* get an L10N instance
+ * @param $app string
+ * @param $lang string|null
* @return OC_L10N
*/
public static function get($app, $lang=null) {
@@ -81,8 +95,8 @@ class OC_L10N{
/**
* @brief The constructor
- * @param $app the app requesting l10n
- * @param $lang default: null Language
+ * @param $app string app requesting l10n
+ * @param $lang string default: null Language
* @returns OC_L10N-Object
*
* If language is not set, the constructor tries to find the right
@@ -93,6 +107,17 @@ class OC_L10N{
$this->lang = $lang;
}
+ public function load($transFile) {
+ $this->app = true;
+ include $transFile;
+ if(isset($TRANSLATIONS) && is_array($TRANSLATIONS)) {
+ $this->translations = $TRANSLATIONS;
+ }
+ if(isset($PLURAL_FORMS)) {
+ $this->plural_form_string = $PLURAL_FORMS;
+ }
+ }
+
protected function init() {
if ($this->app === true) {
return;
@@ -138,6 +163,9 @@ class OC_L10N{
}
}
}
+ if(isset($PLURAL_FORMS)) {
+ $this->plural_form_string = $PLURAL_FORMS;
+ }
}
if(file_exists(OC::$SERVERROOT.'/core/l10n/l10n-'.$lang.'.php')) {
@@ -154,6 +182,65 @@ class OC_L10N{
}
/**
+ * @brief Creates a function that The constructor
+ *
+ * If language is not set, the constructor tries to find the right
+ * language.
+ *
+ * Parts of the code is copied from Habari:
+ * https://github.com/habari/system/blob/master/classes/locale.php
+ * @param $string string
+ * @return string
+ */
+ protected function createPluralFormFunction($string){
+ if(preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
+ // sanitize
+ $nplurals = preg_replace( '/[^0-9]/', '', $matches[1] );
+ $plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] );
+
+ $body = str_replace(
+ array( 'plural', 'n', '$n$plurals', ),
+ array( '$plural', '$n', '$nplurals', ),
+ 'nplurals='. $nplurals . '; plural=' . $plural
+ );
+
+ // add parents
+ // important since PHP's ternary evaluates from left to right
+ $body .= ';';
+ $res = '';
+ $p = 0;
+ for($i = 0; $i < strlen($body); $i++) {
+ $ch = $body[$i];
+ switch ( $ch ) {
+ case '?':
+ $res .= ' ? (';
+ $p++;
+ break;
+ case ':':
+ $res .= ') : (';
+ break;
+ case ';':
+ $res .= str_repeat( ')', $p ) . ';';
+ $p = 0;
+ break;
+ default:
+ $res .= $ch;
+ }
+ }
+
+ $body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);';
+ return create_function('$n', $body);
+ }
+ else {
+ // default: one plural form for all cases but n==1 (english)
+ return create_function(
+ '$n',
+ '$nplurals=2;$plural=($n==1?0:1);return ($plural>=$nplurals?$nplurals-1:$plural);'
+ );
+ }
+ }
+
+ /**
* @brief Translating
* @param $text String The text we need a translation for
* @param array $parameters default:array() Parameters for sprintf
@@ -168,6 +255,37 @@ class OC_L10N{
/**
* @brief Translating
+ * @param $text_singular String the string to translate for exactly one object
+ * @param $text_plural String the string to translate for n objects
+ * @param $count Integer Number of objects
+ * @param array $parameters default:array() Parameters for sprintf
+ * @return \OC_L10N_String Translation or the same text
+ *
+ * Returns the translation. If no translation is found, $text will be
+ * returned. %n will be replaced with the number of objects.
+ *
+ * The correct plural is determined by the plural_forms-function
+ * provided by the po file.
+ *
+ */
+ public function n($text_singular, $text_plural, $count, $parameters = array()) {
+ $this->init();
+ $identifier = "_${text_singular}__${text_plural}_";
+ if( array_key_exists($identifier, $this->translations)) {
+ return new OC_L10N_String( $this, $identifier, $parameters, $count );
+ }
+ else{
+ if($count === 1) {
+ return new OC_L10N_String($this, $text_singular, $parameters, $count);
+ }
+ else{
+ return new OC_L10N_String($this, $text_plural, $parameters, $count);
+ }
+ }
+ }
+
+ /**
+ * @brief Translating
* @param $textArray The text array we need a translation for
* @returns Translation or the same text
*
@@ -201,6 +319,42 @@ class OC_L10N{
}
/**
+ * @brief getPluralFormString
+ * @returns string containing the gettext "Plural-Forms"-string
+ *
+ * Returns a string like "nplurals=2; plural=(n != 1);"
+ */
+ public function getPluralFormString() {
+ $this->init();
+ return $this->plural_form_string;
+ }
+
+ /**
+ * @brief getPluralFormFunction
+ * @returns string the plural form function
+ *
+ * returned function accepts the argument $n
+ */
+ public function getPluralFormFunction() {
+ $this->init();
+ if(is_null($this->plural_form_function)) {
+ $this->plural_form_function = $this->createPluralFormFunction($this->plural_form_string);
+ }
+ return $this->plural_form_function;
+ }
+
+ /**
+ * @brief get localizations
+ * @returns Fetch all localizations
+ *
+ * Returns an associative array with all localizations
+ */
+ public function getLocalizations() {
+ $this->init();
+ return $this->localizations;
+ }
+
+ /**
* @brief Localization
* @param $type Type of localization
* @param $params parameters for this localization
@@ -230,8 +384,11 @@ class OC_L10N{
case 'date':
case 'datetime':
case 'time':
- if($data instanceof DateTime) return $data->format($this->localizations[$type]);
- elseif(is_string($data)) $data = strtotime($data);
+ if($data instanceof DateTime) {
+ return $data->format($this->localizations[$type]);
+ } elseif(is_string($data) && !is_numeric($data)) {
+ $data = strtotime($data);
+ }
$locales = array(self::findLanguage());
if (strlen($locales[0]) == 2) {
$locales[] = $locales[0].'_'.strtoupper($locales[0]);
diff --git a/lib/l10n/af_ZA.php b/lib/l10n/af_ZA.php
index de32778026f..d17df6563bc 100644
--- a/lib/l10n/af_ZA.php
+++ b/lib/l10n/af_ZA.php
@@ -1,9 +1,10 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hulp",
"Personal" => "Persoonlik",
"Settings" => "Instellings",
"Users" => "Gebruikers",
-"Apps" => "Toepassings",
"Admin" => "Admin",
"web services under your control" => "webdienste onder jou beheer"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ar.php b/lib/l10n/ar.php
index 107b27a1fc8..ca48fc39f9b 100644
--- a/lib/l10n/ar.php
+++ b/lib/l10n/ar.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "المساعدة",
"Personal" => "شخصي",
"Settings" => "إعدادات",
"Users" => "المستخدمين",
-"Apps" => "التطبيقات",
"Admin" => "المدير",
"web services under your control" => "خدمات الشبكة تحت سيطرتك",
"ZIP download is turned off." => "تحميل ملفات ZIP متوقف",
@@ -50,3 +50,4 @@
"years ago" => "سنة مضت",
"Could not find category \"%s\"" => "تعذر العثور على المجلد \"%s\""
);
+$PLURAL_FORMS = "nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;";
diff --git a/lib/l10n/bg_BG.php b/lib/l10n/bg_BG.php
index e23112c8302..a366199235e 100644
--- a/lib/l10n/bg_BG.php
+++ b/lib/l10n/bg_BG.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Помощ",
"Personal" => "Лични",
"Settings" => "Настройки",
"Users" => "Потребители",
-"Apps" => "Приложения",
"Admin" => "Админ",
"web services under your control" => "уеб услуги под Ваш контрол",
"ZIP download is turned off." => "Изтеглянето като ZIP е изключено.",
@@ -51,3 +51,4 @@
"years ago" => "последните години",
"Could not find category \"%s\"" => "Невъзможно откриване на категорията \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/bn_BD.php b/lib/l10n/bn_BD.php
index ab1d9b94d0d..2e89f1034f2 100644
--- a/lib/l10n/bn_BD.php
+++ b/lib/l10n/bn_BD.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "সহায়িকা",
"Personal" => "ব্যক্তিগত",
"Settings" => "নিয়ামকসমূহ",
"Users" => "ব্যবহারকারী",
-"Apps" => "অ্যাপ",
"Admin" => "প্রশাসন",
"web services under your control" => "ওয়েব সার্ভিস আপনার হাতের মুঠোয়",
"ZIP download is turned off." => "ZIP ডাউনলোড বন্ধ করা আছে।",
@@ -26,3 +26,4 @@
"last year" => "গত বছর",
"years ago" => "বছর পূর্বে"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php
index 14f9edfe34c..bf7c3f8b459 100644
--- a/lib/l10n/ca.php
+++ b/lib/l10n/ca.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ajuda",
"Personal" => "Personal",
"Settings" => "Configuració",
"Users" => "Usuaris",
-"Apps" => "Aplicacions",
"Admin" => "Administració",
"Failed to upgrade \"%s\"." => "Ha fallat l'actualització \"%s\".",
"web services under your control" => "controleu els vostres serveis web",
@@ -55,3 +55,4 @@
"Caused by:" => "Provocat per:",
"Could not find category \"%s\"" => "No s'ha trobat la categoria \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php
index 7390c5f432a..c0e0ac6a67b 100644
--- a/lib/l10n/cs_CZ.php
+++ b/lib/l10n/cs_CZ.php
@@ -1,17 +1,17 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Nápověda",
"Personal" => "Osobní",
"Settings" => "Nastavení",
"Users" => "Uživatelé",
-"Apps" => "Aplikace",
"Admin" => "Administrace",
-"Failed to upgrade \"%s\"." => "Selhalo povýšení verze \"%s\".",
-"web services under your control" => "služby webu pod Vaší kontrolou",
+"Failed to upgrade \"%s\"." => "Selhala aktualizace verze \"%s\".",
+"web services under your control" => "webové služby pod Vaší kontrolou",
"cannot open \"%s\"" => "nelze otevřít \"%s\"",
-"ZIP download is turned off." => "Stahování ZIPu je vypnuto.",
+"ZIP download is turned off." => "Stahování v ZIPu je vypnuto.",
"Files need to be downloaded one by one." => "Soubory musí být stahovány jednotlivě.",
"Back to Files" => "Zpět k souborům",
-"Selected files too large to generate zip file." => "Vybrané soubory jsou příliš velké pro vytvoření zip souboru.",
+"Selected files too large to generate zip file." => "Vybrané soubory jsou příliš velké pro vytvoření ZIP souboru.",
"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Stáhněte soubory po menších částech, samostatně, nebo se obraťte na správce.",
"couldn't be determined" => "nelze zjistit",
"Application is not enabled" => "Aplikace není povolena",
@@ -23,24 +23,24 @@
"%s enter the database username." => "Zadejte uživatelské jméno %s databáze.",
"%s enter the database name." => "Zadejte název databáze pro %s databáze.",
"%s you may not use dots in the database name" => "V názvu databáze %s nesmíte používat tečky.",
-"MS SQL username and/or password not valid: %s" => "Uživatelské jméno, či heslo MSSQL není platné: %s",
-"You need to enter either an existing account or the administrator." => "Musíte zadat existující účet, či správce.",
-"MySQL username and/or password not valid" => "Uživatelské jméno, či heslo MySQL není platné",
-"DB Error: \"%s\"" => "Chyba DB: \"%s\"",
-"Offending command was: \"%s\"" => "Podezřelý příkaz byl: \"%s\"",
+"MS SQL username and/or password not valid: %s" => "Uživatelské jméno či heslo MSSQL není platné: %s",
+"You need to enter either an existing account or the administrator." => "Musíte zadat existující účet či správce.",
+"MySQL username and/or password not valid" => "Uživatelské jméno či heslo MySQL není platné",
+"DB Error: \"%s\"" => "Chyba databáze: \"%s\"",
+"Offending command was: \"%s\"" => "Příslušný příkaz byl: \"%s\"",
"MySQL user '%s'@'localhost' exists already." => "Uživatel '%s'@'localhost' již v MySQL existuje.",
-"Drop this user from MySQL" => "Zahodit uživatele z MySQL",
+"Drop this user from MySQL" => "Zrušte tohoto uživatele z MySQL",
"MySQL user '%s'@'%%' already exists" => "Uživatel '%s'@'%%' již v MySQL existuje",
-"Drop this user from MySQL." => "Zahodit uživatele z MySQL.",
+"Drop this user from MySQL." => "Zrušte tohoto uživatele z MySQL",
"Oracle connection could not be established" => "Spojení s Oracle nemohlo být navázáno",
-"Oracle username and/or password not valid" => "Uživatelské jméno, či heslo Oracle není platné",
-"Offending command was: \"%s\", name: %s, password: %s" => "Podezřelý příkaz byl: \"%s\", jméno: %s, heslo: %s",
-"PostgreSQL username and/or password not valid" => "Uživatelské jméno, či heslo PostgreSQL není platné",
+"Oracle username and/or password not valid" => "Uživatelské jméno či heslo Oracle není platné",
+"Offending command was: \"%s\", name: %s, password: %s" => "Příslušný příkaz byl: \"%s\", jméno: %s, heslo: %s",
+"PostgreSQL username and/or password not valid" => "Uživatelské jméno či heslo PostgreSQL není platné",
"Set an admin username." => "Zadejte uživatelské jméno správce.",
"Set an admin password." => "Zadejte heslo správce.",
-"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server není správně nastaven pro umožnění synchronizace, protože rozhraní WebDAV je rozbité.",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server není správně nastaven pro umožnění synchronizace, rozhraní WebDAV se zdá být rozbité.",
"Please double check the <a href='%s'>installation guides</a>." => "Zkonzultujte, prosím, <a href='%s'>průvodce instalací</a>.",
-"seconds ago" => "před pár vteřinami",
+"seconds ago" => "před pár sekundami",
"1 minute ago" => "před minutou",
"%d minutes ago" => "před %d minutami",
"1 hour ago" => "před hodinou",
@@ -49,9 +49,10 @@
"yesterday" => "včera",
"%d days ago" => "před %d dny",
"last month" => "minulý měsíc",
-"%d months ago" => "Před %d měsíci",
+"%d months ago" => "před %d měsíci",
"last year" => "minulý rok",
"years ago" => "před lety",
"Caused by:" => "Příčina:",
"Could not find category \"%s\"" => "Nelze nalézt kategorii \"%s\""
);
+$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
diff --git a/lib/l10n/cy_GB.php b/lib/l10n/cy_GB.php
index 27140ba6dbb..15b54e4cc6e 100644
--- a/lib/l10n/cy_GB.php
+++ b/lib/l10n/cy_GB.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Cymorth",
"Personal" => "Personol",
"Settings" => "Gosodiadau",
"Users" => "Defnyddwyr",
-"Apps" => "Pecynnau",
"Admin" => "Gweinyddu",
"web services under your control" => "gwasanaethau gwe a reolir gennych",
"ZIP download is turned off." => "Mae llwytho ZIP wedi ei ddiffodd.",
@@ -50,3 +50,4 @@
"years ago" => "blwyddyn yn ôl",
"Could not find category \"%s\"" => "Methu canfod categori \"%s\""
);
+$PLURAL_FORMS = "nplurals=4; plural=(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3;";
diff --git a/lib/l10n/da.php b/lib/l10n/da.php
index 789328a3100..81650f7eeed 100644
--- a/lib/l10n/da.php
+++ b/lib/l10n/da.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hjælp",
"Personal" => "Personligt",
"Settings" => "Indstillinger",
"Users" => "Brugere",
-"Apps" => "Apps",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Upgradering af \"%s\" fejlede",
"web services under your control" => "Webtjenester under din kontrol",
@@ -55,3 +55,4 @@
"Caused by:" => "Forårsaget af:",
"Could not find category \"%s\"" => "Kunne ikke finde kategorien \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/de.php b/lib/l10n/de.php
index f1c4a1171e2..c3bb8912f70 100644
--- a/lib/l10n/de.php
+++ b/lib/l10n/de.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hilfe",
"Personal" => "Persönlich",
"Settings" => "Einstellungen",
"Users" => "Benutzer",
-"Apps" => "Apps",
"Admin" => "Administration",
"Failed to upgrade \"%s\"." => "Konnte \"%s\" nicht aktualisieren.",
"web services under your control" => "Web-Services unter Deiner Kontrolle",
@@ -55,3 +55,4 @@
"Caused by:" => "Verursacht durch:",
"Could not find category \"%s\"" => "Die Kategorie \"%s\" konnte nicht gefunden werden."
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/de_CH.php b/lib/l10n/de_CH.php
new file mode 100644
index 00000000000..d100afef3f9
--- /dev/null
+++ b/lib/l10n/de_CH.php
@@ -0,0 +1,58 @@
+<?php
+$TRANSLATIONS = array(
+"Help" => "Hilfe",
+"Personal" => "Persönlich",
+"Settings" => "Einstellungen",
+"Users" => "Benutzer",
+"Admin" => "Administrator",
+"Failed to upgrade \"%s\"." => "Konnte \"%s\" nicht aktualisieren.",
+"web services under your control" => "Web-Services unter Ihrer Kontrolle",
+"cannot open \"%s\"" => "Öffnen von \"%s\" fehlgeschlagen",
+"ZIP download is turned off." => "Der ZIP-Download ist deaktiviert.",
+"Files need to be downloaded one by one." => "Die Dateien müssen einzeln heruntergeladen werden.",
+"Back to Files" => "Zurück zu \"Dateien\"",
+"Selected files too large to generate zip file." => "Die gewählten Dateien sind zu gross, um eine ZIP-Datei zu erstellen.",
+"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Laden Sie die Dateien in kleineren, separaten, Stücken herunter oder bitten Sie Ihren Administrator.",
+"couldn't be determined" => "konnte nicht ermittelt werden",
+"Application is not enabled" => "Die Anwendung ist nicht aktiviert",
+"Authentication error" => "Authentifizierungs-Fehler",
+"Token expired. Please reload page." => "Token abgelaufen. Bitte laden Sie die Seite neu.",
+"Files" => "Dateien",
+"Text" => "Text",
+"Images" => "Bilder",
+"%s enter the database username." => "%s geben Sie den Datenbank-Benutzernamen an.",
+"%s enter the database name." => "%s geben Sie den Datenbank-Namen an.",
+"%s you may not use dots in the database name" => "%s Der Datenbank-Name darf keine Punkte enthalten",
+"MS SQL username and/or password not valid: %s" => "MS SQL Benutzername und/oder Passwort ungültig: %s",
+"You need to enter either an existing account or the administrator." => "Sie müssen entweder ein existierendes Benutzerkonto oder das Administratoren-Konto angeben.",
+"MySQL username and/or password not valid" => "MySQL Benutzername und/oder Passwort ungültig",
+"DB Error: \"%s\"" => "DB Fehler: \"%s\"",
+"Offending command was: \"%s\"" => "Fehlerhafter Befehl war: \"%s\"",
+"MySQL user '%s'@'localhost' exists already." => "MySQL Benutzer '%s'@'localhost' existiert bereits.",
+"Drop this user from MySQL" => "Lösche diesen Benutzer aus MySQL",
+"MySQL user '%s'@'%%' already exists" => "MySQL Benutzer '%s'@'%%' existiert bereits",
+"Drop this user from MySQL." => "Lösche diesen Benutzer aus MySQL.",
+"Oracle connection could not be established" => "Die Oracle-Verbindung konnte nicht aufgebaut werden.",
+"Oracle username and/or password not valid" => "Oracle Benutzername und/oder Passwort ungültig",
+"Offending command was: \"%s\", name: %s, password: %s" => "Fehlerhafter Befehl war: \"%s\", Name: %s, Passwort: %s",
+"PostgreSQL username and/or password not valid" => "PostgreSQL Benutzername und/oder Passwort ungültig",
+"Set an admin username." => "Setze Administrator Benutzername.",
+"Set an admin password." => "Setze Administrator Passwort",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ihr Web-Server ist noch nicht für eine Datei-Synchronisation konfiguriert, weil die WebDAV-Schnittstelle vermutlich defekt ist.",
+"Please double check the <a href='%s'>installation guides</a>." => "Bitte prüfen Sie die <a href='%s'>Installationsanleitungen</a>.",
+"seconds ago" => "Gerade eben",
+"1 minute ago" => "Vor 1 Minute",
+"%d minutes ago" => "Vor %d Minuten",
+"1 hour ago" => "Vor einer Stunde",
+"%d hours ago" => "Vor %d Stunden",
+"today" => "Heute",
+"yesterday" => "Gestern",
+"%d days ago" => "Vor %d Tag(en)",
+"last month" => "Letzten Monat",
+"%d months ago" => "Vor %d Monaten",
+"last year" => "Letztes Jahr",
+"years ago" => "Vor Jahren",
+"Caused by:" => "Verursacht durch:",
+"Could not find category \"%s\"" => "Die Kategorie «%s» konnte nicht gefunden werden."
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/de_DE.php b/lib/l10n/de_DE.php
index 276e526e2ed..05cc103c869 100644
--- a/lib/l10n/de_DE.php
+++ b/lib/l10n/de_DE.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hilfe",
"Personal" => "Persönlich",
"Settings" => "Einstellungen",
"Users" => "Benutzer",
-"Apps" => "Apps",
"Admin" => "Administrator",
"Failed to upgrade \"%s\"." => "Konnte \"%s\" nicht aktualisieren.",
"web services under your control" => "Web-Services unter Ihrer Kontrolle",
@@ -55,3 +55,4 @@
"Caused by:" => "Verursacht durch:",
"Could not find category \"%s\"" => "Die Kategorie \"%s\" konnte nicht gefunden werden."
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/el.php b/lib/l10n/el.php
index 3e876aefdfe..7433113f810 100644
--- a/lib/l10n/el.php
+++ b/lib/l10n/el.php
@@ -1,15 +1,18 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Βοήθεια",
"Personal" => "Προσωπικά",
"Settings" => "Ρυθμίσεις",
"Users" => "Χρήστες",
-"Apps" => "Εφαρμογές",
"Admin" => "Διαχειριστής",
+"Failed to upgrade \"%s\"." => "Αποτυχία αναβάθμισης του \"%s\".",
"web services under your control" => "υπηρεσίες δικτύου υπό τον έλεγχό σας",
+"cannot open \"%s\"" => "αδυναμία ανοίγματος \"%s\"",
"ZIP download is turned off." => "Η λήψη ZIP απενεργοποιήθηκε.",
"Files need to be downloaded one by one." => "Τα αρχεία πρέπει να ληφθούν ένα-ένα.",
"Back to Files" => "Πίσω στα Αρχεία",
"Selected files too large to generate zip file." => "Τα επιλεγμένα αρχεία είναι μεγάλα ώστε να δημιουργηθεί αρχείο zip.",
+"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Λήψη των αρχείων σε μικρότερα κομμάτια, χωριστά ή ρωτήστε τον διαχειριστή σας.",
"couldn't be determined" => "δεν μπορούσε να προσδιορισθεί",
"Application is not enabled" => "Δεν ενεργοποιήθηκε η εφαρμογή",
"Authentication error" => "Σφάλμα πιστοποίησης",
@@ -49,5 +52,7 @@
"%d months ago" => "%d μήνες πριν",
"last year" => "τελευταίο χρόνο",
"years ago" => "χρόνια πριν",
+"Caused by:" => "Προκλήθηκε από:",
"Could not find category \"%s\"" => "Αδυναμία εύρεσης κατηγορίας \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/en@pirate.php b/lib/l10n/en@pirate.php
index 02ff0331e05..a86492d2a93 100644
--- a/lib/l10n/en@pirate.php
+++ b/lib/l10n/en@pirate.php
@@ -1,3 +1,5 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"web services under your control" => "web services under your control"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/eo.php b/lib/l10n/eo.php
index fd45f30c69b..196cdd66900 100644
--- a/lib/l10n/eo.php
+++ b/lib/l10n/eo.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Helpo",
"Personal" => "Persona",
"Settings" => "Agordo",
"Users" => "Uzantoj",
-"Apps" => "Aplikaĵoj",
"Admin" => "Administranto",
"web services under your control" => "TTT-servoj regataj de vi",
"ZIP download is turned off." => "ZIP-elŝuto estas malkapabligita.",
@@ -47,3 +47,4 @@
"years ago" => "jaroj antaŭe",
"Could not find category \"%s\"" => "Ne troviĝis kategorio “%s”"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/es.php b/lib/l10n/es.php
index 66011e61a0d..70dc0c0e92c 100644
--- a/lib/l10n/es.php
+++ b/lib/l10n/es.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ayuda",
"Personal" => "Personal",
"Settings" => "Ajustes",
"Users" => "Usuarios",
-"Apps" => "Aplicaciones",
"Admin" => "Administración",
"Failed to upgrade \"%s\"." => "Falló la actualización \"%s\".",
"web services under your control" => "Servicios web bajo su control",
@@ -55,3 +55,4 @@
"Caused by:" => "Causado por:",
"Could not find category \"%s\"" => "No puede encontrar la categoria \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/es_AR.php b/lib/l10n/es_AR.php
index da0f6fae84a..6208e3eb472 100644
--- a/lib/l10n/es_AR.php
+++ b/lib/l10n/es_AR.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ayuda",
"Personal" => "Personal",
"Settings" => "Configuración",
"Users" => "Usuarios",
-"Apps" => "Apps",
"Admin" => "Administración",
"Failed to upgrade \"%s\"." => "No se pudo actualizar \"%s\".",
"web services under your control" => "servicios web sobre los que tenés control",
@@ -55,3 +55,4 @@
"Caused by:" => "Provocado por:",
"Could not find category \"%s\"" => "No fue posible encontrar la categoría \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php
index c2cd8ff0389..1dff8545240 100644
--- a/lib/l10n/et_EE.php
+++ b/lib/l10n/et_EE.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Abiinfo",
"Personal" => "Isiklik",
"Settings" => "Seaded",
"Users" => "Kasutajad",
-"Apps" => "Rakendused",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Ebaõnnestunud uuendus \"%s\".",
"web services under your control" => "veebitenused sinu kontrolli all",
@@ -55,3 +55,4 @@
"Caused by:" => "Põhjustaja:",
"Could not find category \"%s\"" => "Ei leia kategooriat \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php
index 94b4cfb902e..006b3941513 100644
--- a/lib/l10n/eu.php
+++ b/lib/l10n/eu.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Laguntza",
"Personal" => "Pertsonala",
"Settings" => "Ezarpenak",
"Users" => "Erabiltzaileak",
-"Apps" => "Aplikazioak",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Ezin izan da \"%s\" eguneratu.",
"web services under your control" => "web zerbitzuak zure kontrolpean",
@@ -55,3 +55,4 @@
"Caused by:" => "Honek eraginda:",
"Could not find category \"%s\"" => "Ezin da \"%s\" kategoria aurkitu"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/fa.php b/lib/l10n/fa.php
index 40a778e2126..dd313d9d862 100644
--- a/lib/l10n/fa.php
+++ b/lib/l10n/fa.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "راه‌نما",
"Personal" => "شخصی",
"Settings" => "تنظیمات",
"Users" => "کاربران",
-"Apps" => " برنامه ها",
"Admin" => "مدیر",
"web services under your control" => "سرویس های تحت وب در کنترل شما",
"ZIP download is turned off." => "دانلود به صورت فشرده غیر فعال است",
@@ -51,3 +51,4 @@
"years ago" => "سال‌های قبل",
"Could not find category \"%s\"" => "دسته بندی %s یافت نشد"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/fi.php b/lib/l10n/fi.php
index daaddb25e48..ac1f80a8f73 100644
--- a/lib/l10n/fi.php
+++ b/lib/l10n/fi.php
@@ -1,3 +1,5 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Settings" => "asetukset"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/fi_FI.php b/lib/l10n/fi_FI.php
index 75576c3034d..7ce9fcaabca 100644
--- a/lib/l10n/fi_FI.php
+++ b/lib/l10n/fi_FI.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ohje",
"Personal" => "Henkilökohtainen",
"Settings" => "Asetukset",
"Users" => "Käyttäjät",
-"Apps" => "Sovellukset",
"Admin" => "Ylläpitäjä",
"web services under your control" => "verkkopalvelut hallinnassasi",
"ZIP download is turned off." => "ZIP-lataus on poistettu käytöstä.",
@@ -47,3 +47,4 @@
"years ago" => "vuotta sitten",
"Could not find category \"%s\"" => "Luokkaa \"%s\" ei löytynyt"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index 9f30b602696..48e12f7b20f 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Aide",
"Personal" => "Personnel",
"Settings" => "Paramètres",
"Users" => "Utilisateurs",
-"Apps" => "Applications",
"Admin" => "Administration",
"web services under your control" => "services web sous votre contrôle",
"ZIP download is turned off." => "Téléchargement ZIP désactivé.",
@@ -51,3 +51,4 @@
"years ago" => "il y a plusieurs années",
"Could not find category \"%s\"" => "Impossible de trouver la catégorie \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php
index f5309d95081..77d672e1450 100644
--- a/lib/l10n/gl.php
+++ b/lib/l10n/gl.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Axuda",
"Personal" => "Persoal",
"Settings" => "Axustes",
"Users" => "Usuarios",
-"Apps" => "Aplicativos",
"Admin" => "Administración",
"Failed to upgrade \"%s\"." => "Non foi posíbel anovar «%s».",
"web services under your control" => "servizos web baixo o seu control",
@@ -55,3 +55,4 @@
"Caused by:" => "Causado por:",
"Could not find category \"%s\"" => "Non foi posíbel atopar a categoría «%s»"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/he.php b/lib/l10n/he.php
index 2e011e342a0..8a33cb393fe 100644
--- a/lib/l10n/he.php
+++ b/lib/l10n/he.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "עזרה",
"Personal" => "אישי",
"Settings" => "הגדרות",
"Users" => "משתמשים",
-"Apps" => "יישומים",
"Admin" => "מנהל",
"web services under your control" => "שירותי רשת תחת השליטה שלך",
"ZIP download is turned off." => "הורדת ZIP כבויה",
@@ -32,3 +32,4 @@
"years ago" => "שנים",
"Could not find category \"%s\"" => "לא ניתן למצוא את הקטגוריה „%s“"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/hi.php b/lib/l10n/hi.php
index f507993f494..efa06eec8a7 100644
--- a/lib/l10n/hi.php
+++ b/lib/l10n/hi.php
@@ -1,7 +1,8 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "सहयोग",
"Personal" => "यक्तिगत",
"Settings" => "सेटिंग्स",
-"Users" => "उपयोगकर्ता",
-"Apps" => "Apps"
+"Users" => "उपयोगकर्ता"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/hr.php b/lib/l10n/hr.php
index 41c34d3108c..9223b4c9ccb 100644
--- a/lib/l10n/hr.php
+++ b/lib/l10n/hr.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Pomoć",
"Personal" => "Osobno",
"Settings" => "Postavke",
"Users" => "Korisnici",
-"Apps" => "Aplikacije",
"Admin" => "Administrator",
"web services under your control" => "web usluge pod vašom kontrolom",
"Authentication error" => "Greška kod autorizacije",
@@ -16,3 +16,4 @@
"last year" => "prošlu godinu",
"years ago" => "godina"
);
+$PLURAL_FORMS = "nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;";
diff --git a/lib/l10n/hu_HU.php b/lib/l10n/hu_HU.php
index 7738dcc05c8..6231d9c3cab 100644
--- a/lib/l10n/hu_HU.php
+++ b/lib/l10n/hu_HU.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Súgó",
"Personal" => "Személyes",
"Settings" => "Beállítások",
"Users" => "Felhasználók",
-"Apps" => "Alkalmazások",
"Admin" => "Adminsztráció",
"Failed to upgrade \"%s\"." => "Sikertelen Frissítés \"%s\".",
"web services under your control" => "webszolgáltatások saját kézben",
@@ -55,3 +55,4 @@
"Caused by:" => "Okozta:",
"Could not find category \"%s\"" => "Ez a kategória nem található: \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ia.php b/lib/l10n/ia.php
index e5f6e3ddf58..a7fee63892b 100644
--- a/lib/l10n/ia.php
+++ b/lib/l10n/ia.php
@@ -1,11 +1,12 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Adjuta",
"Personal" => "Personal",
"Settings" => "Configurationes",
"Users" => "Usatores",
-"Apps" => "Applicationes",
"Admin" => "Administration",
"web services under your control" => "servicios web sub tu controlo",
"Files" => "Files",
"Text" => "Texto"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/id.php b/lib/l10n/id.php
index c247651f0c9..d37c8c25493 100644
--- a/lib/l10n/id.php
+++ b/lib/l10n/id.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Bantuan",
"Personal" => "Pribadi",
"Settings" => "Setelan",
"Users" => "Pengguna",
-"Apps" => "Aplikasi",
"Admin" => "Admin",
"web services under your control" => "layanan web dalam kontrol Anda",
"ZIP download is turned off." => "Pengunduhan ZIP dimatikan.",
@@ -50,3 +50,4 @@
"years ago" => "beberapa tahun lalu",
"Could not find category \"%s\"" => "Tidak dapat menemukan kategori \"%s\""
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/is.php b/lib/l10n/is.php
index 0f7a22fd13e..b1402f1df49 100644
--- a/lib/l10n/is.php
+++ b/lib/l10n/is.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hjálp",
"Personal" => "Um mig",
"Settings" => "Stillingar",
"Users" => "Notendur",
-"Apps" => "Forrit",
"Admin" => "Stjórnun",
"web services under your control" => "vefþjónusta undir þinni stjórn",
"ZIP download is turned off." => "Slökkt á ZIP niðurhali.",
@@ -30,3 +30,4 @@
"years ago" => "einhverjum árum",
"Could not find category \"%s\"" => "Fann ekki flokkinn \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/it.php b/lib/l10n/it.php
index 693f86b6b80..50723eecbbe 100644
--- a/lib/l10n/it.php
+++ b/lib/l10n/it.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Aiuto",
"Personal" => "Personale",
"Settings" => "Impostazioni",
"Users" => "Utenti",
-"Apps" => "Applicazioni",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Aggiornamento non riuscito \"%s\".",
"web services under your control" => "servizi web nelle tue mani",
@@ -55,3 +55,4 @@
"Caused by:" => "Causato da:",
"Could not find category \"%s\"" => "Impossibile trovare la categoria \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ja_JP.php b/lib/l10n/ja_JP.php
index 36d06d360b9..6561343eaee 100644
--- a/lib/l10n/ja_JP.php
+++ b/lib/l10n/ja_JP.php
@@ -1,15 +1,18 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "ヘルプ",
"Personal" => "個人",
"Settings" => "設定",
"Users" => "ユーザ",
-"Apps" => "アプリ",
"Admin" => "管理",
+"Failed to upgrade \"%s\"." => "\"%s\" へのアップグレードに失敗しました。",
"web services under your control" => "管理下のウェブサービス",
+"cannot open \"%s\"" => "\"%s\" が開けません",
"ZIP download is turned off." => "ZIPダウンロードは無効です。",
"Files need to be downloaded one by one." => "ファイルは1つずつダウンロードする必要があります。",
"Back to Files" => "ファイルに戻る",
"Selected files too large to generate zip file." => "選択したファイルはZIPファイルの生成には大きすぎます。",
+"Download the files in smaller chunks, seperately or kindly ask your administrator." => "ファイルは、小さいファイルに分割されてダウンロードされます。もしくは、管理者にお尋ねください。",
"couldn't be determined" => "測定できませんでした",
"Application is not enabled" => "アプリケーションは無効です",
"Authentication error" => "認証エラー",
@@ -49,5 +52,7 @@
"%d months ago" => "%d 分前",
"last year" => "一年前",
"years ago" => "年前",
+"Caused by:" => "原因は以下:",
"Could not find category \"%s\"" => "カテゴリ \"%s\" が見つかりませんでした"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/ka.php b/lib/l10n/ka.php
index e5a3e659668..b6e06997638 100644
--- a/lib/l10n/ka.php
+++ b/lib/l10n/ka.php
@@ -1,4 +1,5 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "შველა",
"Personal" => "პერსონა",
"Users" => "მომხმარებლები",
@@ -13,3 +14,4 @@
"yesterday" => "გუშინ",
"%d days ago" => "%d დღის წინ"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/ka_GE.php b/lib/l10n/ka_GE.php
index c6e77da2dac..c03cccf1361 100644
--- a/lib/l10n/ka_GE.php
+++ b/lib/l10n/ka_GE.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "დახმარება",
"Personal" => "პირადი",
"Settings" => "პარამეტრები",
"Users" => "მომხმარებელი",
-"Apps" => "აპლიკაციები",
"Admin" => "ადმინისტრატორი",
"web services under your control" => "web services under your control",
"ZIP download is turned off." => "ZIP download–ი გათიშულია",
@@ -50,3 +50,4 @@
"years ago" => "წლის წინ",
"Could not find category \"%s\"" => "\"%s\" კატეგორიის მოძებნა ვერ მოხერხდა"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/ko.php b/lib/l10n/ko.php
index 1f32ebe402a..734b6c6a072 100644
--- a/lib/l10n/ko.php
+++ b/lib/l10n/ko.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "도움말",
"Personal" => "개인",
"Settings" => "설정",
"Users" => "사용자",
-"Apps" => "앱",
"Admin" => "관리자",
"web services under your control" => "내가 관리하는 웹 서비스",
"ZIP download is turned off." => "ZIP 다운로드가 비활성화되었습니다.",
@@ -40,3 +40,4 @@
"years ago" => "년 전",
"Could not find category \"%s\"" => "분류 \"%s\"을(를) 찾을 수 없습니다."
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/ku_IQ.php b/lib/l10n/ku_IQ.php
index 6d7461a1685..a2a6e237b99 100644
--- a/lib/l10n/ku_IQ.php
+++ b/lib/l10n/ku_IQ.php
@@ -1,8 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "یارمەتی",
"Settings" => "ده‌ستكاری",
"Users" => "به‌كارهێنه‌ر",
-"Apps" => "به‌رنامه‌كان",
"Admin" => "به‌ڕێوه‌به‌ری سه‌ره‌كی",
"web services under your control" => "ڕاژه‌ی وێب له‌ژێر چاودێریت دایه"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/lb.php b/lib/l10n/lb.php
index 867b0a37409..84114a6926d 100644
--- a/lib/l10n/lb.php
+++ b/lib/l10n/lb.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hëllef",
"Personal" => "Perséinlech",
"Settings" => "Astellungen",
"Users" => "Benotzer",
-"Apps" => "Applikatiounen",
"Admin" => "Admin",
"web services under your control" => "Web-Servicer ënnert denger Kontroll",
"Authentication error" => "Authentifikatioun's Fehler",
@@ -18,3 +18,4 @@
"last year" => "Läscht Joer",
"years ago" => "Joren hier"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/lt_LT.php b/lib/l10n/lt_LT.php
index 5e3a0482033..4aab3f1113d 100644
--- a/lib/l10n/lt_LT.php
+++ b/lib/l10n/lt_LT.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Pagalba",
"Personal" => "Asmeniniai",
"Settings" => "Nustatymai",
"Users" => "Vartotojai",
-"Apps" => "Programos",
"Admin" => "Administravimas",
"web services under your control" => "jūsų valdomos web paslaugos",
"ZIP download is turned off." => "ZIP atsisiuntimo galimybė yra išjungta.",
@@ -29,3 +29,4 @@
"last year" => "praeitais metais",
"years ago" => "prieš metus"
);
+$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/lv.php b/lib/l10n/lv.php
index 662f4d5b245..38cf55549dd 100644
--- a/lib/l10n/lv.php
+++ b/lib/l10n/lv.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Palīdzība",
"Personal" => "Personīgi",
"Settings" => "Iestatījumi",
"Users" => "Lietotāji",
-"Apps" => "Lietotnes",
"Admin" => "Administratori",
"web services under your control" => "tīmekļa servisi tavā varā",
"ZIP download is turned off." => "ZIP lejupielādēšana ir izslēgta.",
@@ -50,3 +50,4 @@
"years ago" => "gadus atpakaļ",
"Could not find category \"%s\"" => "Nevarēja atrast kategoriju “%s”"
);
+$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);";
diff --git a/lib/l10n/mk.php b/lib/l10n/mk.php
index 30fa9ab73c1..e4a6afef492 100644
--- a/lib/l10n/mk.php
+++ b/lib/l10n/mk.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Помош",
"Personal" => "Лично",
"Settings" => "Подесувања",
"Users" => "Корисници",
-"Apps" => "Аппликации",
"Admin" => "Админ",
"web services under your control" => "веб сервиси под Ваша контрола",
"ZIP download is turned off." => "Преземање во ZIP е исклучено",
@@ -30,3 +30,4 @@
"years ago" => "пред години",
"Could not find category \"%s\"" => "Не можам да најдам категорија „%s“"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;";
diff --git a/lib/l10n/ms_MY.php b/lib/l10n/ms_MY.php
index a2930597971..be7d626ccb7 100644
--- a/lib/l10n/ms_MY.php
+++ b/lib/l10n/ms_MY.php
@@ -1,12 +1,13 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Bantuan",
"Personal" => "Peribadi",
"Settings" => "Tetapan",
"Users" => "Pengguna",
-"Apps" => "Aplikasi",
"Admin" => "Admin",
"web services under your control" => "Perkhidmatan web di bawah kawalan anda",
"Authentication error" => "Ralat pengesahan",
"Files" => "Fail-fail",
"Text" => "Teks"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/my_MM.php b/lib/l10n/my_MM.php
index f214a1ed794..613b58a87cc 100644
--- a/lib/l10n/my_MM.php
+++ b/lib/l10n/my_MM.php
@@ -1,7 +1,7 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "အကူအညီ",
"Users" => "သုံးစွဲသူ",
-"Apps" => "Apps",
"Admin" => "အက်ဒမင်",
"web services under your control" => "သင်၏ထိန်းချုပ်မှု့အောက်တွင်ရှိသော Web services",
"ZIP download is turned off." => "ZIP ဒေါင်းလုတ်ကိုပိတ်ထားသည်",
@@ -27,3 +27,4 @@
"years ago" => "နှစ် အရင်က",
"Could not find category \"%s\"" => "\"%s\"ခေါင်းစဉ်ကို ရှာမတွေ့ပါ"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/nb_NO.php b/lib/l10n/nb_NO.php
index ab2d4f91920..dbc0788f4b0 100644
--- a/lib/l10n/nb_NO.php
+++ b/lib/l10n/nb_NO.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hjelp",
"Personal" => "Personlig",
"Settings" => "Innstillinger",
"Users" => "Brukere",
-"Apps" => "Apper",
"Admin" => "Admin",
"web services under your control" => "web tjenester du kontrollerer",
"ZIP download is turned off." => "ZIP-nedlasting av avslått",
@@ -32,3 +32,4 @@
"years ago" => "år siden",
"Could not find category \"%s\"" => "Kunne ikke finne kategori \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/nl.php b/lib/l10n/nl.php
index 0a221b11f00..6f8d01f5943 100644
--- a/lib/l10n/nl.php
+++ b/lib/l10n/nl.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Help",
"Personal" => "Persoonlijk",
"Settings" => "Instellingen",
"Users" => "Gebruikers",
-"Apps" => "Apps",
"Admin" => "Beheerder",
"Failed to upgrade \"%s\"." => "Upgrade \"%s\" mislukt.",
"web services under your control" => "Webdiensten in eigen beheer",
@@ -55,3 +55,4 @@
"Caused by:" => "Gekomen door:",
"Could not find category \"%s\"" => "Kon categorie \"%s\" niet vinden"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/nn_NO.php b/lib/l10n/nn_NO.php
index c1739398109..712b1e42375 100644
--- a/lib/l10n/nn_NO.php
+++ b/lib/l10n/nn_NO.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hjelp",
"Personal" => "Personleg",
"Settings" => "Innstillingar",
"Users" => "Brukarar",
-"Apps" => "Program",
"Admin" => "Administrer",
"web services under your control" => "Vev tjenester under din kontroll",
"Authentication error" => "Feil i autentisering",
@@ -20,3 +20,4 @@
"last year" => "i fjor",
"years ago" => "år sidan"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/oc.php b/lib/l10n/oc.php
index a72da90790a..be7f3b43a2d 100644
--- a/lib/l10n/oc.php
+++ b/lib/l10n/oc.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ajuda",
"Personal" => "Personal",
"Settings" => "Configuracion",
"Users" => "Usancièrs",
-"Apps" => "Apps",
"Admin" => "Admin",
"web services under your control" => "Services web jos ton contraròtle",
"ZIP download is turned off." => "Avalcargar los ZIP es inactiu.",
@@ -21,3 +21,4 @@
"last year" => "an passat",
"years ago" => "ans a"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php
index d06d5ba8a3e..ff75eca6683 100644
--- a/lib/l10n/pl.php
+++ b/lib/l10n/pl.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Pomoc",
"Personal" => "Osobiste",
"Settings" => "Ustawienia",
"Users" => "Użytkownicy",
-"Apps" => "Aplikacje",
"Admin" => "Administrator",
"Failed to upgrade \"%s\"." => "Błąd przy aktualizacji \"%s\".",
"web services under your control" => "Kontrolowane serwisy",
@@ -55,3 +55,4 @@
"Caused by:" => "Spowodowane przez:",
"Could not find category \"%s\"" => "Nie można odnaleźć kategorii \"%s\""
);
+$PLURAL_FORMS = "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/pl_PL.php b/lib/l10n/pl_PL.php
index 67cf0a33259..5494e3dab25 100644
--- a/lib/l10n/pl_PL.php
+++ b/lib/l10n/pl_PL.php
@@ -1,3 +1,5 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Settings" => "Ustawienia"
);
+$PLURAL_FORMS = "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php
index 23385e8c7d1..fa7dd092519 100644
--- a/lib/l10n/pt_BR.php
+++ b/lib/l10n/pt_BR.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ajuda",
"Personal" => "Pessoal",
"Settings" => "Ajustes",
"Users" => "Usuários",
-"Apps" => "Aplicações",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Falha na atualização de \"%s\".",
"web services under your control" => "serviços web sob seu controle",
@@ -55,3 +55,4 @@
"Caused by:" => "Causados ​​por:",
"Could not find category \"%s\"" => "Impossível localizar categoria \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index 96cb5f65f56..9411df0be3a 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ajuda",
"Personal" => "Pessoal",
"Settings" => "Configurações",
"Users" => "Utilizadores",
-"Apps" => "Aplicações",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "A actualização \"%s\" falhou.",
"web services under your control" => "serviços web sob o seu controlo",
@@ -55,3 +55,4 @@
"Caused by:" => "Causado por:",
"Could not find category \"%s\"" => "Não foi encontrado a categoria \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ro.php b/lib/l10n/ro.php
index 5a34e9571e5..f56ee7323f5 100644
--- a/lib/l10n/ro.php
+++ b/lib/l10n/ro.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ajutor",
"Personal" => "Personal",
"Settings" => "Setări",
"Users" => "Utilizatori",
-"Apps" => "Aplicații",
"Admin" => "Admin",
"web services under your control" => "servicii web controlate de tine",
"ZIP download is turned off." => "Descărcarea ZIP este dezactivată.",
@@ -33,3 +33,4 @@
"years ago" => "ani în urmă",
"Could not find category \"%s\"" => "Cloud nu a gasit categoria \"%s\""
);
+$PLURAL_FORMS = "nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));";
diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php
index d9d1f5c53fe..469acb0a1f0 100644
--- a/lib/l10n/ru.php
+++ b/lib/l10n/ru.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Помощь",
"Personal" => "Личное",
"Settings" => "Конфигурация",
"Users" => "Пользователи",
-"Apps" => "Приложения",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Не смог обновить \"%s\".",
"web services under your control" => "веб-сервисы под вашим управлением",
@@ -55,3 +55,4 @@
"Caused by:" => "Вызвано:",
"Could not find category \"%s\"" => "Категория \"%s\" не найдена"
);
+$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/ru_RU.php b/lib/l10n/ru_RU.php
index 7639a3cc97e..1761c1ebf3b 100644
--- a/lib/l10n/ru_RU.php
+++ b/lib/l10n/ru_RU.php
@@ -1,4 +1,6 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Settings" => "Настройки",
"Text" => "Текст"
);
+$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/si_LK.php b/lib/l10n/si_LK.php
index 49ded7026e0..f09dee7c6cc 100644
--- a/lib/l10n/si_LK.php
+++ b/lib/l10n/si_LK.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "උදව්",
"Personal" => "පෞද්ගලික",
"Settings" => "සිටුවම්",
"Users" => "පරිශීලකයන්",
-"Apps" => "යෙදුම්",
"Admin" => "පරිපාලක",
"web services under your control" => "ඔබට පාලනය කළ හැකි වෙබ් සේවාවන්",
"ZIP download is turned off." => "ZIP භාගත කිරීම් අක්‍රියයි",
@@ -26,3 +26,4 @@
"last year" => "පෙර අවුරුද්දේ",
"years ago" => "අවුරුදු කීපයකට පෙර"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php
index 64ad1e540f3..a3e6a17aaac 100644
--- a/lib/l10n/sk_SK.php
+++ b/lib/l10n/sk_SK.php
@@ -1,15 +1,18 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Pomoc",
"Personal" => "Osobné",
"Settings" => "Nastavenia",
"Users" => "Používatelia",
-"Apps" => "Aplikácie",
"Admin" => "Administrátor",
+"Failed to upgrade \"%s\"." => "Zlyhala aktualizácia \"%s\".",
"web services under your control" => "webové služby pod Vašou kontrolou",
+"cannot open \"%s\"" => "nemožno otvoriť \"%s\"",
"ZIP download is turned off." => "Sťahovanie súborov ZIP je vypnuté.",
"Files need to be downloaded one by one." => "Súbory musia byť nahrávané jeden za druhým.",
"Back to Files" => "Späť na súbory",
"Selected files too large to generate zip file." => "Zvolené súbory sú príliš veľké na vygenerovanie zip súboru.",
+"Download the files in smaller chunks, seperately or kindly ask your administrator." => "Stiahnite súbory po menších častiach, samostatne, alebo sa obráťte na správcu.",
"couldn't be determined" => "nedá sa zistiť",
"Application is not enabled" => "Aplikácia nie je zapnutá",
"Authentication error" => "Chyba autentifikácie",
@@ -49,5 +52,7 @@
"%d months ago" => "Pred %d mesiacmi.",
"last year" => "minulý rok",
"years ago" => "pred rokmi",
+"Caused by:" => "Príčina:",
"Could not find category \"%s\"" => "Nemožno nájsť danú kategóriu \"%s\""
);
+$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php
index a5b4decd61a..4423155fd95 100644
--- a/lib/l10n/sl.php
+++ b/lib/l10n/sl.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Pomoč",
"Personal" => "Osebno",
"Settings" => "Nastavitve",
"Users" => "Uporabniki",
-"Apps" => "Programi",
"Admin" => "Skrbništvo",
"web services under your control" => "spletne storitve pod vašim nadzorom",
"ZIP download is turned off." => "Prejemanje datotek v paketu ZIP je onemogočeno.",
@@ -51,3 +51,4 @@
"years ago" => "let nazaj",
"Could not find category \"%s\"" => "Kategorije \"%s\" ni mogoče najti."
);
+$PLURAL_FORMS = "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);";
diff --git a/lib/l10n/sq.php b/lib/l10n/sq.php
index df5e2a31743..7a51b99c2be 100644
--- a/lib/l10n/sq.php
+++ b/lib/l10n/sq.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Ndihmë",
"Personal" => "Personale",
"Settings" => "Parametra",
"Users" => "Përdoruesit",
-"Apps" => "App",
"Admin" => "Admin",
"web services under your control" => "shërbime web nën kontrollin tënd",
"ZIP download is turned off." => "Shkarimi i skedarëve ZIP është i çaktivizuar.",
@@ -50,3 +50,4 @@
"years ago" => "vite më parë",
"Could not find category \"%s\"" => "Kategoria \"%s\" nuk u gjet"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/sr.php b/lib/l10n/sr.php
index 71d627e7890..96dec30124d 100644
--- a/lib/l10n/sr.php
+++ b/lib/l10n/sr.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Помоћ",
"Personal" => "Лично",
"Settings" => "Поставке",
"Users" => "Корисници",
-"Apps" => "Апликације",
"Admin" => "Администратор",
"web services under your control" => "веб сервиси под контролом",
"ZIP download is turned off." => "Преузимање ZIP-а је искључено.",
@@ -33,3 +33,4 @@
"years ago" => "година раније",
"Could not find category \"%s\"" => "Не могу да пронађем категорију „%s“."
);
+$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/sr@latin.php b/lib/l10n/sr@latin.php
index 13cedc83279..1bfa1f0126f 100644
--- a/lib/l10n/sr@latin.php
+++ b/lib/l10n/sr@latin.php
@@ -1,11 +1,12 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Pomoć",
"Personal" => "Lično",
"Settings" => "Podešavanja",
"Users" => "Korisnici",
-"Apps" => "Programi",
"Admin" => "Adninistracija",
"Authentication error" => "Greška pri autentifikaciji",
"Files" => "Fajlovi",
"Text" => "Tekst"
);
+$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/string.php b/lib/l10n/string.php
index 8eef10071e6..88c85b32e70 100644
--- a/lib/l10n/string.php
+++ b/lib/l10n/string.php
@@ -7,19 +7,50 @@
*/
class OC_L10N_String{
+ /**
+ * @var OC_L10N
+ */
protected $l10n;
- public function __construct($l10n, $text, $parameters) {
+
+ /**
+ * @var string
+ */
+ protected $text;
+
+ /**
+ * @var array
+ */
+ protected $parameters;
+
+ /**
+ * @var integer
+ */
+ protected $count;
+
+ public function __construct($l10n, $text, $parameters, $count = 1) {
$this->l10n = $l10n;
$this->text = $text;
$this->parameters = $parameters;
-
+ $this->count = $count;
}
public function __toString() {
$translations = $this->l10n->getTranslations();
+
+ $text = $this->text;
if(array_key_exists($this->text, $translations)) {
- return vsprintf($translations[$this->text], $this->parameters);
+ if(is_array($translations[$this->text])) {
+ $fn = $this->l10n->getPluralFormFunction();
+ $id = $fn($this->count);
+ $text = $translations[$this->text][$id];
+ }
+ else{
+ $text = $translations[$this->text];
+ }
}
- return vsprintf($this->text, $this->parameters);
+
+ // Replace %n first (won't interfere with vsprintf)
+ $text = str_replace('%n', $this->count, $text);
+ return vsprintf($text, $this->parameters);
}
}
diff --git a/lib/l10n/sv.php b/lib/l10n/sv.php
index 0e2e806b4f6..36fd9b4d7b9 100644
--- a/lib/l10n/sv.php
+++ b/lib/l10n/sv.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Hjälp",
"Personal" => "Personligt",
"Settings" => "Inställningar",
"Users" => "Användare",
-"Apps" => "Program",
"Admin" => "Admin",
"Failed to upgrade \"%s\"." => "Misslyckades med att uppgradera \"%s\".",
"web services under your control" => "webbtjänster under din kontroll",
@@ -55,3 +55,4 @@
"Caused by:" => "Orsakad av:",
"Could not find category \"%s\"" => "Kunde inte hitta kategorin \"%s\""
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ta_LK.php b/lib/l10n/ta_LK.php
index 9193f6f1d2f..4a7dd922f85 100644
--- a/lib/l10n/ta_LK.php
+++ b/lib/l10n/ta_LK.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "உதவி",
"Personal" => "தனிப்பட்ட",
"Settings" => "அமைப்புகள்",
"Users" => "பயனாளர்",
-"Apps" => "செயலிகள்",
"Admin" => "நிர்வாகம்",
"web services under your control" => "வலைய சேவைகள் உங்களுடைய கட்டுப்பாட்டின் கீழ் உள்ளது",
"ZIP download is turned off." => "வீசொலிப் பூட்டு பதிவிறக்கம் நிறுத்தப்பட்டுள்ளது.",
@@ -30,3 +30,4 @@
"years ago" => "வருடங்களுக்கு முன்",
"Could not find category \"%s\"" => "பிரிவு \"%s\" ஐ கண்டுப்பிடிக்க முடியவில்லை"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/te.php b/lib/l10n/te.php
index 87c73d790e2..e7d9d921e5e 100644
--- a/lib/l10n/te.php
+++ b/lib/l10n/te.php
@@ -1,4 +1,5 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "సహాయం",
"Settings" => "అమరికలు",
"Users" => "వాడుకరులు",
@@ -11,3 +12,4 @@
"last year" => "పోయిన సంవత్సరం",
"years ago" => "సంవత్సరాల క్రితం"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/th_TH.php b/lib/l10n/th_TH.php
index 4ec6ef55f4e..6d939c4588d 100644
--- a/lib/l10n/th_TH.php
+++ b/lib/l10n/th_TH.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "ช่วยเหลือ",
"Personal" => "ส่วนตัว",
"Settings" => "ตั้งค่า",
"Users" => "ผู้ใช้งาน",
-"Apps" => "แอปฯ",
"Admin" => "ผู้ดูแล",
"web services under your control" => "เว็บเซอร์วิสที่คุณควบคุมการใช้งานได้",
"ZIP download is turned off." => "คุณสมบัติการดาวน์โหลด zip ถูกปิดการใช้งานไว้",
@@ -31,3 +31,4 @@
"years ago" => "ปี ที่ผ่านมา",
"Could not find category \"%s\"" => "ไม่พบหมวดหมู่ \"%s\""
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php
index 6325ad9886a..c3fc70c798c 100644
--- a/lib/l10n/tr.php
+++ b/lib/l10n/tr.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Yardım",
"Personal" => "Kişisel",
"Settings" => "Ayarlar",
"Users" => "Kullanıcılar",
-"Apps" => "Uygulamalar",
"Admin" => "Yönetici",
"web services under your control" => "Bilgileriniz güvenli ve şifreli",
"ZIP download is turned off." => "ZIP indirmeleri kapatılmıştır.",
@@ -51,3 +51,4 @@
"years ago" => "yıl önce",
"Could not find category \"%s\"" => "\"%s\" kategorisi bulunamadı"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/ug.php b/lib/l10n/ug.php
index 62d91616c1d..89d01c4a157 100644
--- a/lib/l10n/ug.php
+++ b/lib/l10n/ug.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "ياردەم",
"Personal" => "شەخسىي",
"Settings" => "تەڭشەكلەر",
"Users" => "ئىشلەتكۈچىلەر",
-"Apps" => "ئەپلەر",
"Authentication error" => "سالاھىيەت دەلىللەش خاتالىقى",
"Files" => "ھۆججەتلەر",
"Text" => "قىسقا ئۇچۇر",
@@ -17,3 +17,4 @@
"%d days ago" => "%d كۈن ئىلگىرى",
"%d months ago" => "%d ئاي ئىلگىرى"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php
index 7ff7829e1a2..93b1a005a23 100644
--- a/lib/l10n/uk.php
+++ b/lib/l10n/uk.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Допомога",
"Personal" => "Особисте",
"Settings" => "Налаштування",
"Users" => "Користувачі",
-"Apps" => "Додатки",
"Admin" => "Адмін",
"web services under your control" => "підконтрольні Вам веб-сервіси",
"ZIP download is turned off." => "ZIP завантаження вимкнено.",
@@ -50,3 +50,4 @@
"years ago" => "роки тому",
"Could not find category \"%s\"" => "Не вдалося знайти категорію \"%s\""
);
+$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/ur_PK.php b/lib/l10n/ur_PK.php
index 21e711c6df5..b98310070e4 100644
--- a/lib/l10n/ur_PK.php
+++ b/lib/l10n/ur_PK.php
@@ -1,9 +1,10 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "مدد",
"Personal" => "ذاتی",
"Settings" => "سیٹینگز",
"Users" => "یوزرز",
-"Apps" => "ایپز",
"Admin" => "ایڈمن",
"web services under your control" => "آپ کے اختیار میں ویب سروسیز"
);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/vi.php b/lib/l10n/vi.php
index f2a7d669b8f..82ecc0fa47a 100644
--- a/lib/l10n/vi.php
+++ b/lib/l10n/vi.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "Giúp đỡ",
"Personal" => "Cá nhân",
"Settings" => "Cài đặt",
"Users" => "Người dùng",
-"Apps" => "Ứng dụng",
"Admin" => "Quản trị",
"web services under your control" => "dịch vụ web dưới sự kiểm soát của bạn",
"ZIP download is turned off." => "Tải về ZIP đã bị tắt.",
@@ -31,3 +31,4 @@
"years ago" => "năm trước",
"Could not find category \"%s\"" => "không thể tìm thấy mục \"%s\""
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/zh_CN.GB2312.php b/lib/l10n/zh_CN.GB2312.php
index 4780a69eb34..3433bdc35b5 100644
--- a/lib/l10n/zh_CN.GB2312.php
+++ b/lib/l10n/zh_CN.GB2312.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "帮助",
"Personal" => "私人",
"Settings" => "设置",
"Users" => "用户",
-"Apps" => "程序",
"Admin" => "管理员",
"web services under your control" => "您控制的网络服务",
"ZIP download is turned off." => "ZIP 下载已关闭",
@@ -29,3 +29,4 @@
"last year" => "去年",
"years ago" => "年前"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/zh_CN.php b/lib/l10n/zh_CN.php
index 7630f885c4a..c71a1030d8f 100644
--- a/lib/l10n/zh_CN.php
+++ b/lib/l10n/zh_CN.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "帮助",
"Personal" => "个人",
"Settings" => "设置",
"Users" => "用户",
-"Apps" => "应用",
"Admin" => "管理",
"web services under your control" => "您控制的web服务",
"ZIP download is turned off." => "ZIP 下载已经关闭",
@@ -51,3 +51,4 @@
"years ago" => "年前",
"Could not find category \"%s\"" => "无法找到分类 \"%s\""
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/zh_HK.php b/lib/l10n/zh_HK.php
index cfa33ec36f5..d6a8e217b57 100644
--- a/lib/l10n/zh_HK.php
+++ b/lib/l10n/zh_HK.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "幫助",
"Personal" => "個人",
"Settings" => "設定",
"Users" => "用戶",
-"Apps" => "軟件",
"Admin" => "管理",
"Files" => "文件",
"Text" => "文字",
@@ -11,3 +11,4 @@
"yesterday" => "昨日",
"last month" => "前一月"
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php
index afd196f7c82..d215995e307 100644
--- a/lib/l10n/zh_TW.php
+++ b/lib/l10n/zh_TW.php
@@ -1,9 +1,9 @@
-<?php $TRANSLATIONS = array(
+<?php
+$TRANSLATIONS = array(
"Help" => "說明",
"Personal" => "個人",
"Settings" => "設定",
"Users" => "使用者",
-"Apps" => "應用程式",
"Admin" => "管理",
"web services under your control" => "由您控制的網路服務",
"ZIP download is turned off." => "ZIP 下載已關閉。",
@@ -51,3 +51,4 @@
"years ago" => "幾年前",
"Could not find category \"%s\"" => "找不到分類:\"%s\""
);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/template/functions.php b/lib/template/functions.php
index a892e310362..501f8081bff 100644
--- a/lib/template/functions.php
+++ b/lib/template/functions.php
@@ -94,15 +94,13 @@ function relative_modified_date($timestamp) {
$diffmonths = round($diffdays/31);
if($timediff < 60) { return $l->t('seconds ago'); }
- else if($timediff < 120) { return $l->t('1 minute ago'); }
- else if($timediff < 3600) { return $l->t('%d minutes ago', $diffminutes); }
- else if($timediff < 7200) { return $l->t('1 hour ago'); }
- else if($timediff < 86400) { return $l->t('%d hours ago', $diffhours); }
+ else if($timediff < 3600) { return $l->n('%n minute ago', '%n minutes ago', $diffminutes); }
+ else if($timediff < 86400) { return $l->n('%n hour ago', '%n hours ago', $diffhours); }
else if((date('G')-$diffhours) > 0) { return $l->t('today'); }
else if((date('G')-$diffhours) > -24) { return $l->t('yesterday'); }
- else if($timediff < 2678400) { return $l->t('%d days ago', $diffdays); }
+ else if($timediff < 2678400) { return $l->n('%n day go', '%n days ago', $diffdays); }
else if($timediff < 5184000) { return $l->t('last month'); }
- else if((date('n')-$diffmonths) > 0) { return $l->t('%d months ago', $diffmonths); }
+ else if((date('n')-$diffmonths) > 0) { return $l->n('%n month ago', '%n months ago', $diffmonths); }
else if($timediff < 63113852) { return $l->t('last year'); }
else { return $l->t('years ago'); }
}
diff --git a/lib/user.php b/lib/user.php
index ee20f2e0971..93c7c9d4cd5 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -137,7 +137,6 @@ class OC_User {
*/
public static function useBackend($backend = 'database') {
if ($backend instanceof OC_User_Interface) {
- OC_Log::write('core', 'Adding user backend instance of ' . get_class($backend) . '.', OC_Log::DEBUG);
self::$_usedBackends[get_class($backend)] = $backend;
self::getManager()->registerBackend($backend);
} else {