summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-06-03 18:06:13 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2013-06-03 18:06:13 -0400
commit1c617321931494e04ae429c659eda2d0217346cb (patch)
tree4df7aa0b565a978b568f0a3a948bedfb40c7f672 /lib
parentd50d663928a924a359b504c20406550758da7c2d (diff)
parentd921004a6e40f7770cc416871fb9500662b561b6 (diff)
downloadnextcloud-server-1c617321931494e04ae429c659eda2d0217346cb.tar.gz
nextcloud-server-1c617321931494e04ae429c659eda2d0217346cb.zip
Merge branch 'master' into convert-oc_config
Diffstat (limited to 'lib')
-rw-r--r--lib/app.php12
-rw-r--r--lib/backgroundjob/job.php49
-rw-r--r--lib/backgroundjob/joblist.php172
-rw-r--r--lib/backgroundjob/legacy/queuedjob.php18
-rw-r--r--lib/backgroundjob/legacy/regularjob.php15
-rw-r--r--lib/backgroundjob/queuedjob.php28
-rw-r--r--lib/backgroundjob/queuedtask.php105
-rw-r--r--lib/backgroundjob/regulartask.php52
-rw-r--r--lib/backgroundjob/timedjob.php41
-rw-r--r--lib/backgroundjob/worker.php118
-rw-r--r--lib/base.php79
-rw-r--r--lib/cache/file.php1
-rw-r--r--lib/cache/fileglobalgc.php8
-rw-r--r--lib/connector/sabre/node.php2
-rw-r--r--lib/db.php17
-rw-r--r--lib/files.php5
-rw-r--r--lib/files/cache/backgroundwatcher.php4
-rw-r--r--lib/files/cache/cache.php83
-rw-r--r--lib/files/cache/permissions.php20
-rw-r--r--lib/files/cache/scanner.php34
-rw-r--r--lib/files/cache/watcher.php2
-rw-r--r--lib/files/filesystem.php51
-rw-r--r--lib/files/storage/common.php18
-rw-r--r--lib/files/view.php62
-rw-r--r--lib/helper.php42
-rw-r--r--lib/hooks/basicemitter.php89
-rw-r--r--lib/hooks/emitter.php32
-rw-r--r--lib/hooks/legacyemitter.php16
-rw-r--r--lib/hooks/publicemitter.php20
-rw-r--r--lib/l10n/ar.php2
-rw-r--r--lib/l10n/bg_BG.php2
-rw-r--r--lib/l10n/ca.php3
-rw-r--r--lib/l10n/cs_CZ.php2
-rw-r--r--lib/l10n/cy_GB.php2
-rw-r--r--lib/l10n/da.php2
-rw-r--r--lib/l10n/de.php2
-rw-r--r--lib/l10n/de_DE.php3
-rw-r--r--lib/l10n/el.php2
-rw-r--r--lib/l10n/es.php3
-rw-r--r--lib/l10n/es_AR.php2
-rw-r--r--lib/l10n/et_EE.php5
-rw-r--r--lib/l10n/eu.php2
-rw-r--r--lib/l10n/fi_FI.php3
-rw-r--r--lib/l10n/fr.php3
-rw-r--r--lib/l10n/gl.php3
-rw-r--r--lib/l10n/hu_HU.php3
-rw-r--r--lib/l10n/id.php2
-rw-r--r--lib/l10n/it.php3
-rw-r--r--lib/l10n/ja_JP.php3
-rw-r--r--lib/l10n/ka_GE.php2
-rw-r--r--lib/l10n/lv.php2
-rw-r--r--lib/l10n/nb_NO.php2
-rw-r--r--lib/l10n/nl.php3
-rw-r--r--lib/l10n/nn_NO.php2
-rw-r--r--lib/l10n/pl.php3
-rw-r--r--lib/l10n/pt_BR.php3
-rw-r--r--lib/l10n/pt_PT.php3
-rw-r--r--lib/l10n/ru.php2
-rw-r--r--lib/l10n/ru_RU.php3
-rw-r--r--lib/l10n/sk_SK.php3
-rw-r--r--lib/l10n/sl.php2
-rw-r--r--lib/l10n/sq.php2
-rw-r--r--lib/l10n/tr.php2
-rw-r--r--lib/l10n/uk.php2
-rw-r--r--lib/l10n/zh_CN.php2
-rw-r--r--lib/l10n/zh_TW.php3
-rw-r--r--lib/mail.php2
-rw-r--r--lib/public/backgroundjob.php169
-rw-r--r--lib/public/share.php158
-rw-r--r--lib/session/internal.php39
-rw-r--r--lib/session/memory.php63
-rw-r--r--lib/session/session.php79
-rw-r--r--lib/setup.php12
-rw-r--r--lib/template.php8
-rw-r--r--lib/user.php543
-rw-r--r--lib/user/backend.php22
-rw-r--r--lib/user/database.php2
-rw-r--r--lib/user/dummy.php144
-rw-r--r--lib/user/manager.php228
-rw-r--r--lib/user/session.php173
-rw-r--r--lib/user/user.php197
-rwxr-xr-xlib/util.php54
-rw-r--r--lib/vcategories.php31
83 files changed, 2279 insertions, 933 deletions
diff --git a/lib/app.php b/lib/app.php
index 55b4543ec9f..c6f6e92e60e 100644
--- a/lib/app.php
+++ b/lib/app.php
@@ -172,9 +172,17 @@ class OC_App{
return array();
}
$apps=array('files');
- $query = OC_DB::prepare( 'SELECT `appid` FROM `*PREFIX*appconfig`'
- .' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\'' );
+ $sql = 'SELECT `appid` FROM `*PREFIX*appconfig`'
+ .' WHERE `configkey` = \'enabled\' AND `configvalue`=\'yes\'';
+ if (OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { //FIXME oracle hack
+ $sql = 'SELECT `appid` FROM `*PREFIX*appconfig`'
+ .' WHERE `configkey` = \'enabled\' AND to_char(`configvalue`)=\'yes\'';
+ }
+ $query = OC_DB::prepare( $sql );
$result=$query->execute();
+ if( \OC_DB::isError($result)) {
+ throw new DatabaseException($result->getMessage(), $query);
+ }
while($row=$result->fetchRow()) {
if(array_search($row['appid'], $apps)===false) {
$apps[]=$row['appid'];
diff --git a/lib/backgroundjob/job.php b/lib/backgroundjob/job.php
new file mode 100644
index 00000000000..49fbffbd684
--- /dev/null
+++ b/lib/backgroundjob/job.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\BackgroundJob;
+
+abstract class Job {
+ protected $id;
+ protected $lastRun;
+ protected $argument;
+
+ /**
+ * @param JobList $jobList
+ */
+ public function execute($jobList) {
+ $jobList->setLastRun($this);
+ $this->run($this->argument);
+ }
+
+ abstract protected function run($argument);
+
+ public function setId($id) {
+ $this->id = $id;
+ }
+
+ public function setLastRun($lastRun) {
+ $this->lastRun = $lastRun;
+ }
+
+ public function setArgument($argument) {
+ $this->argument = $argument;
+ }
+
+ public function getId() {
+ return $this->id;
+ }
+
+ public function getLastRun() {
+ return $this->lastRun;
+ }
+
+ public function getArgument() {
+ return $this->argument;
+ }
+}
diff --git a/lib/backgroundjob/joblist.php b/lib/backgroundjob/joblist.php
new file mode 100644
index 00000000000..cc803dd9b5f
--- /dev/null
+++ b/lib/backgroundjob/joblist.php
@@ -0,0 +1,172 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\BackgroundJob;
+
+/**
+ * Class QueuedJob
+ *
+ * create a background job that is to be executed once
+ *
+ * @package OC\BackgroundJob
+ */
+class JobList {
+ /**
+ * @param Job|string $job
+ * @param mixed $argument
+ */
+ public function add($job, $argument = null) {
+ if (!$this->has($job, $argument)) {
+ if ($job instanceof Job) {
+ $class = get_class($job);
+ } else {
+ $class = $job;
+ }
+ $argument = json_encode($argument);
+ $query = \OC_DB::prepare('INSERT INTO `*PREFIX*jobs`(`class`, `argument`, `last_run`) VALUES(?, ?, 0)');
+ $query->execute(array($class, $argument));
+ }
+ }
+
+ /**
+ * @param Job|string $job
+ * @param mixed $argument
+ */
+ public function remove($job, $argument = null) {
+ if ($job instanceof Job) {
+ $class = get_class($job);
+ } else {
+ $class = $job;
+ }
+ if (!is_null($argument)) {
+ $argument = json_encode($argument);
+ $query = \OC_DB::prepare('DELETE FROM `*PREFIX*jobs` WHERE `class` = ? AND `argument` = ?');
+ $query->execute(array($class, $argument));
+ } else {
+ $query = \OC_DB::prepare('DELETE FROM `*PREFIX*jobs` WHERE `class` = ?');
+ $query->execute(array($class));
+ }
+ }
+
+ /**
+ * check if a job is in the list
+ *
+ * @param $job
+ * @param mixed $argument
+ * @return bool
+ */
+ public function has($job, $argument) {
+ if ($job instanceof Job) {
+ $class = get_class($job);
+ } else {
+ $class = $job;
+ }
+ $argument = json_encode($argument);
+ $query = \OC_DB::prepare('SELECT `id` FROM `*PREFIX*jobs` WHERE `class` = ? AND `argument` = ?');
+ $result = $query->execute(array($class, $argument));
+ return (bool)$result->fetchRow();
+ }
+
+ /**
+ * get all jobs in the list
+ *
+ * @return Job[]
+ */
+ public function getAll() {
+ $query = \OC_DB::prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs`');
+ $result = $query->execute();
+ $jobs = array();
+ while ($row = $result->fetchRow()) {
+ $jobs[] = $this->buildJob($row);
+ }
+ return $jobs;
+ }
+
+ /**
+ * get the next job in the list
+ *
+ * @return Job
+ */
+ public function getNext() {
+ $lastId = $this->getLastJob();
+ $query = \OC_DB::prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs` WHERE `id` > ? ORDER BY `id` ASC', 1);
+ $result = $query->execute(array($lastId));
+ if ($row = $result->fetchRow()) {
+ return $this->buildJob($row);
+ } else {
+ //begin at the start of the queue
+ $query = \OC_DB::prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs` ORDER BY `id` ASC', 1);
+ $result = $query->execute();
+ if ($row = $result->fetchRow()) {
+ return $this->buildJob($row);
+ } else {
+ return null; //empty job list
+ }
+ }
+ }
+
+ /**
+ * @param int $id
+ * @return Job
+ */
+ public function getById($id) {
+ $query = \OC_DB::prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs` WHERE `id` = ?');
+ $result = $query->execute(array($id));
+ if ($row = $result->fetchRow()) {
+ return $this->buildJob($row);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * get the job object from a row in the db
+ *
+ * @param array $row
+ * @return Job
+ */
+ private function buildJob($row) {
+ $class = $row['class'];
+ /**
+ * @var Job $job
+ */
+ $job = new $class();
+ $job->setId($row['id']);
+ $job->setLastRun($row['last_run']);
+ $job->setArgument(json_decode($row['argument']));
+ return $job;
+ }
+
+ /**
+ * set the job that was last ran
+ *
+ * @param Job $job
+ */
+ public function setLastJob($job) {
+ \OC_Appconfig::setValue('backgroundjob', 'lastjob', $job->getId());
+ }
+
+ /**
+ * get the id of the last ran job
+ *
+ * @return int
+ */
+ public function getLastJob() {
+ return \OC_Appconfig::getValue('backgroundjob', 'lastjob', 0);
+ }
+
+ /**
+ * set the lastRun of $job to now
+ *
+ * @param Job $job
+ */
+ public function setLastRun($job) {
+ $query = \OC_DB::prepare('UPDATE `*PREFIX*jobs` SET `last_run` = ? WHERE `id` = ?');
+ $query->execute(array(time(), $job->getId()));
+ }
+}
diff --git a/lib/backgroundjob/legacy/queuedjob.php b/lib/backgroundjob/legacy/queuedjob.php
new file mode 100644
index 00000000000..2bc001103b8
--- /dev/null
+++ b/lib/backgroundjob/legacy/queuedjob.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\BackgroundJob\Legacy;
+
+class QueuedJob extends \OC\BackgroundJob\QueuedJob {
+ public function run($argument) {
+ $class = $argument['klass'];
+ $method = $argument['method'];
+ $parameters = $argument['parameters'];
+ call_user_func(array($class, $method), $parameters);
+ }
+}
diff --git a/lib/backgroundjob/legacy/regularjob.php b/lib/backgroundjob/legacy/regularjob.php
new file mode 100644
index 00000000000..d4cfa348cea
--- /dev/null
+++ b/lib/backgroundjob/legacy/regularjob.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\BackgroundJob\Legacy;
+
+class RegularJob extends \OC\BackgroundJob\Job {
+ public function run($argument) {
+ call_user_func($argument);
+ }
+}
diff --git a/lib/backgroundjob/queuedjob.php b/lib/backgroundjob/queuedjob.php
new file mode 100644
index 00000000000..1714182820d
--- /dev/null
+++ b/lib/backgroundjob/queuedjob.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\BackgroundJob;
+
+/**
+ * Class QueuedJob
+ *
+ * create a background job that is to be executed once
+ *
+ * @package OC\BackgroundJob
+ */
+abstract class QueuedJob extends Job {
+ /**
+ * run the job, then remove it from the joblist
+ *
+ * @param JobList $jobList
+ */
+ public function execute($jobList) {
+ $jobList->remove($this);
+ $this->run($this->argument);
+ }
+}
diff --git a/lib/backgroundjob/queuedtask.php b/lib/backgroundjob/queuedtask.php
deleted file mode 100644
index b2ce6f39ed8..00000000000
--- a/lib/backgroundjob/queuedtask.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
-* ownCloud
-*
-* @author Jakob Sack
-* @copyright 2012 Jakob Sack owncloud@jakobsack.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-/**
- * This class manages our queued tasks.
- */
-class OC_BackgroundJob_QueuedTask{
- /**
- * @brief Gets one queued task
- * @param $id ID of the task
- * @return associative array
- */
- public static function find( $id ) {
- $stmt = OC_DB::prepare( 'SELECT * FROM `*PREFIX*queuedtasks` WHERE `id` = ?' );
- $result = $stmt->execute(array($id));
- return $result->fetchRow();
- }
-
- /**
- * @brief Gets all queued tasks
- * @return array with associative arrays
- */
- public static function all() {
- // Array for objects
- $return = array();
-
- // Get Data
- $stmt = OC_DB::prepare( 'SELECT * FROM `*PREFIX*queuedtasks`' );
- $result = $stmt->execute(array());
- while( $row = $result->fetchRow()) {
- $return[] = $row;
- }
-
- return $return;
- }
-
- /**
- * @brief Gets all queued tasks of a specific app
- * @param $app app name
- * @return array with associative arrays
- */
- public static function whereAppIs( $app ) {
- // Array for objects
- $return = array();
-
- // Get Data
- $stmt = OC_DB::prepare( 'SELECT * FROM `*PREFIX*queuedtasks` WHERE `app` = ?' );
- $result = $stmt->execute(array($app));
- while( $row = $result->fetchRow()) {
- $return[] = $row;
- }
-
- // Und weg damit
- return $return;
- }
-
- /**
- * @brief queues a task
- * @param $app app name
- * @param $klass class name
- * @param $method method name
- * @param $parameters all useful data as text
- * @return id of task
- */
- public static function add( $app, $klass, $method, $parameters ) {
- $stmt = OC_DB::prepare( 'INSERT INTO `*PREFIX*queuedtasks` (`app`, `klass`, `method`, `parameters`)'
- .' VALUES(?,?,?,?)' );
- $result = $stmt->execute(array($app, $klass, $method, $parameters ));
-
- return OC_DB::insertid();
- }
-
- /**
- * @brief deletes a queued task
- * @param $id id of task
- * @return true/false
- *
- * Deletes a report
- */
- public static function delete( $id ) {
- $stmt = OC_DB::prepare( 'DELETE FROM `*PREFIX*queuedtasks` WHERE `id` = ?' );
- $result = $stmt->execute(array($id));
-
- return true;
- }
-}
diff --git a/lib/backgroundjob/regulartask.php b/lib/backgroundjob/regulartask.php
deleted file mode 100644
index 9976872ee13..00000000000
--- a/lib/backgroundjob/regulartask.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
-* ownCloud
-*
-* @author Jakob Sack
-* @copyright 2012 Jakob Sack owncloud@jakobsack.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-/**
- * This class manages the regular tasks.
- */
-class OC_BackgroundJob_RegularTask{
- static private $registered = array();
-
- /**
- * @brief creates a regular task
- * @param $klass class name
- * @param $method method name
- * @return true
- */
- static public function register( $klass, $method ) {
- // Create the data structure
- self::$registered["$klass-$method"] = array( $klass, $method );
-
- // No chance for failure ;-)
- return true;
- }
-
- /**
- * @brief gets all regular tasks
- * @return associative array
- *
- * key is string "$klass-$method", value is array( $klass, $method )
- */
- static public function all() {
- return self::$registered;
- }
-}
diff --git a/lib/backgroundjob/timedjob.php b/lib/backgroundjob/timedjob.php
new file mode 100644
index 00000000000..ae9f33505ab
--- /dev/null
+++ b/lib/backgroundjob/timedjob.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\BackgroundJob;
+
+/**
+ * Class QueuedJob
+ *
+ * create a background job that is to be executed at an interval
+ *
+ * @package OC\BackgroundJob
+ */
+abstract class TimedJob extends Job {
+ protected $interval = 0;
+
+ /**
+ * set the interval for the job
+ *
+ * @param int $interval
+ */
+ public function setInterval($interval) {
+ $this->interval = $interval;
+ }
+
+ /**
+ * run the job if
+ *
+ * @param JobList $jobList
+ */
+ public function execute($jobList) {
+ if ((time() - $this->lastRun) > $this->interval) {
+ $jobList->setLastRun($this);
+ $this->run($this->argument);
+ }
+ }
+}
diff --git a/lib/backgroundjob/worker.php b/lib/backgroundjob/worker.php
deleted file mode 100644
index e966ac9647c..00000000000
--- a/lib/backgroundjob/worker.php
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-/**
-* ownCloud
-*
-* @author Jakob Sack
-* @copyright 2012 Jakob Sack owncloud@jakobsack.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-/**
- * This class does the dirty work.
- *
- * TODO: locking in doAllSteps
- */
-class OC_BackgroundJob_Worker{
- /**
- * @brief executes all tasks
- * @return boolean
- *
- * This method executes all regular tasks and then all queued tasks.
- * This method should be called by cli scripts that do not let the user
- * wait.
- */
- public static function doAllSteps() {
- // Do our regular work
- $lasttask = OC_Appconfig::getValue( 'core', 'backgroundjobs_task', '' );
-
- $regular_tasks = OC_BackgroundJob_RegularTask::all();
- ksort( $regular_tasks );
- foreach( $regular_tasks as $key => $value ) {
- if( strcmp( $key, $lasttask ) > 0 ) {
- // Set "restart here" config value
- OC_Appconfig::setValue( 'core', 'backgroundjobs_task', $key );
- call_user_func( $value );
- }
- }
- // Reset "start here" config value
- OC_Appconfig::setValue( 'core', 'backgroundjobs_task', '' );
-
- // Do our queued tasks
- $queued_tasks = OC_BackgroundJob_QueuedTask::all();
- foreach( $queued_tasks as $task ) {
- OC_BackgroundJob_QueuedTask::delete( $task['id'] );
- call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
- }
-
- return true;
- }
-
- /**
- * @brief does a single task
- * @return boolean
- *
- * This method executes one task. It saves the last state and continues
- * with the next step. This method should be used by webcron and ajax
- * services.
- */
- public static function doNextStep() {
- $laststep = OC_Appconfig::getValue( 'core', 'backgroundjobs_step', 'regular_tasks' );
-
- if( $laststep == 'regular_tasks' ) {
- // get last app
- $lasttask = OC_Appconfig::getValue( 'core', 'backgroundjobs_task', '' );
-
- // What's the next step?
- $regular_tasks = OC_BackgroundJob_RegularTask::all();
- ksort( $regular_tasks );
- $done = false;
-
- // search for next background job
- foreach( $regular_tasks as $key => $value ) {
- if( strcmp( $key, $lasttask ) > 0 ) {
- OC_Appconfig::setValue( 'core', 'backgroundjobs_task', $key );
- $done = true;
- call_user_func( $value );
- break;
- }
- }
-
- if( $done == false ) {
- // Next time load queued tasks
- OC_Appconfig::setValue( 'core', 'backgroundjobs_step', 'queued_tasks' );
- }
- }
- else{
- $tasks = OC_BackgroundJob_QueuedTask::all();
- if( count( $tasks )) {
- $task = $tasks[0];
- // delete job before we execute it. This prevents endless loops
- // of failing jobs.
- OC_BackgroundJob_QueuedTask::delete($task['id']);
-
- // execute job
- call_user_func( array( $task['klass'], $task['method'] ), $task['parameters'] );
- }
- else{
- // Next time load queued tasks
- OC_Appconfig::setValue( 'core', 'backgroundjobs_step', 'regular_tasks' );
- OC_Appconfig::setValue( 'core', 'backgroundjobs_task', '' );
- }
- }
-
- return true;
- }
-}
diff --git a/lib/base.php b/lib/base.php
index 667202d3aef..a6e4a47dbf5 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -75,6 +75,11 @@ class OC {
protected static $router = null;
/**
+ * @var \OC\Session\Session
+ */
+ public static $session = null;
+
+ /**
* @var \OC\Autoloader $loader
*/
public static $loader = null;
@@ -253,13 +258,16 @@ class OC {
public static function initTemplateEngine() {
// Add the stuff we need always
- OC_Util::addScript("jquery-1.7.2.min");
+ OC_Util::addScript("jquery-1.10.0.min");
+ OC_Util::addScript("jquery-migrate-1.2.1.min");
OC_Util::addScript("jquery-ui-1.10.0.custom");
OC_Util::addScript("jquery-showpassword");
OC_Util::addScript("jquery.infieldlabel");
OC_Util::addScript("jquery-tipsy");
OC_Util::addScript("compatibility");
+ OC_Util::addScript("jquery.ocdialog");
OC_Util::addScript("oc-dialogs");
+ OC_Util::addScript("octemplate");
OC_Util::addScript("js");
OC_Util::addScript("eventsource");
OC_Util::addScript("config");
@@ -271,6 +279,7 @@ class OC {
OC_Util::addStyle("multiselect");
OC_Util::addStyle("jquery-ui-1.10.0.custom");
OC_Util::addStyle("jquery-tipsy");
+ OC_Util::addStyle("jquery.ocdialog");
OC_Util::addScript("oc-requesttoken");
}
@@ -282,14 +291,17 @@ class OC {
$cookie_path = OC::$WEBROOT ?: '/';
ini_set('session.cookie_path', $cookie_path);
- // set the session name to the instance id - which is unique
- session_name(OC_Util::getInstanceId());
+ try{
+ // set the session name to the instance id - which is unique
+ self::$session = new \OC\Session\Internal(OC_Util::getInstanceId());
+ // if session cant be started break with http 500 error
+ }catch (Exception $e){
+ //set the session object to a dummy session so code relying on the session existing still works
+ self::$session = new \OC\Session\Memory('');
- // if session cant be started break with http 500 error
- if (session_start() === false){
- OC_Log::write('core', 'Session could not be initialized',
+ OC_Log::write('core', 'Session could not be initialized',
OC_Log::ERROR);
-
+
header('HTTP/1.1 500 Internal Server Error');
OC_Util::addStyle("styles");
$error = 'Session could not be initialized. Please contact your ';
@@ -303,15 +315,15 @@ class OC {
}
// regenerate session id periodically to avoid session fixation
- if (!isset($_SESSION['SID_CREATED'])) {
- $_SESSION['SID_CREATED'] = time();
- } else if (time() - $_SESSION['SID_CREATED'] > 60*60*12) {
+ if (!self::$session->exists('SID_CREATED')) {
+ self::$session->set('SID_CREATED', time());
+ } else if (time() - self::$session->get('SID_CREATED') > 60*60*12) {
session_regenerate_id(true);
- $_SESSION['SID_CREATED'] = time();
+ self::$session->set('SID_CREATED', time());
}
// session timeout
- if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 60*60*24)) {
+ if (self::$session->exists('LAST_ACTIVITY') && (time() - self::$session->get('LAST_ACTIVITY') > 60*60*24)) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, $cookie_path);
}
@@ -319,7 +331,8 @@ class OC {
session_destroy();
session_start();
}
- $_SESSION['LAST_ACTIVITY'] = time();
+
+ self::$session->set('LAST_ACTIVITY', time());
}
public static function getRouter() {
@@ -430,12 +443,14 @@ class OC {
stream_wrapper_register('oc', 'OC\Files\Stream\OC');
self::initTemplateEngine();
- self::checkConfig();
- self::checkInstalled();
- self::checkSSL();
if ( !self::$CLI ) {
self::initSession();
+ } else {
+ self::$session = new \OC\Session\Memory('');
}
+ self::checkConfig();
+ self::checkInstalled();
+ self::checkSSL();
$errors = OC_Util::checkServer();
if (count($errors) > 0) {
@@ -445,14 +460,14 @@ class OC {
// User and Groups
if (!OC_Config::getValue("installed", false)) {
- $_SESSION['user_id'] = '';
+ self::$session->set('user_id','');
}
OC_User::useBackend(new OC_User_Database());
OC_Group::useBackend(new OC_Group_Database());
- if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SESSION['user_id'])
- && $_SERVER['PHP_AUTH_USER'] != $_SESSION['user_id']) {
+ if (isset($_SERVER['PHP_AUTH_USER']) && self::$session->exists('user_id')
+ && $_SERVER['PHP_AUTH_USER'] != self::$session->get('user_id')) {
OC_User::logout();
}
@@ -524,9 +539,15 @@ class OC {
* register hooks for the cache
*/
public static function registerCacheHooks() {
- // register cache cleanup jobs
- OC_BackgroundJob_RegularTask::register('OC_Cache_FileGlobal', 'gc');
- OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener');
+ if (OC_Config::getValue('installed', false)) { //don't try to do this before we are properly setup
+ // register cache cleanup jobs
+ try { //if this is executed before the upgrade to the new backgroundjob system is completed it will throw an exception
+ \OCP\BackgroundJob::registerJob('OC_Cache_FileGlobalGC');
+ } catch (Exception $e) {
+
+ }
+ OC_Hook::connect('OC_User', 'post_login', 'OC_Cache_File', 'loginListener');
+ }
}
/**
@@ -542,10 +563,12 @@ class OC {
* register hooks for sharing
*/
public static function registerShareHooks() {
- OC_Hook::connect('OC_User', 'post_deleteUser', 'OCP\Share', 'post_deleteUser');
- OC_Hook::connect('OC_User', 'post_addToGroup', 'OCP\Share', 'post_addToGroup');
- OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OCP\Share', 'post_removeFromGroup');
- OC_Hook::connect('OC_User', 'post_deleteGroup', 'OCP\Share', 'post_deleteGroup');
+ if(\OC_Config::getValue('installed')) {
+ OC_Hook::connect('OC_User', 'post_deleteUser', 'OCP\Share', 'post_deleteUser');
+ OC_Hook::connect('OC_User', 'post_addToGroup', 'OCP\Share', 'post_addToGroup');
+ OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OCP\Share', 'post_removeFromGroup');
+ OC_Hook::connect('OC_User', 'post_deleteGroup', 'OCP\Share', 'post_deleteGroup');
+ }
}
/**
@@ -595,7 +618,7 @@ class OC {
// Handle redirect URL for logged in users
if (isset($_REQUEST['redirect_url']) && OC_User::isLoggedIn()) {
$location = OC_Helper::makeURLAbsolute(urldecode($_REQUEST['redirect_url']));
-
+
// Deny the redirect if the URL contains a @
// This prevents unvalidated redirects like ?redirect_url=:user@domain.com
if (strpos($location, '@') === false) {
@@ -745,7 +768,7 @@ class OC {
if (OC_User::login($_POST["user"], $_POST["password"])) {
// setting up the time zone
if (isset($_POST['timezone-offset'])) {
- $_SESSION['timezone'] = $_POST['timezone-offset'];
+ self::$session->set('timezone', $_POST['timezone-offset']);
}
self::cleanupLoginTokens($_POST['user']);
diff --git a/lib/cache/file.php b/lib/cache/file.php
index f9ecf41dcac..531e1d50f40 100644
--- a/lib/cache/file.php
+++ b/lib/cache/file.php
@@ -14,6 +14,7 @@ class OC_Cache_File{
return $this->storage;
}
if(OC_User::isLoggedIn()) {
+ \OC\Files\Filesystem::initMountPoints(OC_User::getUser());
$subdir = 'cache';
$view = new \OC\Files\View('/'.OC_User::getUser());
if(!$view->file_exists($subdir)) {
diff --git a/lib/cache/fileglobalgc.php b/lib/cache/fileglobalgc.php
new file mode 100644
index 00000000000..a29c31f9063
--- /dev/null
+++ b/lib/cache/fileglobalgc.php
@@ -0,0 +1,8 @@
+<?php
+
+
+class OC_Cache_FileGlobalGC extends \OC\BackgroundJob\Job{
+ public function run($argument){
+ OC_Cache_FileGlobal::gc();
+ }
+}
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index 360c3066d05..1ffa048d6b2 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -101,7 +101,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
/**
* @brief Ensure that the fileinfo cache is filled
- & @note Uses OC_FileCache or a direct stat
+ * @note Uses OC_FileCache or a direct stat
*/
protected function getFileinfoCache() {
if (!isset($this->fileinfo_cache)) {
diff --git a/lib/db.php b/lib/db.php
index 8f6f50bda6e..61836551833 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -273,18 +273,13 @@ class OC_DB {
break;
case 'oci':
$dsn = array(
- 'phptype' => 'oci8',
- 'username' => $user,
- 'password' => $pass,
- 'charset' => 'AL32UTF8',
+ 'phptype' => 'oci8',
+ 'username' => $user,
+ 'password' => $pass,
+ 'service' => $name,
+ 'hostspec' => $host,
+ 'charset' => 'AL32UTF8',
);
- if ($host != '') {
- $dsn['hostspec'] = $host;
- $dsn['database'] = $name;
- } else { // use dbname for hostspec
- $dsn['hostspec'] = $name;
- $dsn['database'] = $user;
- }
break;
case 'mssql':
$dsn = array(
diff --git a/lib/files.php b/lib/files.php
index ab7fa1ed096..abb1617c25e 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -123,8 +123,11 @@ class OC_Files {
header('Content-Length: ' . filesize($filename));
self::addSendfileHeader($filename);
}else{
+ $filesize = \OC\Files\Filesystem::filesize($filename);
header('Content-Type: '.\OC\Files\Filesystem::getMimeType($filename));
- header("Content-Length: ".\OC\Files\Filesystem::filesize($filename));
+ if ($filesize > -1) {
+ header("Content-Length: ".$filesize);
+ }
list($storage) = \OC\Files\Filesystem::resolvePath($filename);
if ($storage instanceof \OC\Files\Storage\Local) {
self::addSendfileHeader(\OC\Files\Filesystem::getLocalFile($filename));
diff --git a/lib/files/cache/backgroundwatcher.php b/lib/files/cache/backgroundwatcher.php
index 7549745e7d7..8933101577d 100644
--- a/lib/files/cache/backgroundwatcher.php
+++ b/lib/files/cache/backgroundwatcher.php
@@ -30,7 +30,7 @@ class BackgroundWatcher {
return;
}
list($storageId, $internalPath) = $cacheItem;
- $mounts = Mount::findByStorageId($storageId);
+ $mounts = Filesystem::getMountByStorageId($storageId);
if (count($mounts) === 0) {
//if the storage we need isn't mounted on default, try to find a user that has access to the storage
@@ -40,7 +40,7 @@ class BackgroundWatcher {
return;
}
Filesystem::initMountPoints($users[0]);
- $mounts = Mount::findByStorageId($storageId);
+ $mounts = Filesystem::getMountByStorageId($storageId);
if (count($mounts) === 0) {
return;
}
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 8f5c9643bef..cae2e63e4dc 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -100,6 +100,9 @@ class Cache {
*/
public function get($file) {
if (is_string($file) or $file == '') {
+ // normalize file
+ $file = $this->normalize($file);
+
$where = 'WHERE `storage` = ? AND `path_hash` = ?';
$params = array($this->getNumericStorageId(), md5($file));
} else { //file id
@@ -107,7 +110,7 @@ class Cache {
$params = array($file);
}
$query = \OC_DB::prepare(
- 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
+ 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` ' . $where);
$result = $query->execute($params);
$data = $result->fetchRow();
@@ -123,9 +126,13 @@ class Cache {
$data['size'] = (int)$data['size'];
$data['mtime'] = (int)$data['mtime'];
$data['encrypted'] = (bool)$data['encrypted'];
+ $data['unencrypted_size'] = (int)$data['unencrypted_size'];
$data['storage'] = $this->storageId;
$data['mimetype'] = $this->getMimetype($data['mimetype']);
$data['mimepart'] = $this->getMimetype($data['mimepart']);
+ if ($data['storage_mtime'] == 0) {
+ $data['storage_mtime'] = $data['mtime'];
+ }
}
return $data;
@@ -141,13 +148,20 @@ class Cache {
$fileId = $this->getId($folder);
if ($fileId > -1) {
$query = \OC_DB::prepare(
- 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
- FROM `*PREFIX*filecache` WHERE parent = ? ORDER BY `name` ASC');
+ 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`
+ FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC');
+
$result = $query->execute(array($fileId));
+ if (\OC_DB::isError($result)) {
+ \OCP\Util::writeLog('cache', 'getFolderContents failed: ' . $result->getMessage(), \OCP\Util::ERROR);
+ }
$files = $result->fetchAll();
foreach ($files as &$file) {
$file['mimetype'] = $this->getMimetype($file['mimetype']);
$file['mimepart'] = $this->getMimetype($file['mimepart']);
+ if ($file['storage_mtime'] == 0) {
+ $file['storage_mtime'] = $file['mtime'];
+ }
}
return $files;
} else {
@@ -168,6 +182,9 @@ class Cache {
$this->update($id, $data);
return $id;
} else {
+ // normalize file
+ $file = $this->normalize($file);
+
if (isset($this->partial[$file])) { //add any saved partial data
$data = array_merge($this->partial[$file], $data);
unset($this->partial[$file]);
@@ -195,7 +212,7 @@ class Cache {
. ' VALUES(' . implode(', ', $valuesPlaceholder) . ')');
$result = $query->execute($params);
if (\OC_DB::isError($result)) {
- \OCP\Util::writeLog('cache', 'Insert to cache failed: ' . $result, \OCP\Util::ERROR);
+ \OCP\Util::writeLog('cache', 'Insert to cache failed: ' . $result->getMessage(), \OCP\Util::ERROR);
}
return (int)\OC_DB::insertid('*PREFIX*filecache');
@@ -209,6 +226,17 @@ class Cache {
* @param array $data
*/
public function update($id, array $data) {
+
+ if(isset($data['path'])) {
+ // normalize path
+ $data['path'] = $this->normalize($data['path']);
+ }
+
+ if(isset($data['name'])) {
+ // normalize path
+ $data['name'] = $this->normalize($data['name']);
+ }
+
list($queryParts, $params) = $this->buildParts($data);
$params[] = $id;
@@ -224,7 +252,7 @@ class Cache {
* @return array
*/
function buildParts(array $data) {
- $fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'encrypted', 'etag');
+ $fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted', 'unencrypted_size', 'etag');
$params = array();
$queryParts = array();
foreach ($data as $name => $value) {
@@ -236,6 +264,11 @@ class Cache {
$params[] = $this->getMimetypeId(substr($value, 0, strpos($value, '/')));
$queryParts[] = '`mimepart`';
$value = $this->getMimetypeId($value);
+ } elseif ($name === 'storage_mtime') {
+ if (!isset($data['mtime'])) {
+ $params[] = $value;
+ $queryParts[] = '`mtime`';
+ }
}
$params[] = $value;
$queryParts[] = '`' . $name . '`';
@@ -251,6 +284,9 @@ class Cache {
* @return int
*/
public function getId($file) {
+ // normalize file
+ $file = $this->normalize($file);
+
$pathHash = md5($file);
$query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?');
@@ -318,14 +354,18 @@ class Cache {
* @param string $target
*/
public function move($source, $target) {
+ // normalize source and target
+ $source = $this->normalize($source);
+ $target = $this->normalize($target);
+
$sourceData = $this->get($source);
$sourceId = $sourceData['fileid'];
$newParentId = $this->getParentId($target);
if ($sourceData['mimetype'] === 'httpd/unix-directory') {
//find all child entries
- $query = \OC_DB::prepare('SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `path` LIKE ?');
- $result = $query->execute(array($source . '/%'));
+ $query = \OC_DB::prepare('SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?');
+ $result = $query->execute(array($this->getNumericStorageId(), $source . '/%'));
$childEntries = $result->fetchAll();
$sourceLength = strlen($source);
$query = \OC_DB::prepare('UPDATE `*PREFIX*filecache` SET `path` = ?, `path_hash` = ? WHERE `fileid` = ?');
@@ -358,9 +398,15 @@ class Cache {
* @return int, Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
*/
public function getStatus($file) {
+ // normalize file
+ $file = $this->normalize($file);
+
$pathHash = md5($file);
$query = \OC_DB::prepare('SELECT `size` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?');
$result = $query->execute(array($this->getNumericStorageId(), $pathHash));
+ if( \OC_DB::isError($result)) {
+ \OCP\Util::writeLog('cache', 'get status failed: ' . $result->getMessage(), \OCP\Util::ERROR);
+ }
if ($row = $result->fetchRow()) {
if ((int)$row['size'] === -1) {
return self::SHALLOW;
@@ -383,8 +429,12 @@ class Cache {
* @return array of file data
*/
public function search($pattern) {
+
+ // normalize pattern
+ $pattern = $this->normalize($pattern);
+
$query = \OC_DB::prepare('
- SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
+ SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` WHERE `name` LIKE ? AND `storage` = ?'
);
$result = $query->execute(array($pattern, $this->getNumericStorageId()));
@@ -410,7 +460,7 @@ class Cache {
$where = '`mimepart` = ?';
}
$query = \OC_DB::prepare('
- SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
+ SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?'
);
$mimetype = $this->getMimetypeId($mimetype);
@@ -498,8 +548,11 @@ class Cache {
*/
public function getIncomplete() {
$query = \OC_DB::prepare('SELECT `path` FROM `*PREFIX*filecache`'
- . ' WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC LIMIT 1');
+ . ' WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC',1);
$result = $query->execute(array($this->getNumericStorageId()));
+ if (\OC_DB::isError($result)) {
+ \OCP\Util::writeLog('cache', 'getIncomplete failed: ' . $result->getMessage(), \OCP\Util::ERROR);
+ }
if ($row = $result->fetchRow()) {
return $row['path'];
} else {
@@ -529,4 +582,14 @@ class Cache {
return null;
}
}
+
+ /**
+ * normalize the given path
+ * @param $path
+ * @return string
+ */
+ public function normalize($path) {
+
+ return \OC_Util::normalizeUnicode($path);
+ }
}
diff --git a/lib/files/cache/permissions.php b/lib/files/cache/permissions.php
index faa5ff5eacc..29c30b0f36c 100644
--- a/lib/files/cache/permissions.php
+++ b/lib/files/cache/permissions.php
@@ -86,6 +86,26 @@ class Permissions {
}
/**
+ * get the permissions for all files in a folder
+ *
+ * @param int $parentId
+ * @param string $user
+ * @return int[]
+ */
+ public function getDirectoryPermissions($parentId, $user) {
+ $query = \OC_DB::prepare('SELECT `*PREFIX*permissions`.`fileid`, `permissions`
+ FROM `*PREFIX*permissions` INNER JOIN `*PREFIX*filecache` ON `*PREFIX*permissions`.`fileid` = `*PREFIX*filecache`.`fileid`
+ WHERE `*PREFIX*filecache`.`parent` = ? AND `*PREFIX*permissions`.`user` = ?');
+
+ $result = $query->execute(array($parentId, $user));
+ $filePermissions = array();
+ while ($row = $result->fetchRow()) {
+ $filePermissions[$row['fileid']] = $row['permissions'];
+ }
+ return $filePermissions;
+ }
+
+ /**
* remove the permissions for a file
*
* @param int $fileId
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index 661bc486330..8f9a7921956 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -51,6 +51,7 @@ class Scanner {
$data['size'] = $this->storage->filesize($path);
}
$data['etag'] = $this->storage->getETag($path);
+ $data['storage_mtime'] = $data['mtime'];
return $data;
}
@@ -77,18 +78,21 @@ class Scanner {
$this->scanFile($parent);
}
}
- if($cacheData = $this->cache->get($file)) {
+ $newData = $data;
+ if ($cacheData = $this->cache->get($file)) {
+ if ($checkExisting && $data['size'] === -1) {
+ $data['size'] = $cacheData['size'];
+ }
if ($data['mtime'] === $cacheData['mtime'] &&
$data['size'] === $cacheData['size']) {
$data['etag'] = $cacheData['etag'];
}
+ // Only update metadata that has changed
+ $newData = array_diff($data, $cacheData);
}
- if ($checkExisting and $cacheData) {
- if ($data['size'] === -1) {
- $data['size'] = $cacheData['size'];
- }
+ if (!empty($newData)) {
+ $this->cache->put($file, $newData);
}
- $this->cache->put($file, $data);
}
return $data;
}
@@ -115,7 +119,7 @@ class Scanner {
\OC_DB::beginTransaction();
while ($file = readdir($dh)) {
$child = ($path) ? $path . '/' . $file : $file;
- if (!$this->isIgnoredDir($file)) {
+ if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
$data = $this->scanFile($child, $recursive === self::SCAN_SHALLOW);
if ($data) {
if ($data['size'] === -1) {
@@ -150,18 +154,6 @@ class Scanner {
}
/**
- * @brief check if the directory should be ignored when scanning
- * NOTE: the special directories . and .. would cause never ending recursion
- * @param String $dir
- * @return boolean
- */
- private function isIgnoredDir($dir) {
- if ($dir === '.' || $dir === '..') {
- return true;
- }
- return false;
- }
- /**
* @brief check if the file should be ignored when scanning
* NOTE: files with a '.part' extension are ignored as well!
* prevents unfinished put requests to be scanned
@@ -179,9 +171,11 @@ class Scanner {
* walk over any folders that are not fully scanned yet and scan them
*/
public function backgroundScan() {
- while (($path = $this->cache->getIncomplete()) !== false) {
+ $lastPath = null;
+ while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
$this->scan($path);
$this->cache->correctFolderSize($path);
+ $lastPath = $path;
}
}
}
diff --git a/lib/files/cache/watcher.php b/lib/files/cache/watcher.php
index 31059ec7f56..8bfd4602f3a 100644
--- a/lib/files/cache/watcher.php
+++ b/lib/files/cache/watcher.php
@@ -43,7 +43,7 @@ class Watcher {
*/
public function checkUpdate($path) {
$cachedEntry = $this->cache->get($path);
- if ($this->storage->hasUpdated($path, $cachedEntry['mtime'])) {
+ if ($this->storage->hasUpdated($path, $cachedEntry['storage_mtime'])) {
if ($this->storage->is_dir($path)) {
$this->scanner->scan($path, Scanner::SCAN_SHALLOW);
} else {
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php
index d60d430d77c..d3fddf8c421 100644
--- a/lib/files/filesystem.php
+++ b/lib/files/filesystem.php
@@ -152,6 +152,9 @@ class Filesystem {
* @return string
*/
static public function getMountPoint($path) {
+ if (!self::$mounts) {
+ \OC_Util::setupFS();
+ }
$mount = self::$mounts->find($path);
if ($mount) {
return $mount->getMountPoint();
@@ -167,6 +170,9 @@ class Filesystem {
* @return string[]
*/
static public function getMountPoints($path) {
+ if (!self::$mounts) {
+ \OC_Util::setupFS();
+ }
$result = array();
$mounts = self::$mounts->findIn($path);
foreach ($mounts as $mount) {
@@ -182,6 +188,9 @@ class Filesystem {
* @return \OC\Files\Storage\Storage
*/
public static function getStorage($mountPoint) {
+ if (!self::$mounts) {
+ \OC_Util::setupFS();
+ }
$mount = self::$mounts->find($mountPoint);
return $mount->getStorage();
}
@@ -191,6 +200,9 @@ class Filesystem {
* @return Mount\Mount[]
*/
public static function getMountByStorageId($id) {
+ if (!self::$mounts) {
+ \OC_Util::setupFS();
+ }
return self::$mounts->findByStorageId($id);
}
@@ -199,6 +211,9 @@ class Filesystem {
* @return Mount\Mount[]
*/
public static function getMountByNumericId($id) {
+ if (!self::$mounts) {
+ \OC_Util::setupFS();
+ }
return self::$mounts->findByNumericId($id);
}
@@ -209,6 +224,9 @@ class Filesystem {
* @return array consisting of the storage and the internal path
*/
static public function resolvePath($path) {
+ if (!self::$mounts) {
+ \OC_Util::setupFS();
+ }
$mount = self::$mounts->find($path);
if ($mount) {
return array($mount->getStorage(), $mount->getInternalPath($path));
@@ -223,7 +241,7 @@ class Filesystem {
}
self::$defaultInstance = new View($root);
- if(!self::$mounts) {
+ if (!self::$mounts) {
self::$mounts = new Mount\Manager();
}
@@ -235,8 +253,10 @@ class Filesystem {
return true;
}
- static public function initMounts(){
- self::$mounts = new Mount\Manager();
+ static public function initMounts() {
+ if (!self::$mounts) {
+ self::$mounts = new Mount\Manager();
+ }
}
/**
@@ -357,7 +377,9 @@ class Filesystem {
* clear all mounts and storage backends
*/
public static function clearMounts() {
- self::$mounts->clear();
+ if (self::$mounts) {
+ self::$mounts->clear();
+ }
}
/**
@@ -368,6 +390,9 @@ class Filesystem {
* @param string $mountpoint
*/
static public function mount($class, $arguments, $mountpoint) {
+ if (!self::$mounts) {
+ \OC_Util::setupFS();
+ }
$mount = new Mount\Mount($class, $mountpoint, $arguments);
self::$mounts->addMount($mount);
}
@@ -454,6 +479,19 @@ class Filesystem {
}
/**
+ * @brief check if the directory should be ignored when scanning
+ * NOTE: the special directories . and .. would cause never ending recursion
+ * @param String $dir
+ * @return boolean
+ */
+ static public function isIgnoredDir($dir) {
+ if ($dir === '.' || $dir === '..') {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* following functions are equivalent to their php builtin equivalents for arguments/return values.
*/
static public function mkdir($path) {
@@ -616,9 +654,8 @@ class Filesystem {
$path = substr($path, 0, -1);
}
//normalize unicode if possible
- if (class_exists('Normalizer')) {
- $path = \Normalizer::normalize($path);
- }
+ $path = \OC_Util::normalizeUnicode($path);
+
return $path;
}
diff --git a/lib/files/storage/common.php b/lib/files/storage/common.php
index e87fe3b5239..3da13ac4df0 100644
--- a/lib/files/storage/common.php
+++ b/lib/files/storage/common.php
@@ -138,27 +138,21 @@ abstract class Common implements \OC\Files\Storage\Storage {
*/
public function deleteAll($directory, $empty = false) {
$directory = trim($directory, '/');
-
- if (!$this->file_exists(\OCP\USER::getUser() . '/' . $directory)
- || !$this->is_dir(\OCP\USER::getUser() . '/' . $directory)
- ) {
- return false;
- } elseif (!$this->isReadable(\OCP\USER::getUser() . '/' . $directory)) {
+ if (!$this->is_dir($directory) || !$this->isReadable($directory)) {
return false;
} else {
- $directoryHandle = $this->opendir(\OCP\USER::getUser() . '/' . $directory);
+ $directoryHandle = $this->opendir($directory);
while ($contents = readdir($directoryHandle)) {
- if ($contents != '.' && $contents != '..') {
- $path = $directory . "/" . $contents;
+ if (!\OC\Files\Filesystem::isIgnoredDir($contents)) {
+ $path = $directory . '/' . $contents;
if ($this->is_dir($path)) {
$this->deleteAll($path);
} else {
- $this->unlink(\OCP\USER::getUser() . '/' . $path); // TODO: make unlink use same system path as is_dir
+ $this->unlink($path);
}
}
}
- //$this->closedir( $directoryHandle ); // TODO: implement closedir in OC_FSV
- if ($empty == false) {
+ if ($empty === false) {
if (!$this->rmdir($directory)) {
return false;
}
diff --git a/lib/files/view.php b/lib/files/view.php
index f35e1e3dc16..ecb0f30400a 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -251,8 +251,11 @@ class View {
if (!$this->file_exists($path)) {
$hooks[] = 'write';
}
-
- return $this->basicOperation('touch', $path, $hooks, $mtime);
+ $result = $this->basicOperation('touch', $path, $hooks, $mtime);
+ if (!$result) { //if native touch fails, we emulate it by changing the mtime in the cache
+ $this->putFileInfo($path, array('mtime' => $mtime));
+ }
+ return true;
}
public function file_get_contents($path) {
@@ -264,7 +267,7 @@ class View {
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
if (\OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data)
and Filesystem::isValidPath($path)
- and ! Filesystem::isFileBlacklisted($path)
+ and !Filesystem::isFileBlacklisted($path)
) {
$path = $this->getRelativePath($absolutePath);
$exists = $this->file_exists($path);
@@ -341,7 +344,7 @@ class View {
\OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2)
and Filesystem::isValidPath($path2)
and Filesystem::isValidPath($path1)
- and ! Filesystem::isFileBlacklisted($path2)
+ and !Filesystem::isFileBlacklisted($path2)
) {
$path1 = $this->getRelativePath($absolutePath1);
$path2 = $this->getRelativePath($absolutePath2);
@@ -368,15 +371,24 @@ class View {
list(, $internalPath2) = Filesystem::resolvePath($absolutePath2 . $postFix2);
if ($storage) {
$result = $storage->rename($internalPath1, $internalPath2);
+ \OC_FileProxy::runPostProxies('rename', $absolutePath1, $absolutePath2);
} else {
$result = false;
}
} else {
- $source = $this->fopen($path1 . $postFix1, 'r');
- $target = $this->fopen($path2 . $postFix2, 'w');
- list($count, $result) = \OC_Helper::streamCopy($source, $target);
- list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
- $storage1->unlink($internalPath1);
+ if ($this->is_dir($path1)) {
+ $result = $this->copy($path1, $path2);
+ if ($result === true) {
+ list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
+ $result = $storage1->deleteAll($internalPath1);
+ }
+ } else {
+ $source = $this->fopen($path1 . $postFix1, 'r');
+ $target = $this->fopen($path2 . $postFix2, 'w');
+ list($count, $result) = \OC_Helper::streamCopy($source, $target);
+ list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
+ $storage1->unlink($internalPath1);
+ }
}
if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path1)) {
\OC_Hook::emit(
@@ -406,7 +418,7 @@ class View {
\OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2)
and Filesystem::isValidPath($path2)
and Filesystem::isValidPath($path1)
- and ! Filesystem::isFileBlacklisted($path2)
+ and !Filesystem::isFileBlacklisted($path2)
) {
$path1 = $this->getRelativePath($absolutePath1);
$path2 = $this->getRelativePath($absolutePath2);
@@ -459,9 +471,18 @@ class View {
$result = false;
}
} else {
- $source = $this->fopen($path1 . $postFix1, 'r');
- $target = $this->fopen($path2 . $postFix2, 'w');
- list($count, $result) = \OC_Helper::streamCopy($source, $target);
+ if ($this->is_dir($path1) && ($dh = $this->opendir($path1))) {
+ $result = $this->mkdir($path2);
+ while ($file = readdir($dh)) {
+ if (!Filesystem::isIgnoredDir($file)) {
+ $result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file);
+ }
+ }
+ } else {
+ $source = $this->fopen($path1 . $postFix1, 'r');
+ $target = $this->fopen($path2 . $postFix2, 'w');
+ list($count, $result) = \OC_Helper::streamCopy($source, $target);
+ }
}
if ($this->fakeRoot == Filesystem::getRoot()) {
\OC_Hook::emit(
@@ -611,7 +632,7 @@ class View {
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
if (\OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam)
and Filesystem::isValidPath($path)
- and ! Filesystem::isFileBlacklisted($path)
+ and !Filesystem::isFileBlacklisted($path)
) {
$path = $this->getRelativePath($absolutePath);
if ($path == null) {
@@ -738,6 +759,9 @@ class View {
$data['permissions'] = $permissions;
}
}
+
+ $data = \OC_FileProxy::runPostProxies('getFileInfo', $path, $data);
+
return $data;
}
@@ -773,18 +797,18 @@ class View {
}
$files = $cache->getFolderContents($internalPath); //TODO: mimetype_filter
+ $permissions = $permissionsCache->getDirectoryPermissions($cache->getId($internalPath), $user);
$ids = array();
foreach ($files as $i => $file) {
$files[$i]['type'] = $file['mimetype'] === 'httpd/unix-directory' ? 'dir' : 'file';
$ids[] = $file['fileid'];
- $permissions = $permissionsCache->get($file['fileid'], $user);
- if ($permissions === -1) {
- $permissions = $storage->getPermissions($file['path']);
- $permissionsCache->set($file['fileid'], $user, $permissions);
+ if (!isset($permissions[$file['fileid']])) {
+ $permissions[$file['fileid']] = $storage->getPermissions($file['path']);
+ $permissionsCache->set($file['fileid'], $user, $permissions[$file['fileid']]);
}
- $files[$i]['permissions'] = $permissions;
+ $files[$i]['permissions'] = $permissions[$file['fileid']];
}
//add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders
diff --git a/lib/helper.php b/lib/helper.php
index c69445ed788..225e9fd2a9a 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -27,6 +27,7 @@
class OC_Helper {
private static $mimetypes=array();
private static $tmpFiles=array();
+ private static $mimetypeIcons = array();
/**
* @brief Creates an url using a defined route
@@ -187,31 +188,38 @@ class OC_Helper {
*
* Returns the path to the image of this file type.
*/
- public static function mimetypeIcon( $mimetype ) {
- $alias=array('application/xml'=>'code/xml');
- if(isset($alias[$mimetype])) {
- $mimetype=$alias[$mimetype];
+ public static function mimetypeIcon($mimetype) {
+ $alias = array('application/xml' => 'code/xml');
+ if (isset($alias[$mimetype])) {
+ $mimetype = $alias[$mimetype];
+ }
+ if (isset(self::$mimetypeIcons[$mimetype])) {
+ return self::$mimetypeIcons[$mimetype];
}
// Replace slash and backslash with a minus
- $mimetype = str_replace( "/", "-", $mimetype );
- $mimetype = str_replace( "\\", "-", $mimetype );
+ $icon = str_replace('/', '-', $mimetype);
+ $icon = str_replace( '\\', '-', $icon);
// Is it a dir?
- if( $mimetype == "dir" ) {
- return OC::$WEBROOT."/core/img/filetypes/folder.png";
+ if ($mimetype === 'dir') {
+ self::$mimetypeIcons[$mimetype] = OC::$WEBROOT.'/core/img/filetypes/folder.png';
+ return OC::$WEBROOT.'/core/img/filetypes/folder.png';
}
// Icon exists?
- if( file_exists( OC::$SERVERROOT."/core/img/filetypes/$mimetype.png" )) {
- return OC::$WEBROOT."/core/img/filetypes/$mimetype.png";
- }
- //try only the first part of the filetype
- $mimetype=substr($mimetype, 0, strpos($mimetype, '-'));
- if( file_exists( OC::$SERVERROOT."/core/img/filetypes/$mimetype.png" )) {
- return OC::$WEBROOT."/core/img/filetypes/$mimetype.png";
+ if (file_exists(OC::$SERVERROOT.'/core/img/filetypes/'.$icon.'.png')) {
+ self::$mimetypeIcons[$mimetype] = OC::$WEBROOT.'/core/img/filetypes/'.$icon.'.png';
+ return OC::$WEBROOT.'/core/img/filetypes/'.$icon.'.png';
}
- else{
- return OC::$WEBROOT."/core/img/filetypes/file.png";
+
+ // Try only the first part of the filetype
+ $mimePart = substr($icon, 0, strpos($icon, '-'));
+ if (file_exists(OC::$SERVERROOT.'/core/img/filetypes/'.$mimePart.'.png')) {
+ self::$mimetypeIcons[$mimetype] = OC::$WEBROOT.'/core/img/filetypes/'.$mimePart.'.png';
+ return OC::$WEBROOT.'/core/img/filetypes/'.$mimePart.'.png';
+ } else {
+ self::$mimetypeIcons[$mimetype] = OC::$WEBROOT.'/core/img/filetypes/file.png';
+ return OC::$WEBROOT.'/core/img/filetypes/file.png';
}
}
diff --git a/lib/hooks/basicemitter.php b/lib/hooks/basicemitter.php
new file mode 100644
index 00000000000..e615a58cfe8
--- /dev/null
+++ b/lib/hooks/basicemitter.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Hooks;
+
+abstract class BasicEmitter implements Emitter {
+
+ /**
+ * @var (callable[])[] $listeners
+ */
+ private $listeners = array();
+
+ /**
+ * @param string $scope
+ * @param string $method
+ * @param callable $callback
+ */
+ public function listen($scope, $method, $callback) {
+ $eventName = $scope . '::' . $method;
+ if (!isset($this->listeners[$eventName])) {
+ $this->listeners[$eventName] = array();
+ }
+ if (array_search($callback, $this->listeners[$eventName]) === false) {
+ $this->listeners[$eventName][] = $callback;
+ }
+ }
+
+ /**
+ * @param string $scope optional
+ * @param string $method optional
+ * @param callable $callback optional
+ */
+ public function removeListener($scope = null, $method = null, $callback = null) {
+ $names = array();
+ $allNames = array_keys($this->listeners);
+ if ($scope and $method) {
+ $name = $scope . '::' . $method;
+ if (isset($this->listeners[$name])) {
+ $names[] = $name;
+ }
+ } elseif ($scope) {
+ foreach ($allNames as $name) {
+ $parts = explode('::', $name, 2);
+ if ($parts[0] == $scope) {
+ $names[] = $name;
+ }
+ }
+ } elseif ($method) {
+ foreach ($allNames as $name) {
+ $parts = explode('::', $name, 2);
+ if ($parts[1] == $method) {
+ $names[] = $name;
+ }
+ }
+ } else {
+ $names = $allNames;
+ }
+
+ foreach ($names as $name) {
+ if ($callback) {
+ $index = array_search($callback, $this->listeners[$name]);
+ if ($index !== false) {
+ unset($this->listeners[$name][$index]);
+ }
+ } else {
+ $this->listeners[$name] = array();
+ }
+ }
+ }
+
+ /**
+ * @param string $scope
+ * @param string $method
+ * @param array $arguments optional
+ */
+ protected function emit($scope, $method, $arguments = array()) {
+ $eventName = $scope . '::' . $method;
+ if (isset($this->listeners[$eventName])) {
+ foreach ($this->listeners[$eventName] as $callback) {
+ call_user_func_array($callback, $arguments);
+ }
+ }
+ }
+}
diff --git a/lib/hooks/emitter.php b/lib/hooks/emitter.php
new file mode 100644
index 00000000000..8e9074bad67
--- /dev/null
+++ b/lib/hooks/emitter.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Hooks;
+
+/**
+ * Class Emitter
+ *
+ * interface for all classes that are able to emit events
+ *
+ * @package OC\Hooks
+ */
+interface Emitter {
+ /**
+ * @param string $scope
+ * @param string $method
+ * @param callable $callback
+ */
+ public function listen($scope, $method, $callback);
+
+ /**
+ * @param string $scope optional
+ * @param string $method optional
+ * @param callable $callback optional
+ */
+ public function removeListener($scope = null, $method = null, $callback = null);
+}
diff --git a/lib/hooks/legacyemitter.php b/lib/hooks/legacyemitter.php
new file mode 100644
index 00000000000..a2d16ace9a7
--- /dev/null
+++ b/lib/hooks/legacyemitter.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Hooks;
+
+abstract class LegacyEmitter extends BasicEmitter {
+ protected function emit($scope, $method, $arguments = array()) {
+ \OC_Hook::emit($scope, $method, $arguments);
+ parent::emit($scope, $method, $arguments);
+ }
+}
diff --git a/lib/hooks/publicemitter.php b/lib/hooks/publicemitter.php
new file mode 100644
index 00000000000..e2371713ac3
--- /dev/null
+++ b/lib/hooks/publicemitter.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Hooks;
+
+class PublicEmitter extends BasicEmitter {
+ /**
+ * @param string $scope
+ * @param string $method
+ * @param array $arguments optional
+ */
+ public function emit($scope, $method, $arguments = array()) {
+ parent::emit($scope, $method, $arguments);
+ }
+}
diff --git a/lib/l10n/ar.php b/lib/l10n/ar.php
index 98b9608ce02..22c934e238d 100644
--- a/lib/l10n/ar.php
+++ b/lib/l10n/ar.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s ادخل اسم خادم قاعدة البيانات",
"PostgreSQL username and/or password not valid" => "اسم المستخدم / أو كلمة المرور الخاصة بـPostgreSQL غير صحيحة",
"You need to enter either an existing account or the administrator." => "انت بحاجة لكتابة اسم مستخدم موجود أو حساب المدير.",
-"Oracle username and/or password not valid" => "اسم المستخدم و/أو كلمة المرور لنظام Oracle غير صحيح",
"MySQL username and/or password not valid" => "اسم المستخدم و/أو كلمة المرور لنظام MySQL غير صحيح",
"DB Error: \"%s\"" => "خطأ في قواعد البيانات : \"%s\"",
"Offending command was: \"%s\"" => "الأمر المخالف كان : \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "احذف اسم المستخدم هذا من الـ MySQL",
"MySQL user '%s'@'%%' already exists" => "أسم المستخدم '%s'@'%%' الخاص بـ MySQL موجود مسبقا",
"Drop this user from MySQL." => "احذف اسم المستخدم هذا من الـ MySQL.",
+"Oracle username and/or password not valid" => "اسم المستخدم و/أو كلمة المرور لنظام Oracle غير صحيح",
"Offending command was: \"%s\", name: %s, password: %s" => "الأمر المخالف كان : \"%s\", اسم المستخدم : %s, كلمة المرور: %s",
"MS SQL username and/or password not valid: %s" => "اسم المستخدم و/أو كلمة المرور لنظام MS SQL غير صحيح : %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "اعدادات خادمك غير صحيحة بشكل تسمح لك بمزامنة ملفاتك وذلك بسبب أن واجهة WebDAV تبدو معطلة",
diff --git a/lib/l10n/bg_BG.php b/lib/l10n/bg_BG.php
index 73a7fdce481..2de4c0a6e68 100644
--- a/lib/l10n/bg_BG.php
+++ b/lib/l10n/bg_BG.php
@@ -23,13 +23,13 @@
"%s you may not use dots in the database name" => "%s, не можете да ползвате точки в името на базата от данни",
"PostgreSQL username and/or password not valid" => "Невалидно PostgreSQL потребителско име и/или парола",
"You need to enter either an existing account or the administrator." => "Необходимо е да влезете в всъществуващ акаунт или като администратора",
-"Oracle username and/or password not valid" => "Невалидно Oracle потребителско име и/или парола",
"MySQL username and/or password not valid" => "Невалидно MySQL потребителско име и/или парола",
"DB Error: \"%s\"" => "Грешка в базата от данни: \"%s\"",
"MySQL user '%s'@'localhost' exists already." => "MySQL потребителят '%s'@'localhost' вече съществува",
"Drop this user from MySQL" => "Изтриване на потребителя от MySQL",
"MySQL user '%s'@'%%' already exists" => "MySQL потребителят '%s'@'%%' вече съществува.",
"Drop this user from MySQL." => "Изтриване на потребителя от MySQL.",
+"Oracle username and/or password not valid" => "Невалидно Oracle потребителско име и/или парола",
"MS SQL username and/or password not valid: %s" => "Невалидно MS SQL потребителско име и/или парола: %s",
"Please double check the <a href='%s'>installation guides</a>." => "Моля направете повторна справка с <a href='%s'>ръководството за инсталиране</a>.",
"seconds ago" => "преди секунди",
diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php
index 028bf2343a7..5c368a85b28 100644
--- a/lib/l10n/ca.php
+++ b/lib/l10n/ca.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s establiu l'ordinador central de la base de dades.",
"PostgreSQL username and/or password not valid" => "Nom d'usuari i/o contrasenya PostgreSQL no vàlids",
"You need to enter either an existing account or the administrator." => "Heu d'escriure un compte existent o el d'administrador.",
-"Oracle username and/or password not valid" => "Nom d'usuari i/o contrasenya Oracle no vàlids",
+"Oracle connection could not be established" => "No s'ha pogut establir la connexió Oracle",
"MySQL username and/or password not valid" => "Nom d'usuari i/o contrasenya MySQL no vàlids",
"DB Error: \"%s\"" => "Error DB: \"%s\"",
"Offending command was: \"%s\"" => "L'ordre en conflicte és: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Elimina aquest usuari de MySQL",
"MySQL user '%s'@'%%' already exists" => "L'usuari MySQL '%s'@'%%' ja existeix",
"Drop this user from MySQL." => "Elimina aquest usuari de MySQL.",
+"Oracle username and/or password not valid" => "Nom d'usuari i/o contrasenya Oracle no vàlids",
"Offending command was: \"%s\", name: %s, password: %s" => "L'ordre en conflicte és: \"%s\", nom: %s, contrasenya: %s",
"MS SQL username and/or password not valid: %s" => "Nom d'usuari i/o contrasenya MS SQL no vàlids: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "El servidor web no està configurat correctament per permetre la sincronització de fitxers perquè la interfície WebDAV sembla no funcionar correctament.",
diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php
index e3007f687d9..36469507d40 100644
--- a/lib/l10n/cs_CZ.php
+++ b/lib/l10n/cs_CZ.php
@@ -24,7 +24,6 @@
"%s set the database host." => "Zadejte název počítače s databází %s.",
"PostgreSQL username and/or password not valid" => "Uživatelské jméno, či heslo PostgreSQL není platné",
"You need to enter either an existing account or the administrator." => "Musíte zadat existující účet, či správce.",
-"Oracle username and/or password not valid" => "Uživatelské jméno, či heslo Oracle není platné",
"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\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Zahodit 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.",
+"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",
"MS SQL username and/or password not valid: %s" => "Uživatelské jméno, či heslo MSSQL není platné: %s",
"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é.",
diff --git a/lib/l10n/cy_GB.php b/lib/l10n/cy_GB.php
index ab5623bbf44..b3503dcc572 100644
--- a/lib/l10n/cy_GB.php
+++ b/lib/l10n/cy_GB.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s gosod gwesteiwr y gronfa ddata.",
"PostgreSQL username and/or password not valid" => "Enw a/neu gyfrinair PostgreSQL annilys",
"You need to enter either an existing account or the administrator." => "Rhaid i chi naill ai gyflwyno cyfrif presennol neu'r gweinyddwr.",
-"Oracle username and/or password not valid" => "Enw a/neu gyfrinair Oracle annilys",
"MySQL username and/or password not valid" => "Enw a/neu gyfrinair MySQL annilys",
"DB Error: \"%s\"" => "Gwall DB: \"%s\"",
"Offending command was: \"%s\"" => "Y gorchymyn wnaeth beri tramgwydd oedd: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Gollwng y defnyddiwr hwn o MySQL",
"MySQL user '%s'@'%%' already exists" => "Defnyddiwr MySQL '%s'@'%%' eisoes yn bodoli",
"Drop this user from MySQL." => "Gollwng y defnyddiwr hwn o MySQL.",
+"Oracle username and/or password not valid" => "Enw a/neu gyfrinair Oracle annilys",
"Offending command was: \"%s\", name: %s, password: %s" => "Y gorchymyn wnaeth beri tramgwydd oedd: \"%s\", enw: %s, cyfrinair: %s",
"MS SQL username and/or password not valid: %s" => "Enw a/neu gyfrinair MS SQL annilys: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Nid yw eich gweinydd wedi'i gyflunio eto i ganiatáu cydweddu ffeiliau oherwydd bod y rhyngwyneb WebDAV wedi torri.",
diff --git a/lib/l10n/da.php b/lib/l10n/da.php
index dad64700e52..aead17f510e 100644
--- a/lib/l10n/da.php
+++ b/lib/l10n/da.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s sæt database værten.",
"PostgreSQL username and/or password not valid" => "PostgreSQL brugernavn og/eller kodeord er ikke gyldigt.",
"You need to enter either an existing account or the administrator." => "Du bliver nødt til at indtaste en eksisterende bruger eller en administrator.",
-"Oracle username and/or password not valid" => "Oracle brugernavn og/eller kodeord er ikke gyldigt.",
"MySQL username and/or password not valid" => "MySQL brugernavn og/eller kodeord er ikke gyldigt.",
"DB Error: \"%s\"" => "Databasefejl: \"%s\"",
"Offending command was: \"%s\"" => "Fejlende kommando var: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Slet denne bruger fra MySQL",
"MySQL user '%s'@'%%' already exists" => "MySQL brugeren '%s'@'%%' eksisterer allerede.",
"Drop this user from MySQL." => "Slet denne bruger fra MySQL",
+"Oracle username and/or password not valid" => "Oracle brugernavn og/eller kodeord er ikke gyldigt.",
"Offending command was: \"%s\", name: %s, password: %s" => "Fejlende kommando var: \"%s\", navn: %s, password: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL brugernavn og/eller adgangskode ikke er gyldigt: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Din webserver er endnu ikke sat op til at tillade fil synkronisering fordi WebDAV grænsefladen virker ødelagt.",
diff --git a/lib/l10n/de.php b/lib/l10n/de.php
index 13acc1c55b5..74715bc66eb 100644
--- a/lib/l10n/de.php
+++ b/lib/l10n/de.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s setze den Datenbank-Host",
"PostgreSQL username and/or password not valid" => "PostgreSQL Benutzername und/oder Passwort ungültig",
"You need to enter either an existing account or the administrator." => "Du musst entweder ein existierendes Benutzerkonto oder das Administratoren-Konto angeben.",
-"Oracle username and/or password not valid" => "Oracle Benutzername und/oder Passwort ungültig",
"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\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Lösche diesen Benutzer von MySQL",
"MySQL user '%s'@'%%' already exists" => "MySQL Benutzer '%s'@'%%' existiert bereits",
"Drop this user from MySQL." => "Lösche diesen Benutzer aus MySQL.",
+"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",
"MS SQL username and/or password not valid: %s" => "MS SQL Benutzername und/oder Password ungültig: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Dein Web-Server ist noch nicht für Datei-Synchronisation bereit, weil die WebDAV-Schnittstelle vermutlich defekt ist.",
diff --git a/lib/l10n/de_DE.php b/lib/l10n/de_DE.php
index 566e98b85ce..5ebe4fb26fc 100644
--- a/lib/l10n/de_DE.php
+++ b/lib/l10n/de_DE.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s setze den Datenbank-Host",
"PostgreSQL username and/or password not valid" => "PostgreSQL Benutzername und/oder Passwort ungültig",
"You need to enter either an existing account or the administrator." => "Sie müssen entweder ein existierendes Benutzerkonto oder das Administratoren-Konto angeben.",
-"Oracle username and/or password not valid" => "Oracle Benutzername und/oder Passwort ungültig",
+"Oracle connection could not be established" => "Die Oracle-Verbindung konnte nicht aufgebaut werden.",
"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\"",
@@ -32,6 +32,7 @@
"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 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",
"MS SQL username and/or password not valid: %s" => "MS SQL Benutzername und/oder Passwort ungültig: %s",
"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.",
diff --git a/lib/l10n/el.php b/lib/l10n/el.php
index 14b63a8184c..8637b8da269 100644
--- a/lib/l10n/el.php
+++ b/lib/l10n/el.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s ρυθμίση του κεντρικόυ υπολογιστή βάσης δεδομένων. ",
"PostgreSQL username and/or password not valid" => "Μη έγκυρος χρήστης και/ή συνθηματικό της PostgreSQL",
"You need to enter either an existing account or the administrator." => "Χρειάζεται να εισάγετε είτε έναν υπάρχον λογαριασμό ή του διαχειριστή.",
-"Oracle username and/or password not valid" => "Μη έγκυρος χρήστης και/ή συνθηματικό της Oracle",
"MySQL username and/or password not valid" => "Μη έγκυρος χρήστης και/ή συνθηματικό της MySQL",
"DB Error: \"%s\"" => "Σφάλμα Βάσης Δεδομένων: \"%s\"",
"Offending command was: \"%s\"" => "Η εντολη παραβατικοτητας ηταν: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Απόρριψη αυτού του χρήστη από την MySQL",
"MySQL user '%s'@'%%' already exists" => "Ο χρήστης '%s'@'%%' της MySQL υπάρχει ήδη",
"Drop this user from MySQL." => "Απόρριψη αυτού του χρήστη από την MySQL",
+"Oracle username and/or password not valid" => "Μη έγκυρος χρήστης και/ή συνθηματικό της Oracle",
"Offending command was: \"%s\", name: %s, password: %s" => "Η εντολη παραβατικοτητας ηταν: \"%s\", ονομα: %s, κωδικος: %s",
"MS SQL username and/or password not valid: %s" => "Το όνομα χρήστη και/ή ο κωδικός της MS SQL δεν είναι έγκυρα: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ο διακομιστής σας δεν έχει ρυθμιστεί κατάλληλα ώστε να επιτρέπει τον συγχρονισμό αρχείων γιατί η διεπαφή WebDAV πιθανόν να είναι κατεστραμμένη.",
diff --git a/lib/l10n/es.php b/lib/l10n/es.php
index af96e693d1c..3b32036d3af 100644
--- a/lib/l10n/es.php
+++ b/lib/l10n/es.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s ingresar el host de la base de datos.",
"PostgreSQL username and/or password not valid" => "Usuario y/o contraseña de PostgreSQL no válidos",
"You need to enter either an existing account or the administrator." => "Tiene que ingresar una cuenta existente o la del administrador.",
-"Oracle username and/or password not valid" => "Usuario y/o contraseña de Oracle no válidos",
+"Oracle connection could not be established" => "No se pudo establecer la conexión a Oracle",
"MySQL username and/or password not valid" => "Usuario y/o contraseña de MySQL no válidos",
"DB Error: \"%s\"" => "Error BD: \"%s\"",
"Offending command was: \"%s\"" => "Comando infractor: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Eliminar este usuario de MySQL",
"MySQL user '%s'@'%%' already exists" => "Usuario MySQL '%s'@'%%' ya existe",
"Drop this user from MySQL." => "Eliminar este usuario de MySQL.",
+"Oracle username and/or password not valid" => "Usuario y/o contraseña de Oracle no válidos",
"Offending command was: \"%s\", name: %s, password: %s" => "Comando infractor: \"%s\", nombre: %s, contraseña: %s",
"MS SQL username and/or password not valid: %s" => "Usuario y/o contraseña de MS SQL no válidos: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Su servidor web aún no está configurado adecuadamente para permitir sincronización de archivos ya que la interfaz WebDAV parece no estar funcionando.",
diff --git a/lib/l10n/es_AR.php b/lib/l10n/es_AR.php
index e9da37e0a3d..1df1b16de65 100644
--- a/lib/l10n/es_AR.php
+++ b/lib/l10n/es_AR.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s Especifique la dirección de la Base de Datos",
"PostgreSQL username and/or password not valid" => "Nombre de usuario o contraseña de PostgradeSQL no válido.",
"You need to enter either an existing account or the administrator." => "Debe ingresar una cuenta existente o el administrador",
-"Oracle username and/or password not valid" => "El nombre de usuario y contraseña no son válidos",
"MySQL username and/or password not valid" => "Usuario y/o contraseña MySQL no válido",
"DB Error: \"%s\"" => "Error DB: \"%s\"",
"Offending command was: \"%s\"" => "El comando no comprendido es: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Borrar este usuario de MySQL",
"MySQL user '%s'@'%%' already exists" => "Usuario MySQL '%s'@'%%' ya existente",
"Drop this user from MySQL." => "Borrar este usuario de MySQL",
+"Oracle username and/or password not valid" => "El nombre de usuario y contraseña no son válidos",
"Offending command was: \"%s\", name: %s, password: %s" => "El comando no comprendido es: \"%s\", nombre: \"%s\", contraseña: \"%s\"",
"MS SQL username and/or password not valid: %s" => "Nombre de usuario y contraseña de MS SQL no son válidas: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Tu servidor web no está configurado todavía para permitir sincronización de archivos porque la interfaz WebDAV parece no funcionar.",
diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php
index 90c9c416827..24fc98bde64 100644
--- a/lib/l10n/et_EE.php
+++ b/lib/l10n/et_EE.php
@@ -9,7 +9,7 @@
"Files need to be downloaded one by one." => "Failid tuleb alla laadida ükshaaval.",
"Back to Files" => "Tagasi failide juurde",
"Selected files too large to generate zip file." => "Valitud failid on ZIP-faili loomiseks liiga suured.",
-"couldn't be determined" => "Ei suuda tuvastada",
+"couldn't be determined" => "ei suudetud tuvastada",
"Application is not enabled" => "Rakendus pole sisse lülitatud",
"Authentication error" => "Autentimise viga",
"Token expired. Please reload page." => "Kontrollkood aegus. Paelun lae leht uuesti.",
@@ -24,7 +24,7 @@
"%s set the database host." => "%s määra andmebaasi server.",
"PostgreSQL username and/or password not valid" => "PostgreSQL kasutajatunnus ja/või parool pole õiged",
"You need to enter either an existing account or the administrator." => "Sisesta kas juba olemasolev konto või administrator.",
-"Oracle username and/or password not valid" => "Oracle kasutajatunnus ja/või parool pole õiged",
+"Oracle connection could not be established" => "Ei suuda luua ühendust Oracle baasiga",
"MySQL username and/or password not valid" => "MySQL kasutajatunnus ja/või parool pole õiged",
"DB Error: \"%s\"" => "Andmebaasi viga: \"%s\"",
"Offending command was: \"%s\"" => "Tõrkuv käsk oli: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Kustuta see kasutaja MySQL-ist",
"MySQL user '%s'@'%%' already exists" => "MySQL kasutaja '%s'@'%%' on juba olemas",
"Drop this user from MySQL." => "Kustuta see kasutaja MySQL-ist.",
+"Oracle username and/or password not valid" => "Oracle kasutajatunnus ja/või parool pole õiged",
"Offending command was: \"%s\", name: %s, password: %s" => "Tõrkuv käsk oli: \"%s\", nimi: %s, parool: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL kasutajatunnus ja/või parool pole õiged: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Veebiserveri ei ole veel korralikult seadistatud võimaldamaks failide sünkroniseerimist, kuna WebDAV liides näib olevat mittetoimiv.",
diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php
index 934a4d19ab5..05b68b062c5 100644
--- a/lib/l10n/eu.php
+++ b/lib/l10n/eu.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s sartu datu basearen hostalaria.",
"PostgreSQL username and/or password not valid" => "PostgreSQL erabiltzaile edota pasahitza ez dira egokiak.",
"You need to enter either an existing account or the administrator." => "Existitzen den kontu bat edo administradorearena jarri behar duzu.",
-"Oracle username and/or password not valid" => "Oracle erabiltzaile edota pasahitza ez dira egokiak.",
"MySQL username and/or password not valid" => "MySQL erabiltzaile edota pasahitza ez dira egokiak.",
"DB Error: \"%s\"" => "DB errorea: \"%s\"",
"Offending command was: \"%s\"" => "Errorea komando honek sortu du: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Ezabatu erabiltzaile hau MySQLtik",
"MySQL user '%s'@'%%' already exists" => "MySQL '%s'@'%%' erabiltzailea dagoeneko existitzen da",
"Drop this user from MySQL." => "Ezabatu erabiltzaile hau MySQLtik.",
+"Oracle username and/or password not valid" => "Oracle erabiltzaile edota pasahitza ez dira egokiak.",
"Offending command was: \"%s\", name: %s, password: %s" => "Errorea komando honek sortu du: \"%s\", izena: %s, pasahitza: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL erabiltzaile izena edota pasahitza ez dira egokiak: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Zure web zerbitzaria ez dago oraindik ongi konfiguratuta fitxategien sinkronizazioa egiteko, WebDAV interfazea ongi ez dagoela dirudi.",
diff --git a/lib/l10n/fi_FI.php b/lib/l10n/fi_FI.php
index c2e83f66166..0caa7b12df6 100644
--- a/lib/l10n/fi_FI.php
+++ b/lib/l10n/fi_FI.php
@@ -22,13 +22,14 @@
"%s enter the database name." => "%s anna tietokannan nimi.",
"%s you may not use dots in the database name" => "%s et voi käyttää pisteitä tietokannan nimessä",
"PostgreSQL username and/or password not valid" => "PostgreSQL:n käyttäjätunnus ja/tai salasana on väärin",
-"Oracle username and/or password not valid" => "Oraclen käyttäjätunnus ja/tai salasana on väärin",
+"Oracle connection could not be established" => "Oracle-yhteyttä ei voitu muodostaa",
"MySQL username and/or password not valid" => "MySQL:n käyttäjätunnus ja/tai salasana on väärin",
"DB Error: \"%s\"" => "Tietokantavirhe: \"%s\"",
"MySQL user '%s'@'localhost' exists already." => "MySQL-käyttäjä '%s'@'localhost' on jo olemassa.",
"Drop this user from MySQL" => "Pudota tämä käyttäjä MySQL:stä",
"MySQL user '%s'@'%%' already exists" => "MySQL-käyttäjä '%s'@'%%' on jo olemassa",
"Drop this user from MySQL." => "Pudota tämä käyttäjä MySQL:stä.",
+"Oracle username and/or password not valid" => "Oraclen käyttäjätunnus ja/tai salasana on väärin",
"MS SQL username and/or password not valid: %s" => "MS SQL -käyttäjätunnus ja/tai -salasana on väärin: %s",
"Please double check the <a href='%s'>installation guides</a>." => "Lue tarkasti <a href='%s'>asennusohjeet</a>.",
"seconds ago" => "sekuntia sitten",
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index c0920179dbb..aed5d056f37 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s spécifiez l'hôte de la base de données.",
"PostgreSQL username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe de la base PostgreSQL invalide",
"You need to enter either an existing account or the administrator." => "Vous devez spécifier soit le nom d'un compte existant, soit celui de l'administrateur.",
-"Oracle username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe de la base Oracle invalide",
+"Oracle connection could not be established" => "La connexion Oracle ne peut pas être établie",
"MySQL username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe de la base MySQL invalide",
"DB Error: \"%s\"" => "Erreur de la base de données : \"%s\"",
"Offending command was: \"%s\"" => "La requête en cause est : \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Retirer cet utilisateur de la base MySQL",
"MySQL user '%s'@'%%' already exists" => "L'utilisateur MySQL '%s'@'%%' existe déjà",
"Drop this user from MySQL." => "Retirer cet utilisateur de la base MySQL.",
+"Oracle username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe de la base Oracle invalide",
"Offending command was: \"%s\", name: %s, password: %s" => "La requête en cause est : \"%s\", nom : %s, mot de passe : %s",
"MS SQL username and/or password not valid: %s" => "Le nom d'utilisateur et/ou le mot de passe de la base MS SQL est invalide : %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Votre serveur web, n'est pas correctement configuré pour permettre la synchronisation des fichiers, car l'interface WebDav ne fonctionne pas comme il faut.",
diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php
index 783826508c9..1b4db4b30af 100644
--- a/lib/l10n/gl.php
+++ b/lib/l10n/gl.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s estabeleza o servidor da base de datos",
"PostgreSQL username and/or password not valid" => "Nome de usuario e/ou contrasinal de PostgreSQL incorrecto",
"You need to enter either an existing account or the administrator." => "Deberá introducir unha conta existente ou o administrador.",
-"Oracle username and/or password not valid" => "Nome de usuario e/ou contrasinal de Oracle incorrecto",
+"Oracle connection could not be established" => "Non foi posíbel estabelecer a conexión con Oracle",
"MySQL username and/or password not valid" => "Nome de usuario e/ou contrasinal de MySQL incorrecto",
"DB Error: \"%s\"" => "Produciuse un erro na base de datos: «%s»",
"Offending command was: \"%s\"" => "A orde ofensiva foi: «%s»",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Omitir este usuario de MySQL",
"MySQL user '%s'@'%%' already exists" => "O usuario MySQL «%s»@«%%» xa existe.",
"Drop this user from MySQL." => "Omitir este usuario de MySQL.",
+"Oracle username and/or password not valid" => "Nome de usuario e/ou contrasinal de Oracle incorrecto",
"Offending command was: \"%s\", name: %s, password: %s" => "A orde ofensiva foi: «%s», nome: %s, contrasinal: %s",
"MS SQL username and/or password not valid: %s" => "Nome de usuario e/ou contrasinal de MS SQL incorrecto: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web non está aínda configurado adecuadamente para permitir a sincronización de ficheiros xa que semella que a interface WebDAV non está a funcionar.",
diff --git a/lib/l10n/hu_HU.php b/lib/l10n/hu_HU.php
index 841020183b0..3b5c886bd2c 100644
--- a/lib/l10n/hu_HU.php
+++ b/lib/l10n/hu_HU.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s adja meg az adatbázist szolgáltató számítógép nevét.",
"PostgreSQL username and/or password not valid" => "A PostgreSQL felhasználói név és/vagy jelszó érvénytelen",
"You need to enter either an existing account or the administrator." => "Vagy egy létező felhasználó vagy az adminisztrátor bejelentkezési nevét kell megadnia",
-"Oracle username and/or password not valid" => "Az Oracle felhasználói név és/vagy jelszó érvénytelen",
+"Oracle connection could not be established" => "Az Oracle kapcsolat nem hozható létre",
"MySQL username and/or password not valid" => "A MySQL felhasználói név és/vagy jelszó érvénytelen",
"DB Error: \"%s\"" => "Adatbázis hiba: \"%s\"",
"Offending command was: \"%s\"" => "A hibát ez a parancs okozta: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Törölje ezt a felhasználót a MySQL-ből",
"MySQL user '%s'@'%%' already exists" => "A '%s'@'%%' MySQL felhasználó már létezik",
"Drop this user from MySQL." => "Törölje ezt a felhasználót a MySQL-ből.",
+"Oracle username and/or password not valid" => "Az Oracle felhasználói név és/vagy jelszó érvénytelen",
"Offending command was: \"%s\", name: %s, password: %s" => "A hibát okozó parancs ez volt: \"%s\", login név: %s, jelszó: %s",
"MS SQL username and/or password not valid: %s" => "Az MS SQL felhasználónév és/vagy jelszó érvénytelen: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Az Ön webkiszolgálója nincs megfelelően beállítva az állományok szinkronizálásához, mert a WebDAV-elérés úgy tűnik, nem működik.",
diff --git a/lib/l10n/id.php b/lib/l10n/id.php
index 54b46cd8961..29843a95327 100644
--- a/lib/l10n/id.php
+++ b/lib/l10n/id.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s setel host basis data.",
"PostgreSQL username and/or password not valid" => "Nama pengguna dan/atau sandi PostgreSQL tidak valid",
"You need to enter either an existing account or the administrator." => "Anda harus memasukkan akun yang sudah ada atau administrator.",
-"Oracle username and/or password not valid" => "Nama pengguna dan/atau sandi Oracle tidak valid",
"MySQL username and/or password not valid" => "Nama pengguna dan/atau sandi MySQL tidak valid",
"DB Error: \"%s\"" => "Galat Basis Data: \"%s\"",
"Offending command was: \"%s\"" => "Perintah yang bermasalah: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Hapus pengguna ini dari MySQL",
"MySQL user '%s'@'%%' already exists" => "Pengguna MySQL '%s'@'%%' sudah ada.",
"Drop this user from MySQL." => "Hapus pengguna ini dari MySQL.",
+"Oracle username and/or password not valid" => "Nama pengguna dan/atau sandi Oracle tidak valid",
"Offending command was: \"%s\", name: %s, password: %s" => "Perintah yang bermasalah: \"%s\", nama pengguna: %s, sandi: %s",
"MS SQL username and/or password not valid: %s" => "Nama pengguna dan/atau sandi MySQL tidak valid: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web server Anda belum dikonfigurasikan dengan baik untuk mengizinkan sinkronisasi berkas karena tampaknya antarmuka WebDAV rusak.",
diff --git a/lib/l10n/it.php b/lib/l10n/it.php
index 1db48dbc80d..db26ac82ae3 100644
--- a/lib/l10n/it.php
+++ b/lib/l10n/it.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s imposta l'host del database.",
"PostgreSQL username and/or password not valid" => "Nome utente e/o password di PostgreSQL non validi",
"You need to enter either an existing account or the administrator." => "È necessario inserire un account esistente o l'amministratore.",
-"Oracle username and/or password not valid" => "Nome utente e/o password di Oracle non validi",
+"Oracle connection could not be established" => "La connessione a Oracle non può essere stabilita",
"MySQL username and/or password not valid" => "Nome utente e/o password di MySQL non validi",
"DB Error: \"%s\"" => "Errore DB: \"%s\"",
"Offending command was: \"%s\"" => "Il comando non consentito era: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Elimina questo utente da MySQL",
"MySQL user '%s'@'%%' already exists" => "L'utente MySQL '%s'@'%%' esiste già",
"Drop this user from MySQL." => "Elimina questo utente da MySQL.",
+"Oracle username and/or password not valid" => "Nome utente e/o password di Oracle non validi",
"Offending command was: \"%s\", name: %s, password: %s" => "Il comando non consentito era: \"%s\", nome: %s, password: %s",
"MS SQL username and/or password not valid: %s" => "Nome utente e/o password MS SQL non validi: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Il tuo server web non è configurato correttamente per consentire la sincronizzazione dei file poiché l'interfaccia WebDAV sembra essere danneggiata.",
diff --git a/lib/l10n/ja_JP.php b/lib/l10n/ja_JP.php
index 3b97ffc431f..a2eb4bee67b 100644
--- a/lib/l10n/ja_JP.php
+++ b/lib/l10n/ja_JP.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s にデータベースホストを設定します。",
"PostgreSQL username and/or password not valid" => "PostgreSQLのユーザ名もしくはパスワードは有効ではありません",
"You need to enter either an existing account or the administrator." => "既存のアカウントもしくは管理者のどちらかを入力する必要があります。",
-"Oracle username and/or password not valid" => "Oracleのユーザ名もしくはパスワードは有効ではありません",
+"Oracle connection could not be established" => "Oracleへの接続が確立できませんでした。",
"MySQL username and/or password not valid" => "MySQLのユーザ名もしくはパスワードは有効ではありません",
"DB Error: \"%s\"" => "DBエラー: \"%s\"",
"Offending command was: \"%s\"" => "違反コマンド: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "MySQLからこのユーザを削除",
"MySQL user '%s'@'%%' already exists" => "MySQLのユーザ '%s'@'%%' はすでに存在します。",
"Drop this user from MySQL." => "MySQLからこのユーザを削除する。",
+"Oracle username and/or password not valid" => "Oracleのユーザ名もしくはパスワードは有効ではありません",
"Offending command was: \"%s\", name: %s, password: %s" => "違反コマンド: \"%s\"、名前: %s、パスワード: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL サーバーのユーザー名/パスワードが正しくありません: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "WebDAVインタフェースが動作していないと考えられるため、あなたのWEBサーバはまだファイルの同期を許可するように適切な設定がされていません。",
diff --git a/lib/l10n/ka_GE.php b/lib/l10n/ka_GE.php
index a55323832ec..93835e4ead7 100644
--- a/lib/l10n/ka_GE.php
+++ b/lib/l10n/ka_GE.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s მიუთითეთ ბაზის ჰოსტი.",
"PostgreSQL username and/or password not valid" => "PostgreSQL იუზერნეიმი და/ან პაროლი არ არის სწორი",
"You need to enter either an existing account or the administrator." => "თქვენ უნდა შეიყვანოთ არსებული მომხმარებელის სახელი ან ადმინისტრატორი.",
-"Oracle username and/or password not valid" => "Oracle იუზერნეიმი და/ან პაროლი არ არის სწორი",
"MySQL username and/or password not valid" => "MySQL იუზერნეიმი და/ან პაროლი არ არის სწორი",
"DB Error: \"%s\"" => "DB შეცდომა: \"%s\"",
"Offending command was: \"%s\"" => "Offending ბრძანება იყო: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "წაშალე ეს მომხამრებელი MySQL–იდან",
"MySQL user '%s'@'%%' already exists" => "MySQL მომხმარებელი '%s'@'%%' უკვე არსებობს",
"Drop this user from MySQL." => "წაშალე ეს მომხამრებელი MySQL–იდან",
+"Oracle username and/or password not valid" => "Oracle იუზერნეიმი და/ან პაროლი არ არის სწორი",
"Offending command was: \"%s\", name: %s, password: %s" => "Offending ბრძანება იყო: \"%s\", სახელი: %s, პაროლი: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL მომხმარებელი და/ან პაროლი არ არის მართებული: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "თქვენი web სერვერი არ არის კონფიგურირებული ფაილ სინქრონიზაციისთვის, რადგან WebDAV ინტერფეისი შეიძლება იყოს გატეხილი.",
diff --git a/lib/l10n/lv.php b/lib/l10n/lv.php
index 28b96c56e10..140c75af3ce 100644
--- a/lib/l10n/lv.php
+++ b/lib/l10n/lv.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s iestatiet datubāžu serveri.",
"PostgreSQL username and/or password not valid" => "Nav derīga PostgreSQL parole un/vai lietotājvārds",
"You need to enter either an existing account or the administrator." => "Jums jāievada vai nu esošs vai administratora konts.",
-"Oracle username and/or password not valid" => "Nav derīga Oracle parole un/vai lietotājvārds",
"MySQL username and/or password not valid" => "Nav derīga MySQL parole un/vai lietotājvārds",
"DB Error: \"%s\"" => "DB kļūda — “%s”",
"Offending command was: \"%s\"" => "Vainīgā komanda bija “%s”",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Izmest šo lietotāju no MySQL",
"MySQL user '%s'@'%%' already exists" => "MySQL lietotājs '%s'@'%%' jau eksistē",
"Drop this user from MySQL." => "Izmest šo lietotāju no MySQL.",
+"Oracle username and/or password not valid" => "Nav derīga Oracle parole un/vai lietotājvārds",
"Offending command was: \"%s\", name: %s, password: %s" => "Vainīgā komanda bija \"%s\", vārds: %s, parole: %s",
"MS SQL username and/or password not valid: %s" => "Nav derīga MySQL parole un/vai lietotājvārds — %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Jūsu serveris vēl nav pareizi iestatīts, lai ļautu sinhronizēt datnes, jo izskatās, ka WebDAV saskarne ir salauzta.",
diff --git a/lib/l10n/nb_NO.php b/lib/l10n/nb_NO.php
index fc95561d3b4..23146154c77 100644
--- a/lib/l10n/nb_NO.php
+++ b/lib/l10n/nb_NO.php
@@ -15,6 +15,8 @@
"Files" => "Filer",
"Text" => "Tekst",
"Images" => "Bilder",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Din nettservev er ikke konfigurert korrekt for filsynkronisering. WebDAV ser ut til å ikke funkere.",
+"Please double check the <a href='%s'>installation guides</a>." => "Vennligst dobbelsjekk <a href='%s'>installasjonsguiden</a>.",
"seconds ago" => "sekunder siden",
"1 minute ago" => "1 minutt siden",
"%d minutes ago" => "%d minutter siden",
diff --git a/lib/l10n/nl.php b/lib/l10n/nl.php
index 0c387142619..2a6086a5968 100644
--- a/lib/l10n/nl.php
+++ b/lib/l10n/nl.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s instellen databaseservernaam.",
"PostgreSQL username and/or password not valid" => "PostgreSQL gebruikersnaam en/of wachtwoord ongeldig",
"You need to enter either an existing account or the administrator." => "Geef of een bestaand account op of het beheerdersaccount.",
-"Oracle username and/or password not valid" => "Oracle gebruikersnaam en/of wachtwoord ongeldig",
+"Oracle connection could not be established" => "Er kon geen verbinding met Oracle worden bereikt",
"MySQL username and/or password not valid" => "MySQL gebruikersnaam en/of wachtwoord ongeldig",
"DB Error: \"%s\"" => "DB Fout: \"%s\"",
"Offending command was: \"%s\"" => "Onjuiste commande was: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Verwijder deze gebruiker uit MySQL",
"MySQL user '%s'@'%%' already exists" => "MySQL gebruiker '%s'@'%%' bestaat al",
"Drop this user from MySQL." => "Verwijder deze gebruiker uit MySQL.",
+"Oracle username and/or password not valid" => "Oracle gebruikersnaam en/of wachtwoord ongeldig",
"Offending command was: \"%s\", name: %s, password: %s" => "Onjuiste commando was: \"%s\", naam: %s, wachtwoord: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL gebruikersnaam en/of wachtwoord niet geldig: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Uw webserver is nog niet goed ingesteld voor bestandssynchronisatie omdat de WebDAV interface verbroken lijkt.",
diff --git a/lib/l10n/nn_NO.php b/lib/l10n/nn_NO.php
index f8f15c9fba6..8241573f9ae 100644
--- a/lib/l10n/nn_NO.php
+++ b/lib/l10n/nn_NO.php
@@ -3,7 +3,7 @@
"Personal" => "Personleg",
"Settings" => "Innstillingar",
"Users" => "Brukarar",
-"Apps" => "Applikasjonar",
+"Apps" => "Program",
"Admin" => "Administrer",
"Authentication error" => "Feil i autentisering",
"Files" => "Filer",
diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php
index 4ac1c14439f..53a9290785c 100644
--- a/lib/l10n/pl.php
+++ b/lib/l10n/pl.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s ustaw hosta bazy danych.",
"PostgreSQL username and/or password not valid" => "PostgreSQL: Nazwa użytkownika i/lub hasło jest niepoprawne",
"You need to enter either an existing account or the administrator." => "Należy wprowadzić istniejące konto użytkownika lub administratora.",
-"Oracle username and/or password not valid" => "Oracle: Nazwa użytkownika i/lub hasło jest niepoprawne",
+"Oracle connection could not be established" => "Nie można ustanowić połączenia z bazą Oracle",
"MySQL username and/or password not valid" => "MySQL: Nazwa użytkownika i/lub hasło jest niepoprawne",
"DB Error: \"%s\"" => "Błąd DB: \"%s\"",
"Offending command was: \"%s\"" => "Niepoprawna komenda: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Usuń tego użytkownika z MySQL",
"MySQL user '%s'@'%%' already exists" => "Użytkownik MySQL '%s'@'%%t' już istnieje",
"Drop this user from MySQL." => "Usuń tego użytkownika z MySQL.",
+"Oracle username and/or password not valid" => "Oracle: Nazwa użytkownika i/lub hasło jest niepoprawne",
"Offending command was: \"%s\", name: %s, password: %s" => "Niepoprawne polecania: \"%s\", nazwa: %s, hasło: %s",
"MS SQL username and/or password not valid: %s" => "Nazwa i/lub hasło serwera MS SQL jest niepoprawne: %s.",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serwer internetowy nie jest jeszcze poprawnie skonfigurowany, aby umożliwić synchronizację plików, ponieważ interfejs WebDAV wydaje się być uszkodzony.",
diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php
index 4c50f8de9e6..9606477d945 100644
--- a/lib/l10n/pt_BR.php
+++ b/lib/l10n/pt_BR.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s defina o host do banco de dados.",
"PostgreSQL username and/or password not valid" => "Nome de usuário e/ou senha PostgreSQL inválido(s)",
"You need to enter either an existing account or the administrator." => "Você precisa inserir uma conta existente ou o administrador.",
-"Oracle username and/or password not valid" => "Nome de usuário e/ou senha Oracle inválido(s)",
+"Oracle connection could not be established" => "Conexão Oracle não pode ser estabelecida",
"MySQL username and/or password not valid" => "Nome de usuário e/ou senha MySQL inválido(s)",
"DB Error: \"%s\"" => "Erro no BD: \"%s\"",
"Offending command was: \"%s\"" => "Comando ofensivo era: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Derrubar este usuário do MySQL",
"MySQL user '%s'@'%%' already exists" => "Usuário MySQL '%s'@'%%' já existe",
"Drop this user from MySQL." => "Derrube este usuário do MySQL.",
+"Oracle username and/or password not valid" => "Nome de usuário e/ou senha Oracle inválido(s)",
"Offending command was: \"%s\", name: %s, password: %s" => "Comando ofensivo era: \"%s\", nome: %s, senha: %s",
"MS SQL username and/or password not valid: %s" => "Nome de usuário e/ou senha MS SQL inválido(s): %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Seu servidor web não está configurado corretamente para permitir sincronização de arquivos porque a interface WebDAV parece estar quebrada.",
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index b3befe96e03..f49258157ed 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s defina o servidor da base de dados (geralmente localhost)",
"PostgreSQL username and/or password not valid" => "Nome de utilizador/password do PostgreSQL inválido",
"You need to enter either an existing account or the administrator." => "Precisa de introduzir uma conta existente ou de administrador",
-"Oracle username and/or password not valid" => "Nome de utilizador/password do Oracle inválida",
+"Oracle connection could not be established" => "Não foi possível estabelecer a ligação Oracle",
"MySQL username and/or password not valid" => "Nome de utilizador/password do MySQL inválida",
"DB Error: \"%s\"" => "Erro na BD: \"%s\"",
"Offending command was: \"%s\"" => "O comando gerador de erro foi: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Eliminar este utilizador do MySQL",
"MySQL user '%s'@'%%' already exists" => "O utilizador '%s'@'%%' do MySQL já existe",
"Drop this user from MySQL." => "Eliminar este utilizador do MySQL",
+"Oracle username and/or password not valid" => "Nome de utilizador/password do Oracle inválida",
"Offending command was: \"%s\", name: %s, password: %s" => "O comando gerador de erro foi: \"%s\", nome: %s, password: %s",
"MS SQL username and/or password not valid: %s" => "Nome de utilizador/password do MySQL é inválido: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web não está configurado correctamente para autorizar sincronização de ficheiros, pois o interface WebDAV parece estar com problemas.",
diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php
index e716f6d1c11..e077b688c09 100644
--- a/lib/l10n/ru.php
+++ b/lib/l10n/ru.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s задайте хост базы данных.",
"PostgreSQL username and/or password not valid" => "Неверное имя пользователя и/или пароль PostgreSQL",
"You need to enter either an existing account or the administrator." => "Вы должны войти или в существующий аккаунт или под администратором.",
-"Oracle username and/or password not valid" => "Неверное имя пользователя и/или пароль Oracle",
"MySQL username and/or password not valid" => "Неверное имя пользователя и/или пароль MySQL",
"DB Error: \"%s\"" => "Ошибка БД: \"%s\"",
"Offending command was: \"%s\"" => "Вызываемая команда была: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Удалить этого пользователя из MySQL",
"MySQL user '%s'@'%%' already exists" => "Пользователь MySQL '%s'@'%%' уже существует",
"Drop this user from MySQL." => "Удалить этого пользователя из MySQL.",
+"Oracle username and/or password not valid" => "Неверное имя пользователя и/или пароль Oracle",
"Offending command was: \"%s\", name: %s, password: %s" => "Вызываемая команда была: \"%s\", имя: %s, пароль: %s",
"MS SQL username and/or password not valid: %s" => "Имя пользователя и/или пароль MS SQL не подходит: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ваш веб сервер до сих пор не настроен правильно для возможности синхронизации файлов, похоже что проблема в неисправности интерфейса WebDAV.",
diff --git a/lib/l10n/ru_RU.php b/lib/l10n/ru_RU.php
index 8fb568aee7e..7639a3cc97e 100644
--- a/lib/l10n/ru_RU.php
+++ b/lib/l10n/ru_RU.php
@@ -1,3 +1,4 @@
<?php $TRANSLATIONS = array(
-"Settings" => "Настройки"
+"Settings" => "Настройки",
+"Text" => "Текст"
);
diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php
index e074ed78c3c..c1ec2470b46 100644
--- a/lib/l10n/sk_SK.php
+++ b/lib/l10n/sk_SK.php
@@ -24,7 +24,7 @@
"%s set the database host." => "Zadajte názov počítača s databázou %s.",
"PostgreSQL username and/or password not valid" => "Používateľské meno a/alebo heslo pre PostgreSQL databázu je neplatné",
"You need to enter either an existing account or the administrator." => "Musíte zadať jestvujúci účet alebo administrátora.",
-"Oracle username and/or password not valid" => "Používateľské meno a/alebo heslo pre Oracle databázu je neplatné",
+"Oracle connection could not be established" => "Nie je možné pripojiť sa k Oracle",
"MySQL username and/or password not valid" => "Používateľské meno a/alebo heslo pre MySQL databázu je neplatné",
"DB Error: \"%s\"" => "Chyba DB: \"%s\"",
"Offending command was: \"%s\"" => "Podozrivý príkaz bol: \"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "Zahodiť používateľa z MySQL.",
"MySQL user '%s'@'%%' already exists" => "Používateľ '%s'@'%%' už v MySQL existuje",
"Drop this user from MySQL." => "Zahodiť používateľa z MySQL.",
+"Oracle username and/or password not valid" => "Používateľské meno a/alebo heslo pre Oracle databázu je neplatné",
"Offending command was: \"%s\", name: %s, password: %s" => "Podozrivý príkaz bol: \"%s\", meno: %s, heslo: %s",
"MS SQL username and/or password not valid: %s" => "Používateľské meno, alebo heslo MS SQL nie je platné: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server nie je správne nastavený na synchronizáciu, pretože rozhranie WebDAV je poškodené.",
diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php
index 0c42f44d2aa..7f8827d17f3 100644
--- a/lib/l10n/sl.php
+++ b/lib/l10n/sl.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s - vnos gostitelja podatkovne zbirke.",
"PostgreSQL username and/or password not valid" => "Uporabniško ime ali geslo PostgreSQL ni veljavno",
"You need to enter either an existing account or the administrator." => "Prijaviti se je treba v obstoječi ali pa skrbniški račun.",
-"Oracle username and/or password not valid" => "Uporabniško ime ali geslo Oracle ni veljavno",
"MySQL username and/or password not valid" => "Uporabniško ime ali geslo MySQL ni veljavno",
"DB Error: \"%s\"" => "Napaka podatkovne zbirke: \"%s\"",
"Offending command was: \"%s\"" => "Napačni ukaz je: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Odstrani uporabnika s podatkovne zbirke MySQL",
"MySQL user '%s'@'%%' already exists" => "Uporabnik MySQL '%s'@'%%' že obstaja.",
"Drop this user from MySQL." => "Odstrani uporabnika s podatkovne zbirke MySQL",
+"Oracle username and/or password not valid" => "Uporabniško ime ali geslo Oracle ni veljavno",
"Offending command was: \"%s\", name: %s, password: %s" => "Napačni ukaz je: \"%s\", ime: %s, geslo: %s",
"MS SQL username and/or password not valid: %s" => "Uporabniško ime ali geslo MS SQL ni veljavno: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Spletni stražnik še ni ustrezno nastavljen in ne omogoča usklajevanja, saj je nastavitev WebDAV okvarjena.",
diff --git a/lib/l10n/sq.php b/lib/l10n/sq.php
index 60d83ca48c3..04186f62102 100644
--- a/lib/l10n/sq.php
+++ b/lib/l10n/sq.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s caktoni pozicionin (host) e database-it.",
"PostgreSQL username and/or password not valid" => "Përdoruesi dhe/apo kodi i PostgreSQL i pavlefshëm",
"You need to enter either an existing account or the administrator." => "Duhet të përdorni një llogari ekzistuese ose llogarinë e administratorit.",
-"Oracle username and/or password not valid" => "Përdoruesi dhe/apo kodi i Oracle-it i pavlefshëm",
"MySQL username and/or password not valid" => "Përdoruesi dhe/apo kodi i MySQL-it i pavlefshëm.",
"DB Error: \"%s\"" => "Veprim i gabuar i DB-it: \"%s\"",
"Offending command was: \"%s\"" => "Komanda e gabuar ishte: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Eliminoni këtë përdorues nga MySQL",
"MySQL user '%s'@'%%' already exists" => "Përdoruesi MySQL '%s'@'%%' ekziston",
"Drop this user from MySQL." => "Eliminoni këtë përdorues nga MySQL.",
+"Oracle username and/or password not valid" => "Përdoruesi dhe/apo kodi i Oracle-it i pavlefshëm",
"Offending command was: \"%s\", name: %s, password: %s" => "Komanda e gabuar ishte: \"%s\", përdoruesi: %s, kodi: %s",
"MS SQL username and/or password not valid: %s" => "Përdoruesi dhe/apo kodi i MS SQL i pavlefshëm: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serveri web i juaji nuk është konfiguruar akoma për të lejuar sinkronizimin e skedarëve sepse ndërfaqja WebDAV mund të jetë e dëmtuar.",
diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php
index 641da2447ee..7996447b95d 100644
--- a/lib/l10n/tr.php
+++ b/lib/l10n/tr.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s veritabanı sunucu adını tanımla",
"PostgreSQL username and/or password not valid" => "PostgreSQL adi kullanici ve/veya parola yasal degildir. ",
"You need to enter either an existing account or the administrator." => "Bir konto veya kullanici birlemek ihtiyacin. ",
-"Oracle username and/or password not valid" => "Adi klullanici ve/veya parola Oracle mantikli değildir. ",
"MySQL username and/or password not valid" => "MySQL kullanıcı adı ve/veya parolası geçerli değil",
"DB Error: \"%s\"" => "DB Hata: ''%s''",
"Offending command was: \"%s\"" => "Komut rahasiz ''%s''. ",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Bu kullanici MySQLden list disari koymak. ",
"MySQL user '%s'@'%%' already exists" => "MySQL kullanici '%s @ % % zaten var (zaten yazili)",
"Drop this user from MySQL." => "Bu kulanıcıyı MySQL veritabanından kaldır",
+"Oracle username and/or password not valid" => "Adi klullanici ve/veya parola Oracle mantikli değildir. ",
"Offending command was: \"%s\", name: %s, password: %s" => "Hatalı komut: \"%s\", ad: %s, parola: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL kullanıcı adı ve/veya parolası geçersiz: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web sunucunuz dosya transferi için düzgün bir şekilde yapılandırılmamış. WevDAV arabirimini sorunlu gözüküyor.",
diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php
index a5448901247..676879629ef 100644
--- a/lib/l10n/uk.php
+++ b/lib/l10n/uk.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s встановити хост бази даних.",
"PostgreSQL username and/or password not valid" => "PostgreSQL ім'я користувача та/або пароль не дійсні",
"You need to enter either an existing account or the administrator." => "Вам потрібно ввести або існуючий обліковий запис або administrator.",
-"Oracle username and/or password not valid" => "Oracle ім'я користувача та/або пароль не дійсні",
"MySQL username and/or password not valid" => "MySQL ім'я користувача та/або пароль не дійсні",
"DB Error: \"%s\"" => "Помилка БД: \"%s\"",
"Offending command was: \"%s\"" => "Команда, що викликала проблему: \"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "Видалити цього користувача з MySQL",
"MySQL user '%s'@'%%' already exists" => "Користувач MySQL '%s'@'%%' вже існує",
"Drop this user from MySQL." => "Видалити цього користувача з MySQL.",
+"Oracle username and/or password not valid" => "Oracle ім'я користувача та/або пароль не дійсні",
"Offending command was: \"%s\", name: %s, password: %s" => "Команда, що викликала проблему: \"%s\", ім'я: %s, пароль: %s",
"MS SQL username and/or password not valid: %s" => "MS SQL ім'я користувача та/або пароль не дійсні: %s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ваш Web-сервер ще не налаштований належним чином для того, щоб дозволити синхронізацію файлів, через те що інтерфейс WebDAV, здається, зламаний.",
diff --git a/lib/l10n/zh_CN.php b/lib/l10n/zh_CN.php
index cab5142e5d5..61e405d8058 100644
--- a/lib/l10n/zh_CN.php
+++ b/lib/l10n/zh_CN.php
@@ -24,7 +24,6 @@
"%s set the database host." => "%s 设置数据库所在主机。",
"PostgreSQL username and/or password not valid" => "PostgreSQL 数据库用户名和/或密码无效",
"You need to enter either an existing account or the administrator." => "你需要输入一个数据库中已有的账户或管理员账户。",
-"Oracle username and/or password not valid" => "Oracle 数据库用户名和/或密码无效",
"MySQL username and/or password not valid" => "MySQL 数据库用户名和/或密码无效",
"DB Error: \"%s\"" => "数据库错误:\"%s\"",
"Offending command was: \"%s\"" => "冲突命令为:\"%s\"",
@@ -32,6 +31,7 @@
"Drop this user from MySQL" => "建议从 MySQL 数据库中丢弃 Drop 此用户",
"MySQL user '%s'@'%%' already exists" => "MySQL 用户 '%s'@'%%' 已存在",
"Drop this user from MySQL." => "建议从 MySQL 数据库中丢弃 Drop 此用户。",
+"Oracle username and/or password not valid" => "Oracle 数据库用户名和/或密码无效",
"Offending command was: \"%s\", name: %s, password: %s" => "冲突命令为:\"%s\",名称:%s,密码:%s",
"MS SQL username and/or password not valid: %s" => "MS SQL 用户名和/或密码无效:%s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "您的Web服务器尚未正确设置以允许文件同步, 因为WebDAV的接口似乎已损坏.",
diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php
index 5affb1ccf35..4e0d50e7fc9 100644
--- a/lib/l10n/zh_TW.php
+++ b/lib/l10n/zh_TW.php
@@ -24,7 +24,7 @@
"%s set the database host." => "%s 設定資料庫主機。",
"PostgreSQL username and/or password not valid" => "PostgreSQL 用戶名和/或密碼無效",
"You need to enter either an existing account or the administrator." => "您必須輸入一個現有的帳號或管理員帳號。",
-"Oracle username and/or password not valid" => "Oracle 用戶名和/或密碼無效",
+"Oracle connection could not be established" => "無法建立 Oracle 資料庫連線",
"MySQL username and/or password not valid" => "MySQL 用戶名和/或密碼無效",
"DB Error: \"%s\"" => "資料庫錯誤:\"%s\"",
"Offending command was: \"%s\"" => "有問題的指令是:\"%s\"",
@@ -32,6 +32,7 @@
"Drop this user from MySQL" => "在 MySQL 移除這個使用者",
"MySQL user '%s'@'%%' already exists" => "MySQL 使用者 '%s'@'%%' 已經存在",
"Drop this user from MySQL." => "在 MySQL 移除這個使用者。",
+"Oracle username and/or password not valid" => "Oracle 用戶名和/或密碼無效",
"Offending command was: \"%s\", name: %s, password: %s" => "有問題的指令是:\"%s\" ,使用者:\"%s\",密碼:\"%s\"",
"MS SQL username and/or password not valid: %s" => "MS SQL 使用者和/或密碼無效:%s",
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "您的網頁伺服器尚未被正確設定來進行檔案同步,因為您的 WebDAV 界面似乎無法使用。",
diff --git a/lib/mail.php b/lib/mail.php
index 61634632efc..e15af277a64 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -113,7 +113,7 @@ class OC_Mail {
*/
public static function getfooter() {
- $txt="\n--\n";
+ $txt="\n-- \n";
$txt.="ownCloud\n";
$txt.="Your Cloud, Your Data, Your Way!\n";
return($txt);
diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php
index 601046fe691..cc076a3a845 100644
--- a/lib/public/backgroundjob.php
+++ b/lib/public/backgroundjob.php
@@ -1,49 +1,46 @@
<?php
/**
-* ownCloud
-*
-* @author Jakob Sack
-* @copyright 2012 Jakob Sack owncloud@jakobsack.de
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
+ * ownCloud
+ *
+ * @author Jakob Sack
+ * @copyright 2012 Jakob Sack owncloud@jakobsack.de
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
/**
- * Public interface of ownCloud forbackground jobs.
+ * Public interface of ownCloud for background jobs.
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
+use \OC\BackgroundJob\JobList;
+
/**
- * This class provides functions to manage backgroundjobs in ownCloud
- *
- * There are two kind of background jobs in ownCloud: regular tasks and
- * queued tasks.
+ * This class provides functions to register backgroundjobs in ownCloud
*
- * Regular tasks have to be registered in appinfo.php and
- * will run on a regular base. Fetching news could be a task that should run
- * frequently.
+ * To create a new backgroundjob create a new class that inharits from either \OC\BackgroundJob\Job,
+ * \OC\BackgroundJob\QueuedJob or \OC\BackgroundJob\TimedJob and register it using
+ * \OCP\BackgroundJob->registerJob($job, $argument), $argument will be passed to the run() function
+ * of the job when the job is executed.
*
- * Queued tasks have to be registered each time you want to execute them.
- * An example of the queued task would be the creation of the thumbnail. As
- * soon as the user uploads a picture the gallery app registers the queued
- * task "create thumbnail" and saves the path in the parameter instead of doing
- * the work right away. This makes the app more responsive. As soon as the task
- * is done it will be deleted from the list.
+ * A regular Job will be executed every time cron.php is run, a QueuedJob will only run once and a TimedJob
+ * will only run at a specific interval which is to be specified in the constructor of the job by calling
+ * $this->setInterval($interval) with $interval in seconds.
*/
class BackgroundJob {
/**
@@ -59,82 +56,136 @@ class BackgroundJob {
/**
* @brief sets the background jobs execution type
- * @param $type execution type
+ * @param string $type execution type
* @return boolean
*
* This method sets the execution type of the background jobs. Possible types
* are "none", "ajax", "webcron", "cron"
*/
- public static function setExecutionType( $type ) {
- return \OC_BackgroundJob::setExecutionType( $type );
+ public static function setExecutionType($type) {
+ return \OC_BackgroundJob::setExecutionType($type);
+ }
+
+ /**
+ * @param \OC\BackgroundJob\Job|string $job
+ * @param mixed $argument
+ */
+ public static function registerJob($job, $argument = null) {
+ $jobList = new JobList();
+ $jobList->add($job, $argument);
}
/**
+ * @deprecated
* @brief creates a regular task
- * @param $klass class name
- * @param $method method name
+ * @param string $klass class name
+ * @param string $method method name
* @return true
*/
- public static function addRegularTask( $klass, $method ) {
- return \OC_BackgroundJob_RegularTask::register( $klass, $method );
+ public static function addRegularTask($klass, $method) {
+ self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method));
+ return true;
}
/**
+ * @deprecated
* @brief gets all regular tasks
* @return associative array
*
* key is string "$klass-$method", value is array( $klass, $method )
*/
static public function allRegularTasks() {
- return \OC_BackgroundJob_RegularTask::all();
+ $jobList = new JobList();
+ $allJobs = $jobList->getAll();
+ $regularJobs = array();
+ foreach ($allJobs as $job) {
+ if ($job instanceof RegularLegacyJob) {
+ $key = implode('-', $job->getArgument());
+ $regularJobs[$key] = $job->getArgument();
+ }
+ }
+ return $regularJobs;
}
/**
+ * @deprecated
* @brief Gets one queued task
- * @param $id ID of the task
+ * @param int $id ID of the task
* @return associative array
*/
- public static function findQueuedTask( $id ) {
- return \OC_BackgroundJob_QueuedTask::find( $id );
+ public static function findQueuedTask($id) {
+ $jobList = new JobList();
+ return $jobList->getById($id);
}
/**
+ * @deprecated
* @brief Gets all queued tasks
* @return array with associative arrays
*/
public static function allQueuedTasks() {
- return \OC_BackgroundJob_QueuedTask::all();
+ $jobList = new JobList();
+ $allJobs = $jobList->getAll();
+ $queuedJobs = array();
+ foreach ($allJobs as $job) {
+ if ($job instanceof QueuedLegacyJob) {
+ $queuedJob = $job->getArgument();
+ $queuedJob['id'] = $job->getId();
+ $queuedJobs[] = $queuedJob;
+ }
+ }
+ return $queuedJobs;
}
/**
+ * @deprecated
* @brief Gets all queued tasks of a specific app
- * @param $app app name
+ * @param string $app app name
* @return array with associative arrays
*/
- public static function queuedTaskWhereAppIs( $app ) {
- return \OC_BackgroundJob_QueuedTask::whereAppIs( $app );
+ public static function queuedTaskWhereAppIs($app) {
+ $jobList = new JobList();
+ $allJobs = $jobList->getAll();
+ $queuedJobs = array();
+ foreach ($allJobs as $job) {
+ if ($job instanceof QueuedLegacyJob) {
+ $queuedJob = $job->getArgument();
+ $queuedJob['id'] = $job->getId();
+ if ($queuedJob['app'] === $app) {
+ $queuedJobs[] = $queuedJob;
+ }
+ }
+ }
+ return $queuedJobs;
}
/**
+ * @deprecated
* @brief queues a task
- * @param $app app name
- * @param $klass class name
- * @param $method method name
- * @param $parameters all useful data as text
- * @return id of task
+ * @param string $app app name
+ * @param string $class class name
+ * @param string $method method name
+ * @param string $parameters all useful data as text
+ * @return int id of task
*/
- public static function addQueuedTask( $app, $klass, $method, $parameters ) {
- return \OC_BackgroundJob_QueuedTask::add( $app, $klass, $method, $parameters );
+ public static function addQueuedTask($app, $class, $method, $parameters) {
+ self::registerJob('OC\BackgroundJob\Legacy\QueuedJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters));
+ return true;
}
/**
+ * @deprecated
* @brief deletes a queued task
- * @param $id id of task
- * @return true/false
+ * @param int $id id of task
+ * @return bool
*
* Deletes a report
*/
- public static function deleteQueuedTask( $id ) {
- return \OC_BackgroundJob_QueuedTask::delete( $id );
+ public static function deleteQueuedTask($id) {
+ $jobList = new JobList();
+ $job = $jobList->getById($id);
+ if ($job) {
+ $jobList->remove($job);
+ }
}
}
diff --git a/lib/public/share.php b/lib/public/share.php
index a561319e9bd..81f5515bb4b 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -106,6 +106,125 @@ class Share {
}
return false;
}
+
+ /**
+ * @brief Prepare a path to be passed to DB as file_target
+ * @return string Prepared path
+ */
+ public static function prepFileTarget( $path ) {
+
+ // Paths in DB are stored with leading slashes, so add one if necessary
+ if ( substr( $path, 0, 1 ) !== '/' ) {
+
+ $path = '/' . $path;
+
+ }
+
+ return $path;
+
+ }
+
+ /**
+ * @brief Find which users can access a shared item
+ * @param $path to the file
+ * @param $user owner of the file
+ * @param include owner to the list of users with access to the file
+ * @return array
+ * @note $path needs to be relative to user data dir, e.g. 'file.txt'
+ * not '/admin/data/file.txt'
+ */
+ public static function getUsersSharingFile($path, $user, $includeOwner = false) {
+
+ $shares = array();
+ $publicShare = false;
+ $source = -1;
+ $cache = false;
+
+ $view = new \OC\Files\View('/' . $user . '/files/');
+ $meta = $view->getFileInfo(\OC\Files\Filesystem::normalizePath($path));
+
+ if($meta !== false) {
+ $source = $meta['fileid'];
+ $cache = new \OC\Files\Cache\Cache($meta['storage']);
+ }
+
+ while ($source !== -1) {
+
+ // Fetch all shares of this file path from DB
+ $query = \OC_DB::prepare(
+ 'SELECT share_with
+ FROM
+ `*PREFIX*share`
+ WHERE
+ item_source = ? AND share_type = ?'
+ );
+
+ $result = $query->execute(array($source, self::SHARE_TYPE_USER));
+
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ } else {
+ while ($row = $result->fetchRow()) {
+ $shares[] = $row['share_with'];
+ }
+ }
+ // We also need to take group shares into account
+
+ $query = \OC_DB::prepare(
+ 'SELECT share_with
+ FROM
+ `*PREFIX*share`
+ WHERE
+ item_source = ? AND share_type = ?'
+ );
+
+ $result = $query->execute(array($source, self::SHARE_TYPE_GROUP));
+
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ } else {
+ while ($row = $result->fetchRow()) {
+ $usersInGroup = \OC_Group::usersInGroup($row['share_with']);
+ $shares = array_merge($shares, $usersInGroup);
+ }
+ }
+
+ //check for public link shares
+ if (!$publicShare) {
+ $query = \OC_DB::prepare(
+ 'SELECT share_with
+ FROM
+ `*PREFIX*share`
+ WHERE
+ item_source = ? AND share_type = ?'
+ );
+
+ $result = $query->execute(array($source, self::SHARE_TYPE_LINK));
+
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ } else {
+ if ($result->fetchRow()) {
+ $publicShare = true;
+ }
+ }
+ }
+
+ // let's get the parent for the next round
+ $meta = $cache->get((int)$source);
+ if($meta !== false) {
+ $source = (int)$meta['parent'];
+ } else {
+ $source = -1;
+ }
+ }
+ // Include owner in list of users, if requested
+ if ($includeOwner) {
+ $shares[] = $user;
+ }
+
+ return array("users" => array_unique($shares), "public" => $publicShare);
+ }
/**
* @brief Get the items of item type shared with the current user
@@ -132,7 +251,7 @@ class Share {
return self::getItems($itemType, $itemTarget, self::$shareTypeUserAndGroups, \OC_User::getUser(), null, $format,
$parameters, 1, $includeCollections);
}
-
+
/**
* @brief Get the item of item type shared with the current user by source
* @param string Item type
@@ -409,8 +528,16 @@ class Share {
'fileSource' => $item['file_source'],
'shareType' => $shareType,
'shareWith' => $shareWith,
+ 'itemParent' => $item['parent'],
));
self::delete($item['id']);
+ \OC_Hook::emit('OCP\Share', 'post_unshare', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'shareType' => $shareType,
+ 'shareWith' => $shareWith,
+ 'itemParent' => $item['parent'],
+ ));
return true;
}
return false;
@@ -433,6 +560,11 @@ class Share {
foreach ($shares as $share) {
self::delete($share['id']);
}
+ \OC_Hook::emit('OCP\Share', 'post_unshareAll', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'shares' => $shares
+ ));
return true;
}
return false;
@@ -877,7 +1009,7 @@ class Share {
if (!isset($mounts[$row['storage']])) {
$mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']);
if (is_array($mountPoints)) {
- $mounts[$row['storage']] = $mountPoints[key($mountPoints)];
+ $mounts[$row['storage']] = current($mountPoints);
}
}
if ($mounts[$row['storage']]) {
@@ -1089,6 +1221,17 @@ class Share {
if ($shareType == self::SHARE_TYPE_GROUP) {
$groupItemTarget = self::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'],
$uidOwner, $suggestedItemTarget);
+ \OC_Hook::emit('OCP\Share', 'pre_shared', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'itemTarget' => $groupItemTarget,
+ 'shareType' => $shareType,
+ 'shareWith' => $shareWith['group'],
+ 'uidOwner' => $uidOwner,
+ 'permissions' => $permissions,
+ 'fileSource' => $fileSource,
+ 'token' => $token
+ ));
if (isset($fileSource)) {
if ($parentFolder) {
if ($parentFolder === true) {
@@ -1164,6 +1307,17 @@ class Share {
} else {
$itemTarget = self::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$suggestedItemTarget);
+ \OC_Hook::emit('OCP\Share', 'pre_shared', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'itemTarget' => $itemTarget,
+ 'shareType' => $shareType,
+ 'shareWith' => $shareWith,
+ 'uidOwner' => $uidOwner,
+ 'permissions' => $permissions,
+ 'fileSource' => $fileSource,
+ 'token' => $token
+ ));
if (isset($fileSource)) {
if ($parentFolder) {
if ($parentFolder === true) {
diff --git a/lib/session/internal.php b/lib/session/internal.php
new file mode 100644
index 00000000000..60aecccc8aa
--- /dev/null
+++ b/lib/session/internal.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Session;
+
+/**
+ * Class Internal
+ *
+ * wrap php's internal session handling into the Session interface
+ *
+ * @package OC\Session
+ */
+class Internal extends Memory {
+ public function __construct($name) {
+ session_name($name);
+ session_start();
+ if (!isset($_SESSION)) {
+ throw new \Exception('Failed to start session');
+ }
+ $this->data = $_SESSION;
+ }
+
+ public function __destruct() {
+ $_SESSION = $this->data;
+ session_write_close();
+ }
+
+ public function clear() {
+ session_unset();
+ @session_regenerate_id(true);
+ @session_start();
+ $this->data = $_SESSION = array();
+ }
+}
diff --git a/lib/session/memory.php b/lib/session/memory.php
new file mode 100644
index 00000000000..c148ff4b9b9
--- /dev/null
+++ b/lib/session/memory.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Session;
+
+/**
+ * Class Internal
+ *
+ * store session data in an in-memory array, not persistance
+ *
+ * @package OC\Session
+ */
+class Memory extends Session {
+ protected $data;
+
+ public function __construct($name) {
+ //no need to use $name since all data is already scoped to this instance
+ $this->data = array();
+ }
+
+ /**
+ * @param string $key
+ * @param mixed $value
+ */
+ public function set($key, $value) {
+ $this->data[$key] = $value;
+ }
+
+ /**
+ * @param string $key
+ * @return mixed
+ */
+ public function get($key) {
+ if (!$this->exists($key)) {
+ return null;
+ }
+ return $this->data[$key];
+ }
+
+ /**
+ * @param string $key
+ * @return bool
+ */
+ public function exists($key) {
+ return isset($this->data[$key]);
+ }
+
+ /**
+ * @param string $key
+ */
+ public function remove($key) {
+ unset($this->data[$key]);
+ }
+
+ public function clear() {
+ $this->data = array();
+ }
+}
diff --git a/lib/session/session.php b/lib/session/session.php
new file mode 100644
index 00000000000..55515f57a87
--- /dev/null
+++ b/lib/session/session.php
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Session;
+
+abstract class Session implements \ArrayAccess {
+ /**
+ * $name serves as a namespace for the session keys
+ *
+ * @param string $name
+ */
+ abstract public function __construct($name);
+
+ /**
+ * @param string $key
+ * @param mixed $value
+ */
+ abstract public function set($key, $value);
+
+ /**
+ * @param string $key
+ * @return mixed should return null if $key does not exist
+ */
+ abstract public function get($key);
+
+ /**
+ * @param string $key
+ * @return bool
+ */
+ abstract public function exists($key);
+
+ /**
+ * should not throw any errors if $key does not exist
+ *
+ * @param string $key
+ */
+ abstract public function remove($key);
+
+ /**
+ * removes all entries within the cache namespace
+ */
+ abstract public function clear();
+
+ /**
+ * @param mixed $offset
+ * @return bool
+ */
+ public function offsetExists($offset) {
+ return $this->exists($offset);
+ }
+
+ /**
+ * @param mixed $offset
+ * @return mixed
+ */
+ public function offsetGet($offset) {
+ return $this->get($offset);
+ }
+
+ /**
+ * @param mixed $offset
+ * @param mixed $value
+ */
+ public function offsetSet($offset, $value) {
+ $this->set($offset, $value);
+ }
+
+ /**
+ * @param mixed $offset
+ */
+ public function offsetUnset($offset) {
+ $this->remove($offset);
+ }
+}
diff --git a/lib/setup.php b/lib/setup.php
index 376b71fc03b..fd22141f1b9 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -138,8 +138,12 @@ class OC_Setup {
self::setupOCIDatabase($dbhost, $dbuser, $dbpass, $dbname, $dbtableprefix, $dbtablespace, $username);
} catch (Exception $e) {
$error[] = array(
- 'error' => $l->t('Oracle username and/or password not valid'),
- 'hint' => $l->t('You need to enter either an existing account or the administrator.')
+ 'error' => $l->t('Oracle connection could not be established'),
+ 'hint' => $e->getMessage().' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
+ .' ORACLE_SID='.getenv('ORACLE_SID')
+ .' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
+ .' NLS_LANG='.getenv('NLS_LANG')
+ .' tnsnames.ora is '.(is_readable(getenv('ORACLE_HOME').'/network/admin/tnsnames.ora')?'':'not ').'readable'
);
return $error;
}
@@ -438,9 +442,13 @@ class OC_Setup {
} else {
$easy_connect_string = '//'.$e_host.'/'.$e_dbname;
}
+ \OC_Log::write('setup oracle', 'connect string: ' . $easy_connect_string, \OC_Log::DEBUG);
$connection = @oci_connect($dbuser, $dbpass, $easy_connect_string);
if(!$connection) {
$e = oci_error();
+ if (is_array ($e) && isset ($e['message'])) {
+ throw new Exception($e['message']);
+ }
throw new Exception($l->t('Oracle username and/or password not valid'));
}
//check for roles creation rights in oracle
diff --git a/lib/template.php b/lib/template.php
index 2f535335648..9467dedb62a 100644
--- a/lib/template.php
+++ b/lib/template.php
@@ -246,14 +246,14 @@ class OC_Template{
// if the formfactor is not yet autodetected do the
// autodetection now. For possible formfactors check the
// detectFormfactor documentation
- if(!isset($_SESSION['formfactor'])) {
- $_SESSION['formfactor'] = self::detectFormfactor();
+ if (!\OC::$session->exists('formfactor')) {
+ \OC::$session->set('formfactor', self::detectFormfactor());
}
// allow manual override via GET parameter
if(isset($_GET['formfactor'])) {
- $_SESSION['formfactor']=$_GET['formfactor'];
+ \OC::$session->set('formfactor', $_GET['formfactor']);
}
- $formfactor=$_SESSION['formfactor'];
+ $formfactor = \OC::$session->get('formfactor');
if($formfactor=='default') {
$fext='';
}elseif($formfactor=='mobile') {
diff --git a/lib/user.php b/lib/user.php
index 226b716188d..503ac3f7493 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -30,35 +30,85 @@
* post_createUser(uid, password)
* pre_deleteUser(&run, uid)
* post_deleteUser(uid)
- * pre_setPassword(&run, uid, password)
- * post_setPassword(uid, password)
- * pre_login(&run, uid)
+ * pre_setPassword(&run, uid, password, recoveryPassword)
+ * post_setPassword(uid, password, recoveryPassword)
+ * pre_login(&run, uid, password)
* post_login(uid)
* logout()
*/
class OC_User {
- // The backend used for user management
- private static $_usedBackends = array();
+ public static $userSession = null;
+
+ private static function getUserSession() {
+ if (!self::$userSession) {
+ $manager = new \OC\User\Manager();
+ self::$userSession = new \OC\User\Session($manager, \OC::$session);
+ self::$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
+ \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
+ });
+ self::$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
+ /** @var $user \OC\User\User */
+ \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
+ });
+ self::$userSession->listen('\OC\User', 'preDelete', function ($user) {
+ /** @var $user \OC\User\User */
+ \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
+ });
+ self::$userSession->listen('\OC\User', 'postDelete', function ($user) {
+ /** @var $user \OC\User\User */
+ \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
+ });
+ self::$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
+ /** @var $user \OC\User\User */
+ OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
+ });
+ self::$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
+ /** @var $user \OC\User\User */
+ OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
+ });
+ self::$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
+ \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
+ });
+ self::$userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
+ /** @var $user \OC\User\User */
+ \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
+ });
+ self::$userSession->listen('\OC\User', 'logout', function () {
+ \OC_Hook::emit('OC_User', 'logout', array());
+ });
+ }
+ return self::$userSession;
+ }
- private static $_setupedBackends = array();
+ /**
+ * @return \OC\User\Manager
+ */
+ private static function getManager() {
+ return self::getUserSession()->getManager();
+ }
- // Backends available (except database)
private static $_backends = array();
+ private static $_usedBackends = array();
+
+ private static $_setupedBackends = array();
+
/**
* @brief registers backend
- * @param $name name of the backend
- * @returns true/false
+ * @param string $backend name of the backend
+ * @deprecated Add classes by calling useBackend with a class instance instead
+ * @return bool
*
* Makes a list of backends that can be used by other modules
*/
- public static function registerBackend( $backend ) {
+ public static function registerBackend($backend) {
self::$_backends[] = $backend;
return true;
}
/**
* @brief gets available backends
+ * @deprecated
* @returns array of backends
*
* Returns the names of all backends.
@@ -69,6 +119,7 @@ class OC_User {
/**
* @brief gets used backends
+ * @deprecated
* @returns array of backends
*
* Returns the names of all used backends.
@@ -79,33 +130,36 @@ class OC_User {
/**
* @brief Adds the backend to the list of used backends
- * @param $backend default: database The backend to use for user managment
- * @returns true/false
+ * @param string | OC_User_Backend $backend default: database The backend to use for user management
+ * @return bool
*
* Set the User Authentication Module
*/
- 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;
+ 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 {
// You'll never know what happens
- if( null === $backend OR !is_string( $backend )) {
+ if (null === $backend OR !is_string($backend)) {
$backend = 'database';
}
// Load backend
- switch( $backend ) {
+ switch ($backend) {
case 'database':
case 'mysql':
case 'sqlite':
- OC_Log::write('core', 'Adding user backend '.$backend.'.', OC_Log::DEBUG);
+ OC_Log::write('core', 'Adding user backend ' . $backend . '.', OC_Log::DEBUG);
self::$_usedBackends[$backend] = new OC_User_Database();
+ self::getManager()->registerBackend(self::$_usedBackends[$backend]);
break;
default:
- OC_Log::write('core', 'Adding default user backend '.$backend.'.', OC_Log::DEBUG);
+ OC_Log::write('core', 'Adding default user backend ' . $backend . '.', OC_Log::DEBUG);
$className = 'OC_USER_' . strToUpper($backend);
self::$_usedBackends[$backend] = new $className();
+ self::getManager()->registerBackend(self::$_usedBackends[$backend]);
break;
}
}
@@ -116,121 +170,73 @@ class OC_User {
* remove all used backends
*/
public static function clearBackends() {
- self::$_usedBackends=array();
+ self::$_usedBackends = array();
+ self::getManager()->clearBackends();
}
/**
* setup the configured backends in config.php
*/
public static function setupBackends() {
- $backends=OC_Config::getValue('user_backends', array());
- foreach($backends as $i=>$config) {
- $class=$config['class'];
- $arguments=$config['arguments'];
- if(class_exists($class)) {
- if(array_search($i, self::$_setupedBackends)===false) {
+ $backends = OC_Config::getValue('user_backends', array());
+ foreach ($backends as $i => $config) {
+ $class = $config['class'];
+ $arguments = $config['arguments'];
+ if (class_exists($class)) {
+ if (array_search($i, self::$_setupedBackends) === false) {
// make a reflection object
$reflectionObj = new ReflectionClass($class);
// use Reflection to create a new instance, using the $args
$backend = $reflectionObj->newInstanceArgs($arguments);
self::useBackend($backend);
- $_setupedBackends[]=$i;
+ $_setupedBackends[] = $i;
} else {
- OC_Log::write('core', 'User backend '.$class.' already initialized.', OC_Log::DEBUG);
+ OC_Log::write('core', 'User backend ' . $class . ' already initialized.', OC_Log::DEBUG);
}
} else {
- OC_Log::write('core', 'User backend '.$class.' not found.', OC_Log::ERROR);
+ OC_Log::write('core', 'User backend ' . $class . ' not found.', OC_Log::ERROR);
}
}
}
/**
* @brief Create a new user
- * @param $uid The username of the user to create
- * @param $password The password of the new user
- * @returns true/false
+ * @param string $uid The username of the user to create
+ * @param string $password The password of the new user
+ * @throws Exception
+ * @return bool true/false
*
* Creates a new user. Basic checking of username is done in OC_User
* itself, not in its subclasses.
*
* Allowed characters in the username are: "a-z", "A-Z", "0-9" and "_.@-"
*/
- public static function createUser( $uid, $password ) {
- // Check the name for bad characters
- // Allowed are: "a-z", "A-Z", "0-9" and "_.@-"
- if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $uid )) {
- throw new Exception('Only the following characters are allowed in a username:'
- .' "a-z", "A-Z", "0-9", and "_.@-"');
- }
- // No empty username
- if(trim($uid) == '') {
- throw new Exception('A valid username must be provided');
- }
- // No empty password
- if(trim($password) == '') {
- throw new Exception('A valid password must be provided');
- }
-
- // Check if user already exists
- if( self::userExistsForCreation($uid) ) {
- throw new Exception('The username is already being used');
- }
-
-
- $run = true;
- OC_Hook::emit( "OC_User", "pre_createUser", array( "run" => &$run, "uid" => $uid, "password" => $password ));
-
- if( $run ) {
- //create the user in the first backend that supports creating users
- foreach(self::$_usedBackends as $backend) {
- if(!$backend->implementsActions(OC_USER_BACKEND_CREATE_USER))
- continue;
-
- $backend->createUser($uid, $password);
- OC_Hook::emit( "OC_User", "post_createUser", array( "uid" => $uid, "password" => $password ));
-
- return self::userExists($uid);
- }
- }
- return false;
+ public static function createUser($uid, $password) {
+ self::getManager()->createUser($uid, $password);
}
/**
* @brief delete a user
- * @param $uid The username of the user to delete
- * @returns true/false
+ * @param string $uid The username of the user to delete
+ * @return bool
*
* Deletes a user
*/
- public static function deleteUser( $uid ) {
- $run = true;
- OC_Hook::emit( "OC_User", "pre_deleteUser", array( "run" => &$run, "uid" => $uid ));
-
- if( $run ) {
- //delete the user from all backends
- foreach(self::$_usedBackends as $backend) {
- $backend->deleteUser($uid);
- }
- if (self::userExists($uid)) {
- return false;
- }
+ public static function deleteUser($uid) {
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ $user->delete();
+
// We have to delete the user from all groups
- foreach( OC_Group::getUserGroups( $uid ) as $i ) {
- OC_Group::removeFromGroup( $uid, $i );
+ foreach (OC_Group::getUserGroups($uid) as $i) {
+ OC_Group::removeFromGroup($uid, $i);
}
// Delete the user's keys in preferences
OC_Preferences::deleteUser($uid);
// Delete user files in /data/
- OC_Helper::rmdirr(OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ) . '/'.$uid.'/');
-
- // Emit and exit
- OC_Hook::emit( "OC_User", "post_deleteUser", array( "uid" => $uid ));
- return true;
- }
- else{
- return false;
+ OC_Helper::rmdirr(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid . '/');
}
}
@@ -238,75 +244,34 @@ class OC_User {
* @brief Try to login a user
* @param $uid The username of the user to log in
* @param $password The password of the user
- * @returns true/false
+ * @return bool
*
* Log in a user and regenerate a new session - if the password is ok
*/
- public static function login( $uid, $password ) {
- $run = true;
- OC_Hook::emit( "OC_User", "pre_login", array( "run" => &$run, "uid" => $uid ));
-
- if( $run ) {
- $uid = self::checkPassword( $uid, $password );
- $enabled = self::isEnabled($uid);
- if($uid && $enabled) {
- session_regenerate_id(true);
- self::setUserId($uid);
- self::setDisplayName($uid);
- OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid, 'password'=>$password ));
- return true;
- }
- }
- return false;
+ public static function login($uid, $password) {
+ return self::getUserSession()->login($uid, $password);
}
/**
* @brief Sets user id for session and triggers emit
*/
public static function setUserId($uid) {
- $_SESSION['user_id'] = $uid;
+ OC::$session->set('user_id', $uid);
}
/**
* @brief Sets user display name for session
*/
public static function setDisplayName($uid, $displayName = null) {
- $result = false;
- if ($displayName ) {
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
- if($backend->userExists($uid)) {
- $result |= $backend->setDisplayName($uid, $displayName);
- }
- }
- }
- } else {
- $displayName = self::determineDisplayName($uid);
- $result = true;
+ if (is_null($displayName)) {
+ $displayName = $uid;
}
- if (OC_User::getUser() === $uid) {
- $_SESSION['display_name'] = $displayName;
- }
- return $result;
- }
-
-
- /**
- * @brief get display name
- * @param $uid The username
- * @returns string display name or uid if no display name is defined
- *
- */
- private static function determineDisplayName( $uid ) {
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) {
- $result=$backend->getDisplayName( $uid );
- if($result) {
- return $result;
- }
- }
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ return $user->setDisplayName($displayName);
+ } else {
+ return false;
}
- return $uid;
}
/**
@@ -315,36 +280,31 @@ class OC_User {
* Logout, destroys session
*/
public static function logout() {
- OC_Hook::emit( "OC_User", "logout", array());
- session_unset();
- session_destroy();
- OC_User::unsetMagicInCookie();
+ self::getUserSession()->logout();
}
/**
* @brief Check if the user is logged in
- * @returns true/false
+ * @returns bool
*
* Checks if the user is logged in
*/
public static function isLoggedIn() {
- if( isset($_SESSION['user_id']) AND $_SESSION['user_id']) {
+ if (\OC::$session->get('user_id')) {
OC_App::loadApps(array('authentication'));
self::setupBackends();
- if (self::userExists($_SESSION['user_id']) ) {
- return true;
- }
+ return self::userExists(\OC::$session->get('user_id'));
}
return false;
}
/**
* @brief Check if the user is an admin user
- * @param $uid uid of the admin
- * @returns bool
+ * @param string $uid uid of the admin
+ * @return bool
*/
public static function isAdminUser($uid) {
- if(OC_Group::inGroup($uid, 'admin' )) {
+ if (OC_Group::inGroup($uid, 'admin')) {
return true;
}
return false;
@@ -356,32 +316,40 @@ class OC_User {
* @return string uid or false
*/
public static function getUser() {
- if( isset($_SESSION['user_id']) AND $_SESSION['user_id'] ) {
- return $_SESSION['user_id'];
- }
- else{
+ $uid = OC::$session->get('user_id');
+ if (!is_null($uid)) {
+ return $uid;
+ } else {
return false;
}
}
/**
* @brief get the display name of the user currently logged in.
+ * @param string $uid
* @return string uid or false
*/
- public static function getDisplayName($user=null) {
- if ( $user ) {
- return self::determineDisplayName($user);
- } else if( isset($_SESSION['display_name']) AND $_SESSION['display_name'] ) {
- return $_SESSION['display_name'];
- }
- else{
- return false;
+ public static function getDisplayName($uid = null) {
+ if ($uid) {
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ return $user->getDisplayName();
+ } else {
+ return $uid;
+ }
+ } else {
+ $user = self::getUserSession()->getUser();
+ if ($user) {
+ return $user->getDisplayName();
+ } else {
+ return false;
+ }
}
}
/**
* @brief Autogenerate a password
- * @returns string
+ * @return string
*
* generates a password
*/
@@ -391,111 +359,89 @@ class OC_User {
/**
* @brief Set password
- * @param $uid The username
- * @param $password The new password
- * @returns true/false
+ * @param string $uid The username
+ * @param string $password The new password
+ * @param string $recoveryPassword for the encryption app to reset encryption keys
+ * @return bool
*
* Change the password of a user
*/
- public static function setPassword( $uid, $password ) {
- $run = true;
- OC_Hook::emit( "OC_User", "pre_setPassword", array( "run" => &$run, "uid" => $uid, "password" => $password ));
-
- if( $run ) {
- $success = false;
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_SET_PASSWORD)) {
- if($backend->userExists($uid)) {
- $success |= $backend->setPassword($uid, $password);
- }
- }
- }
- // invalidate all login cookies
- OC_Preferences::deleteApp($uid, 'login_token');
- OC_Hook::emit( "OC_User", "post_setPassword", array( "uid" => $uid, "password" => $password ));
- return $success;
- }
- else{
+ public static function setPassword($uid, $password, $recoveryPassword = null) {
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ return $user->setPassword($password, $recoveryPassword);
+ } else {
return false;
}
}
/**
* @brief Check whether user can change his password
- * @param $uid The username
- * @returns true/false
+ * @param string $uid The username
+ * @return bool
*
* Check whether a specified user can change his password
*/
public static function canUserChangePassword($uid) {
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_SET_PASSWORD)) {
- if($backend->userExists($uid)) {
- return true;
- }
- }
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ return $user->canChangePassword();
+ } else {
+ return false;
}
- return false;
}
/**
* @brief Check whether user can change his display name
- * @param $uid The username
- * @returns true/false
+ * @param string $uid The username
+ * @return bool
*
* Check whether a specified user can change his display name
*/
public static function canUserChangeDisplayName($uid) {
- if (OC_Config::getValue('allow_user_to_change_display_name', true)) {
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_SET_DISPLAYNAME)) {
- if($backend->userExists($uid)) {
- return true;
- }
- }
- }
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ return $user->canChangeDisplayName();
+ } else {
+ return false;
}
- return false;
}
/**
* @brief Check if the password is correct
- * @param $uid The username
- * @param $password The password
- * @returns string
+ * @param string $uid The username
+ * @param string $password The password
+ * @return bool
*
* Check if the password is correct without logging in the user
* returns the user id or false
*/
- public static function checkPassword( $uid, $password ) {
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_CHECK_PASSWORD)) {
- $result=$backend->checkPassword( $uid, $password );
- if($result) {
- return $result;
- }
+ public static function checkPassword($uid, $password) {
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ if ($user->checkPassword($password)) {
+ return $user->getUID();
+ } else {
+ return false;
}
+ } else {
+ return false;
}
}
/**
- * @brief Check if the password is correct
* @param string $uid The username
- * @param string $password The password
- * @returns string
+ * @return string
*
* returns the path to the users home directory
*/
public static function getHome($uid) {
- foreach(self::$_usedBackends as $backend) {
- if($backend->implementsActions(OC_USER_BACKEND_GET_HOME) && $backend->userExists($uid)) {
- $result=$backend->getHome($uid);
- if($result) {
- return $result;
- }
- }
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ return $user->getHome();
+ } else {
+ return OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid;
}
- return OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ) . '/' . $uid;
}
/**
@@ -505,148 +451,93 @@ class OC_User {
* Get a list of all users.
*/
public static function getUsers($search = '', $limit = null, $offset = null) {
- $users = array();
- foreach (self::$_usedBackends as $backend) {
- $backendUsers = $backend->getUsers($search, $limit, $offset);
- if (is_array($backendUsers)) {
- $users = array_merge($users, $backendUsers);
- }
+ $users = self::getManager()->search($search, $limit, $offset);
+ $uids = array();
+ foreach ($users as $user) {
+ $uids[] = $user->getUID();
}
- asort($users);
- return $users;
+ return $uids;
}
/**
* @brief Get a list of all users display name
- * @returns associative array with all display names (value) and corresponding uids (key)
+ * @param string $search
+ * @param int $limit
+ * @param int $offset
+ * @return array associative array with all display names (value) and corresponding uids (key)
*
* Get a list of all display names and user ids.
*/
public static function getDisplayNames($search = '', $limit = null, $offset = null) {
$displayNames = array();
- foreach (self::$_usedBackends as $backend) {
- $backendDisplayNames = $backend->getDisplayNames($search, $limit, $offset);
- if (is_array($backendDisplayNames)) {
- $displayNames = $displayNames + $backendDisplayNames;
- }
+ $users = self::getManager()->searchDisplayName($search, $limit, $offset);
+ foreach ($users as $user) {
+ $displayNames[$user->getUID()] = $user->getDisplayName();
}
- asort($displayNames);
return $displayNames;
}
/**
* @brief check if a user exists
* @param string $uid the username
- * @param string $excludingBackend (default none)
* @return boolean
*/
- public static function userExists($uid, $excludingBackend=null) {
- foreach(self::$_usedBackends as $backend) {
- if (!is_null($excludingBackend) && !strcmp(get_class($backend), $excludingBackend)) {
- OC_Log::write('OC_User', $excludingBackend . 'excluded from user existance check.', OC_Log::DEBUG);
- continue;
- }
- $result=$backend->userExists($uid);
- if($result===true) {
- return true;
- }
- }
- return false;
+ public static function userExists($uid) {
+ return self::getManager()->userExists($uid);
}
- public static function userExistsForCreation($uid) {
- foreach(self::$_usedBackends as $backend) {
- if(!$backend->hasUserListings())
- continue;
-
- $result=$backend->userExists($uid);
- if($result===true) {
- return true;
- }
- }
- return false;
- }
-
/**
* disables a user
- * @param string $userid the user to disable
+ *
+ * @param string $uid the user to disable
*/
- public static function disableUser($userid) {
- $sql = "INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, `configkey`, `configvalue`) VALUES(?, ?, ?, ?)";
- $stmt = OC_DB::prepare($sql);
- if ( ! OC_DB::isError($stmt) ) {
- $result = $stmt->execute(array($userid, 'core', 'enabled', 'false'));
- if ( OC_DB::isError($result) ) {
- OC_Log::write('OC_User', 'could not enable user: '. OC_DB::getErrorMessage($result), OC_Log::ERROR);
- }
- } else {
- OC_Log::write('OC_User', 'could not disable user: '. OC_DB::getErrorMessage($stmt), OC_Log::ERROR);
+ public static function disableUser($uid) {
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ $user->setEnabled(false);
}
}
/**
* enable a user
- * @param string $userid
+ *
+ * @param string $uid
*/
- public static function enableUser($userid) {
- $sql = 'DELETE FROM `*PREFIX*preferences`'
- ." WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND `configvalue` = ?";
- $stmt = OC_DB::prepare($sql);
- if ( ! OC_DB::isError($stmt) ) {
- $result = $stmt->execute(array($userid, 'core', 'enabled', 'false'));
- if ( OC_DB::isError($result) ) {
- OC_Log::write('OC_User', 'could not enable user: '. OC_DB::getErrorMessage($result), OC_Log::ERROR);
- }
- } else {
- OC_Log::write('OC_User', 'could not enable user: '. OC_DB::getErrorMessage($stmt), OC_Log::ERROR);
+ public static function enableUser($uid) {
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ $user->setEnabled(true);
}
}
/**
* checks if a user is enabled
- * @param string $userid
+ *
+ * @param string $uid
* @return bool
*/
- public static function isEnabled($userid) {
- $sql = 'SELECT `userid` FROM `*PREFIX*preferences`'
- .' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ? AND `configvalue` = ?';
- $stmt = OC_DB::prepare($sql);
- if ( ! OC_DB::isError($stmt) ) {
- $result = $stmt->execute(array($userid, 'core', 'enabled', 'false'));
- if ( ! OC_DB::isError($result) ) {
- return $result->numRows() ? false : true;
- } else {
- OC_Log::write('OC_User',
- 'could not check if enabled: '. OC_DB::getErrorMessage($result),
- OC_Log::ERROR);
- }
+ public static function isEnabled($uid) {
+ $user = self::getManager()->get($uid);
+ if ($user) {
+ return $user->isEnabled();
} else {
- OC_Log::write('OC_User', 'could not check if enabled: '. OC_DB::getErrorMessage($stmt), OC_Log::ERROR);
+ return false;
}
- return false;
}
/**
* @brief Set cookie value to use in next page load
* @param string $username username to be set
+ * @param string $token
*/
public static function setMagicInCookie($username, $token) {
- $secure_cookie = OC_Config::getValue("forcessl", false);
- $expires = time() + OC_Config::getValue('remember_login_cookie_lifetime', 60*60*24*15);
- setcookie("oc_username", $username, $expires, OC::$WEBROOT, '', $secure_cookie);
- setcookie("oc_token", $token, $expires, OC::$WEBROOT, '', $secure_cookie, true);
- setcookie("oc_remember_login", true, $expires, OC::$WEBROOT, '', $secure_cookie);
+ self::getUserSession()->setMagicInCookie($username, $token);
}
/**
* @brief Remove cookie for "remember username"
*/
public static function unsetMagicInCookie() {
- unset($_COOKIE["oc_username"]);
- unset($_COOKIE["oc_token"]);
- unset($_COOKIE["oc_remember_login"]);
- setcookie("oc_username", null, -1);
- setcookie("oc_token", null, -1);
- setcookie("oc_remember_login", null, -1);
+ self::getUserSession()->unsetMagicInCookie();
}
}
diff --git a/lib/user/backend.php b/lib/user/backend.php
index 93e8f17ca98..e9be08e429c 100644
--- a/lib/user/backend.php
+++ b/lib/user/backend.php
@@ -58,7 +58,7 @@ abstract class OC_User_Backend implements OC_User_Interface {
/**
* @brief Get all supported actions
- * @returns bitwise-or'ed actions
+ * @return int bitwise-or'ed actions
*
* Returns the supported actions as int to be
* compared with OC_USER_BACKEND_CREATE_USER etc.
@@ -76,8 +76,8 @@ abstract class OC_User_Backend implements OC_User_Interface {
/**
* @brief Check if backend implements actions
- * @param $actions bitwise-or'ed actions
- * @returns boolean
+ * @param int $actions bitwise-or'ed actions
+ * @return boolean
*
* Returns the supported actions as int to be
* compared with OC_USER_BACKEND_CREATE_USER etc.
@@ -87,12 +87,12 @@ abstract class OC_User_Backend implements OC_User_Interface {
}
/**
- * @brief delete a user
- * @param $uid The username of the user to delete
- * @returns true/false
- *
- * Deletes a user
- */
+ * @brief delete a user
+ * @param string $uid The username of the user to delete
+ * @return bool
+ *
+ * Deletes a user
+ */
public function deleteUser( $uid ) {
return false;
}
@@ -127,8 +127,8 @@ abstract class OC_User_Backend implements OC_User_Interface {
/**
* @brief get display name of the user
- * @param $uid user ID of the user
- * @return display name
+ * @param string $uid user ID of the user
+ * @return string display name
*/
public function getDisplayName($uid) {
return $uid;
diff --git a/lib/user/database.php b/lib/user/database.php
index 63c64ed43d3..d70b620f2ab 100644
--- a/lib/user/database.php
+++ b/lib/user/database.php
@@ -136,7 +136,7 @@ class OC_User_Database extends OC_User_Backend {
*/
public function getDisplayName($uid) {
if( $this->userExists($uid) ) {
- $query = OC_DB::prepare( 'SELECT displayname FROM `*PREFIX*users` WHERE `uid` = ?' );
+ $query = OC_DB::prepare( 'SELECT `displayname` FROM `*PREFIX*users` WHERE `uid` = ?' );
$result = $query->execute( array( $uid ))->fetchAll();
$displayName = trim($result[0]['displayname'], ' ');
if ( !empty($displayName) ) {
diff --git a/lib/user/dummy.php b/lib/user/dummy.php
index d63f60efbeb..b5b7a6c3c7a 100644
--- a/lib/user/dummy.php
+++ b/lib/user/dummy.php
@@ -1,114 +1,118 @@
<?php
/**
-* ownCloud
-*
-* @author Frank Karlitschek
-* @copyright 2012 Frank Karlitschek frank@owncloud.org
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
-* version 3 of the License, or any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
-* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
+ * ownCloud
+ *
+ * @author Frank Karlitschek
+ * @copyright 2012 Frank Karlitschek frank@owncloud.org
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
/**
* dummy user backend, does not keep state, only for testing use
*/
class OC_User_Dummy extends OC_User_Backend {
- private $users=array();
+ private $users = array();
+
/**
- * @brief Create a new user
- * @param $uid The username of the user to create
- * @param $password The password of the new user
- * @returns true/false
- *
- * Creates a new user. Basic checking of username is done in OC_User
- * itself, not in its subclasses.
- */
+ * @brief Create a new user
+ * @param string $uid The username of the user to create
+ * @param string $password The password of the new user
+ * @return bool
+ *
+ * Creates a new user. Basic checking of username is done in OC_User
+ * itself, not in its subclasses.
+ */
public function createUser($uid, $password) {
- if(isset($this->users[$uid])) {
+ if (isset($this->users[$uid])) {
return false;
- }else{
- $this->users[$uid]=$password;
+ } else {
+ $this->users[$uid] = $password;
return true;
}
}
/**
- * @brief delete a user
- * @param $uid The username of the user to delete
- * @returns true/false
- *
- * Deletes a user
- */
- public function deleteUser( $uid ) {
- if(isset($this->users[$uid])) {
+ * @brief delete a user
+ * @param string $uid The username of the user to delete
+ * @return bool
+ *
+ * Deletes a user
+ */
+ public function deleteUser($uid) {
+ if (isset($this->users[$uid])) {
unset($this->users[$uid]);
return true;
- }else{
+ } else {
return false;
}
}
/**
- * @brief Set password
- * @param $uid The username
- * @param $password The new password
- * @returns true/false
- *
- * Change the password of a user
- */
+ * @brief Set password
+ * @param string $uid The username
+ * @param string $password The new password
+ * @return bool
+ *
+ * Change the password of a user
+ */
public function setPassword($uid, $password) {
- if(isset($this->users[$uid])) {
- $this->users[$uid]=$password;
+ if (isset($this->users[$uid])) {
+ $this->users[$uid] = $password;
return true;
- }else{
+ } else {
return false;
}
}
/**
- * @brief Check if the password is correct
- * @param $uid The username
- * @param $password The password
- * @returns string
- *
- * Check if the password is correct without logging in the user
- * returns the user id or false
- */
+ * @brief Check if the password is correct
+ * @param string $uid The username
+ * @param string $password The password
+ * @return string
+ *
+ * Check if the password is correct without logging in the user
+ * returns the user id or false
+ */
public function checkPassword($uid, $password) {
- if(isset($this->users[$uid])) {
- return ($this->users[$uid]==$password);
- }else{
+ if (isset($this->users[$uid])) {
+ return ($this->users[$uid] == $password);
+ } else {
return false;
}
}
/**
- * @brief Get a list of all users
- * @returns array with all uids
- *
- * Get a list of all users.
- */
+ * @brief Get a list of all users
+ * @param string $search
+ * @param int $limit
+ * @param int $offset
+ * @return array with all uids
+ *
+ * Get a list of all users.
+ */
public function getUsers($search = '', $limit = null, $offset = null) {
return array_keys($this->users);
}
/**
- * @brief check if a user exists
- * @param string $uid the username
- * @return boolean
- */
+ * @brief check if a user exists
+ * @param string $uid the username
+ * @return boolean
+ */
public function userExists($uid) {
return isset($this->users[$uid]);
}
diff --git a/lib/user/manager.php b/lib/user/manager.php
new file mode 100644
index 00000000000..d17cdf1a200
--- /dev/null
+++ b/lib/user/manager.php
@@ -0,0 +1,228 @@
+<?php
+
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\User;
+
+use OC\Hooks\PublicEmitter;
+
+/**
+ * Class Manager
+ *
+ * Hooks available in scope \OC\User:
+ * - preSetPassword(\OC\User\User $user, string $password, string $recoverPassword)
+ * - postSetPassword(\OC\User\User $user, string $password, string $recoverPassword)
+ * - preDelete(\OC\User\User $user)
+ * - postDelete(\OC\User\User $user)
+ * - preCreateUser(string $uid, string $password)
+ * - postCreateUser(\OC\User\User $user, string $password)
+ *
+ * @package OC\User
+ */
+class Manager extends PublicEmitter {
+ /**
+ * @var \OC_User_Backend[] $backends
+ */
+ private $backends = array();
+
+ private $cachedUsers = array();
+
+ public function __construct() {
+ $cachedUsers = $this->cachedUsers;
+ $this->listen('\OC\User', 'postDelete', function ($user) use (&$cachedUsers) {
+ $i = array_search($user, $cachedUsers);
+ if ($i !== false) {
+ unset($cachedUsers[$i]);
+ }
+ });
+ }
+
+ /**
+ * register a user backend
+ *
+ * @param \OC_User_Backend $backend
+ */
+ public function registerBackend($backend) {
+ $this->backends[] = $backend;
+ }
+
+ /**
+ * remove a user backend
+ *
+ * @param \OC_User_Backend $backend
+ */
+ public function removeBackend($backend) {
+ $this->cachedUsers = array();
+ if (($i = array_search($backend, $this->backends)) !== false) {
+ unset($this->backends[$i]);
+ }
+ }
+
+ /**
+ * remove all user backends
+ */
+ public function clearBackends() {
+ $this->cachedUsers = array();
+ $this->backends = array();
+ }
+
+ /**
+ * get a user by user id
+ *
+ * @param string $uid
+ * @return \OC\User\User
+ */
+ public function get($uid) {
+ if (isset($this->cachedUsers[$uid])) { //check the cache first to prevent having to loop over the backends
+ return $this->cachedUsers[$uid];
+ }
+ foreach ($this->backends as $backend) {
+ if ($backend->userExists($uid)) {
+ return $this->getUserObject($uid, $backend);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * get or construct the user object
+ *
+ * @param string $uid
+ * @param \OC_User_Backend $backend
+ * @return \OC\User\User
+ */
+ protected function getUserObject($uid, $backend) {
+ if (isset($this->cachedUsers[$uid])) {
+ return $this->cachedUsers[$uid];
+ }
+ $this->cachedUsers[$uid] = new User($uid, $backend, $this);
+ return $this->cachedUsers[$uid];
+ }
+
+ /**
+ * check if a user exists
+ *
+ * @param string $uid
+ * @return bool
+ */
+ public function userExists($uid) {
+ $user = $this->get($uid);
+ return ($user !== null);
+ }
+
+ /**
+ * search by user id
+ *
+ * @param string $pattern
+ * @param int $limit
+ * @param int $offset
+ * @return \OC\User\User[]
+ */
+ public function search($pattern, $limit = null, $offset = null) {
+ $users = array();
+ foreach ($this->backends as $backend) {
+ $backendUsers = $backend->getUsers($pattern, $limit, $offset);
+ if (is_array($backendUsers)) {
+ foreach ($backendUsers as $uid) {
+ $users[] = $this->getUserObject($uid, $backend);
+ if (!is_null($limit)) {
+ $limit--;
+ }
+ if (!is_null($offset) and $offset > 0) {
+ $offset--;
+ }
+
+ }
+ }
+ }
+
+ usort($users, function ($a, $b) {
+ /**
+ * @var \OC\User\User $a
+ * @var \OC\User\User $b
+ */
+ return strcmp($a->getUID(), $b->getUID());
+ });
+ return $users;
+ }
+
+ /**
+ * search by displayName
+ *
+ * @param string $pattern
+ * @param int $limit
+ * @param int $offset
+ * @return \OC\User\User[]
+ */
+ public function searchDisplayName($pattern, $limit = null, $offset = null) {
+ $users = array();
+ foreach ($this->backends as $backend) {
+ $backendUsers = $backend->getDisplayNames($pattern, $limit, $offset);
+ if (is_array($backendUsers)) {
+ foreach ($backendUsers as $uid => $displayName) {
+ $users[] = $this->getUserObject($uid, $backend);
+ if (!is_null($limit)) {
+ $limit--;
+ }
+ if (!is_null($offset) and $offset > 0) {
+ $offset--;
+ }
+
+ }
+ }
+ }
+
+ usort($users, function ($a, $b) {
+ /**
+ * @var \OC\User\User $a
+ * @var \OC\User\User $b
+ */
+ return strcmp($a->getDisplayName(), $b->getDisplayName());
+ });
+ return $users;
+ }
+
+ /**
+ * @param string $uid
+ * @param string $password
+ * @throws \Exception
+ * @return bool | \OC\User\User the created user of false
+ */
+ public function createUser($uid, $password) {
+ // Check the name for bad characters
+ // Allowed are: "a-z", "A-Z", "0-9" and "_.@-"
+ if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) {
+ throw new \Exception('Only the following characters are allowed in a username:'
+ . ' "a-z", "A-Z", "0-9", and "_.@-"');
+ }
+ // No empty username
+ if (trim($uid) == '') {
+ throw new \Exception('A valid username must be provided');
+ }
+ // No empty password
+ if (trim($password) == '') {
+ throw new \Exception('A valid password must be provided');
+ }
+
+ // Check if user already exists
+ if ($this->userExists($uid)) {
+ throw new \Exception('The username is already being used');
+ }
+
+ $this->emit('\OC\User', 'preCreateUser', array($uid, $password));
+ foreach ($this->backends as $backend) {
+ if ($backend->implementsActions(\OC_USER_BACKEND_CREATE_USER)) {
+ $backend->createUser($uid, $password);
+ $user = $this->getUserObject($uid, $backend);
+ $this->emit('\OC\User', 'postCreateUser', array($user, $password));
+ return $user;
+ }
+ }
+ return false;
+ }
+}
diff --git a/lib/user/session.php b/lib/user/session.php
new file mode 100644
index 00000000000..cf93d9593af
--- /dev/null
+++ b/lib/user/session.php
@@ -0,0 +1,173 @@
+<?php
+
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\User;
+
+use OC\Hooks\Emitter;
+
+/**
+ * Class Session
+ *
+ * Hooks available in scope \OC\User:
+ * - preSetPassword(\OC\User\User $user, string $password, string $recoverPassword)
+ * - postSetPassword(\OC\User\User $user, string $password, string $recoverPassword)
+ * - preDelete(\OC\User\User $user)
+ * - postDelete(\OC\User\User $user)
+ * - preCreateUser(string $uid, string $password)
+ * - postCreateUser(\OC\User\User $user)
+ * - preLogin(string $user, string $password)
+ * - postLogin(\OC\User\User $user)
+ * - logout()
+ *
+ * @package OC\User
+ */
+class Session implements Emitter {
+ /**
+ * @var \OC\User\Manager $manager
+ */
+ private $manager;
+
+ /**
+ * @var \OC\Session\Session $session
+ */
+ private $session;
+
+ /**
+ * @var \OC\User\User $activeUser
+ */
+ protected $activeUser;
+
+ /**
+ * @param \OC\User\Manager $manager
+ * @param \OC\Session\Session $session
+ */
+ public function __construct($manager, $session) {
+ $this->manager = $manager;
+ $this->session = $session;
+ }
+
+ /**
+ * @param string $scope
+ * @param string $method
+ * @param callable $callback
+ */
+ public function listen($scope, $method, $callback) {
+ $this->manager->listen($scope, $method, $callback);
+ }
+
+ /**
+ * @param string $scope optional
+ * @param string $method optional
+ * @param callable $callback optional
+ */
+ public function removeListener($scope = null, $method = null, $callback = null) {
+ $this->manager->removeListener($scope, $method, $callback);
+ }
+
+ /**
+ * get the manager object
+ *
+ * @return \OC\User\Manager
+ */
+ public function getManager() {
+ return $this->manager;
+ }
+
+ /**
+ * set the currently active user
+ *
+ * @param \OC\User\User $user
+ */
+ public function setUser($user) {
+ if (is_null($user)) {
+ $this->session->remove('user_id');
+ } else {
+ $this->session->set('user_id', $user->getUID());
+ }
+ $this->activeUser = $user;
+ }
+
+ /**
+ * get the current active user
+ *
+ * @return \OC\User\User
+ */
+ public function getUser() {
+ if ($this->activeUser) {
+ return $this->activeUser;
+ } else {
+ $uid = $this->session->get('user_id');
+ if ($uid) {
+ $this->activeUser = $this->manager->get($uid);
+ return $this->activeUser;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * try to login with the provided credentials
+ *
+ * @param string $uid
+ * @param string $password
+ * @return bool
+ */
+ public function login($uid, $password) {
+ $this->manager->emit('\OC\User', 'preLogin', array($uid, $password));
+ $user = $this->manager->get($uid);
+ if ($user) {
+ $result = $user->checkPassword($password);
+ if ($result and $user->isEnabled()) {
+ $this->setUser($user);
+ $this->manager->emit('\OC\User', 'postLogin', array($user, $password));
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * logout the user from the session
+ */
+ public function logout() {
+ $this->manager->emit('\OC\User', 'logout');
+ $this->setUser(null);
+ $this->unsetMagicInCookie();
+ }
+
+ /**
+ * Set cookie value to use in next page load
+ *
+ * @param string $username username to be set
+ * @param string $token
+ */
+ public function setMagicInCookie($username, $token) {
+ $secure_cookie = \OC_Config::getValue("forcessl", false); //TODO: DI for cookies and OC_Config
+ $expires = time() + \OC_Config::getValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
+ setcookie("oc_username", $username, $expires, \OC::$WEBROOT, '', $secure_cookie);
+ setcookie("oc_token", $token, $expires, \OC::$WEBROOT, '', $secure_cookie, true);
+ setcookie("oc_remember_login", true, $expires, \OC::$WEBROOT, '', $secure_cookie);
+ }
+
+ /**
+ * Remove cookie for "remember username"
+ */
+ public function unsetMagicInCookie() {
+ unset($_COOKIE["oc_username"]); //TODO: DI
+ unset($_COOKIE["oc_token"]);
+ unset($_COOKIE["oc_remember_login"]);
+ setcookie("oc_username", null, -1);
+ setcookie("oc_token", null, -1);
+ setcookie("oc_remember_login", null, -1);
+ }
+}
diff --git a/lib/user/user.php b/lib/user/user.php
new file mode 100644
index 00000000000..f9466b71499
--- /dev/null
+++ b/lib/user/user.php
@@ -0,0 +1,197 @@
+<?php
+
+/**
+ * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\User;
+
+use OC\Hooks\Emitter;
+
+class User {
+ /**
+ * @var string $uid
+ */
+ private $uid;
+
+ /**
+ * @var string $displayName
+ */
+ private $displayName;
+
+ /**
+ * @var \OC_User_Backend $backend
+ */
+ private $backend;
+
+ /**
+ * @var bool $enabled
+ */
+ private $enabled;
+
+ /**
+ * @var Emitter | Manager $emitter
+ */
+ private $emitter;
+
+ /**
+ * @param string $uid
+ * @param \OC_User_Backend $backend
+ * @param Emitter $emitter
+ */
+ public function __construct($uid, $backend, $emitter = null) {
+ $this->uid = $uid;
+ if ($backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) {
+ $this->displayName = $backend->getDisplayName($uid);
+ } else {
+ $this->displayName = $uid;
+ }
+ $this->backend = $backend;
+ $this->emitter = $emitter;
+ $enabled = \OC_Preferences::getValue($uid, 'core', 'enabled', 'true'); //TODO: DI for OC_Preferences
+ $this->enabled = ($enabled === 'true');
+ }
+
+ /**
+ * get the user id
+ *
+ * @return string
+ */
+ public function getUID() {
+ return $this->uid;
+ }
+
+ /**
+ * get the displayname for the user, if no specific displayname is set it will fallback to the user id
+ *
+ * @return string
+ */
+ public function getDisplayName() {
+ return $this->displayName;
+ }
+
+ /**
+ * set the displayname for the user
+ *
+ * @param string $displayName
+ * @return bool
+ */
+ public function setDisplayName($displayName) {
+ if ($this->canChangeDisplayName()) {
+ $this->displayName = $displayName;
+ $result = $this->backend->setDisplayName($this->uid, $displayName);
+ return $result !== false;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Delete the user
+ *
+ * @return bool
+ */
+ public function delete() {
+ if ($this->emitter) {
+ $this->emitter->emit('\OC\User', 'preDelete', array($this));
+ }
+ $result = $this->backend->deleteUser($this->uid);
+ if ($this->emitter) {
+ $this->emitter->emit('\OC\User', 'postDelete', array($this));
+ }
+ return !($result === false);
+ }
+
+ /**
+ * Check if the password is valid for the user
+ *
+ * @param $password
+ * @return bool
+ */
+ public function checkPassword($password) {
+ if ($this->backend->implementsActions(\OC_USER_BACKEND_CHECK_PASSWORD)) {
+ $result = $this->backend->checkPassword($this->uid, $password);
+ if ($result !== false) {
+ $this->uid = $result;
+ }
+ return !($result === false);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Set the password of the user
+ *
+ * @param string $password
+ * @param string $recoveryPassword for the encryption app to reset encryption keys
+ * @return bool
+ */
+ public function setPassword($password, $recoveryPassword) {
+ if ($this->backend->implementsActions(\OC_USER_BACKEND_SET_PASSWORD)) {
+ if ($this->emitter) {
+ $this->emitter->emit('\OC\User', 'preSetPassword', array($this, $password, $recoveryPassword));
+ }
+ $result = $this->backend->setPassword($this->uid, $password);
+ if ($this->emitter) {
+ $this->emitter->emit('\OC\User', 'postSetPassword', array($this, $password, $recoveryPassword));
+ }
+ return !($result === false);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * get the users home folder to mount
+ *
+ * @return string
+ */
+ public function getHome() {
+ if ($this->backend->implementsActions(\OC_USER_BACKEND_GET_HOME) and $home = $this->backend->getHome($this->uid)) {
+ return $home;
+ }
+ return \OC_Config::getValue("datadirectory", \OC::$SERVERROOT . "/data") . '/' . $this->uid; //TODO switch to Config object once implemented
+ }
+
+ /**
+ * check if the backend supports changing passwords
+ *
+ * @return bool
+ */
+ public function canChangePassword() {
+ return $this->backend->implementsActions(\OC_USER_BACKEND_SET_PASSWORD);
+ }
+
+ /**
+ * check if the backend supports changing display names
+ *
+ * @return bool
+ */
+ public function canChangeDisplayName() {
+ return $this->backend->implementsActions(\OC_USER_BACKEND_SET_DISPLAYNAME);
+ }
+
+ /**
+ * check if the user is enabled
+ *
+ * @return bool
+ */
+ public function isEnabled() {
+ return $this->enabled;
+ }
+
+ /**
+ * set the enabled status for the user
+ *
+ * @param bool $enabled
+ */
+ public function setEnabled($enabled) {
+ $this->enabled = $enabled;
+ $enabled = ($enabled) ? 'true' : 'false';
+ \OC_Preferences::setValue($this->uid, 'core', 'enabled', $enabled);
+ }
+}
diff --git a/lib/util.php b/lib/util.php
index f30cdf6a534..95af22ed0ee 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -1,4 +1,7 @@
<?php
+
+require_once 'Patchwork/PHP/Shim/Normalizer.php';
+
/**
* Class for utility functions
*
@@ -77,7 +80,7 @@ class OC_Util {
public static function getVersion() {
// hint: We only can count up. Reset minor/patchlevel when
// updating major/minor version number.
- return array(5, 80, 02);
+ return array(5, 80, 05);
}
/**
@@ -151,10 +154,10 @@ class OC_Util {
* @param bool dateOnly option to omit time from the result
*/
public static function formatDate( $timestamp, $dateOnly=false) {
- if(isset($_SESSION['timezone'])) {//adjust to clients timezone if we know it
+ if(\OC::$session->exists('timezone')) {//adjust to clients timezone if we know it
$systemTimeZone = intval(date('O'));
$systemTimeZone=(round($systemTimeZone/100, 0)*60)+($systemTimeZone%100);
- $clientTimeZone=$_SESSION['timezone']*60;
+ $clientTimeZone=\OC::$session->get('timezone')*60;
$offset=$clientTimeZone-$systemTimeZone;
$timestamp=$timestamp+$offset*60;
}
@@ -173,7 +176,8 @@ class OC_Util {
//check for database drivers
if(!(is_callable('sqlite_open') or class_exists('SQLite3'))
and !is_callable('mysql_connect')
- and !is_callable('pg_connect')) {
+ and !is_callable('pg_connect')
+ and !is_callable('oci_connect')) {
$errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.',
'hint'=>'');//TODO: sane hint
$web_server_restart= true;
@@ -457,13 +461,13 @@ class OC_Util {
*/
public static function callRegister() {
// Check if a token exists
- if(!isset($_SESSION['requesttoken'])) {
+ if(!\OC::$session->exists('requesttoken')) {
// No valid token found, generate a new one.
$requestToken = self::generate_random_bytes(20);
- $_SESSION['requesttoken']=$requestToken;
+ \OC::$session->set('requesttoken', $requestToken);
} else {
// Valid token already exists, send it
- $requestToken = $_SESSION['requesttoken'];
+ $requestToken = \OC::$session->get('requesttoken');
}
return($requestToken);
}
@@ -475,7 +479,7 @@ class OC_Util {
* @see OC_Util::callRegister()
*/
public static function isCallRegistered() {
- if(!isset($_SESSION['requesttoken'])) {
+ if(!\OC::$session->exists('requesttoken')) {
return false;
}
@@ -491,7 +495,7 @@ class OC_Util {
}
// Check if the token is valid
- if($token !== $_SESSION['requesttoken']) {
+ if($token !== \OC::$session->get('requesttoken')) {
// Not valid
return false;
} else {
@@ -640,11 +644,10 @@ class OC_Util {
/**
* Check if the ownCloud server can connect to the internet
*/
- public static function isinternetconnectionworking() {
-
- // in case there is no internet connection on purpose there is no need to display a warning
- if (!\OC_Config::getValue("has_internet_connection", true)) {
- return true;
+ public static function isInternetConnectionWorking() {
+ // in case there is no internet connection on purpose return false
+ if (self::isInternetConnectionEnabled() === false) {
+ return false;
}
// try to connect to owncloud.org to see if http connections to the internet are possible.
@@ -666,6 +669,13 @@ class OC_Util {
}
}
+
+ /**
+ * Check if the connection to the internet is disabled on purpose
+ */
+ public static function isInternetConnectionEnabled(){
+ return \OC_Config::getValue("has_internet_connection", true);
+ }
/**
* clear all levels of output buffering
@@ -822,5 +832,21 @@ class OC_Util {
return $theme;
}
+ /**
+ * Normalize a unicode string
+ * @param string $value a not normalized string
+ * @return bool|string
+ */
+ public static function normalizeUnicode($value) {
+ if(class_exists('Patchwork\PHP\Shim\Normalizer')) {
+ $normalizedValue = \Patchwork\PHP\Shim\Normalizer::normalize($value);
+ if($normalizedValue === false) {
+ \OC_Log::write( 'core', 'normalizing failed for "' . $value . '"', \OC_Log::WARN);
+ } else {
+ $value = $normalizedValue;
+ }
+ }
+ return $value;
+ }
}
diff --git a/lib/vcategories.php b/lib/vcategories.php
index 5975e688b75..91c72d5dfae 100644
--- a/lib/vcategories.php
+++ b/lib/vcategories.php
@@ -325,6 +325,37 @@ class OC_VCategories {
}
/**
+ * @brief Rename category.
+ * @param string $from The name of the existing category
+ * @param string $to The new name of the category.
+ * @returns bool
+ */
+ public function rename($from, $to) {
+ $id = $this->array_searchi($from, $this->categories);
+ if($id === false) {
+ OCP\Util::writeLog('core', __METHOD__.', category: ' . $from. ' does not exist', OCP\Util::DEBUG);
+ return false;
+ }
+
+ $sql = 'UPDATE `' . self::CATEGORY_TABLE . '` SET `category` = ? '
+ . 'WHERE `uid` = ? AND `type` = ? AND `id` = ?';
+ try {
+ $stmt = OCP\DB::prepare($sql);
+ $result = $stmt->execute(array($to, $this->user, $this->type, $id));
+ if (OC_DB::isError($result)) {
+ OC_Log::write('core', __METHOD__. 'DB error: ' . OC_DB::getErrorMessage($result), OC_Log::ERROR);
+ return false;
+ }
+ } catch(Exception $e) {
+ OCP\Util::writeLog('core', __METHOD__.', exception: '.$e->getMessage(),
+ OCP\Util::ERROR);
+ return false;
+ }
+ $this->categories[$id] = $to;
+ return true;
+ }
+
+ /**
* @brief Add a new category.
* @param $names A string with a name or an array of strings containing
* the name(s) of the categor(y|ies) to add.