$destination ) { if ( 'stash' == $destination['type'] ) { if ( '0' == $destination['disable_file_management'] ) { $stashDestination = $destination_id; break; } else { pb_backupbuddy::alert( 'A Stash destination was found but deployment functionality has been disabled for it. It is not available for deployment features.' ); } } } $deployments = array( array( 'siteurl' => 'http://destsite.com/', 'destination' => 0, 'importSettings' => array( ) ) ); echo 'Deploys:
'; print_r( $deployments ); echo ''; if ( '' != pb_backupbuddy::_GET( 'deploy' ) ) { if ( ! wp_verify_nonce( pb_backupbuddy::_GET( '_wpnonce' ), 'backupbuddy_deploy_toggle' ) ) { die( 'Access Denied. Invalid NONCE.' ); } if ( 'enable' == pb_backupbuddy::_GET( 'deploy' ) ) { $identifier = pb_backupbuddy::random_string( 12 ); $deployFile = backupbuddy_core::getTempDirectory() . 'deploy-' . backupbuddy_core::backup_prefix() . '.dat'; // . '-' . $identifier . $meta = array( 'siteurl' => site_url(), 'deployEnabled' => time(), ); $deployFileContents = json_encode( $meta ); pb_backupbuddy::anti_directory_browsing( backupbuddy_core::getTempDirectory(), $die = false ); if ( false === file_put_contents( $deployFile, $deployFileContents ) ) { pb_backupbuddy::alert( 'Error #848383: Unable to write temporary deployment file `' . $deployFile . '`. Verify permissions on the directory.' ); } else { $destinationSettings = pb_backupbuddy::$options['remote_destinations'][ $stashDestination ]; $destinationSettings['meta'] = $meta; $destinationSettings['forceRootUpload'] = true; require_once( pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php' ); $send_result = pb_backupbuddy_destinations::send( $destinationSettings, array( $deployFile ), $identifier, $delete_after = true ); if ( true === $send_result ) { pb_backupbuddy::$options['deployment_allowed'] = '1'; pb_backupbuddy::save(); pb_backupbuddy::alert( __( 'Deployments have been enabled for this site. Other sites sharing this Stash account may Push to or Pull from this site as long as your iThemes Member password is correctly provided.', 'it-l10n-backupbuddy' ) ); } else { pb_backupbuddy::alert( __( 'Error #84838: Failure notifying Stash of new deployment site. See Remote Destinations page Recent Transfers listing for details.', 'it-l10n-backupbuddy' ) ); } } } elseif ( 'disable' == pb_backupbuddy::_GET( 'deploy' ) ) { pb_backupbuddy::$options['deployment_allowed'] = '0'; pb_backupbuddy::save(); pb_backupbuddy::alert( __( 'Deployments have been disabled for this site.', 'it-l10n-backupbuddy' ) ); } } if ( false !== $stashDestination ) { require_once( pb_backupbuddy::plugin_path() . '/destinations/stash/lib/class.itx_helper.php' ); require_once( pb_backupbuddy::plugin_path() . '/destinations/stash/init.php' ); //$stash = new ITXAPI_Helper( pb_backupbuddy_destination_stash::ITXAPI_KEY, pb_backupbuddy_destination_stash::ITXAPI_URL, pb_backupbuddy::$options['remote_destinations'][ $stashDestination ]['itxapi_username'], pb_backupbuddy::$options['remote_destinations'][ $stashDestination ]['itxapi_password'] ); $manage_data = pb_backupbuddy_destination_stash::get_manage_data( pb_backupbuddy::$options['remote_destinations'][ $stashDestination ] ); // Connect to S3. if ( ! is_array( $manage_data['credentials'] ) ) { die( 'Error #8484383c: Your authentication credentials for Stash failed. Verify your login and password to Stash. You may need to update the Stash destination settings. Perhaps you recently changed your password?' ); } $s3 = new AmazonS3( $manage_data['credentials'] ); // the key, secret, token if ( pb_backupbuddy::$options['remote_destinations'][ $stashDestination ]['ssl'] == '0' ) { @$s3->disable_ssl(true); } $response = $s3->list_objects( $manage_data['bucket'], array( 'prefix' => $manage_data['subkey'] . '/deploy' ) ); // list all the files in the subscriber account echo '
'; print_r( $response ); echo ''; foreach( $response->body->Contents as $object ) { print_r( $object ); echo '
'; print_r( $metadata ); echo ''; } //$contents = $s3->get_object( $manage_data['bucket'], $object['key'] ); //print_r( $contents ); } } ?>
Push to | Pull from |