/** * Tests Dropbox->fileopsMove() */ public function testFileopsMove() { $this->dropbox->fileopsCreateFolder(BASE_PATH . 'will_be_moved'); $response = $this->dropbox->fileopsMove(BASE_PATH . 'will_be_moved', BASE_PATH . 'moved'); $this->assertArrayHasKey('hash', $response); $this->assertArrayHasKey('revision', $response); $this->assertArrayHasKey('modified', $response); $this->assertArrayHasKey('path', $response); // cleanup $this->dropbox->fileopsDelete(BASE_PATH . 'moved'); }
/** * Deletes backup file from Dropbox to root folder on local server. * * @param array $args arguments passed to the function * [consumer_key] -> consumer key of ManageWP Dropbox application * [consumer_secret] -> consumer secret of ManageWP Dropbox application * [oauth_token] -> oauth token of user on ManageWP Dropbox application * [oauth_token_secret] -> oauth token secret of user on ManageWP Dropbox application * [dropbox_destination] -> folder on user's Dropbox account which backup file should be downloaded from * [dropbox_site_folder] -> subfolder with site name in dropbox_destination which backup file should be downloaded from * [backup_file] -> absolute path of backup file on local server * @return void */ function remove_dropbox_backup($args) { extract($args); global $mmb_plugin_dir; require_once $mmb_plugin_dir . '/lib/dropbox.php'; $dropbox = new Dropbox($consumer_key, $consumer_secret); $dropbox->setOAuthTokens($oauth_token, $oauth_token_secret); if ($dropbox_site_folder == true) { $dropbox_destination .= '/' . $this->site_name; } try { $dropbox->fileopsDelete($dropbox_destination . '/' . $backup_file); } catch (Exception $e) { $this->_log($e->getMessage()); /*return array( 'error' => $e->getMessage(), 'partial' => 1 );*/ } //return true; }