aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/backgroundjob.php8
-rw-r--r--lib/public/db.php12
-rw-r--r--lib/public/iconfig.php15
-rw-r--r--lib/public/json.php8
-rw-r--r--lib/public/share.php5
-rw-r--r--lib/public/util.php3
6 files changed, 35 insertions, 16 deletions
diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php
index 1788c4e293d..a7f54491dfa 100644
--- a/lib/public/backgroundjob.php
+++ b/lib/public/backgroundjob.php
@@ -45,6 +45,7 @@ use \OC\BackgroundJob\JobList;
class BackgroundJob {
/**
* get the execution type of background jobs
+ *
* @return string
*
* This method returns the type how background jobs are executed. If the user
@@ -56,6 +57,7 @@ class BackgroundJob {
/**
* sets the background jobs execution type
+ *
* @param string $type execution type
* @return boolean
*
@@ -83,8 +85,10 @@ class BackgroundJob {
* @return true
*/
public static function addRegularTask($klass, $method) {
- self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method));
- return true;
+ if (!\OC::needUpgrade()) {
+ self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method));
+ return true;
+ }
}
/**
diff --git a/lib/public/db.php b/lib/public/db.php
index c9997c79c3c..4a19d78d444 100644
--- a/lib/public/db.php
+++ b/lib/public/db.php
@@ -39,9 +39,9 @@ class DB {
* @param string $query Query string
* @param int $limit Limit of the SQL statement
* @param int $offset Offset of the SQL statement
- * @return \MDB2_Statement_Common prepared SQL query
+ * @return \Doctrine\DBAL\Statement prepared SQL query
*
- * SQL query via MDB2 prepare(), needs to be execute()'d!
+ * SQL query via Doctrine prepare(), needs to be execute()'d!
*/
static public function prepare( $query, $limit=null, $offset=null ) {
return(\OC_DB::prepare($query, $limit, $offset));
@@ -73,7 +73,7 @@ class DB {
* @param $table string The optional table name (will replace *PREFIX*) and add sequence suffix
* @return int
*
- * MDB2 lastInsertID()
+ * \Doctrine\DBAL\Connection lastInsertID()
*
* Call this method right after the insert command or other functions may
* cause trouble!
@@ -86,18 +86,18 @@ class DB {
* Start a transaction
*/
public static function beginTransaction() {
- return(\OC_DB::beginTransaction());
+ \OC_DB::beginTransaction();
}
/**
* Commit the database changes done during a transaction that is in progress
*/
public static function commit() {
- return(\OC_DB::commit());
+ \OC_DB::commit();
}
/**
- * Check if a result is an error, works with MDB2 and PDOException
+ * Check if a result is an error, works with Doctrine
* @param mixed $result
* @return bool
*/
diff --git a/lib/public/iconfig.php b/lib/public/iconfig.php
index da6b6c54843..1d0f8e0015c 100644
--- a/lib/public/iconfig.php
+++ b/lib/public/iconfig.php
@@ -36,6 +36,7 @@ namespace OCP;
interface IConfig {
/**
* Sets a new system wide value
+ *
* @param string $key the key of the value, under which will be saved
* @param string $value the value that should be stored
* @todo need a use case for this
@@ -44,14 +45,17 @@ interface IConfig {
/**
* Looks up a system wide defined value
+ *
* @param string $key the key of the value, under which it was saved
+ * @param string $default the default value to be returned if the value isn't set
* @return string the saved value
*/
- public function getSystemValue($key);
+ public function getSystemValue($key, $default = '');
/**
* Writes a new app wide value
+ *
* @param string $appName the appName that we want to store the value under
* @param string $key the key of the value, under which will be saved
* @param string $value the value that should be stored
@@ -60,15 +64,18 @@ interface IConfig {
/**
* Looks up an app wide defined value
+ *
* @param string $appName the appName that we stored the value under
* @param string $key the key of the value, under which it was saved
+ * @param string $default the default value to be returned if the value isn't set
* @return string the saved value
*/
- public function getAppValue($appName, $key);
+ public function getAppValue($appName, $key, $default = '');
/**
* Set a user defined value
+ *
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we want to store the value under
* @param string $key the key under which the value is being stored
@@ -78,9 +85,11 @@ interface IConfig {
/**
* Shortcut for getting a user defined value
+ *
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we stored the value under
* @param string $key the key under which the value is being stored
+ * @param string $default the default value to be returned if the value isn't set
*/
- public function getUserValue($userId, $appName, $key);
+ public function getUserValue($userId, $appName, $key, $default = '');
}
diff --git a/lib/public/json.php b/lib/public/json.php
index 134f724b0e6..831e3ef1cf6 100644
--- a/lib/public/json.php
+++ b/lib/public/json.php
@@ -169,4 +169,12 @@ class JSON {
public static function checkAdminUser() {
return(\OC_JSON::checkAdminUser());
}
+
+ /**
+ * Encode JSON
+ * @param array $data
+ */
+ public static function encode($data) {
+ return(\OC_JSON::encode($data));
+ }
}
diff --git a/lib/public/share.php b/lib/public/share.php
index 6b3397c85c6..f0fd8e1ab1b 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -850,9 +850,8 @@ class Share {
protected static function expireItem(array $item) {
if (!empty($item['expiration'])) {
$now = new \DateTime();
- $expirationDate = \Doctrine\DBAL\Types\Type::getType('datetime')
- ->convertToPhpValue($item['expiration'], \OC_DB::getConnection()->getDatabasePlatform());
- if ($now > $expirationDate) {
+ $expires = new \DateTime($item['expiration']);
+ if ($now > $expires) {
self::unshareItem($item);
return true;
}
diff --git a/lib/public/util.php b/lib/public/util.php
index 1d76fd1e1f7..8e85f9afc3f 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -103,9 +103,8 @@ class Util {
}
// include cause
- $l = \OC_L10N::get('lib');
while (method_exists($ex, 'getPrevious') && $ex = $ex->getPrevious()) {
- $message .= ' - '.$l->t('Caused by:').' ';
+ $message .= ' - Caused by:' . ' ';
$message .= $ex->getMessage();
if ($ex->getCode()) {
$message .= '[' . $ex->getCode() . '] ';