/** * Move remote file to another parent * * @param integer $projectid Project ID * @param string $service Service name (google or dropbox) * @param integer $uid User ID * @param string $remoteid Remote resource ID * @param array $local Array of local file info * @param string $parentId Parent folder ID * * @return array */ public function moveRemoteItem($projectid = NULL, $service = 'google', $uid = 0, $remoteid = 0, $local = array(), $parentId = 0) { if (!$projectid || !$remoteid || empty($local) || !$parentId) { return false; } // Get api $apiService = $this->getAPI($service, $uid); if (!$apiService) { $this->setError(Lang::txt('PLG_PROJECTS_FILES_SYNC_API_UNAVAILABLE')); return false; } // Collector for created folder metadata $metadata = array(); $success = 0; // Perform request if ($service == 'google') { $success = Google::patchFile($apiService, $remoteid, '', $parentId, $metadata); } if (!$success) { return false; } $remote_md5 = isset($metadata) && isset($metadata['md5Checksum']) ? $metadata['md5Checksum'] : NULL; $remote_modified = isset($metadata) && isset($metadata['modifiedDate']) ? gmdate('Y-m-d H:i:s', strtotime($metadata['modifiedDate'])) : NULL; $remote_format = isset($metadata) && isset($metadata['mimeType']) ? $metadata['mimeType'] : NULL; // Update connection record $objRFile = new \Components\Projects\Tables\RemoteFile($this->_db); $update = $objRFile->updateRecord($projectid, $service, $remoteid, $local['local_path'], $local['type'], $uid, $parentId, $metadata['title'], $remote_md5, $local['md5'], $local['converted'], $remote_format, $local['mimeType'], $remote_modified); return $success; }