summaryrefslogtreecommitdiffstats
path: root/lib/private/share/share.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/share/share.php')
-rw-r--r--lib/private/share/share.php70
1 files changed, 35 insertions, 35 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index af7f78b9ff5..5d2e3b74da1 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -87,10 +87,10 @@ class Share extends Constants {
}
return true;
}
- \OC_Log::write('OCP\Share',
+ \OCP\Util::writeLog('OCP\Share',
'Sharing backend '.$class.' not registered, '.self::$backendTypes[$itemType]['class']
.' is already registered for '.$itemType,
- \OC_Log::WARN);
+ \OCP\Util::WARN);
}
return false;
}
@@ -153,7 +153,7 @@ class Share extends Constants {
$result = $query->execute(array($source, self::SHARE_TYPE_USER));
if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
$shares[] = $row['share_with'];
@@ -175,7 +175,7 @@ class Share extends Constants {
$result = $query->execute(array($source, self::SHARE_TYPE_GROUP));
if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
$usersInGroup = \OC_Group::usersInGroup($row['share_with']);
@@ -256,7 +256,7 @@ class Share extends Constants {
$result = $query->execute();
if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR);
} else {
while ($row = $result->fetchRow()) {
foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
@@ -464,7 +464,7 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
$result = $query->execute(array($token));
if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, \OCP\Util::ERROR);
}
$row = $result->fetchRow();
if ($row === false) {
@@ -581,7 +581,7 @@ class Share extends Constants {
if ($backend->isShareTypeAllowed($shareType) === false) {
$message = 'Sharing %s failed, because the backend does not allow shares from type %i';
$message_t = $l->t('Sharing %s failed, because the backend does not allow shares from type %i', array($itemSourceName, $shareType));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareType), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -599,14 +599,14 @@ class Share extends Constants {
if (!$path) {
$message = 'Sharing %s failed, because the file does not exist';
$message_t = $l->t('Sharing %s failed, because the file does not exist', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
// verify that the user has share permission
if (!\OC\Files\Filesystem::isSharable($path)) {
$message = 'You are not allowed to share %s';
$message_t = $l->t('You are not allowed to share %s', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -619,7 +619,7 @@ class Share extends Constants {
foreach ($mounts as $mount) {
if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
$message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::ERROR);
throw new \Exception($message);
}
@@ -636,13 +636,13 @@ class Share extends Constants {
if ($shareWith == $uidOwner) {
$message = 'Sharing %s failed, because the user %s is the item owner';
$message_t = $l->t('Sharing %s failed, because the user %s is the item owner', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if (!\OC_User::userExists($shareWith)) {
$message = 'Sharing %s failed, because the user %s does not exist';
$message_t = $l->t('Sharing %s failed, because the user %s does not exist', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($shareWithinGroupOnly) {
@@ -651,7 +651,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user '
.'%s is not a member of any groups that %s is a member of';
$message_t = $l->t('Sharing %s failed, because the user %s is not a member of any groups that %s is a member of', array($itemSourceName, $shareWith, $uidOwner));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith, $uidOwner), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith, $uidOwner), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -664,7 +664,7 @@ class Share extends Constants {
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
$message = 'Sharing %s failed, because this item is already shared with %s';
$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -672,14 +672,14 @@ class Share extends Constants {
if (!\OC_Group::groupExists($shareWith)) {
$message = 'Sharing %s failed, because the group %s does not exist';
$message_t = $l->t('Sharing %s failed, because the group %s does not exist', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($shareWithinGroupOnly && !\OC_Group::inGroup($uidOwner, $shareWith)) {
$message = 'Sharing %s failed, because '
.'%s is not a member of the group %s';
$message_t = $l->t('Sharing %s failed, because %s is not a member of the group %s', array($itemSourceName, $uidOwner, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
// Check if the item source is already shared with the group, either from the same owner or a different user
@@ -692,7 +692,7 @@ class Share extends Constants {
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
$message = 'Sharing %s failed, because this item is already shared with %s';
$message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -731,7 +731,7 @@ class Share extends Constants {
if (\OCP\Util::isPublicLinkPasswordRequired() && empty($shareWith)) {
$message = 'You need to provide a password to create a public link, only protected links are allowed';
$message_t = $l->t('You need to provide a password to create a public link, only protected links are allowed');
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', $message, \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -760,7 +760,7 @@ class Share extends Constants {
}
$message = 'Sharing %s failed, because sharing with links is not allowed';
$message_t = $l->t('Sharing %s failed, because sharing with links is not allowed', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
} else if ($shareType === self::SHARE_TYPE_REMOTE) {
$token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER .
@@ -787,7 +787,7 @@ class Share extends Constants {
// Future share types need to include their own conditions
$message = 'Share type %s is not valid for %s';
$message_t = $l->t('Share type %s is not valid for %s', array($shareType, $itemSource));
- \OC_Log::write('OCP\Share', sprintf($message, $shareType, $itemSource), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $shareType, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -988,7 +988,7 @@ class Share extends Constants {
$result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient));
if($result === false) {
- \OC_Log::write('OCP\Share', 'Couldn\'t set send mail status', \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', \OCP\Util::ERROR);
}
}
@@ -1015,7 +1015,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed,'
.' because the permissions exceed permissions granted to %s';
$message_t = $l->t('Setting permissions for %s failed, because the permissions exceed permissions granted to %s', array($itemSource, \OC_User::getUser()));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource, \OC_User::getUser()), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, \OC_User::getUser()), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -1078,7 +1078,7 @@ class Share extends Constants {
$message = 'Setting permissions for %s failed, because the item was not found';
$message_t = $l->t('Setting permissions for %s failed, because the item was not found', array($itemSource));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -1340,20 +1340,20 @@ class Share extends Constants {
if (!(self::$backends[$itemType] instanceof \OCP\Share_Backend)) {
$message = 'Sharing backend %s must implement the interface OCP\Share_Backend';
$message_t = $l->t('Sharing backend %s must implement the interface OCP\Share_Backend', array($class));
- \OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
return self::$backends[$itemType];
} else {
$message = 'Sharing backend %s not found';
$message_t = $l->t('Sharing backend %s not found', array($class));
- \OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $class), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
$message = 'Sharing backend for %s not found';
$message_t = $l->t('Sharing backend for %s not found', array($itemType));
- \OC_Log::write('OCP\Share', sprintf($message, $itemType), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
@@ -1617,9 +1617,9 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit);
$result = $query->execute($queryArgs);
if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share',
+ \OCP\Util::writeLog('OCP\Share',
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
- \OC_Log::ERROR);
+ \OCP\Util::ERROR);
}
$items = array();
$targets = array();
@@ -1681,9 +1681,9 @@ class Share extends Constants {
$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
$parentResult = $query->execute(array($row['parent']));
if (\OC_DB::isError($result)) {
- \OC_Log::write('OCP\Share', 'Can\'t select parent: ' .
+ \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
- \OC_Log::ERROR);
+ \OCP\Util::ERROR);
} else {
$parentRow = $parentResult->fetchRow();
$tmpPath = $parentRow['file_target'];
@@ -2124,7 +2124,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the user %s is the original sharer';
$message_t = $l->t('Sharing %s failed, because the user %s is the original sharer', array($itemSourceName, $shareWith));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
}
@@ -2136,7 +2136,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
$message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OCP\Util::ERROR);
throw new \Exception($message_t);
} else {
// TODO Don't check if inside folder
@@ -2162,7 +2162,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because resharing is not allowed';
$message_t = $l->t('Sharing %s failed, because resharing is not allowed', array($itemSourceName));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
} else {
@@ -2175,7 +2175,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the sharing backend for '
.'%s could not find its source';
$message_t = $l->t('Sharing %s failed, because the sharing backend for %s could not find its source', array($itemSource, $itemType));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource, $itemType), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource, $itemType), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
if ($backend instanceof \OCP\Share_Backend_File_Dependent) {
@@ -2190,7 +2190,7 @@ class Share extends Constants {
$message = 'Sharing %s failed, because the file could not be found in the file cache';
$message_t = $l->t('Sharing %s failed, because the file could not be found in the file cache', array($itemSource));
- \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSource), \OCP\Util::ERROR);
throw new \Exception($message_t);
}
} else {