Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117906717
D4376.1775390522.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D4376.1775390522.diff
View Options
diff --git a/lib/ext/Syncroton/Command/FolderCreate.php b/lib/ext/Syncroton/Command/FolderCreate.php
--- a/lib/ext/Syncroton/Command/FolderCreate.php
+++ b/lib/ext/Syncroton/Command/FolderCreate.php
@@ -98,16 +98,31 @@
$this->_folder->deviceId = $this->_device;
$this->_folder->creationTime = $this->_syncTimeStamp;
- $this->_folderBackend->create($this->_folder);
+ // Check if the folder already exists to avoid a duplicate insert attempt in db
+ try {
+ $this->_folderBackend->getFolder($this->_device, $this->_folder->serverId);
+
+ if ($this->_logger instanceof Zend_Log)
+ $this->_logger->info(__METHOD__ . '::' . __LINE__ . " Attempted to create a folder that already exists. parentId: {$folder->parentId} displayName: {$folder->displayName}");
+
+ // The folder already exists
+ $this->_status = Syncroton_Command_FolderSync::STATUS_FOLDER_EXISTS;
+ } catch (Syncroton_Exception_NotFound $e) {
+ // This is the normal case
+ if ($this->_logger instanceof Zend_Log)
+ $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+
+ $this->_folderBackend->create($this->_folder);
+ }
}
} catch (Syncroton_Exception_Status $e) {
if ($this->_logger instanceof Zend_Log)
- $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+ $this->_logger->info(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
$this->_status = $e->getCode();
} catch (Exception $e) {
if ($this->_logger instanceof Zend_Log)
- $this->_logger->debug(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
+ $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " " . $e->getMessage());
$this->_status = Syncroton_Command_FolderSync::STATUS_UNKNOWN_ERROR;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 12:02 PM (1 d, 15 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18830800
Default Alt Text
D4376.1775390522.diff (2 KB)
Attached To
Mode
D4376: Avoid a db error if the folder already exists and return status 2
Attached
Detach File
Event Timeline