Version Description
- removed calling home function
- fixed missing ' in mysql dump
- now lager than 150MB uploads to Dropbox with there Beta API
- fixed bug in progress updates
- fixed problem with ftp dir can not empty
- Updated AWS lib to 1.5.11
Download this release
Release Info
Developer | danielhuesken |
Plugin | BackWPup – WordPress Backup Plugin |
Version | 2.1.14 |
Comparing to | |
See all releases |
Code changes from version 2.1.13 to 2.1.14
- backwpup-functions.php +67 -85
- backwpup.php +2 -4
- job/db_dump.php +25 -17
- job/dest_dropbox.php +12 -11
- job/dest_ftp.php +30 -29
- job/dest_gstorage.php +8 -8
- job/dest_s3.php +10 -10
- job/dest_sugarsync.php +5 -5
- job/job_functions.php +22 -25
- job/job_start.php +0 -1
- libs/aws/README.md +33 -1
- libs/aws/lib/dom/ArrayToDOMDocument.php +1 -1
- libs/aws/lib/dom/Transmogrifier.php +317 -0
- libs/aws/lib/requestcore/requestcore.class.php +5 -0
- libs/aws/sdk.class.php +5 -5
- libs/aws/services/dynamodb.class.php +2 -31
- libs/aws/services/ec2.class.php +139 -16
- libs/aws/services/elasticbeanstalk.class.php +32 -2
- libs/aws/services/elb.class.php +1 -1
- libs/aws/services/s3.class.php +37 -7
- libs/aws/services/ses.class.php +101 -1
- libs/aws/services/sts.class.php +3 -1
- libs/aws/utilities/credentials.class.php +11 -1
- libs/aws/utilities/hadoopbase.class.php +6 -4
- libs/aws/utilities/hadoopbootstrap.class.php +12 -12
- libs/aws/utilities/hadoopstep.class.php +3 -3
- libs/aws/utilities/json.class.php +2 -2
- libs/aws/utilities/response.class.php +2 -1
- libs/aws/utilities/simplexml.class.php +4 -2
- libs/dropbox.php +73 -41
- pages/func_backwpupeditjob.php +1 -1
- readme.txt +10 -2
- uninstall.php +0 -2
backwpup-functions.php
CHANGED
@@ -15,7 +15,7 @@ function backwpup_admin_menu() {
|
|
15 |
$hook = add_submenu_page( 'backwpup', __('Tools','backwpup'), __('Tools','backwpup'), BACKWPUP_USER_CAPABILITY, 'backwpuptools', 'backwpup_menu_page' );
|
16 |
add_action('load-'.$hook, 'backwpup_menu_page_header');
|
17 |
$hook = add_submenu_page( 'backwpup', __('Settings','backwpup'), __('Settings','backwpup'), BACKWPUP_USER_CAPABILITY, 'backwpupsettings', 'backwpup_menu_page' );
|
18 |
-
add_action('load-'.$hook, 'backwpup_menu_page_header');
|
19 |
}
|
20 |
|
21 |
function backwpup_menu_page() {
|
@@ -26,7 +26,7 @@ function backwpup_menu_page() {
|
|
26 |
//Set pages that exists
|
27 |
$menupages=array('backwpup','backwpupeditjob','backwpupworking','backwpuplogs','backwpupbackups','backwpuptools','backwpupsettings');
|
28 |
//check called page exists
|
29 |
-
if (!empty($_REQUEST['page']) and in_array($_REQUEST['page'],$menupages))
|
30 |
require_once(dirname(__FILE__).'/pages/page_'.$_REQUEST['page'].'.php');
|
31 |
}
|
32 |
|
@@ -39,7 +39,7 @@ function backwpup_menu_page_header() {
|
|
39 |
$menupages=array('backwpup','backwpupeditjob','backwpupworking','backwpuplogs','backwpupbackups','backwpuptools','backwpupsettings');
|
40 |
//check called page exists
|
41 |
$page=$_REQUEST['page'];
|
42 |
-
if (!empty($page) and in_array($page,$menupages)) {
|
43 |
//Css for Admin Section
|
44 |
if (is_file(dirname(__FILE__).'/css/'.$page.'.css')) {
|
45 |
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
|
@@ -60,11 +60,11 @@ function backwpup_menu_page_header() {
|
|
60 |
wp_enqueue_script($page,BACKWPUP_PLUGIN_BASEURL.'/js/'.$page.'.js','',BACKWPUP_VERSION,true);
|
61 |
}
|
62 |
//incude functions
|
63 |
-
if (is_file(dirname(__FILE__).'/pages/func_'.$page.'.php'))
|
64 |
require_once(dirname(__FILE__).'/pages/func_'.$page.'.php');
|
65 |
//include code
|
66 |
-
if (is_file(dirname(__FILE__).'/pages/header_'.$page.'.php'))
|
67 |
-
require_once(dirname(__FILE__).'/pages/header_'.$page.'.php');
|
68 |
}
|
69 |
}
|
70 |
|
@@ -74,15 +74,15 @@ function backwpup_load_ajax() {
|
|
74 |
if (!empty($_POST['backwpupajaxpage']) and in_array($_POST['backwpupajaxpage'],$menupages)) {
|
75 |
$page=$_POST['backwpupajaxpage'];
|
76 |
//incude functions
|
77 |
-
if (is_file(dirname(__FILE__).'/pages/func_'.$page.'.php'))
|
78 |
-
require_once(dirname(__FILE__).'/pages/func_'.$page.'.php');
|
79 |
}
|
80 |
}
|
81 |
|
82 |
function backwpup_contextual_help($help='') {
|
83 |
global $current_screen;
|
84 |
$help='<p>'.$help.'</p>';
|
85 |
-
|
86 |
if ( method_exists( $current_screen, 'add_help_tab' ) ) {
|
87 |
if ( 'http://backwpup.de'==__('http://backwpup.com','backwpup')) {
|
88 |
$current_screen->add_help_tab( array(
|
@@ -103,7 +103,7 @@ function backwpup_contextual_help($help='') {
|
|
103 |
'id' => 'overview',
|
104 |
'title' => __( 'Overview', 'backwpup' ),
|
105 |
'content' => $help
|
106 |
-
) );
|
107 |
if ( 'http://backwpup.de'==__('http://backwpup.com','backwpup')) {
|
108 |
$current_screen->set_help_sidebar(
|
109 |
'<p><strong>' . __( 'For more information:', 'backwpup' ) . '</strong></p>' .
|
@@ -151,17 +151,17 @@ function backwpup_contextual_help($help='') {
|
|
151 |
'</p>'
|
152 |
);
|
153 |
}
|
154 |
-
}
|
155 |
}
|
156 |
|
157 |
//On activate function
|
158 |
function backwpup_plugin_activate() {
|
159 |
//Load Settings
|
160 |
-
$cfg=get_option('backwpup');
|
161 |
//Check only run once on update
|
162 |
-
if ($cfg['last_activate']==BACKWPUP_VERSION or !is_main_site())
|
163 |
return;
|
164 |
-
else
|
165 |
$cfg['last_activate']=BACKWPUP_VERSION;
|
166 |
//check jobs
|
167 |
$jobs=get_option('backwpup_jobs');
|
@@ -183,7 +183,7 @@ function backwpup_plugin_activate() {
|
|
183 |
if (empty($cfg['mailsndname'])) $cfg['mailsndname']='BackWPup '.get_bloginfo( 'name' );
|
184 |
if (empty($cfg['mailmethod'])) $cfg['mailmethod']='mail';
|
185 |
if (empty($cfg['mailsendmail'])) $cfg['mailsendmail']=substr(ini_get('sendmail_path'),0,strpos(ini_get('sendmail_path'),' -'));
|
186 |
-
if (isset($cfg['mailhost']) && false !== strpos($cfg['mailhost'],':'))
|
187 |
list($cfg['mailhost'],$cfg['mailhostport'])=explode(':',$cfg['mailhost'],2);
|
188 |
if (!isset($cfg['mailhost'])) $cfg['mailhost']='';
|
189 |
if (!isset($cfg['mailhostport'])) $cfg['mailhostport']=25;
|
@@ -213,17 +213,14 @@ function backwpup_plugin_activate() {
|
|
213 |
//delete not longer used options
|
214 |
delete_option('backwpup_backups_chache');
|
215 |
delete_option('backwpup_last_activate');
|
216 |
-
delete_site_transient('backwpup_api_update');
|
217 |
-
backwpup_api(true);
|
218 |
}
|
219 |
|
220 |
//on Plugin deaktivate
|
221 |
function backwpup_plugin_deactivate() {
|
222 |
wp_clear_scheduled_hook('backwpup_cron'); //delete cron
|
223 |
-
$cfg=get_option('backwpup');
|
224 |
$cfg['last_activate']=''; //set to not activated
|
225 |
update_option('backwpup',$cfg);
|
226 |
-
backwpup_api(false);
|
227 |
}
|
228 |
|
229 |
//get temp dir
|
@@ -242,22 +239,8 @@ function backwpup_check_open_basedir($dir) {
|
|
242 |
if (stripos($dir,rtrim(str_replace('\\','/',$basedir),'/').'/')==0)
|
243 |
return true;
|
244 |
}
|
245 |
-
}
|
246 |
-
return false;
|
247 |
-
}
|
248 |
-
|
249 |
-
//Backwpup API
|
250 |
-
function backwpup_api($active=true) {
|
251 |
-
include(ABSPATH . WPINC . '/version.php'); // include an unmodified $wp_version
|
252 |
-
if ($active) {
|
253 |
-
if (!get_site_transient( 'backwpup_api_update' )) {
|
254 |
-
set_site_transient('backwpup_api_update',true,3600*24*14); //only all 14 Days
|
255 |
-
wp_remote_post( BACKWPUP_API_URL, array('timeout' => 5, 'blocking' => false, 'sslverify' => false, 'body'=>array('URL'=>home_url(),'WP_VER'=>$wp_version,'BACKWPUP_VER'=>BACKWPUP_VERSION), 'user-agent'=>'BackWPup/'.BACKWPUP_VERSION.'; WordPress/'.$wp_version.'; ' . home_url()) );
|
256 |
-
}
|
257 |
-
} elseif (!$active) {
|
258 |
-
delete_site_transient('backwpup_api_update');
|
259 |
-
wp_remote_post( BACKWPUP_API_URL, array('timeout' => 5, 'blocking' => false, 'sslverify' => false, 'body'=>array('URL'=>home_url(),'ACTION'=>'delete'), 'user-agent'=>'BackWPup/0.0.0; WordPress/'.$wp_version.'; ' . home_url()) );
|
260 |
}
|
|
|
261 |
}
|
262 |
|
263 |
//add edit setting to plugins page
|
@@ -290,7 +273,7 @@ function backwpup_intervals($schedules) {
|
|
290 |
|
291 |
//
|
292 |
function backwpup_date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
|
293 |
-
if ($unixtimestamp)
|
294 |
$unixtimestamp=$unixtimestamp+get_option('gmt_offset')*3600;
|
295 |
return date_i18n( $dateformatstring, $unixtimestamp, $gmt);
|
296 |
}
|
@@ -315,7 +298,7 @@ function backwpup_cron() {
|
|
315 |
continue;
|
316 |
if ($jobvalue['cronnextrun']<=current_time('timestamp')) {
|
317 |
require_once(dirname(__FILE__).'/job/job_start.php');
|
318 |
-
backwpup_jobstart($jobid,true);
|
319 |
}
|
320 |
}
|
321 |
}
|
@@ -422,8 +405,8 @@ function backwpup_dashboard_logs() {
|
|
422 |
printf(' <span style="color:red;font-weight:bold;">'._n("%d ERROR", "%d ERRORS", $logdata['errors'],'backwpup').'</span>', $logdata['errors']);
|
423 |
if ($logdata['warnings']>0)
|
424 |
printf(' <span style="color:#e66f00;font-weight:bold;">'._n("%d WARNING", "%d WARNINGS", $logdata['warnings'],'backwpup').'</span>', $logdata['warnings']);
|
425 |
-
if($logdata['errors']==0 and $logdata['warnings']==0)
|
426 |
-
echo ' <span style="color:green;font-weight:bold;">'.__('O.K.','backwpup').'</span>';
|
427 |
echo '</li>';
|
428 |
$count++;
|
429 |
if ($count>=$widgets['backwpup_dashboard_logs'])
|
@@ -441,7 +424,7 @@ function backwpup_dashboard_logs_config() {
|
|
441 |
$widget_options = array();
|
442 |
|
443 |
if ( !isset($widget_options['backwpup_dashboard_logs']) )
|
444 |
-
$widget_options['backwpup_dashboard_logs'] = 5;
|
445 |
|
446 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['backwpup_dashboard_logs']) ) {
|
447 |
$number = absint( $_POST['backwpup_dashboard_logs'] );
|
@@ -487,8 +470,8 @@ function backwpup_dashboard_activejobs() {
|
|
487 |
$count++;
|
488 |
}
|
489 |
}
|
490 |
-
|
491 |
-
if ($count==0)
|
492 |
echo '<li><i>'.__('none','backwpup').'</i></li>';
|
493 |
echo '</ul>';
|
494 |
}
|
@@ -498,7 +481,7 @@ function backwpup_add_dashboard() {
|
|
498 |
if (!current_user_can(BACKWPUP_USER_CAPABILITY))
|
499 |
return;
|
500 |
wp_add_dashboard_widget( 'backwpup_dashboard_widget_logs', __('BackWPup Logs','backwpup'), 'backwpup_dashboard_logs' , 'backwpup_dashboard_logs_config');
|
501 |
-
wp_add_dashboard_widget( 'backwpup_dashboard_widget_activejobs', __('BackWPup
|
502 |
}
|
503 |
|
504 |
//add admin bar menu
|
@@ -509,7 +492,7 @@ function backwpup_add_adminbar() {
|
|
509 |
return;
|
510 |
/* Add the main siteadmin menu item */
|
511 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup', 'title' => __( 'BackWPup', 'backwpup' ), 'href' => backwpup_admin_url('admin.php').'?page=backwpup'));
|
512 |
-
if (backwpup_get_working_file())
|
513 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup_working','parent' => 'backwpup', 'title' => __('See Working!','backwpup'), 'href' => backwpup_admin_url('admin.php').'?page=backwpupworking'));
|
514 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup_jobs', 'parent' => 'backwpup', 'title' => __('Jobs','backwpup'), 'href' => backwpup_admin_url('admin.php').'?page=backwpup'));
|
515 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup_logs', 'parent' => 'backwpup', 'title' => __('Logs','backwpup'), 'href' => backwpup_admin_url('admin.php').'?page=backwpuplogs'));
|
@@ -676,7 +659,7 @@ function backwpup_cron_next($cronstring) {
|
|
676 |
//generate next 10 years
|
677 |
for ($i=date('Y');$i<2038;$i++)
|
678 |
$cron['year'][]=$i;
|
679 |
-
|
680 |
//calc next timestamp
|
681 |
$currenttime=current_time('timestamp');
|
682 |
foreach ($cron['year'] as $year) {
|
@@ -732,7 +715,7 @@ function backwpup_env_checks() {
|
|
732 |
$message.=str_replace('%d',BACKWPUP_MIN_WORDPRESS_VERSION,__('- WordPress %d or higher is needed!','backwpup')) . '<br />';
|
733 |
$checks=false;
|
734 |
}
|
735 |
-
if (version_compare(phpversion(), '5.2.4', '<')) { // check PHP Version
|
736 |
$message.=__('- PHP 5.2.4 or higher is needed!','backwpup') . '<br />';
|
737 |
$checks=false;
|
738 |
}
|
@@ -767,7 +750,7 @@ function backwpup_env_checks() {
|
|
767 |
if (empty($nextrun) or $nextrun<(time()-(3600*24))) { //check cron jobs work
|
768 |
$message.=__("- WP-Cron isn't working, please check it!","backwpup") .'<br />';
|
769 |
}
|
770 |
-
}
|
771 |
//put massage if one
|
772 |
if (!empty($message))
|
773 |
$backwpup_admin_message = '<div id="message" class="error fade"><strong>BackWPup:</strong><br />'.$message.'</div>';
|
@@ -795,7 +778,7 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
795 |
$heighestid=0;
|
796 |
if (is_array($jobs)) {
|
797 |
foreach ($jobs as $jobkey => $jobvalue) {
|
798 |
-
if ($jobkey>$heighestid)
|
799 |
$heighestid=$jobkey;
|
800 |
}
|
801 |
}
|
@@ -807,7 +790,7 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
807 |
if (!empty($jobnewsettings) && is_array($jobnewsettings)) { //overwrite with new settings
|
808 |
$jobsettings=array_merge($jobsettings,$jobnewsettings);
|
809 |
}
|
810 |
-
|
811 |
//check job type
|
812 |
if (!isset($jobsettings['type']) or !is_string($jobsettings['type']))
|
813 |
$jobsettings['type']='DB+FILE';
|
@@ -830,23 +813,23 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
830 |
$jobsettings['cronselect']='basic';
|
831 |
elseif (!isset($jobsettings['cronselect']) and isset($jobsettings['cron']))
|
832 |
$jobsettings['cronselect']='advanced';
|
833 |
-
|
834 |
if ($jobsettings['cronselect']!='advanced' and $jobsettings['cronselect']!='basic')
|
835 |
$jobsettings['cronselect']='advanced';
|
836 |
-
|
837 |
if (!isset($jobsettings['cron']) or !is_string($jobsettings['cron']))
|
838 |
$jobsettings['cron']='0 3 * * *';
|
839 |
-
|
840 |
if (!isset($jobsettings['cronnextrun']) or !is_numeric($jobsettings['cronnextrun']))
|
841 |
$jobsettings['cronnextrun']=backwpup_cron_next($jobsettings['cron']);
|
842 |
-
|
843 |
if (!isset($jobsettings['mailaddresslog']) or !is_string($jobsettings['mailaddresslog']))
|
844 |
$jobsettings['mailaddresslog']=get_option('admin_email');
|
845 |
|
846 |
if (!isset($jobsettings['mailerroronly']) or !is_bool($jobsettings['mailerroronly']))
|
847 |
$jobsettings['mailerroronly']=true;
|
848 |
|
849 |
-
|
850 |
//Tables to backup (old)
|
851 |
if (isset($jobsettings['dbtables']) and is_array($jobsettings['dbtables'])) {
|
852 |
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
@@ -855,7 +838,7 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
855 |
$jobsettings['dbexclude'][]=$table;
|
856 |
}
|
857 |
}
|
858 |
-
|
859 |
//don not backup tables
|
860 |
if (!isset($jobsettings['dbexclude']) or !is_array($jobsettings['dbexclude'])) {
|
861 |
$jobsettings['dbexclude']=array();
|
@@ -864,8 +847,8 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
864 |
if (substr($table,0,strlen($wpdb->prefix))!=$wpdb->prefix)
|
865 |
$jobsettings['dbexclude'][]=$table;
|
866 |
}
|
867 |
-
}
|
868 |
-
|
869 |
if (!isset($jobsettings['dbshortinsert']) or !is_bool($jobsettings['dbshortinsert']))
|
870 |
$jobsettings['dbshortinsert']=false;
|
871 |
|
@@ -957,10 +940,10 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
957 |
$fileformarts=array('.zip','.tar.gz','.tar.bz2','.tar');
|
958 |
if (!isset($jobsettings['fileformart']) or !in_array($jobsettings['fileformart'],$fileformarts))
|
959 |
$jobsettings['fileformart']='.zip';
|
960 |
-
|
961 |
if (!isset($jobsettings['fileprefix']) or !is_string($jobsettings['fileprefix']))
|
962 |
$jobsettings['fileprefix']='backwpup_'.$jobsettings['jobid'].'_';
|
963 |
-
|
964 |
if (!isset($jobsettings['mailefilesize']) or !is_float($jobsettings['mailefilesize']))
|
965 |
$jobsettings['mailefilesize']=0;
|
966 |
|
@@ -975,14 +958,14 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
975 |
if (!isset($jobsettings['maxbackups']) or !is_int($jobsettings['maxbackups']))
|
976 |
$jobsettings['maxbackups']=0;
|
977 |
|
978 |
-
if (!empty($jobsettings['ftphost']) and false !== strpos($jobsettings['ftphost'],':'))
|
979 |
list($jobsettings['ftphost'],$jobsettings['ftphostport'])=explode(':',$jobsettings['ftphost'],2);
|
980 |
-
|
981 |
if (!isset($jobsettings['ftphost']) or !is_string($jobsettings['ftphost']))
|
982 |
$jobsettings['ftphost']='';
|
983 |
-
|
984 |
$jobsettings['ftphost']=str_replace(array('http://','ftp://'),'',$jobsettings['ftphost']);
|
985 |
-
|
986 |
if (!isset($jobsettings['ftphostport']) or !is_int($jobsettings['ftphostport']))
|
987 |
$jobsettings['ftphostport']=21;
|
988 |
|
@@ -992,18 +975,17 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
992 |
if (!isset($jobsettings['ftppass']) or !is_string($jobsettings['ftppass']))
|
993 |
$jobsettings['ftppass']='';
|
994 |
|
995 |
-
if (!isset($jobsettings['ftpdir']) or !is_string($jobsettings['ftpdir'])
|
996 |
$jobsettings['ftpdir']='';
|
997 |
-
|
998 |
-
|
999 |
-
$jobsettings['ftpdir']='/'.$jobsettings['ftpdir'];
|
1000 |
|
1001 |
if (!isset($jobsettings['ftpmaxbackups']) or !is_int($jobsettings['ftpmaxbackups']))
|
1002 |
$jobsettings['ftpmaxbackups']=0;
|
1003 |
-
|
1004 |
if (!isset($jobsettings['ftppasv']) or !is_bool($jobsettings['ftppasv']))
|
1005 |
$jobsettings['ftppasv']=true;
|
1006 |
-
|
1007 |
if (!isset($jobsettings['ftpssl']) or !is_bool($jobsettings['ftpssl']))
|
1008 |
$jobsettings['ftpssl']=false;
|
1009 |
|
@@ -1027,7 +1009,7 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
1027 |
|
1028 |
if (!isset($jobsettings['awsmaxbackups']) or !is_int($jobsettings['awsmaxbackups']))
|
1029 |
$jobsettings['awsmaxbackups']=0;
|
1030 |
-
|
1031 |
if (!isset($jobsettings['GStorageAccessKey']) or !is_string($jobsettings['GStorageAccessKey']))
|
1032 |
$jobsettings['GStorageAccessKey']='';
|
1033 |
|
@@ -1065,8 +1047,8 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
1065 |
$jobsettings['msazuredir']=substr($jobsettings['msazuredir'],1);
|
1066 |
|
1067 |
if (!isset($jobsettings['msazuremaxbackups']) or !is_int($jobsettings['msazuremaxbackups']))
|
1068 |
-
$jobsettings['msazuremaxbackups']=0;
|
1069 |
-
|
1070 |
if (!isset($jobsettings['rscUsername']) or !is_string($jobsettings['rscUsername']))
|
1071 |
$jobsettings['rscUsername']='';
|
1072 |
|
@@ -1084,10 +1066,10 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
1084 |
|
1085 |
if (!isset($jobsettings['rscmaxbackups']) or !is_int($jobsettings['rscmaxbackups']))
|
1086 |
$jobsettings['rscmaxbackups']=0;
|
1087 |
-
|
1088 |
if (!isset($jobsettings['dropetoken']) or !is_string($jobsettings['dropetoken']))
|
1089 |
$jobsettings['dropetoken']='';
|
1090 |
-
|
1091 |
if (!isset($jobsettings['dropesecret']) or !is_string($jobsettings['dropesecret']))
|
1092 |
$jobsettings['dropesecret']='';
|
1093 |
|
@@ -1096,28 +1078,28 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
1096 |
$jobsettings['dropedir']=trailingslashit(str_replace('//','/',str_replace('\\','/',trim($jobsettings['dropedir']))));
|
1097 |
if (substr($jobsettings['dropedir'],0,1)=='/')
|
1098 |
$jobsettings['dropedir']=substr($jobsettings['dropedir'],1);
|
1099 |
-
|
1100 |
if (!isset($jobsettings['droperoot']) or ($jobsettings['droperoot']!='dropbox' and $jobsettings['droperoot']!='sandbox'))
|
1101 |
-
$jobsettings['droperoot']='dropbox';
|
1102 |
-
|
1103 |
if (!isset($jobsettings['dropemaxbackups']) or !is_int($jobsettings['dropemaxbackups']))
|
1104 |
-
$jobsettings['dropemaxbackups']=0;
|
1105 |
-
|
1106 |
if (!isset($jobsettings['sugarrefreshtoken']) or !is_string($jobsettings['sugarrefreshtoken']))
|
1107 |
-
$jobsettings['sugarrefreshtoken']='';
|
1108 |
|
1109 |
if (!isset($jobsettings['sugarroot']) or !is_string($jobsettings['sugarroot']))
|
1110 |
$jobsettings['sugarroot']='';
|
1111 |
-
|
1112 |
if (!isset($jobsettings['sugardir']) or !is_string($jobsettings['sugardir']) or $jobsettings['sugardir']=='/')
|
1113 |
$jobsettings['sugardir']='';
|
1114 |
$jobsettings['sugardir']=trailingslashit(str_replace('//','/',str_replace('\\','/',trim($jobsettings['sugardir']))));
|
1115 |
if (substr($jobsettings['sugardir'],0,1)=='/')
|
1116 |
$jobsettings['sugardir']=substr($jobsettings['sugardir'],1);
|
1117 |
-
|
1118 |
if (!isset($jobsettings['sugarmaxbackups']) or !is_int($jobsettings['sugarmaxbackups']))
|
1119 |
-
$jobsettings['sugarmaxbackups']=0;
|
1120 |
-
|
1121 |
if (!isset($jobsettings['mailaddress']) or !is_string($jobsettings['mailaddress']))
|
1122 |
$jobsettings['mailaddress']='';
|
1123 |
|
@@ -1127,11 +1109,11 @@ function backwpup_get_job_vars($jobid='',$jobnewsettings='') {
|
|
1127 |
unset($jobsettings['scheduleintervalteimes']);
|
1128 |
unset($jobsettings['scheduleinterval']);
|
1129 |
unset($jobsettings['dropemail']);
|
1130 |
-
unset($jobsettings['dropepass']);
|
1131 |
unset($jobsettings['dbtables']);
|
1132 |
unset($jobsettings['dropesignmethod']);
|
1133 |
unset($jobsettings['sugarpass']);
|
1134 |
unset($jobsettings['sugaruser']);
|
1135 |
-
|
1136 |
return $jobsettings;
|
1137 |
}
|
15 |
$hook = add_submenu_page( 'backwpup', __('Tools','backwpup'), __('Tools','backwpup'), BACKWPUP_USER_CAPABILITY, 'backwpuptools', 'backwpup_menu_page' );
|
16 |
add_action('load-'.$hook, 'backwpup_menu_page_header');
|
17 |
$hook = add_submenu_page( 'backwpup', __('Settings','backwpup'), __('Settings','backwpup'), BACKWPUP_USER_CAPABILITY, 'backwpupsettings', 'backwpup_menu_page' );
|
18 |
+
add_action('load-'.$hook, 'backwpup_menu_page_header');
|
19 |
}
|
20 |
|
21 |
function backwpup_menu_page() {
|
26 |
//Set pages that exists
|
27 |
$menupages=array('backwpup','backwpupeditjob','backwpupworking','backwpuplogs','backwpupbackups','backwpuptools','backwpupsettings');
|
28 |
//check called page exists
|
29 |
+
if (!empty($_REQUEST['page']) and in_array($_REQUEST['page'],$menupages))
|
30 |
require_once(dirname(__FILE__).'/pages/page_'.$_REQUEST['page'].'.php');
|
31 |
}
|
32 |
|
39 |
$menupages=array('backwpup','backwpupeditjob','backwpupworking','backwpuplogs','backwpupbackups','backwpuptools','backwpupsettings');
|
40 |
//check called page exists
|
41 |
$page=$_REQUEST['page'];
|
42 |
+
if (!empty($page) and in_array($page,$menupages)) {
|
43 |
//Css for Admin Section
|
44 |
if (is_file(dirname(__FILE__).'/css/'.$page.'.css')) {
|
45 |
if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
|
60 |
wp_enqueue_script($page,BACKWPUP_PLUGIN_BASEURL.'/js/'.$page.'.js','',BACKWPUP_VERSION,true);
|
61 |
}
|
62 |
//incude functions
|
63 |
+
if (is_file(dirname(__FILE__).'/pages/func_'.$page.'.php'))
|
64 |
require_once(dirname(__FILE__).'/pages/func_'.$page.'.php');
|
65 |
//include code
|
66 |
+
if (is_file(dirname(__FILE__).'/pages/header_'.$page.'.php'))
|
67 |
+
require_once(dirname(__FILE__).'/pages/header_'.$page.'.php');
|
68 |
}
|
69 |
}
|
70 |
|
74 |
if (!empty($_POST['backwpupajaxpage']) and in_array($_POST['backwpupajaxpage'],$menupages)) {
|
75 |
$page=$_POST['backwpupajaxpage'];
|
76 |
//incude functions
|
77 |
+
if (is_file(dirname(__FILE__).'/pages/func_'.$page.'.php'))
|
78 |
+
require_once(dirname(__FILE__).'/pages/func_'.$page.'.php');
|
79 |
}
|
80 |
}
|
81 |
|
82 |
function backwpup_contextual_help($help='') {
|
83 |
global $current_screen;
|
84 |
$help='<p>'.$help.'</p>';
|
85 |
+
|
86 |
if ( method_exists( $current_screen, 'add_help_tab' ) ) {
|
87 |
if ( 'http://backwpup.de'==__('http://backwpup.com','backwpup')) {
|
88 |
$current_screen->add_help_tab( array(
|
103 |
'id' => 'overview',
|
104 |
'title' => __( 'Overview', 'backwpup' ),
|
105 |
'content' => $help
|
106 |
+
) );
|
107 |
if ( 'http://backwpup.de'==__('http://backwpup.com','backwpup')) {
|
108 |
$current_screen->set_help_sidebar(
|
109 |
'<p><strong>' . __( 'For more information:', 'backwpup' ) . '</strong></p>' .
|
151 |
'</p>'
|
152 |
);
|
153 |
}
|
154 |
+
}
|
155 |
}
|
156 |
|
157 |
//On activate function
|
158 |
function backwpup_plugin_activate() {
|
159 |
//Load Settings
|
160 |
+
$cfg=get_option('backwpup');
|
161 |
//Check only run once on update
|
162 |
+
if ($cfg['last_activate']==BACKWPUP_VERSION or !is_main_site())
|
163 |
return;
|
164 |
+
else
|
165 |
$cfg['last_activate']=BACKWPUP_VERSION;
|
166 |
//check jobs
|
167 |
$jobs=get_option('backwpup_jobs');
|
183 |
if (empty($cfg['mailsndname'])) $cfg['mailsndname']='BackWPup '.get_bloginfo( 'name' );
|
184 |
if (empty($cfg['mailmethod'])) $cfg['mailmethod']='mail';
|
185 |
if (empty($cfg['mailsendmail'])) $cfg['mailsendmail']=substr(ini_get('sendmail_path'),0,strpos(ini_get('sendmail_path'),' -'));
|
186 |
+
if (isset($cfg['mailhost']) && false !== strpos($cfg['mailhost'],':'))
|
187 |
list($cfg['mailhost'],$cfg['mailhostport'])=explode(':',$cfg['mailhost'],2);
|
188 |
if (!isset($cfg['mailhost'])) $cfg['mailhost']='';
|
189 |
if (!isset($cfg['mailhostport'])) $cfg['mailhostport']=25;
|
213 |
//delete not longer used options
|
214 |
delete_option('backwpup_backups_chache');
|
215 |
delete_option('backwpup_last_activate');
|
|
|
|
|
216 |
}
|
217 |
|
218 |
//on Plugin deaktivate
|
219 |
function backwpup_plugin_deactivate() {
|
220 |
wp_clear_scheduled_hook('backwpup_cron'); //delete cron
|
221 |
+
$cfg=get_option('backwpup');
|
222 |
$cfg['last_activate']=''; //set to not activated
|
223 |
update_option('backwpup',$cfg);
|
|
|
224 |
}
|
225 |
|
226 |
//get temp dir
|
239 |
if (stripos($dir,rtrim(str_replace('\\','/',$basedir),'/').'/')==0)
|
240 |
return true;
|
241 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
}
|
243 |
+
return false;
|
244 |
}
|
245 |
|
246 |
//add edit setting to plugins page
|
273 |
|
274 |
//
|
275 |
function backwpup_date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
|
276 |
+
if ($unixtimestamp)
|
277 |
$unixtimestamp=$unixtimestamp+get_option('gmt_offset')*3600;
|
278 |
return date_i18n( $dateformatstring, $unixtimestamp, $gmt);
|
279 |
}
|
298 |
continue;
|
299 |
if ($jobvalue['cronnextrun']<=current_time('timestamp')) {
|
300 |
require_once(dirname(__FILE__).'/job/job_start.php');
|
301 |
+
backwpup_jobstart($jobid,true);
|
302 |
}
|
303 |
}
|
304 |
}
|
405 |
printf(' <span style="color:red;font-weight:bold;">'._n("%d ERROR", "%d ERRORS", $logdata['errors'],'backwpup').'</span>', $logdata['errors']);
|
406 |
if ($logdata['warnings']>0)
|
407 |
printf(' <span style="color:#e66f00;font-weight:bold;">'._n("%d WARNING", "%d WARNINGS", $logdata['warnings'],'backwpup').'</span>', $logdata['warnings']);
|
408 |
+
if($logdata['errors']==0 and $logdata['warnings']==0)
|
409 |
+
echo ' <span style="color:green;font-weight:bold;">'.__('O.K.','backwpup').'</span>';
|
410 |
echo '</li>';
|
411 |
$count++;
|
412 |
if ($count>=$widgets['backwpup_dashboard_logs'])
|
424 |
$widget_options = array();
|
425 |
|
426 |
if ( !isset($widget_options['backwpup_dashboard_logs']) )
|
427 |
+
$widget_options['backwpup_dashboard_logs'] = 5;
|
428 |
|
429 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['backwpup_dashboard_logs']) ) {
|
430 |
$number = absint( $_POST['backwpup_dashboard_logs'] );
|
470 |
$count++;
|
471 |
}
|
472 |
}
|
473 |
+
|
474 |
+
if ($count==0)
|
475 |
echo '<li><i>'.__('none','backwpup').'</i></li>';
|
476 |
echo '</ul>';
|
477 |
}
|
481 |
if (!current_user_can(BACKWPUP_USER_CAPABILITY))
|
482 |
return;
|
483 |
wp_add_dashboard_widget( 'backwpup_dashboard_widget_logs', __('BackWPup Logs','backwpup'), 'backwpup_dashboard_logs' , 'backwpup_dashboard_logs_config');
|
484 |
+
wp_add_dashboard_widget( 'backwpup_dashboard_widget_activejobs', __('BackWPup Active Jobs','backwpup'), 'backwpup_dashboard_activejobs' );
|
485 |
}
|
486 |
|
487 |
//add admin bar menu
|
492 |
return;
|
493 |
/* Add the main siteadmin menu item */
|
494 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup', 'title' => __( 'BackWPup', 'backwpup' ), 'href' => backwpup_admin_url('admin.php').'?page=backwpup'));
|
495 |
+
if (backwpup_get_working_file())
|
496 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup_working','parent' => 'backwpup', 'title' => __('See Working!','backwpup'), 'href' => backwpup_admin_url('admin.php').'?page=backwpupworking'));
|
497 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup_jobs', 'parent' => 'backwpup', 'title' => __('Jobs','backwpup'), 'href' => backwpup_admin_url('admin.php').'?page=backwpup'));
|
498 |
$wp_admin_bar->add_menu(array( 'id' => 'backwpup_logs', 'parent' => 'backwpup', 'title' => __('Logs','backwpup'), 'href' => backwpup_admin_url('admin.php').'?page=backwpuplogs'));
|
659 |
//generate next 10 years
|
660 |
for ($i=date('Y');$i<2038;$i++)
|
661 |
$cron['year'][]=$i;
|
662 |
+
|
663 |
//calc next timestamp
|
664 |
$currenttime=current_time('timestamp');
|
665 |
foreach ($cron['year'] as $year) {
|
715 |
$message.=str_replace('%d',BACKWPUP_MIN_WORDPRESS_VERSION,__('- WordPress %d or higher is needed!','backwpup')) . '<br />';
|
716 |
$checks=false;
|
717 |
}
|
718 |
+
if (version_compare(phpversion(), '5.2.4', '<')) { // check PHP Version
|
719 |
$message.=__('- PHP 5.2.4 or higher is needed!','backwpup') . '<br />';
|
720 |
$checks=false;
|
721 |
}
|
750 |
if (empty($nextrun) or $nextrun<(time()-(3600*24))) { //check cron jobs work
|
751 |
$message.=__("- WP-Cron isn't working, please check it!","backwpup") .'<br />';
|
752 |
}
|
753 |
+
}
|
754 |
//put massage if one
|
755 |
if (!empty($message))
|
756 |
$backwpup_admin_message = '<div id="message" class="error fade"><strong>BackWPup:</strong><br />'.$message.'</div>';
|
778 |
$heighestid=0;
|
779 |
if (is_array($jobs)) {
|
780 |
foreach ($jobs as $jobkey => $jobvalue) {
|
781 |
+
if ($jobkey>$heighestid)
|
782 |
$heighestid=$jobkey;
|
783 |
}
|
784 |
}
|
790 |
if (!empty($jobnewsettings) && is_array($jobnewsettings)) { //overwrite with new settings
|
791 |
$jobsettings=array_merge($jobsettings,$jobnewsettings);
|
792 |
}
|
793 |
+
|
794 |
//check job type
|
795 |
if (!isset($jobsettings['type']) or !is_string($jobsettings['type']))
|
796 |
$jobsettings['type']='DB+FILE';
|
813 |
$jobsettings['cronselect']='basic';
|
814 |
elseif (!isset($jobsettings['cronselect']) and isset($jobsettings['cron']))
|
815 |
$jobsettings['cronselect']='advanced';
|
816 |
+
|
817 |
if ($jobsettings['cronselect']!='advanced' and $jobsettings['cronselect']!='basic')
|
818 |
$jobsettings['cronselect']='advanced';
|
819 |
+
|
820 |
if (!isset($jobsettings['cron']) or !is_string($jobsettings['cron']))
|
821 |
$jobsettings['cron']='0 3 * * *';
|
822 |
+
|
823 |
if (!isset($jobsettings['cronnextrun']) or !is_numeric($jobsettings['cronnextrun']))
|
824 |
$jobsettings['cronnextrun']=backwpup_cron_next($jobsettings['cron']);
|
825 |
+
|
826 |
if (!isset($jobsettings['mailaddresslog']) or !is_string($jobsettings['mailaddresslog']))
|
827 |
$jobsettings['mailaddresslog']=get_option('admin_email');
|
828 |
|
829 |
if (!isset($jobsettings['mailerroronly']) or !is_bool($jobsettings['mailerroronly']))
|
830 |
$jobsettings['mailerroronly']=true;
|
831 |
|
832 |
+
|
833 |
//Tables to backup (old)
|
834 |
if (isset($jobsettings['dbtables']) and is_array($jobsettings['dbtables'])) {
|
835 |
$tables=$wpdb->get_col('SHOW TABLES FROM `'.DB_NAME.'`');
|
838 |
$jobsettings['dbexclude'][]=$table;
|
839 |
}
|
840 |
}
|
841 |
+
|
842 |
//don not backup tables
|
843 |
if (!isset($jobsettings['dbexclude']) or !is_array($jobsettings['dbexclude'])) {
|
844 |
$jobsettings['dbexclude']=array();
|
847 |
if (substr($table,0,strlen($wpdb->prefix))!=$wpdb->prefix)
|
848 |
$jobsettings['dbexclude'][]=$table;
|
849 |
}
|
850 |
+
}
|
851 |
+
|
852 |
if (!isset($jobsettings['dbshortinsert']) or !is_bool($jobsettings['dbshortinsert']))
|
853 |
$jobsettings['dbshortinsert']=false;
|
854 |
|
940 |
$fileformarts=array('.zip','.tar.gz','.tar.bz2','.tar');
|
941 |
if (!isset($jobsettings['fileformart']) or !in_array($jobsettings['fileformart'],$fileformarts))
|
942 |
$jobsettings['fileformart']='.zip';
|
943 |
+
|
944 |
if (!isset($jobsettings['fileprefix']) or !is_string($jobsettings['fileprefix']))
|
945 |
$jobsettings['fileprefix']='backwpup_'.$jobsettings['jobid'].'_';
|
946 |
+
|
947 |
if (!isset($jobsettings['mailefilesize']) or !is_float($jobsettings['mailefilesize']))
|
948 |
$jobsettings['mailefilesize']=0;
|
949 |
|
958 |
if (!isset($jobsettings['maxbackups']) or !is_int($jobsettings['maxbackups']))
|
959 |
$jobsettings['maxbackups']=0;
|
960 |
|
961 |
+
if (!empty($jobsettings['ftphost']) and false !== strpos($jobsettings['ftphost'],':'))
|
962 |
list($jobsettings['ftphost'],$jobsettings['ftphostport'])=explode(':',$jobsettings['ftphost'],2);
|
963 |
+
|
964 |
if (!isset($jobsettings['ftphost']) or !is_string($jobsettings['ftphost']))
|
965 |
$jobsettings['ftphost']='';
|
966 |
+
|
967 |
$jobsettings['ftphost']=str_replace(array('http://','ftp://'),'',$jobsettings['ftphost']);
|
968 |
+
|
969 |
if (!isset($jobsettings['ftphostport']) or !is_int($jobsettings['ftphostport']))
|
970 |
$jobsettings['ftphostport']=21;
|
971 |
|
975 |
if (!isset($jobsettings['ftppass']) or !is_string($jobsettings['ftppass']))
|
976 |
$jobsettings['ftppass']='';
|
977 |
|
978 |
+
if (!isset($jobsettings['ftpdir']) or !is_string($jobsettings['ftpdir']))
|
979 |
$jobsettings['ftpdir']='';
|
980 |
+
if (!empty($jobsettings['ftpdir']))
|
981 |
+
$jobsettings['ftpdir']=trailingslashit(str_replace('//','/',str_replace('\\','/',trim($jobsettings['ftpdir']))));
|
|
|
982 |
|
983 |
if (!isset($jobsettings['ftpmaxbackups']) or !is_int($jobsettings['ftpmaxbackups']))
|
984 |
$jobsettings['ftpmaxbackups']=0;
|
985 |
+
|
986 |
if (!isset($jobsettings['ftppasv']) or !is_bool($jobsettings['ftppasv']))
|
987 |
$jobsettings['ftppasv']=true;
|
988 |
+
|
989 |
if (!isset($jobsettings['ftpssl']) or !is_bool($jobsettings['ftpssl']))
|
990 |
$jobsettings['ftpssl']=false;
|
991 |
|
1009 |
|
1010 |
if (!isset($jobsettings['awsmaxbackups']) or !is_int($jobsettings['awsmaxbackups']))
|
1011 |
$jobsettings['awsmaxbackups']=0;
|
1012 |
+
|
1013 |
if (!isset($jobsettings['GStorageAccessKey']) or !is_string($jobsettings['GStorageAccessKey']))
|
1014 |
$jobsettings['GStorageAccessKey']='';
|
1015 |
|
1047 |
$jobsettings['msazuredir']=substr($jobsettings['msazuredir'],1);
|
1048 |
|
1049 |
if (!isset($jobsettings['msazuremaxbackups']) or !is_int($jobsettings['msazuremaxbackups']))
|
1050 |
+
$jobsettings['msazuremaxbackups']=0;
|
1051 |
+
|
1052 |
if (!isset($jobsettings['rscUsername']) or !is_string($jobsettings['rscUsername']))
|
1053 |
$jobsettings['rscUsername']='';
|
1054 |
|
1066 |
|
1067 |
if (!isset($jobsettings['rscmaxbackups']) or !is_int($jobsettings['rscmaxbackups']))
|
1068 |
$jobsettings['rscmaxbackups']=0;
|
1069 |
+
|
1070 |
if (!isset($jobsettings['dropetoken']) or !is_string($jobsettings['dropetoken']))
|
1071 |
$jobsettings['dropetoken']='';
|
1072 |
+
|
1073 |
if (!isset($jobsettings['dropesecret']) or !is_string($jobsettings['dropesecret']))
|
1074 |
$jobsettings['dropesecret']='';
|
1075 |
|
1078 |
$jobsettings['dropedir']=trailingslashit(str_replace('//','/',str_replace('\\','/',trim($jobsettings['dropedir']))));
|
1079 |
if (substr($jobsettings['dropedir'],0,1)=='/')
|
1080 |
$jobsettings['dropedir']=substr($jobsettings['dropedir'],1);
|
1081 |
+
|
1082 |
if (!isset($jobsettings['droperoot']) or ($jobsettings['droperoot']!='dropbox' and $jobsettings['droperoot']!='sandbox'))
|
1083 |
+
$jobsettings['droperoot']='dropbox';
|
1084 |
+
|
1085 |
if (!isset($jobsettings['dropemaxbackups']) or !is_int($jobsettings['dropemaxbackups']))
|
1086 |
+
$jobsettings['dropemaxbackups']=0;
|
1087 |
+
|
1088 |
if (!isset($jobsettings['sugarrefreshtoken']) or !is_string($jobsettings['sugarrefreshtoken']))
|
1089 |
+
$jobsettings['sugarrefreshtoken']='';
|
1090 |
|
1091 |
if (!isset($jobsettings['sugarroot']) or !is_string($jobsettings['sugarroot']))
|
1092 |
$jobsettings['sugarroot']='';
|
1093 |
+
|
1094 |
if (!isset($jobsettings['sugardir']) or !is_string($jobsettings['sugardir']) or $jobsettings['sugardir']=='/')
|
1095 |
$jobsettings['sugardir']='';
|
1096 |
$jobsettings['sugardir']=trailingslashit(str_replace('//','/',str_replace('\\','/',trim($jobsettings['sugardir']))));
|
1097 |
if (substr($jobsettings['sugardir'],0,1)=='/')
|
1098 |
$jobsettings['sugardir']=substr($jobsettings['sugardir'],1);
|
1099 |
+
|
1100 |
if (!isset($jobsettings['sugarmaxbackups']) or !is_int($jobsettings['sugarmaxbackups']))
|
1101 |
+
$jobsettings['sugarmaxbackups']=0;
|
1102 |
+
|
1103 |
if (!isset($jobsettings['mailaddress']) or !is_string($jobsettings['mailaddress']))
|
1104 |
$jobsettings['mailaddress']='';
|
1105 |
|
1109 |
unset($jobsettings['scheduleintervalteimes']);
|
1110 |
unset($jobsettings['scheduleinterval']);
|
1111 |
unset($jobsettings['dropemail']);
|
1112 |
+
unset($jobsettings['dropepass']);
|
1113 |
unset($jobsettings['dbtables']);
|
1114 |
unset($jobsettings['dropesignmethod']);
|
1115 |
unset($jobsettings['sugarpass']);
|
1116 |
unset($jobsettings['sugaruser']);
|
1117 |
+
|
1118 |
return $jobsettings;
|
1119 |
}
|
backwpup.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: BackWPup
|
|
4 |
Plugin URI: http://backwpup.com
|
5 |
Description: WordPress Backup and more...
|
6 |
Author: Daniel Hüsken
|
7 |
-
Version: 2.1.
|
8 |
Author URI: http://danielhuesken.de
|
9 |
Text Domain: backwpup
|
10 |
Domain Path: /lang/
|
@@ -32,7 +32,7 @@ Domain Path: /lang/
|
|
32 |
define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
|
33 |
define('BACKWPUP_PLUGIN_BASEURL',plugins_url('',__FILE__));
|
34 |
//Set Plugin Version
|
35 |
-
define('BACKWPUP_VERSION', '2.1.
|
36 |
//Set Min Wordpress Version
|
37 |
define('BACKWPUP_MIN_WORDPRESS_VERSION', '3.1');
|
38 |
//Set User Capability
|
@@ -44,8 +44,6 @@ if (!defined('BACKWPUP_DESTS')) {
|
|
44 |
else
|
45 |
define('BACKWPUP_DESTS', 'FTP,DROPBOX,SUGARSYNC,S3,GSTORAGE,RSC,MSAZURE');
|
46 |
}
|
47 |
-
//BackWPup API url
|
48 |
-
define('BACKWPUP_API_URL', 'https://api.backwpup.com');
|
49 |
//load Text Domain
|
50 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_BASEDIR.'/lang');
|
51 |
//Load functions file
|
4 |
Plugin URI: http://backwpup.com
|
5 |
Description: WordPress Backup and more...
|
6 |
Author: Daniel Hüsken
|
7 |
+
Version: 2.1.14
|
8 |
Author URI: http://danielhuesken.de
|
9 |
Text Domain: backwpup
|
10 |
Domain Path: /lang/
|
32 |
define('BACKWPUP_PLUGIN_BASEDIR', dirname(plugin_basename(__FILE__)));
|
33 |
define('BACKWPUP_PLUGIN_BASEURL',plugins_url('',__FILE__));
|
34 |
//Set Plugin Version
|
35 |
+
define('BACKWPUP_VERSION', '2.1.14');
|
36 |
//Set Min Wordpress Version
|
37 |
define('BACKWPUP_MIN_WORDPRESS_VERSION', '3.1');
|
38 |
//Set User Capability
|
44 |
else
|
45 |
define('BACKWPUP_DESTS', 'FTP,DROPBOX,SUGARSYNC,S3,GSTORAGE,RSC,MSAZURE');
|
46 |
}
|
|
|
|
|
47 |
//load Text Domain
|
48 |
load_plugin_textdomain('backwpup', false, BACKWPUP_PLUGIN_BASEDIR.'/lang');
|
49 |
//Load functions file
|
job/db_dump.php
CHANGED
@@ -4,7 +4,7 @@ function db_dump() {
|
|
4 |
trigger_error(sprintf(__('%d. try for database dump...','backwpup'),$WORKING['DB_DUMP']['STEP_TRY']),E_USER_NOTICE);
|
5 |
if (!isset($WORKING['DB_DUMP']['DONETABLE']) or !is_array($WORKING['DB_DUMP']['DONETABLE']))
|
6 |
$WORKING['DB_DUMP']['DONETABLE']=array();
|
7 |
-
|
8 |
mysql_update();
|
9 |
//to backup
|
10 |
$tabelstobackup=array();
|
@@ -14,7 +14,7 @@ function db_dump() {
|
|
14 |
while ($data = mysql_fetch_row($result)) {
|
15 |
if (!in_array($data[0],$STATIC['JOB']['dbexclude']))
|
16 |
$tabelstobackup[]=$data[0];
|
17 |
-
}
|
18 |
$WORKING['STEPTODO']=count($tabelstobackup);
|
19 |
//Set maintenance
|
20 |
maintenance_mode(true);
|
@@ -31,7 +31,7 @@ function db_dump() {
|
|
31 |
fwrite($file, "-- ---------------------------------------------------------\n");
|
32 |
fwrite($file, "-- Dump with BackWPup ver.: ".$STATIC['BACKWPUP']['VERSION']."\n");
|
33 |
fwrite($file, "-- Plugin for WordPress ".$STATIC['WP']['VERSION']." by Daniel Huesken\n");
|
34 |
-
fwrite($file, "-- http://
|
35 |
fwrite($file, "-- Blog Name: ".$STATIC['WP']['BLOGNAME']."\n");
|
36 |
fwrite($file, "-- Blog URL: ".$STATIC['WP']['SITEURL']."\n");
|
37 |
fwrite($file, "-- Blog ABSPATH: ".$STATIC['WP']['ABSPATH']."\n");
|
@@ -54,8 +54,6 @@ function db_dump() {
|
|
54 |
foreach($tabelstobackup as $table) {
|
55 |
if (in_array($table, $WORKING['DB_DUMP']['DONETABLE']))
|
56 |
continue;
|
57 |
-
trigger_error(sprintf(__('Dump database table "%s"','backwpup'),$table),E_USER_NOTICE);
|
58 |
-
need_free_memory(($status[$table]['Data_length']+$status[$table]['Index_length'])*4); //get more memory if needed
|
59 |
_db_dump_table($table,$status[$table],$file);
|
60 |
$WORKING['DB_DUMP']['DONETABLE'][]=$table;
|
61 |
$WORKING['STEPDONE']=count($WORKING['DB_DUMP']['DONETABLE']);
|
@@ -94,8 +92,10 @@ function db_dump() {
|
|
94 |
|
95 |
function _db_dump_table($table,$status,$file) {
|
96 |
global $WORKING,$STATIC;
|
|
|
97 |
// create dump
|
98 |
-
|
|
|
99 |
fwrite($file, "--\n");
|
100 |
fwrite($file, "-- Table structure for table $table\n");
|
101 |
fwrite($file, "--\n\n");
|
@@ -118,6 +118,14 @@ function _db_dump_table($table,$status,$file) {
|
|
118 |
trigger_error(sprintf(__('Database error %1$s for query %2$s','backwpup'), mysql_error(), "SELECT * FROM `".$table."`"),E_USER_ERROR);
|
119 |
return false;
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
fwrite($file, "--\n");
|
123 |
fwrite($file, "-- Dumping data for table $table\n");
|
@@ -128,17 +136,17 @@ function _db_dump_table($table,$status,$file) {
|
|
128 |
while ($data = mysql_fetch_assoc($result)) {
|
129 |
$keys = array();
|
130 |
$values = array();
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
// make data dump
|
143 |
if ($STATIC['JOB']['dbshortinsert'])
|
144 |
fwrite($file, "INSERT INTO `".$table."` VALUES ( ".implode(", ",$values)." );\n");
|
4 |
trigger_error(sprintf(__('%d. try for database dump...','backwpup'),$WORKING['DB_DUMP']['STEP_TRY']),E_USER_NOTICE);
|
5 |
if (!isset($WORKING['DB_DUMP']['DONETABLE']) or !is_array($WORKING['DB_DUMP']['DONETABLE']))
|
6 |
$WORKING['DB_DUMP']['DONETABLE']=array();
|
7 |
+
|
8 |
mysql_update();
|
9 |
//to backup
|
10 |
$tabelstobackup=array();
|
14 |
while ($data = mysql_fetch_row($result)) {
|
15 |
if (!in_array($data[0],$STATIC['JOB']['dbexclude']))
|
16 |
$tabelstobackup[]=$data[0];
|
17 |
+
}
|
18 |
$WORKING['STEPTODO']=count($tabelstobackup);
|
19 |
//Set maintenance
|
20 |
maintenance_mode(true);
|
31 |
fwrite($file, "-- ---------------------------------------------------------\n");
|
32 |
fwrite($file, "-- Dump with BackWPup ver.: ".$STATIC['BACKWPUP']['VERSION']."\n");
|
33 |
fwrite($file, "-- Plugin for WordPress ".$STATIC['WP']['VERSION']." by Daniel Huesken\n");
|
34 |
+
fwrite($file, "-- http://backwpup.com/\n");
|
35 |
fwrite($file, "-- Blog Name: ".$STATIC['WP']['BLOGNAME']."\n");
|
36 |
fwrite($file, "-- Blog URL: ".$STATIC['WP']['SITEURL']."\n");
|
37 |
fwrite($file, "-- Blog ABSPATH: ".$STATIC['WP']['ABSPATH']."\n");
|
54 |
foreach($tabelstobackup as $table) {
|
55 |
if (in_array($table, $WORKING['DB_DUMP']['DONETABLE']))
|
56 |
continue;
|
|
|
|
|
57 |
_db_dump_table($table,$status[$table],$file);
|
58 |
$WORKING['DB_DUMP']['DONETABLE'][]=$table;
|
59 |
$WORKING['STEPDONE']=count($WORKING['DB_DUMP']['DONETABLE']);
|
92 |
|
93 |
function _db_dump_table($table,$status,$file) {
|
94 |
global $WORKING,$STATIC;
|
95 |
+
need_free_memory(($status['Data_length']+$status['Index_length'])*4); //get more memory if needed
|
96 |
// create dump
|
97 |
+
trigger_error( sprintf( __( 'Dump database table "%s"', 'backwpup' ), $table ), E_USER_NOTICE );
|
98 |
+
fwrite($file, "\n");
|
99 |
fwrite($file, "--\n");
|
100 |
fwrite($file, "-- Table structure for table $table\n");
|
101 |
fwrite($file, "--\n\n");
|
118 |
trigger_error(sprintf(__('Database error %1$s for query %2$s','backwpup'), mysql_error(), "SELECT * FROM `".$table."`"),E_USER_ERROR);
|
119 |
return false;
|
120 |
}
|
121 |
+
//get field information
|
122 |
+
$fieldsarray = array();
|
123 |
+
$fieldinfo = array();
|
124 |
+
$fields = mysql_num_fields( $result );
|
125 |
+
for ( $i = 0; $i < $fields; $i ++ ) {
|
126 |
+
$fieldsarray[$i] = mysql_field_name( $result, $i );
|
127 |
+
$fieldinfo[$fieldsarray[$i]] = mysql_fetch_field( $result, $i );
|
128 |
+
}
|
129 |
|
130 |
fwrite($file, "--\n");
|
131 |
fwrite($file, "-- Dumping data for table $table\n");
|
136 |
while ($data = mysql_fetch_assoc($result)) {
|
137 |
$keys = array();
|
138 |
$values = array();
|
139 |
+
foreach ( $data as $key => $value ) {
|
140 |
+
if (!$STATIC['JOB']['dbshortinsert'])
|
141 |
+
$keys[] = "`".str_replace("�", "��", $key)."`"; // Add key to key list
|
142 |
+
if ( is_null( $value ) || ! isset($value) ) // Make Value NULL to string NULL
|
143 |
+
$value = "NULL";
|
144 |
+
elseif ( $fieldinfo[$key]->numeric == 1 && $fieldinfo[$key]->type != 'timestamp' && $fieldinfo[$key]->blob != 1 ) //is value numeric no esc
|
145 |
+
$value = empty($value) ? 0 : $value;
|
146 |
+
else
|
147 |
+
$value = "'" . mysql_real_escape_string( $value ) . "'";
|
148 |
+
$values[] = $value;
|
149 |
+
}
|
150 |
// make data dump
|
151 |
if ($STATIC['JOB']['dbshortinsert'])
|
152 |
fwrite($file, "INSERT INTO `".$table."` VALUES ( ".implode(", ",$values)." );\n");
|
job/dest_dropbox.php
CHANGED
@@ -4,13 +4,14 @@ function dest_dropbox() {
|
|
4 |
$WORKING['STEPTODO']=2+filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']);
|
5 |
$WORKING['STEPDONE']=0;
|
6 |
trigger_error(sprintf(__('%d. Try to sending backup file to DropBox...','backwpup'),$WORKING['DEST_DROPBOX']['STEP_TRY']),E_USER_NOTICE);
|
7 |
-
|
8 |
require_once(realpath(dirname(__FILE__).'/../libs/dropbox.php'));
|
9 |
try {
|
10 |
-
|
|
|
11 |
$dropbox = new backwpup_Dropbox('dropbox');
|
12 |
-
|
13 |
-
// set the tokens
|
14 |
$dropbox->setOAuthTokens($STATIC['JOB']['dropetoken'],$STATIC['JOB']['dropesecret']);
|
15 |
$info=$dropbox->accountInfo();
|
16 |
if (!empty($info['uid'])) {
|
@@ -25,9 +26,9 @@ function dest_dropbox() {
|
|
25 |
} else {
|
26 |
trigger_error(sprintf(__('%s free on DropBox','backwpup'),formatBytes($dropboxfreespase)),E_USER_NOTICE);
|
27 |
}
|
28 |
-
//set
|
29 |
-
$dropbox->setProgressFunction
|
30 |
-
// put the file
|
31 |
trigger_error(__('Upload to DropBox now started... ','backwpup'),E_USER_NOTICE);
|
32 |
$response = $dropbox->upload($STATIC['JOB']['backupdir'].$STATIC['backupfile'],$STATIC['JOB']['dropedir'].$STATIC['backupfile']);
|
33 |
if ($response['bytes']==filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile'])) {
|
@@ -37,11 +38,11 @@ function dest_dropbox() {
|
|
37 |
trigger_error(sprintf(__('Backup transferred to %s','backwpup'),'https://api-content.dropbox.com/1/files/'.$STATIC['JOB']['droperoot'].'/'.$STATIC['JOB']['dropedir'].$STATIC['backupfile']),E_USER_NOTICE);
|
38 |
}
|
39 |
//unset calback function
|
40 |
-
$dropbox->setProgressFunction
|
41 |
} catch (Exception $e) {
|
42 |
trigger_error(sprintf(__('DropBox API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
43 |
}
|
44 |
-
try {
|
45 |
if ($STATIC['JOB']['dropemaxbackups']>0 and is_object($dropbox)) { //Delete old backups
|
46 |
$backupfilelist=array();
|
47 |
$metadata = $dropbox->metadata($STATIC['JOB']['dropedir']);
|
@@ -62,10 +63,10 @@ function dest_dropbox() {
|
|
62 |
if ($numdeltefiles>0)
|
63 |
trigger_error(sprintf(_n('One file deleted on DropBox','%d files deleted on DropBox',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
64 |
}
|
65 |
-
}
|
66 |
} catch (Exception $e) {
|
67 |
trigger_error(sprintf(__('DropBox API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
68 |
-
}
|
69 |
|
70 |
$WORKING['STEPDONE']++;
|
71 |
}
|
4 |
$WORKING['STEPTODO']=2+filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']);
|
5 |
$WORKING['STEPDONE']=0;
|
6 |
trigger_error(sprintf(__('%d. Try to sending backup file to DropBox...','backwpup'),$WORKING['DEST_DROPBOX']['STEP_TRY']),E_USER_NOTICE);
|
7 |
+
|
8 |
require_once(realpath(dirname(__FILE__).'/../libs/dropbox.php'));
|
9 |
try {
|
10 |
+
need_free_memory(5000000);
|
11 |
+
//set boxtype
|
12 |
$dropbox = new backwpup_Dropbox('dropbox');
|
13 |
+
|
14 |
+
// set the tokens
|
15 |
$dropbox->setOAuthTokens($STATIC['JOB']['dropetoken'],$STATIC['JOB']['dropesecret']);
|
16 |
$info=$dropbox->accountInfo();
|
17 |
if (!empty($info['uid'])) {
|
26 |
} else {
|
27 |
trigger_error(sprintf(__('%s free on DropBox','backwpup'),formatBytes($dropboxfreespase)),E_USER_NOTICE);
|
28 |
}
|
29 |
+
//set callback function
|
30 |
+
$dropbox->setProgressFunction('curl_progresscallback');
|
31 |
+
// put the file
|
32 |
trigger_error(__('Upload to DropBox now started... ','backwpup'),E_USER_NOTICE);
|
33 |
$response = $dropbox->upload($STATIC['JOB']['backupdir'].$STATIC['backupfile'],$STATIC['JOB']['dropedir'].$STATIC['backupfile']);
|
34 |
if ($response['bytes']==filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile'])) {
|
38 |
trigger_error(sprintf(__('Backup transferred to %s','backwpup'),'https://api-content.dropbox.com/1/files/'.$STATIC['JOB']['droperoot'].'/'.$STATIC['JOB']['dropedir'].$STATIC['backupfile']),E_USER_NOTICE);
|
39 |
}
|
40 |
//unset calback function
|
41 |
+
$dropbox->setProgressFunction();
|
42 |
} catch (Exception $e) {
|
43 |
trigger_error(sprintf(__('DropBox API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
44 |
}
|
45 |
+
try {
|
46 |
if ($STATIC['JOB']['dropemaxbackups']>0 and is_object($dropbox)) { //Delete old backups
|
47 |
$backupfilelist=array();
|
48 |
$metadata = $dropbox->metadata($STATIC['JOB']['dropedir']);
|
63 |
if ($numdeltefiles>0)
|
64 |
trigger_error(sprintf(_n('One file deleted on DropBox','%d files deleted on DropBox',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
65 |
}
|
66 |
+
}
|
67 |
} catch (Exception $e) {
|
68 |
trigger_error(sprintf(__('DropBox API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
69 |
+
}
|
70 |
|
71 |
$WORKING['STEPDONE']++;
|
72 |
}
|
job/dest_ftp.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
function dest_ftp() {
|
3 |
global $WORKING,$STATIC;
|
4 |
if (empty($STATIC['JOB']['ftphost']) or empty($STATIC['JOB']['ftpuser']) or empty($STATIC['JOB']['ftppass'])) {
|
5 |
-
$WORKING['STEPSDONE'][]='DEST_FTP'; //set done
|
6 |
return;
|
7 |
}
|
8 |
$WORKING['STEPTODO']=filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']);
|
@@ -11,7 +11,7 @@ function dest_ftp() {
|
|
11 |
if ($STATIC['JOB']['ftpssl']) { //make SSL FTP connection
|
12 |
if (function_exists('ftp_ssl_connect')) {
|
13 |
$ftp_conn_id = ftp_ssl_connect($STATIC['JOB']['ftphost'],$STATIC['JOB']['ftphostport'],10);
|
14 |
-
if ($ftp_conn_id)
|
15 |
trigger_error(sprintf(__('Connected by SSL-FTP to Server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_NOTICE);
|
16 |
else {
|
17 |
trigger_error(sprintf(__('Can not connect by SSL-FTP to Server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_ERROR);
|
@@ -19,11 +19,11 @@ function dest_ftp() {
|
|
19 |
}
|
20 |
} else {
|
21 |
trigger_error(__('PHP function to connect with SSL-FTP to server not exists!','backwpup'),E_USER_ERROR);
|
22 |
-
return false;
|
23 |
}
|
24 |
-
} else { //make normal FTP
|
25 |
$ftp_conn_id = ftp_connect($STATIC['JOB']['ftphost'],$STATIC['JOB']['ftphostport'],10);
|
26 |
-
if ($ftp_conn_id)
|
27 |
trigger_error(sprintf(__('Connected to FTP server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_NOTICE);
|
28 |
else {
|
29 |
trigger_error(sprintf(__('Can not connect to FTP server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_ERROR);
|
@@ -37,13 +37,13 @@ function dest_ftp() {
|
|
37 |
if ($loginok=ftp_login($ftp_conn_id, $STATIC['JOB']['ftpuser'], backwpup_base64($STATIC['JOB']['ftppass']))) {
|
38 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),' User '.$STATIC['JOB']['ftpuser'].' logged in.'),E_USER_NOTICE);
|
39 |
} else { //if PHP ftp login don't work use raw login
|
40 |
-
$return=ftp_raw($ftp_conn_id,'USER '.$STATIC['JOB']['ftpuser']);
|
41 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),$return[0]),E_USER_NOTICE);
|
42 |
if (substr(trim($return[0]),0,3)<=400) {
|
43 |
trigger_error(sprintf(__('FTP Client command: %s','backwpup'),' PASS *******'),E_USER_NOTICE);
|
44 |
$return=ftp_raw($ftp_conn_id,'PASS '.backwpup_base64($STATIC['JOB']['ftppass']));
|
45 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),$return[0]),E_USER_NOTICE);
|
46 |
-
if (substr(trim($return[0]),0,3)<=400)
|
47 |
$loginok=true;
|
48 |
}
|
49 |
}
|
@@ -54,31 +54,32 @@ function dest_ftp() {
|
|
54 |
//SYSTYPE
|
55 |
trigger_error(sprintf(__('FTP Client command: %s','backwpup'),' SYST'),E_USER_NOTICE);
|
56 |
$systype=ftp_systype($ftp_conn_id);
|
57 |
-
if ($systype)
|
58 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),$systype),E_USER_NOTICE);
|
59 |
else
|
60 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),__('Error getting SYSTYPE','backwpup')),E_USER_ERROR);
|
61 |
|
62 |
//test ftp dir and create it f not exists
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
78 |
//delete file on ftp if new try
|
79 |
if ($WORKING['STEPDONE']==0)
|
80 |
@ftp_delete($ftp_conn_id, $STATIC['JOB']['ftpdir'].$STATIC['backupfile']);
|
81 |
-
|
82 |
//PASV
|
83 |
trigger_error(sprintf(__('FTP Client command: %s','backwpup'),' PASV'),E_USER_NOTICE);
|
84 |
if ($STATIC['JOB']['ftppasv']) {
|
@@ -90,9 +91,9 @@ function dest_ftp() {
|
|
90 |
if (ftp_pasv($ftp_conn_id, false))
|
91 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),__('Entering Normal Mode','backwpup')),E_USER_NOTICE);
|
92 |
else
|
93 |
-
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),__('Can not Entering Normal Mode','backwpup')),E_USER_WARNING);
|
94 |
}
|
95 |
-
|
96 |
if ($WORKING['STEPDONE']<$WORKING['STEPTODO']) {
|
97 |
trigger_error(__('Upload to FTP now started ... ','backwpup'),E_USER_NOTICE);
|
98 |
$fp = fopen($STATIC['JOB']['backupdir'].$STATIC['backupfile'], 'r');
|
@@ -104,16 +105,16 @@ function dest_ftp() {
|
|
104 |
}
|
105 |
if ($ret != FTP_FINISHED) {
|
106 |
trigger_error(__('Can not transfer backup to FTP server!','backwpup'),E_USER_ERROR);
|
107 |
-
return false;
|
108 |
} else {
|
109 |
$WORKING['STEPDONE']=filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']);
|
110 |
trigger_error(sprintf(__('Backup transferred to FTP server: %s','backwpup'),$STATIC['JOB']['ftpdir'].$STATIC['backupfile']),E_USER_NOTICE);
|
111 |
$STATIC['JOB']['lastbackupdownloadurl']="ftp://".$STATIC['JOB']['ftpuser'].":".backwpup_base64($STATIC['JOB']['ftppass'])."@".$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport'].$STATIC['JOB']['ftpdir'].$STATIC['backupfile'];
|
112 |
$WORKING['STEPSDONE'][]='DEST_FTP'; //set done
|
113 |
}
|
114 |
-
fclose($fp);
|
115 |
}
|
116 |
-
|
117 |
if ($STATIC['JOB']['ftpmaxbackups']>0) { //Delete old backups
|
118 |
$backupfilelist=array();
|
119 |
if ($filelist=ftp_nlist($ftp_conn_id, $STATIC['JOB']['ftpdir'])) {
|
2 |
function dest_ftp() {
|
3 |
global $WORKING,$STATIC;
|
4 |
if (empty($STATIC['JOB']['ftphost']) or empty($STATIC['JOB']['ftpuser']) or empty($STATIC['JOB']['ftppass'])) {
|
5 |
+
$WORKING['STEPSDONE'][]='DEST_FTP'; //set done
|
6 |
return;
|
7 |
}
|
8 |
$WORKING['STEPTODO']=filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']);
|
11 |
if ($STATIC['JOB']['ftpssl']) { //make SSL FTP connection
|
12 |
if (function_exists('ftp_ssl_connect')) {
|
13 |
$ftp_conn_id = ftp_ssl_connect($STATIC['JOB']['ftphost'],$STATIC['JOB']['ftphostport'],10);
|
14 |
+
if ($ftp_conn_id)
|
15 |
trigger_error(sprintf(__('Connected by SSL-FTP to Server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_NOTICE);
|
16 |
else {
|
17 |
trigger_error(sprintf(__('Can not connect by SSL-FTP to Server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_ERROR);
|
19 |
}
|
20 |
} else {
|
21 |
trigger_error(__('PHP function to connect with SSL-FTP to server not exists!','backwpup'),E_USER_ERROR);
|
22 |
+
return false;
|
23 |
}
|
24 |
+
} else { //make normal FTP connection if SSL not work
|
25 |
$ftp_conn_id = ftp_connect($STATIC['JOB']['ftphost'],$STATIC['JOB']['ftphostport'],10);
|
26 |
+
if ($ftp_conn_id)
|
27 |
trigger_error(sprintf(__('Connected to FTP server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_NOTICE);
|
28 |
else {
|
29 |
trigger_error(sprintf(__('Can not connect to FTP server: %s','backwpup'),$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport']),E_USER_ERROR);
|
37 |
if ($loginok=ftp_login($ftp_conn_id, $STATIC['JOB']['ftpuser'], backwpup_base64($STATIC['JOB']['ftppass']))) {
|
38 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),' User '.$STATIC['JOB']['ftpuser'].' logged in.'),E_USER_NOTICE);
|
39 |
} else { //if PHP ftp login don't work use raw login
|
40 |
+
$return=ftp_raw($ftp_conn_id,'USER '.$STATIC['JOB']['ftpuser']);
|
41 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),$return[0]),E_USER_NOTICE);
|
42 |
if (substr(trim($return[0]),0,3)<=400) {
|
43 |
trigger_error(sprintf(__('FTP Client command: %s','backwpup'),' PASS *******'),E_USER_NOTICE);
|
44 |
$return=ftp_raw($ftp_conn_id,'PASS '.backwpup_base64($STATIC['JOB']['ftppass']));
|
45 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),$return[0]),E_USER_NOTICE);
|
46 |
+
if (substr(trim($return[0]),0,3)<=400)
|
47 |
$loginok=true;
|
48 |
}
|
49 |
}
|
54 |
//SYSTYPE
|
55 |
trigger_error(sprintf(__('FTP Client command: %s','backwpup'),' SYST'),E_USER_NOTICE);
|
56 |
$systype=ftp_systype($ftp_conn_id);
|
57 |
+
if ($systype)
|
58 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),$systype),E_USER_NOTICE);
|
59 |
else
|
60 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),__('Error getting SYSTYPE','backwpup')),E_USER_ERROR);
|
61 |
|
62 |
//test ftp dir and create it f not exists
|
63 |
+
if ($STATIC['JOB']['ftpdir']!='/' && $STATIC['JOB']['ftpdir']='') {
|
64 |
+
$ftpdirs=explode("/", rtrim($STATIC['JOB']['ftpdir'],'/'));
|
65 |
+
foreach ($ftpdirs as $ftpdir) {
|
66 |
+
if (empty($ftpdir))
|
67 |
+
continue;
|
68 |
+
if (!@ftp_chdir($ftp_conn_id, $ftpdir)) {
|
69 |
+
if (@ftp_mkdir($ftp_conn_id, $ftpdir)) {
|
70 |
+
trigger_error(sprintf(__('FTP Folder "%s" created!','backwpup'),$ftpdir),E_USER_NOTICE);
|
71 |
+
ftp_chdir($ftp_conn_id, $ftpdir);
|
72 |
+
} else {
|
73 |
+
trigger_error(sprintf(__('FTP Folder "%s" can not created!','backwpup'),$ftpdir),E_USER_ERROR);
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
//delete file on ftp if new try
|
80 |
if ($WORKING['STEPDONE']==0)
|
81 |
@ftp_delete($ftp_conn_id, $STATIC['JOB']['ftpdir'].$STATIC['backupfile']);
|
82 |
+
|
83 |
//PASV
|
84 |
trigger_error(sprintf(__('FTP Client command: %s','backwpup'),' PASV'),E_USER_NOTICE);
|
85 |
if ($STATIC['JOB']['ftppasv']) {
|
91 |
if (ftp_pasv($ftp_conn_id, false))
|
92 |
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),__('Entering Normal Mode','backwpup')),E_USER_NOTICE);
|
93 |
else
|
94 |
+
trigger_error(sprintf(__('FTP Server reply: %s','backwpup'),__('Can not Entering Normal Mode','backwpup')),E_USER_WARNING);
|
95 |
}
|
96 |
+
|
97 |
if ($WORKING['STEPDONE']<$WORKING['STEPTODO']) {
|
98 |
trigger_error(__('Upload to FTP now started ... ','backwpup'),E_USER_NOTICE);
|
99 |
$fp = fopen($STATIC['JOB']['backupdir'].$STATIC['backupfile'], 'r');
|
105 |
}
|
106 |
if ($ret != FTP_FINISHED) {
|
107 |
trigger_error(__('Can not transfer backup to FTP server!','backwpup'),E_USER_ERROR);
|
108 |
+
return false;
|
109 |
} else {
|
110 |
$WORKING['STEPDONE']=filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']);
|
111 |
trigger_error(sprintf(__('Backup transferred to FTP server: %s','backwpup'),$STATIC['JOB']['ftpdir'].$STATIC['backupfile']),E_USER_NOTICE);
|
112 |
$STATIC['JOB']['lastbackupdownloadurl']="ftp://".$STATIC['JOB']['ftpuser'].":".backwpup_base64($STATIC['JOB']['ftppass'])."@".$STATIC['JOB']['ftphost'].':'.$STATIC['JOB']['ftphostport'].$STATIC['JOB']['ftpdir'].$STATIC['backupfile'];
|
113 |
$WORKING['STEPSDONE'][]='DEST_FTP'; //set done
|
114 |
}
|
115 |
+
fclose($fp);
|
116 |
}
|
117 |
+
|
118 |
if ($STATIC['JOB']['ftpmaxbackups']>0) { //Delete old backups
|
119 |
$backupfilelist=array();
|
120 |
if ($filelist=ftp_nlist($ftp_conn_id, $STATIC['JOB']['ftpdir'])) {
|
job/dest_gstorage.php
CHANGED
@@ -6,7 +6,7 @@ function dest_gstorage() {
|
|
6 |
$WORKING['STEPDONE']=0;
|
7 |
|
8 |
require_once(dirname(__FILE__).'/../libs/aws/sdk.class.php');
|
9 |
-
need_free_memory(26214400*1.1);
|
10 |
try {
|
11 |
$gstorage = new AmazonS3(array('key'=>$STATIC['JOB']['GStorageAccessKey'],'secret'=>$STATIC['JOB']['GStorageSecret'],'certificate_authority'=>true));
|
12 |
//set up s3 for google
|
@@ -14,12 +14,12 @@ function dest_gstorage() {
|
|
14 |
$gstorage->allow_hostname_override(false);
|
15 |
if ($gstorage->if_bucket_exists($STATIC['JOB']['GStorageBucket'])) {
|
16 |
trigger_error(sprintf(__('Connected to GStorage Bucket: %s','backwpup'),$STATIC['JOB']['GStorageBucket']),E_USER_NOTICE);
|
17 |
-
//set
|
18 |
$curlops=array();
|
19 |
if (defined('CURLOPT_PROGRESSFUNCTION'))
|
20 |
-
$curlops=array(CURLOPT_NOPROGRESS=>false,CURLOPT_PROGRESSFUNCTION=>'curl_progresscallback',CURLOPT_BUFFERSIZE=>
|
21 |
-
trigger_error(__('Upload to GStorage now started... ','backwpup'),E_USER_NOTICE);
|
22 |
-
//
|
23 |
$result=$gstorage->create_object($STATIC['JOB']['GStorageBucket'], $STATIC['JOB']['GStoragedir'].$STATIC['backupfile'], array('fileUpload' => $STATIC['JOB']['backupdir'].$STATIC['backupfile'],'acl' => 'private','curlopts'=>$curlops));
|
24 |
$result=(array)$result;
|
25 |
if ($result["status"]>=200 and $result["status"]<300) {
|
@@ -37,7 +37,7 @@ function dest_gstorage() {
|
|
37 |
trigger_error(sprintf(__('GStorage API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
38 |
return;
|
39 |
}
|
40 |
-
try {
|
41 |
if ($gstorage->if_bucket_exists($STATIC['JOB']['GStorageBucket'])) {
|
42 |
if ($STATIC['JOB']['GStoragemaxbackups']>0) { //Delete old backups
|
43 |
$backupfilelist=array();
|
@@ -60,12 +60,12 @@ function dest_gstorage() {
|
|
60 |
if ($numdeltefiles>0)
|
61 |
trigger_error(sprintf(_n('One file deleted on GStorage Bucket','%d files deleted on GStorage Bucket',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
62 |
}
|
63 |
-
}
|
64 |
}
|
65 |
} catch (Exception $e) {
|
66 |
trigger_error(sprintf(__('GStorage API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
67 |
return;
|
68 |
}
|
69 |
-
|
70 |
$WORKING['STEPDONE']++;
|
71 |
}
|
6 |
$WORKING['STEPDONE']=0;
|
7 |
|
8 |
require_once(dirname(__FILE__).'/../libs/aws/sdk.class.php');
|
9 |
+
need_free_memory(26214400*1.1);
|
10 |
try {
|
11 |
$gstorage = new AmazonS3(array('key'=>$STATIC['JOB']['GStorageAccessKey'],'secret'=>$STATIC['JOB']['GStorageSecret'],'certificate_authority'=>true));
|
12 |
//set up s3 for google
|
14 |
$gstorage->allow_hostname_override(false);
|
15 |
if ($gstorage->if_bucket_exists($STATIC['JOB']['GStorageBucket'])) {
|
16 |
trigger_error(sprintf(__('Connected to GStorage Bucket: %s','backwpup'),$STATIC['JOB']['GStorageBucket']),E_USER_NOTICE);
|
17 |
+
//set curl Prozess bar
|
18 |
$curlops=array();
|
19 |
if (defined('CURLOPT_PROGRESSFUNCTION'))
|
20 |
+
$curlops=array(CURLOPT_NOPROGRESS=>false,CURLOPT_PROGRESSFUNCTION=>'curl_progresscallback',CURLOPT_BUFFERSIZE=>512);
|
21 |
+
trigger_error(__('Upload to GStorage now started... ','backwpup'),E_USER_NOTICE);
|
22 |
+
//transferee file to GStorage
|
23 |
$result=$gstorage->create_object($STATIC['JOB']['GStorageBucket'], $STATIC['JOB']['GStoragedir'].$STATIC['backupfile'], array('fileUpload' => $STATIC['JOB']['backupdir'].$STATIC['backupfile'],'acl' => 'private','curlopts'=>$curlops));
|
24 |
$result=(array)$result;
|
25 |
if ($result["status"]>=200 and $result["status"]<300) {
|
37 |
trigger_error(sprintf(__('GStorage API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
38 |
return;
|
39 |
}
|
40 |
+
try {
|
41 |
if ($gstorage->if_bucket_exists($STATIC['JOB']['GStorageBucket'])) {
|
42 |
if ($STATIC['JOB']['GStoragemaxbackups']>0) { //Delete old backups
|
43 |
$backupfilelist=array();
|
60 |
if ($numdeltefiles>0)
|
61 |
trigger_error(sprintf(_n('One file deleted on GStorage Bucket','%d files deleted on GStorage Bucket',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
62 |
}
|
63 |
+
}
|
64 |
}
|
65 |
} catch (Exception $e) {
|
66 |
trigger_error(sprintf(__('GStorage API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
67 |
return;
|
68 |
}
|
69 |
+
|
70 |
$WORKING['STEPDONE']++;
|
71 |
}
|
job/dest_s3.php
CHANGED
@@ -6,8 +6,8 @@ function dest_s3() {
|
|
6 |
$WORKING['STEPDONE']=0;
|
7 |
|
8 |
require_once(dirname(__FILE__).'/../libs/aws/sdk.class.php');
|
9 |
-
need_free_memory(26214400*1.1);
|
10 |
-
|
11 |
try {
|
12 |
$s3 = new AmazonS3(array('key'=>$STATIC['JOB']['awsAccessKey'],'secret'=>$STATIC['JOB']['awsSecretKey'],'certificate_authority'=>true));
|
13 |
if ($s3->if_bucket_exists($STATIC['JOB']['awsBucket'])) {
|
@@ -15,14 +15,14 @@ function dest_s3() {
|
|
15 |
//Transfer Backup to S3
|
16 |
if ($STATIC['JOB']['awsrrs']) //set reduced redundancy or not
|
17 |
$storage=AmazonS3::STORAGE_REDUCED;
|
18 |
-
else
|
19 |
$storage=AmazonS3::STORAGE_STANDARD;
|
20 |
-
//set
|
21 |
$curlops=array();
|
22 |
if (defined('CURLOPT_PROGRESSFUNCTION'))
|
23 |
-
|
24 |
-
trigger_error(__('Upload to Amazon S3 now started... ','backwpup'),E_USER_NOTICE);
|
25 |
-
//
|
26 |
$result=$s3->create_object($STATIC['JOB']['awsBucket'], $STATIC['JOB']['awsdir'].$STATIC['backupfile'], array('fileUpload' => $STATIC['JOB']['backupdir'].$STATIC['backupfile'],'acl' => AmazonS3::ACL_PRIVATE,'storage' => $storage,'curlopts'=>$curlops));
|
27 |
$result=(array)$result;
|
28 |
if ($result["status"]>=200 and $result["status"]<300) {
|
@@ -40,7 +40,7 @@ function dest_s3() {
|
|
40 |
trigger_error(sprintf(__('Amazon API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
41 |
return;
|
42 |
}
|
43 |
-
try {
|
44 |
if ($s3->if_bucket_exists($STATIC['JOB']['awsBucket'])) {
|
45 |
if ($STATIC['JOB']['awsmaxbackups']>0) { //Delete old backups
|
46 |
$backupfilelist=array();
|
@@ -63,12 +63,12 @@ function dest_s3() {
|
|
63 |
if ($numdeltefiles>0)
|
64 |
trigger_error(sprintf(_n('One file deleted on S3 Bucket','%d files deleted on S3 Bucket',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
65 |
}
|
66 |
-
}
|
67 |
}
|
68 |
} catch (Exception $e) {
|
69 |
trigger_error(sprintf(__('Amazon API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
70 |
return;
|
71 |
}
|
72 |
-
|
73 |
$WORKING['STEPDONE']++;
|
74 |
}
|
6 |
$WORKING['STEPDONE']=0;
|
7 |
|
8 |
require_once(dirname(__FILE__).'/../libs/aws/sdk.class.php');
|
9 |
+
need_free_memory(26214400*1.1);
|
10 |
+
|
11 |
try {
|
12 |
$s3 = new AmazonS3(array('key'=>$STATIC['JOB']['awsAccessKey'],'secret'=>$STATIC['JOB']['awsSecretKey'],'certificate_authority'=>true));
|
13 |
if ($s3->if_bucket_exists($STATIC['JOB']['awsBucket'])) {
|
15 |
//Transfer Backup to S3
|
16 |
if ($STATIC['JOB']['awsrrs']) //set reduced redundancy or not
|
17 |
$storage=AmazonS3::STORAGE_REDUCED;
|
18 |
+
else
|
19 |
$storage=AmazonS3::STORAGE_STANDARD;
|
20 |
+
//set curl Progress bar
|
21 |
$curlops=array();
|
22 |
if (defined('CURLOPT_PROGRESSFUNCTION'))
|
23 |
+
$curlops=array(CURLOPT_NOPROGRESS=>false,CURLOPT_PROGRESSFUNCTION=>'curl_progresscallback',CURLOPT_BUFFERSIZE=>512);
|
24 |
+
trigger_error(__('Upload to Amazon S3 now started... ','backwpup'),E_USER_NOTICE);
|
25 |
+
//transferee file to S3
|
26 |
$result=$s3->create_object($STATIC['JOB']['awsBucket'], $STATIC['JOB']['awsdir'].$STATIC['backupfile'], array('fileUpload' => $STATIC['JOB']['backupdir'].$STATIC['backupfile'],'acl' => AmazonS3::ACL_PRIVATE,'storage' => $storage,'curlopts'=>$curlops));
|
27 |
$result=(array)$result;
|
28 |
if ($result["status"]>=200 and $result["status"]<300) {
|
40 |
trigger_error(sprintf(__('Amazon API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
41 |
return;
|
42 |
}
|
43 |
+
try {
|
44 |
if ($s3->if_bucket_exists($STATIC['JOB']['awsBucket'])) {
|
45 |
if ($STATIC['JOB']['awsmaxbackups']>0) { //Delete old backups
|
46 |
$backupfilelist=array();
|
63 |
if ($numdeltefiles>0)
|
64 |
trigger_error(sprintf(_n('One file deleted on S3 Bucket','%d files deleted on S3 Bucket',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
65 |
}
|
66 |
+
}
|
67 |
}
|
68 |
} catch (Exception $e) {
|
69 |
trigger_error(sprintf(__('Amazon API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
70 |
return;
|
71 |
}
|
72 |
+
|
73 |
$WORKING['STEPDONE']++;
|
74 |
}
|
job/dest_sugarsync.php
CHANGED
@@ -6,7 +6,7 @@ function dest_sugarsync() {
|
|
6 |
trigger_error(sprintf(__('%d. try sending backup to SugarSync...','backwpup'),$WORKING['DEST_SUGARSYNC']['STEP_TRY']),E_USER_NOTICE);
|
7 |
|
8 |
require_once(realpath(dirname(__FILE__).'/../libs/sugarsync.php'));
|
9 |
-
|
10 |
try {
|
11 |
$sugarsync = new SugarSync($STATIC['JOB']['sugarrefreshtoken']);
|
12 |
//Check Quota
|
@@ -38,9 +38,9 @@ function dest_sugarsync() {
|
|
38 |
} else {
|
39 |
trigger_error(__('Can not transfer backup to SugarSync!','backwpup'),E_USER_ERROR);
|
40 |
return;
|
41 |
-
}
|
42 |
$sugarsync->setProgressFunction('');
|
43 |
-
|
44 |
if ($STATIC['JOB']['sugarmaxbackups']>0) { //Delete old backups
|
45 |
$backupfilelist=array();
|
46 |
$getfiles=$sugarsync->getcontents('file');
|
@@ -61,10 +61,10 @@ function dest_sugarsync() {
|
|
61 |
if ($numdeltefiles>0)
|
62 |
trigger_error(sprintf(_n('One file deleted on SugarSync folder','%d files deleted on SugarSync folder',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
63 |
}
|
64 |
-
}
|
65 |
} catch (Exception $e) {
|
66 |
trigger_error(sprintf(__('SugarSync API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
67 |
-
}
|
68 |
|
69 |
$WORKING['STEPDONE']++;
|
70 |
}
|
6 |
trigger_error(sprintf(__('%d. try sending backup to SugarSync...','backwpup'),$WORKING['DEST_SUGARSYNC']['STEP_TRY']),E_USER_NOTICE);
|
7 |
|
8 |
require_once(realpath(dirname(__FILE__).'/../libs/sugarsync.php'));
|
9 |
+
|
10 |
try {
|
11 |
$sugarsync = new SugarSync($STATIC['JOB']['sugarrefreshtoken']);
|
12 |
//Check Quota
|
38 |
} else {
|
39 |
trigger_error(__('Can not transfer backup to SugarSync!','backwpup'),E_USER_ERROR);
|
40 |
return;
|
41 |
+
}
|
42 |
$sugarsync->setProgressFunction('');
|
43 |
+
|
44 |
if ($STATIC['JOB']['sugarmaxbackups']>0) { //Delete old backups
|
45 |
$backupfilelist=array();
|
46 |
$getfiles=$sugarsync->getcontents('file');
|
61 |
if ($numdeltefiles>0)
|
62 |
trigger_error(sprintf(_n('One file deleted on SugarSync folder','%d files deleted on SugarSync folder',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
63 |
}
|
64 |
+
}
|
65 |
} catch (Exception $e) {
|
66 |
trigger_error(sprintf(__('SugarSync API: %s','backwpup'),$e->getMessage()),E_USER_ERROR);
|
67 |
+
}
|
68 |
|
69 |
$WORKING['STEPDONE']++;
|
70 |
}
|
job/job_functions.php
CHANGED
@@ -72,7 +72,7 @@ function get_filelist() {
|
|
72 |
global $STATIC;
|
73 |
if (is_file($STATIC['TEMPDIR'].'.filelist') and $filelistfile=file_get_contents($STATIC['TEMPDIR'].'.filelist'))
|
74 |
return unserialize(trim($filelistfile));
|
75 |
-
else
|
76 |
return array();
|
77 |
}
|
78 |
|
@@ -100,7 +100,7 @@ function inbytes($value) {
|
|
100 |
}
|
101 |
|
102 |
function need_free_memory($memneed) {
|
103 |
-
if (!function_exists('memory_get_usage'))
|
104 |
return;
|
105 |
//need memory
|
106 |
$needmemory=@memory_get_usage(true)+inbytes($memneed);
|
@@ -152,7 +152,7 @@ function maintenance_mode($enable = false) {
|
|
152 |
}
|
153 |
|
154 |
function curl_progresscallback($download_size, $downloaded, $upload_size, $uploaded) {
|
155 |
-
global $WORKING
|
156 |
if ($WORKING['STEPTODO']>10)
|
157 |
$WORKING['STEPDONE']=$uploaded;
|
158 |
update_working_file();
|
@@ -183,12 +183,12 @@ function delete_working_file() {
|
|
183 |
}
|
184 |
|
185 |
function update_working_file($mustwrite=false) {
|
186 |
-
global $WORKING,$STATIC,$
|
187 |
if (!is_file($STATIC['TEMPDIR'].'.running')) {
|
188 |
job_end();
|
189 |
return false;
|
190 |
}
|
191 |
-
if ($mustwrite or empty($runmicrotime) or $
|
192 |
if ($WORKING['STEPTODO']>0 and $WORKING['STEPDONE']>0)
|
193 |
$steppersent=round($WORKING['STEPDONE']/$WORKING['STEPTODO']*100);
|
194 |
else
|
@@ -198,11 +198,9 @@ function update_working_file($mustwrite=false) {
|
|
198 |
else
|
199 |
$stepspersent=1;
|
200 |
@set_time_limit(0);
|
201 |
-
$runningfile=file_get_contents($STATIC['TEMPDIR'].'.running');
|
202 |
-
$infile=unserialize(trim($runningfile));
|
203 |
if (is_writable($STATIC['TEMPDIR'].'.running')) {
|
204 |
file_put_contents($STATIC['TEMPDIR'].'.running',serialize(array('timestamp'=>time(),'JOBID'=>$STATIC['JOB']['jobid'],'LOGFILE'=>$STATIC['LOGFILE'],'STEPSPERSENT'=>$stepspersent,'STEPPERSENT'=>$steppersent,'ABSPATH'=>$STATIC['WP']['ABSPATH'],'WORKING'=>$WORKING)));
|
205 |
-
$
|
206 |
}
|
207 |
}
|
208 |
return true;
|
@@ -213,7 +211,7 @@ function mysql_update() {
|
|
213 |
if (!$mysqlconlink or !@mysql_ping($mysqlconlink)) {
|
214 |
// make a mysql connection
|
215 |
$mysqlconlink=mysql_connect($STATIC['WP']['DB_HOST'], $STATIC['WP']['DB_USER'], $STATIC['WP']['DB_PASSWORD'], true);
|
216 |
-
if (!$mysqlconlink)
|
217 |
trigger_error(sprintf(__('No MySQL connection: %s','backwpup'),mysql_error()),E_USER_ERROR);
|
218 |
//set connecten charset
|
219 |
if (!empty($STATIC['WP']['DB_CHARSET'])) {
|
@@ -239,9 +237,9 @@ function joberrorhandler() {
|
|
239 |
$args = func_get_args(); // 0:errno, 1:errstr, 2:errfile, 3:errline
|
240 |
|
241 |
// if error has been supressed with an @
|
242 |
-
if (error_reporting()==0)
|
243 |
return;
|
244 |
-
|
245 |
$adderrorwarning=false;
|
246 |
|
247 |
switch ($args[0]) {
|
@@ -255,7 +253,7 @@ function joberrorhandler() {
|
|
255 |
$adderrorwarning=true;
|
256 |
$message="<span class=\"warning\">".__('[WARNING]','backwpup')." ".$args[1]."</span>";
|
257 |
break;
|
258 |
-
case E_ERROR:
|
259 |
case E_USER_ERROR:
|
260 |
$WORKING['ERROR']++;
|
261 |
$adderrorwarning=true;
|
@@ -312,16 +310,16 @@ function joberrorhandler() {
|
|
312 |
if ($args[0]==E_ERROR or $args[0]==E_CORE_ERROR or $args[0]==E_COMPILE_ERROR) {//Die on fatal php errors.
|
313 |
die();
|
314 |
}
|
315 |
-
|
316 |
//true for no more php error hadling.
|
317 |
return true;
|
318 |
-
}
|
319 |
|
320 |
//job end function
|
321 |
function job_end() {
|
322 |
global $WORKING,$STATIC,$mysqlconlink;
|
323 |
//check if job_end allredy runs
|
324 |
-
if (empty($WORKING['JOBENDINPROGRESS']) or !$WORKING['JOBENDINPROGRESS'])
|
325 |
$WORKING['JOBENDINPROGRESS']=true;
|
326 |
else
|
327 |
return;
|
@@ -348,9 +346,9 @@ function job_end() {
|
|
348 |
trigger_error(sprintf(_n('One old log deleted','%d old logs deleted',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
349 |
}
|
350 |
}
|
351 |
-
//Display job working time
|
352 |
-
trigger_error(sprintf(__('Job done in %s sec.','backwpup'),time()-$STATIC['JOB']['starttime']),E_USER_NOTICE);
|
353 |
-
|
354 |
if (empty($STATIC['backupfile']) or !is_file($STATIC['JOB']['backupdir'].$STATIC['backupfile']) or !($filesize=filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']))) //Set the filezie corectly
|
355 |
$filesize=0;
|
356 |
|
@@ -365,7 +363,7 @@ function job_end() {
|
|
365 |
}
|
366 |
closedir($dir);
|
367 |
}
|
368 |
-
|
369 |
$jobs=get_option('backwpup_jobs');
|
370 |
$jobs[$STATIC['JOB']['jobid']]['lastrun']=$jobs[$STATIC['JOB']['jobid']]['starttime'];
|
371 |
$STATIC['JOB']['lastrun']=$jobs[$STATIC['JOB']['jobid']]['lastrun'];
|
@@ -377,7 +375,7 @@ function job_end() {
|
|
377 |
else
|
378 |
$jobs[$STATIC['JOB']['jobid']]['lastbackupdownloadurl']='';
|
379 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
380 |
-
|
381 |
//write header info
|
382 |
if (is_writable($STATIC['LOGFILE'])) {
|
383 |
$fd=fopen($STATIC['LOGFILE'],'r+');
|
@@ -415,12 +413,12 @@ function job_end() {
|
|
415 |
fclose($fd);
|
416 |
unlink($STATIC['LOGFILE']);
|
417 |
$STATIC['LOGFILE']=$STATIC['LOGFILE'].'.gz';
|
418 |
-
|
419 |
$jobs=get_option('backwpup_jobs');
|
420 |
$jobs[$STATIC['JOB']['jobid']]['logfile']=$STATIC['LOGFILE'];
|
421 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
422 |
}
|
423 |
-
|
424 |
//Send mail with log
|
425 |
$sendmail=false;
|
426 |
if ($WORKING['ERROR']>0 and $STATIC['JOB']['mailerroronly'] and !empty($STATIC['JOB']['mailaddresslog']))
|
@@ -458,7 +456,7 @@ function job_end() {
|
|
458 |
} else {
|
459 |
$mailbody=file_get_contents($STATIC['LOGFILE']);
|
460 |
}
|
461 |
-
|
462 |
$phpmailer->From = $STATIC['CFG']['mailsndemail'];
|
463 |
$phpmailer->FromName = $STATIC['CFG']['mailsndname'];
|
464 |
$phpmailer->AddAddress($STATIC['JOB']['mailaddresslog']);
|
@@ -474,7 +472,6 @@ function job_end() {
|
|
474 |
if (is_file($STATIC['TEMPDIR'].'.running')) {
|
475 |
update_working_file(true);
|
476 |
unlink($STATIC['TEMPDIR'].'.running');
|
477 |
-
rmdir($STATIC['TEMPDIR']);
|
478 |
clearstatcache();
|
479 |
}
|
480 |
mysql_close($mysqlconlink);
|
@@ -569,7 +566,7 @@ function job_shutdown($signal='') {
|
|
569 |
$header.= "User-Agent: BackWPup\r\n";
|
570 |
$header.= "Content-Type: application/x-www-form-urlencoded\r\n";
|
571 |
$header.= "Content-Length: ".strlen($query)."\r\n";
|
572 |
-
if (!empty($STATIC['CFG']['httpauthuser']) and !empty($STATIC['CFG']['httpauthpassword']))
|
573 |
$header.= "Authorization: Basic ".base64_encode($STATIC['CFG']['httpauthuser'].':'.backwpup_base64($STATIC['CFG']['httpauthpassword']))."\r\n";
|
574 |
$header.= "Connection: Close\r\n\r\n";
|
575 |
$header.=$query;
|
72 |
global $STATIC;
|
73 |
if (is_file($STATIC['TEMPDIR'].'.filelist') and $filelistfile=file_get_contents($STATIC['TEMPDIR'].'.filelist'))
|
74 |
return unserialize(trim($filelistfile));
|
75 |
+
else
|
76 |
return array();
|
77 |
}
|
78 |
|
100 |
}
|
101 |
|
102 |
function need_free_memory($memneed) {
|
103 |
+
if (!function_exists('memory_get_usage'))
|
104 |
return;
|
105 |
//need memory
|
106 |
$needmemory=@memory_get_usage(true)+inbytes($memneed);
|
152 |
}
|
153 |
|
154 |
function curl_progresscallback($download_size, $downloaded, $upload_size, $uploaded) {
|
155 |
+
global $WORKING;
|
156 |
if ($WORKING['STEPTODO']>10)
|
157 |
$WORKING['STEPDONE']=$uploaded;
|
158 |
update_working_file();
|
183 |
}
|
184 |
|
185 |
function update_working_file($mustwrite=false) {
|
186 |
+
global $WORKING,$STATIC,$savedmicrotime;
|
187 |
if (!is_file($STATIC['TEMPDIR'].'.running')) {
|
188 |
job_end();
|
189 |
return false;
|
190 |
}
|
191 |
+
if ($mustwrite or empty($runmicrotime) or $savedmicrotime<microtime()) { //only update all 1 sec.
|
192 |
if ($WORKING['STEPTODO']>0 and $WORKING['STEPDONE']>0)
|
193 |
$steppersent=round($WORKING['STEPDONE']/$WORKING['STEPTODO']*100);
|
194 |
else
|
198 |
else
|
199 |
$stepspersent=1;
|
200 |
@set_time_limit(0);
|
|
|
|
|
201 |
if (is_writable($STATIC['TEMPDIR'].'.running')) {
|
202 |
file_put_contents($STATIC['TEMPDIR'].'.running',serialize(array('timestamp'=>time(),'JOBID'=>$STATIC['JOB']['jobid'],'LOGFILE'=>$STATIC['LOGFILE'],'STEPSPERSENT'=>$stepspersent,'STEPPERSENT'=>$steppersent,'ABSPATH'=>$STATIC['WP']['ABSPATH'],'WORKING'=>$WORKING)));
|
203 |
+
$savedmicrotime=microtime()+1000;
|
204 |
}
|
205 |
}
|
206 |
return true;
|
211 |
if (!$mysqlconlink or !@mysql_ping($mysqlconlink)) {
|
212 |
// make a mysql connection
|
213 |
$mysqlconlink=mysql_connect($STATIC['WP']['DB_HOST'], $STATIC['WP']['DB_USER'], $STATIC['WP']['DB_PASSWORD'], true);
|
214 |
+
if (!$mysqlconlink)
|
215 |
trigger_error(sprintf(__('No MySQL connection: %s','backwpup'),mysql_error()),E_USER_ERROR);
|
216 |
//set connecten charset
|
217 |
if (!empty($STATIC['WP']['DB_CHARSET'])) {
|
237 |
$args = func_get_args(); // 0:errno, 1:errstr, 2:errfile, 3:errline
|
238 |
|
239 |
// if error has been supressed with an @
|
240 |
+
if (error_reporting()==0)
|
241 |
return;
|
242 |
+
|
243 |
$adderrorwarning=false;
|
244 |
|
245 |
switch ($args[0]) {
|
253 |
$adderrorwarning=true;
|
254 |
$message="<span class=\"warning\">".__('[WARNING]','backwpup')." ".$args[1]."</span>";
|
255 |
break;
|
256 |
+
case E_ERROR:
|
257 |
case E_USER_ERROR:
|
258 |
$WORKING['ERROR']++;
|
259 |
$adderrorwarning=true;
|
310 |
if ($args[0]==E_ERROR or $args[0]==E_CORE_ERROR or $args[0]==E_COMPILE_ERROR) {//Die on fatal php errors.
|
311 |
die();
|
312 |
}
|
313 |
+
|
314 |
//true for no more php error hadling.
|
315 |
return true;
|
316 |
+
}
|
317 |
|
318 |
//job end function
|
319 |
function job_end() {
|
320 |
global $WORKING,$STATIC,$mysqlconlink;
|
321 |
//check if job_end allredy runs
|
322 |
+
if (empty($WORKING['JOBENDINPROGRESS']) or !$WORKING['JOBENDINPROGRESS'])
|
323 |
$WORKING['JOBENDINPROGRESS']=true;
|
324 |
else
|
325 |
return;
|
346 |
trigger_error(sprintf(_n('One old log deleted','%d old logs deleted',$numdeltefiles,'backwpup'),$numdeltefiles),E_USER_NOTICE);
|
347 |
}
|
348 |
}
|
349 |
+
//Display job working time
|
350 |
+
trigger_error(sprintf(__('Job done in %s sec.','backwpup'),time()-$STATIC['JOB']['starttime']),E_USER_NOTICE);
|
351 |
+
|
352 |
if (empty($STATIC['backupfile']) or !is_file($STATIC['JOB']['backupdir'].$STATIC['backupfile']) or !($filesize=filesize($STATIC['JOB']['backupdir'].$STATIC['backupfile']))) //Set the filezie corectly
|
353 |
$filesize=0;
|
354 |
|
363 |
}
|
364 |
closedir($dir);
|
365 |
}
|
366 |
+
|
367 |
$jobs=get_option('backwpup_jobs');
|
368 |
$jobs[$STATIC['JOB']['jobid']]['lastrun']=$jobs[$STATIC['JOB']['jobid']]['starttime'];
|
369 |
$STATIC['JOB']['lastrun']=$jobs[$STATIC['JOB']['jobid']]['lastrun'];
|
375 |
else
|
376 |
$jobs[$STATIC['JOB']['jobid']]['lastbackupdownloadurl']='';
|
377 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
378 |
+
|
379 |
//write header info
|
380 |
if (is_writable($STATIC['LOGFILE'])) {
|
381 |
$fd=fopen($STATIC['LOGFILE'],'r+');
|
413 |
fclose($fd);
|
414 |
unlink($STATIC['LOGFILE']);
|
415 |
$STATIC['LOGFILE']=$STATIC['LOGFILE'].'.gz';
|
416 |
+
|
417 |
$jobs=get_option('backwpup_jobs');
|
418 |
$jobs[$STATIC['JOB']['jobid']]['logfile']=$STATIC['LOGFILE'];
|
419 |
update_option('backwpup_jobs',$jobs); //Save Settings
|
420 |
}
|
421 |
+
|
422 |
//Send mail with log
|
423 |
$sendmail=false;
|
424 |
if ($WORKING['ERROR']>0 and $STATIC['JOB']['mailerroronly'] and !empty($STATIC['JOB']['mailaddresslog']))
|
456 |
} else {
|
457 |
$mailbody=file_get_contents($STATIC['LOGFILE']);
|
458 |
}
|
459 |
+
|
460 |
$phpmailer->From = $STATIC['CFG']['mailsndemail'];
|
461 |
$phpmailer->FromName = $STATIC['CFG']['mailsndname'];
|
462 |
$phpmailer->AddAddress($STATIC['JOB']['mailaddresslog']);
|
472 |
if (is_file($STATIC['TEMPDIR'].'.running')) {
|
473 |
update_working_file(true);
|
474 |
unlink($STATIC['TEMPDIR'].'.running');
|
|
|
475 |
clearstatcache();
|
476 |
}
|
477 |
mysql_close($mysqlconlink);
|
566 |
$header.= "User-Agent: BackWPup\r\n";
|
567 |
$header.= "Content-Type: application/x-www-form-urlencoded\r\n";
|
568 |
$header.= "Content-Length: ".strlen($query)."\r\n";
|
569 |
+
if (!empty($STATIC['CFG']['httpauthuser']) and !empty($STATIC['CFG']['httpauthpassword']))
|
570 |
$header.= "Authorization: Basic ".base64_encode($STATIC['CFG']['httpauthuser'].':'.backwpup_base64($STATIC['CFG']['httpauthpassword']))."\r\n";
|
571 |
$header.= "Connection: Close\r\n\r\n";
|
572 |
$header.=$query;
|
job/job_start.php
CHANGED
@@ -239,6 +239,5 @@ function backwpup_jobstart($jobid='',$cronstart=false) {
|
|
239 |
$httpauthheader=array( 'Authorization' => 'Basic '.base64_encode($backwpup_static['CFG']['httpauthuser'].':'.backwpup_base64($backwpup_static['CFG']['httpauthpassword'])));
|
240 |
if (!$backwpup_static['WP']['ALTERNATE_CRON'])
|
241 |
wp_remote_post($backwpup_static['JOBRUNURL'], array('timeout' => 3, 'blocking' => false, 'sslverify' => false, 'headers'=>$httpauthheader ,'body'=>array('nonce'=>$backwpup_working['NONCE'], 'type'=>'start'), 'user-agent'=>'BackWPup'));
|
242 |
-
backwpup_api(true);
|
243 |
return $backwpup_static['LOGFILE'];
|
244 |
}
|
239 |
$httpauthheader=array( 'Authorization' => 'Basic '.base64_encode($backwpup_static['CFG']['httpauthuser'].':'.backwpup_base64($backwpup_static['CFG']['httpauthpassword'])));
|
240 |
if (!$backwpup_static['WP']['ALTERNATE_CRON'])
|
241 |
wp_remote_post($backwpup_static['JOBRUNURL'], array('timeout' => 3, 'blocking' => false, 'sslverify' => false, 'headers'=>$httpauthheader ,'body'=>array('nonce'=>$backwpup_working['NONCE'], 'type'=>'start'), 'user-agent'=>'BackWPup'));
|
|
|
242 |
return $backwpup_static['LOGFILE'];
|
243 |
}
|
libs/aws/README.md
CHANGED
@@ -119,7 +119,39 @@ your project with:
|
|
119 |
|
120 |
require_once 'AWSSDKforPHP/sdk.class.php';
|
121 |
|
122 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
1. Copy the contents of [config-sample.inc.php](https://github.com/amazonwebservices/aws-sdk-for-php/raw/master/config-sample.inc.php)
|
125 |
and add your credentials as instructed in the file.
|
119 |
|
120 |
require_once 'AWSSDKforPHP/sdk.class.php';
|
121 |
|
122 |
+
### Via Composer
|
123 |
+
|
124 |
+
[Composer](http://getcomposer.org) is a newer dependency manager for PHP, and is now supported by the SDK.
|
125 |
+
|
126 |
+
In order to use the AWS SDK for PHP via Composer, you must do the following:
|
127 |
+
|
128 |
+
1. Add ``amazonwebservices/aws-sdk-for-php`` as a dependency in your project's ``composer.json`` file:
|
129 |
+
|
130 |
+
{
|
131 |
+
"require": {
|
132 |
+
"amazonwebservices/aws-sdk-for-php": "*"
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
Consider tightening your dependencies to a known version when deploying mission critical applications (e.g. ``1.5.*``).
|
137 |
+
|
138 |
+
2. Download and install Composer:
|
139 |
+
|
140 |
+
curl -s http://getcomposer.org/installer | php
|
141 |
+
|
142 |
+
3. Install your dependencies:
|
143 |
+
|
144 |
+
php composer.phar install
|
145 |
+
|
146 |
+
4. Require Composer's autoloader
|
147 |
+
|
148 |
+
Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process:
|
149 |
+
|
150 |
+
require 'vendor/autoload.php';
|
151 |
+
|
152 |
+
You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at [getcomposer.org](http://getcomposer.org).
|
153 |
+
|
154 |
+
## Configuration
|
155 |
|
156 |
1. Copy the contents of [config-sample.inc.php](https://github.com/amazonwebservices/aws-sdk-for-php/raw/master/config-sample.inc.php)
|
157 |
and add your credentials as instructed in the file.
|
libs/aws/lib/dom/ArrayToDOMDocument.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
class Array2DOM
|
8 |
{
|
9 |
const ATTRIBUTES = '__attributes__';
|
10 |
-
const CONTENT
|
11 |
|
12 |
/**
|
13 |
* @param array $source
|
7 |
class Array2DOM
|
8 |
{
|
9 |
const ATTRIBUTES = '__attributes__';
|
10 |
+
const CONTENT = '__content__';
|
11 |
|
12 |
/**
|
13 |
* @param array $source
|
libs/aws/lib/dom/Transmogrifier.php
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2010-2012 [Ryan Parman](http://ryanparman.com)
|
4 |
+
* Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
|
5 |
+
*
|
6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
+
* of this software and associated documentation files (the "Software"), to deal
|
8 |
+
* in the Software without restriction, including without limitation the rights
|
9 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
+
* copies of the Software, and to permit persons to whom the Software is
|
11 |
+
* furnished to do so, subject to the following conditions:
|
12 |
+
*
|
13 |
+
* The above copyright notice and this permission notice shall be included in
|
14 |
+
* all copies or substantial portions of the Software.
|
15 |
+
*
|
16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
+
* THE SOFTWARE.
|
23 |
+
*
|
24 |
+
* <http://www.opensource.org/licenses/mit-license.php>
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Magically transmogrifies arrays into XML documents.
|
30 |
+
*/
|
31 |
+
class Transmogrifier
|
32 |
+
{
|
33 |
+
/******************************************************************************/
|
34 |
+
// CONSTANTS
|
35 |
+
|
36 |
+
const ATTRIBUTES = '__attributes__';
|
37 |
+
const CONTENT = '__content__';
|
38 |
+
|
39 |
+
|
40 |
+
/******************************************************************************/
|
41 |
+
// PUBLIC METHODS
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Public method for converting an array into an XML DOMDocument object.
|
45 |
+
*
|
46 |
+
* @param array $source The source array to convert into an XML document.
|
47 |
+
* @param string $rootTagName The name to assign to the root element of the XML document. The default value is "root".
|
48 |
+
* @return string The XML document as a string.
|
49 |
+
*/
|
50 |
+
public static function to_dom(array $source, $rootTagName = 'root')
|
51 |
+
{
|
52 |
+
$document = new DOMDocument();
|
53 |
+
|
54 |
+
// Generate the document
|
55 |
+
$root = $document->createElement('root');
|
56 |
+
$root->appendChild(self::create_dom_element_from_array($source, 'member', $document));
|
57 |
+
$document->appendChild($root);
|
58 |
+
|
59 |
+
// Cleanup duplicated notes
|
60 |
+
self::cleanup($document);
|
61 |
+
|
62 |
+
return $document;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Public method for converting an array into an XML document.
|
67 |
+
*
|
68 |
+
* @param array $source The source array to convert into an XML document.
|
69 |
+
* @param string $rootTagName The name to assign to the root element of the XML document. The default value is "root".
|
70 |
+
* @return string The XML document as a string.
|
71 |
+
*/
|
72 |
+
public static function to_xml(array $source, $rootTagName = 'root')
|
73 |
+
{
|
74 |
+
$document = self::to_dom($source, $rootTagName);
|
75 |
+
|
76 |
+
// Output the content
|
77 |
+
$document->formatOutput = true;
|
78 |
+
return $document->saveXML();
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/******************************************************************************/
|
83 |
+
// WORKER METHODS
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Recursively iterates over each child of the array to produce an XML structure.
|
87 |
+
*
|
88 |
+
* @param mixed $source The content node that is being evaluated.
|
89 |
+
* @param string $tagName The name of the current element.
|
90 |
+
* @param DOMDocument $document The parent-most DOMDocument element that we're writing to.
|
91 |
+
* @return DOMDocumentFragment A DOM document fragment that can be appended to a parent DOM element.
|
92 |
+
*/
|
93 |
+
protected static function create_dom_element_from_array($source, $tagName, DOMDocument $document, $parent = null)
|
94 |
+
{
|
95 |
+
// Create a document fragment to hold the elements
|
96 |
+
$fragment = $document->createDocumentFragment();
|
97 |
+
|
98 |
+
if (is_numeric($tagName))
|
99 |
+
{
|
100 |
+
$tagName = $parent->tagName;
|
101 |
+
}
|
102 |
+
|
103 |
+
if (is_array($source))
|
104 |
+
{
|
105 |
+
// Indexed array
|
106 |
+
if (self::is_list($source))
|
107 |
+
{
|
108 |
+
// Loop through each entry in the array
|
109 |
+
foreach ($source as $key => $value)
|
110 |
+
{
|
111 |
+
// Create a new element where the name is the array key
|
112 |
+
$element = $document->createElement($tagName);
|
113 |
+
$fragment->appendChild($element);
|
114 |
+
|
115 |
+
// Recurse
|
116 |
+
$fragment_with_children = self::create_dom_element_from_array($value, $tagName, $document, $element);
|
117 |
+
|
118 |
+
// Verify the fragment has children before appending it
|
119 |
+
if ($fragment_with_children->hasChildNodes())
|
120 |
+
{
|
121 |
+
$element->appendChild($fragment_with_children);
|
122 |
+
}
|
123 |
+
|
124 |
+
// Figure out which nodes need to be removed
|
125 |
+
if ($parent && $parent->tagName === $tagName)
|
126 |
+
{
|
127 |
+
$parent->setAttribute('remove', true);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
// Associative array
|
133 |
+
elseif (self::is_hash($source))
|
134 |
+
{
|
135 |
+
// Loop through each entry in the array
|
136 |
+
foreach ($source as $key => $value)
|
137 |
+
{
|
138 |
+
// Handle custom attributes
|
139 |
+
if ($key === self::ATTRIBUTES)
|
140 |
+
{
|
141 |
+
foreach ($value as $attributeName => $attributeValue)
|
142 |
+
{
|
143 |
+
$parent->setAttribute($attributeName, $attributeValue);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
// Handle content nodes
|
148 |
+
elseif ($key === self::CONTENT)
|
149 |
+
{
|
150 |
+
$parent->appendChild($document->createCDATASection($value));
|
151 |
+
}
|
152 |
+
|
153 |
+
else
|
154 |
+
{
|
155 |
+
// Create a new element where the name is the array key
|
156 |
+
$element = $document->createElement($key);
|
157 |
+
$fragment->appendChild($element);
|
158 |
+
|
159 |
+
// Recurse
|
160 |
+
$fragment_with_children = self::create_dom_element_from_array($value, $key, $document, $element);
|
161 |
+
|
162 |
+
// Verify the fragment has children before appending it
|
163 |
+
if ($fragment_with_children->hasChildNodes())
|
164 |
+
{
|
165 |
+
$element->appendChild($fragment_with_children);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
// Content node
|
173 |
+
else
|
174 |
+
{
|
175 |
+
$fragment->appendChild(self::handle_content($source, $document, $parent));
|
176 |
+
}
|
177 |
+
|
178 |
+
return $fragment;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Handle nodes that are only content.
|
183 |
+
*
|
184 |
+
* @param mixed $content The content node to handle.
|
185 |
+
* @param DOMDocument $document The parent-most DOMDocument element that we're writing to.
|
186 |
+
* @param DOMElement $element The parent node of the content to mark as encoded.
|
187 |
+
* @return DOMDocumentFragment A DOM document fragment that can be appended to a parent DOM element.
|
188 |
+
*/
|
189 |
+
protected static function handle_content($content, DOMDocument $document, DOMElement $element)
|
190 |
+
{
|
191 |
+
$fragment = $document->createDocumentFragment();
|
192 |
+
|
193 |
+
// boolean
|
194 |
+
if (is_bool($content))
|
195 |
+
{
|
196 |
+
$fragment->appendChild(
|
197 |
+
$document->createCDATASection(
|
198 |
+
($content ? 'true' : 'false')
|
199 |
+
)
|
200 |
+
);
|
201 |
+
}
|
202 |
+
|
203 |
+
// numbers
|
204 |
+
elseif (is_numeric($content))
|
205 |
+
{
|
206 |
+
$fragment->appendChild(
|
207 |
+
$document->createTextNode($content)
|
208 |
+
);
|
209 |
+
}
|
210 |
+
|
211 |
+
// strings?
|
212 |
+
else
|
213 |
+
{
|
214 |
+
// Handle NULL bytes
|
215 |
+
if (strpos($content, "\0") !== false)
|
216 |
+
{
|
217 |
+
$content = 'json_encoded::' . json_encode($content);
|
218 |
+
$element->setAttribute('encoded', 'json');
|
219 |
+
}
|
220 |
+
|
221 |
+
$fragment->appendChild(
|
222 |
+
$document->createCDATASection($content)
|
223 |
+
);
|
224 |
+
}
|
225 |
+
|
226 |
+
return $fragment;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Clean-up the duplicate nodes caused by not being able to reference
|
231 |
+
* grandparent nodes during the recursion flow.
|
232 |
+
*
|
233 |
+
* @param DOMDocument $document The XML document to clean-up.
|
234 |
+
* @return DOMDocument The original XML document.
|
235 |
+
*/
|
236 |
+
protected static function cleanup(DOMDocument $document)
|
237 |
+
{
|
238 |
+
// Find matches
|
239 |
+
$xpath = new DOMXPath($document);
|
240 |
+
$entries = $xpath->query('//*[@remove]');
|
241 |
+
|
242 |
+
// Loop through matches and find each node with a "remove" attribute
|
243 |
+
foreach ($entries as $entry)
|
244 |
+
{
|
245 |
+
// Grab a reference to this so that it doesn't dynamically move on us
|
246 |
+
$next_sibling = $entry->nextSibling;
|
247 |
+
|
248 |
+
// Look through each child node and add it to the parent node
|
249 |
+
while ($entry->childNodes->length > 0)
|
250 |
+
{
|
251 |
+
// If there's a next sibling, let's insert before it
|
252 |
+
if ($next_sibling)
|
253 |
+
{
|
254 |
+
$entry->parentNode->insertBefore($entry->childNodes->item(0), $next_sibling);
|
255 |
+
}
|
256 |
+
|
257 |
+
// Otherwise, just add it to the end
|
258 |
+
else
|
259 |
+
{
|
260 |
+
$entry->parentNode->appendChild($entry->childNodes->item(0));
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
// If there aren't any more child nodes, remove the entry
|
265 |
+
if (!$entry->hasChildNodes())
|
266 |
+
{
|
267 |
+
$entry->parentNode->removeChild($entry);
|
268 |
+
}
|
269 |
+
}
|
270 |
+
}
|
271 |
+
|
272 |
+
|
273 |
+
/******************************************************************************/
|
274 |
+
// UTILITY METHODS
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Method that checks to see if the array is indexed.
|
278 |
+
*
|
279 |
+
* @param array $array The array to test.
|
280 |
+
* @return boolean Whether or not the array is indexed. A value of true means that the array is indexed. A value of false means that the array is associative.
|
281 |
+
*/
|
282 |
+
protected static function is_list(array $array)
|
283 |
+
{
|
284 |
+
foreach ($array as $key => $value)
|
285 |
+
{
|
286 |
+
// If any keys are non-numeric...
|
287 |
+
if (!is_numeric($key))
|
288 |
+
{
|
289 |
+
// Then this is not a list
|
290 |
+
return false;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
return true;
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Method that checks to see if the array is associative.
|
299 |
+
*
|
300 |
+
* @param array $array The array to test.
|
301 |
+
* @return boolean Whether or not the array is associative. A value of true means that the array is associative. A value of false means that the array is indexed.
|
302 |
+
*/
|
303 |
+
protected static function is_hash(array $array)
|
304 |
+
{
|
305 |
+
foreach ($array as $key => $value)
|
306 |
+
{
|
307 |
+
// If any keys are non-numeric...
|
308 |
+
if (!is_numeric($key))
|
309 |
+
{
|
310 |
+
// Then this is a hash
|
311 |
+
return true;
|
312 |
+
}
|
313 |
+
}
|
314 |
+
|
315 |
+
return false;
|
316 |
+
}
|
317 |
+
}
|
libs/aws/lib/requestcore/requestcore.class.php
CHANGED
@@ -685,6 +685,11 @@ class RequestCore
|
|
685 |
{
|
686 |
$temp_headers = array();
|
687 |
|
|
|
|
|
|
|
|
|
|
|
688 |
foreach ($this->request_headers as $k => $v)
|
689 |
{
|
690 |
$temp_headers[] = $k . ': ' . $v;
|
685 |
{
|
686 |
$temp_headers = array();
|
687 |
|
688 |
+
if (!array_key_exists('Expect', $this->request_headers))
|
689 |
+
{
|
690 |
+
$this->request_headers['Expect'] = '';
|
691 |
+
}
|
692 |
+
|
693 |
foreach ($this->request_headers as $k => $v)
|
694 |
{
|
695 |
$temp_headers[] = $k . ': ' . $v;
|
libs/aws/sdk.class.php
CHANGED
@@ -115,8 +115,8 @@ function __aws_sdk_ua_callback()
|
|
115 |
// INTERMEDIARY CONSTANTS
|
116 |
|
117 |
define('CFRUNTIME_NAME', 'aws-sdk-php');
|
118 |
-
define('CFRUNTIME_VERSION', '1.5.
|
119 |
-
define('CFRUNTIME_BUILD', '
|
120 |
define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . str_replace(' ', '_', php_uname('s')) . '/' . str_replace(' ', '_', php_uname('r')) . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . __aws_sdk_ua_callback());
|
121 |
|
122 |
|
@@ -1439,10 +1439,10 @@ class CFLoader
|
|
1439 |
return false;
|
1440 |
}
|
1441 |
|
1442 |
-
// Load
|
1443 |
-
elseif (strstr($class, '
|
1444 |
{
|
1445 |
-
if (file_exists($require_this = $path . 'lib' . DIRECTORY_SEPARATOR . 'dom' . DIRECTORY_SEPARATOR . '
|
1446 |
{
|
1447 |
require_once $require_this;
|
1448 |
return true;
|
115 |
// INTERMEDIARY CONSTANTS
|
116 |
|
117 |
define('CFRUNTIME_NAME', 'aws-sdk-php');
|
118 |
+
define('CFRUNTIME_VERSION', '1.5.11');
|
119 |
+
define('CFRUNTIME_BUILD', '20120801150000');
|
120 |
define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . str_replace(' ', '_', php_uname('s')) . '/' . str_replace(' ', '_', php_uname('r')) . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . __aws_sdk_ua_callback());
|
121 |
|
122 |
|
1439 |
return false;
|
1440 |
}
|
1441 |
|
1442 |
+
// Load Transmogrifier
|
1443 |
+
elseif (strstr($class, 'Transmogrifier'))
|
1444 |
{
|
1445 |
+
if (file_exists($require_this = $path . 'lib' . DIRECTORY_SEPARATOR . 'dom' . DIRECTORY_SEPARATOR . 'Transmogrifier.php'))
|
1446 |
{
|
1447 |
require_once $require_this;
|
1448 |
return true;
|
libs/aws/services/dynamodb.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
* Amazon DynamoDB removes traditional scalability limitations on data storage while maintaining
|
22 |
* low latency and predictable performance.
|
23 |
*
|
24 |
-
* @version 2012.
|
25 |
* @license See the included NOTICE.md file for complete information.
|
26 |
* @copyright See the included NOTICE.md file for complete information.
|
27 |
* @link http://aws.amazon.com/dynamodb/ Amazon DynamoDB
|
@@ -258,39 +258,10 @@ class AmazonDynamoDB extends CFRuntime
|
|
258 |
{
|
259 |
$this->api_version = '2011-12-05';
|
260 |
$this->hostname = self::DEFAULT_URL;
|
261 |
-
$this->auth_class = '
|
262 |
$this->operation_prefix = 'x-amz-target:DynamoDB_20111205.';
|
263 |
|
264 |
parent::__construct($options);
|
265 |
-
|
266 |
-
// Only attempt to get STS credentials if there is no token (i.e. they
|
267 |
-
// are not already using STS or instance profile credentials)
|
268 |
-
if (!$this->auth_token)
|
269 |
-
{
|
270 |
-
// Default caching mechanism is required
|
271 |
-
if (!$this->credentials->default_cache_config)
|
272 |
-
{
|
273 |
-
// @codeCoverageIgnoreStart
|
274 |
-
throw new DynamoDB_Exception('The DynamoDB class requires the '
|
275 |
-
. '"default_cache_config" option to be set in the '
|
276 |
-
. 'config.inc.php file or AmazonDynamoDB constructor.');
|
277 |
-
// @codeCoverageIgnoreEnd
|
278 |
-
}
|
279 |
-
|
280 |
-
// Instantiate and invoke the cache
|
281 |
-
$cache_id = $this->key . '_sts_credentials_' . sha1(serialize($options));
|
282 |
-
$cache = new $this->cache_class($cache_id, $this->cache_location, 0, $this->cache_compress);
|
283 |
-
if ($data = $cache->read())
|
284 |
-
{
|
285 |
-
$cache->expire_in((strtotime($data['expires']) - time()) * 0.85);
|
286 |
-
}
|
287 |
-
$sts_credentials = $cache->response_manager(array($this, 'cache_sts_credentials'), array($cache, $options));
|
288 |
-
|
289 |
-
// Store the credentials inside the class
|
290 |
-
$this->key = $sts_credentials['key'];
|
291 |
-
$this->secret_key = $sts_credentials['secret'];
|
292 |
-
$this->auth_token = $sts_credentials['token'];
|
293 |
-
}
|
294 |
}
|
295 |
|
296 |
|
21 |
* Amazon DynamoDB removes traditional scalability limitations on data storage while maintaining
|
22 |
* low latency and predictable performance.
|
23 |
*
|
24 |
+
* @version 2012.06.21
|
25 |
* @license See the included NOTICE.md file for complete information.
|
26 |
* @copyright See the included NOTICE.md file for complete information.
|
27 |
* @link http://aws.amazon.com/dynamodb/ Amazon DynamoDB
|
258 |
{
|
259 |
$this->api_version = '2011-12-05';
|
260 |
$this->hostname = self::DEFAULT_URL;
|
261 |
+
$this->auth_class = 'AuthV4JSON';
|
262 |
$this->operation_prefix = 'x-amz-target:DynamoDB_20111205.';
|
263 |
|
264 |
parent::__construct($options);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
|
libs/aws/services/ec2.class.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
*
|
30 |
* Visit <a href="http://aws.amazon.com/ec2/">http://aws.amazon.com/ec2/</a> for more information.
|
31 |
*
|
32 |
-
* @version 2012.
|
33 |
* @license See the included NOTICE.md file for complete information.
|
34 |
* @copyright See the included NOTICE.md file for complete information.
|
35 |
* @link http://aws.amazon.com/ec2/ Amazon EC2
|
@@ -138,7 +138,7 @@ class AmazonEC2 extends CFRuntime
|
|
138 |
*/
|
139 |
public function __construct(array $options = array())
|
140 |
{
|
141 |
-
$this->api_version = '2012-
|
142 |
$this->hostname = self::DEFAULT_URL;
|
143 |
$this->auth_class = 'AuthV2Query';
|
144 |
|
@@ -181,6 +181,10 @@ class AmazonEC2 extends CFRuntime
|
|
181 |
const INSTANCE_CLUSTER_8XLARGE = 'cc2.8xlarge';
|
182 |
const INSTANCE_CLUSTER_GPU_XLARGE = 'cg1.4xlarge';
|
183 |
|
|
|
|
|
|
|
|
|
184 |
/*%******************************************************************************************%*/
|
185 |
// SETTERS
|
186 |
|
@@ -238,6 +242,35 @@ class AmazonEC2 extends CFRuntime
|
|
238 |
return $this->authenticate('AllocateAddress', $opt);
|
239 |
}
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
/**
|
242 |
* The AssociateAddress operation associates an elastic IP address with an instance.
|
243 |
*
|
@@ -250,6 +283,8 @@ class AmazonEC2 extends CFRuntime
|
|
250 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
251 |
* <li><code>AllocationId</code> - <code>string</code> - Optional - The allocation ID that AWS returned when you allocated the elastic IP address for use with Amazon VPC.</li>
|
252 |
* <li><code>NetworkInterfaceId</code> - <code>string</code> - Optional - </li>
|
|
|
|
|
253 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
254 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
255 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -721,6 +756,22 @@ class AmazonEC2 extends CFRuntime
|
|
721 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
722 |
* <li><code>Description</code> - <code>string</code> - Optional - The description for the new AMI being created.</li>
|
723 |
* <li><code>NoReboot</code> - <code>boolean</code> - Optional - By default this property is set to <code>false</code>, which means Amazon EC2 attempts to cleanly shut down the instance before image creation and reboots the instance afterwards. When set to true, Amazon EC2 will not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed.</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
724 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
725 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
726 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -730,6 +781,15 @@ class AmazonEC2 extends CFRuntime
|
|
730 |
if (!$opt) $opt = array();
|
731 |
$opt['InstanceId'] = $instance_id;
|
732 |
$opt['Name'] = $name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
733 |
|
734 |
return $this->authenticate('CreateImage', $opt);
|
735 |
}
|
@@ -903,6 +963,13 @@ class AmazonEC2 extends CFRuntime
|
|
903 |
* <li><code>Description</code> - <code>string</code> - Optional - </li>
|
904 |
* <li><code>PrivateIpAddress</code> - <code>string</code> - Optional - </li>
|
905 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
906 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
907 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
908 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -920,6 +987,15 @@ class AmazonEC2 extends CFRuntime
|
|
920 |
)));
|
921 |
unset($opt['SecurityGroupId']);
|
922 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
923 |
|
924 |
return $this->authenticate('CreateNetworkInterface', $opt);
|
925 |
}
|
@@ -1154,6 +1230,8 @@ class AmazonEC2 extends CFRuntime
|
|
1154 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1155 |
* <li><code>Size</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes. Required if you are not creating a volume from a snapshot.</li>
|
1156 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which to create the new volume.</li>
|
|
|
|
|
1157 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1158 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
1159 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -1953,11 +2031,7 @@ class AmazonEC2 extends CFRuntime
|
|
1953 |
*
|
1954 |
*
|
1955 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1956 |
-
* <li><code>ExportTaskId</code> - <code>array</code> - Optional -
|
1957 |
-
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
1958 |
-
* <li><code>ExportTaskId</code> - <code>string</code> - Optional - </li>
|
1959 |
-
* </ul></li>
|
1960 |
-
* </ul></li>
|
1961 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1962 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
1963 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -1966,11 +2040,11 @@ class AmazonEC2 extends CFRuntime
|
|
1966 |
{
|
1967 |
if (!$opt) $opt = array();
|
1968 |
|
1969 |
-
// Optional list
|
1970 |
if (isset($opt['ExportTaskId']))
|
1971 |
{
|
1972 |
$opt = array_merge($opt, CFComplexType::map(array(
|
1973 |
-
'ExportTaskId' => $opt['ExportTaskId']
|
1974 |
)));
|
1975 |
unset($opt['ExportTaskId']);
|
1976 |
}
|
@@ -2099,7 +2173,7 @@ class AmazonEC2 extends CFRuntime
|
|
2099 |
* call.
|
2100 |
*
|
2101 |
* @param string $instance_id (Required) The ID of the instance whose instance attribute is being described.
|
2102 |
-
* @param string $attribute (Required) The name of the attribute to describe. Available attribute names: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code> [Allowed values: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code>, <code>productCodes</code>, <code>sourceDestCheck</code>, <code>groupSet</code>]
|
2103 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
2104 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
2105 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
@@ -2634,7 +2708,7 @@ class AmazonEC2 extends CFRuntime
|
|
2634 |
*
|
2635 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
2636 |
* <li><code>ReservedInstancesOfferingId</code> - <code>string|array</code> - Optional - An optional list of the unique IDs of the Reserved Instance offerings to describe. Pass a string for a single value, or an indexed array for multiple values.</li>
|
2637 |
-
* <li><code>InstanceType</code> - <code>string</code> - Optional - The instance type on which the Reserved Instance can be used. [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
2638 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The Availability Zone in which the Reserved Instance can be used.</li>
|
2639 |
* <li><code>ProductDescription</code> - <code>string</code> - Optional - The Reserved Instance product description.</li>
|
2640 |
* <li><code>Filter</code> - <code>array</code> - Optional - A list of filters used to match properties for ReservedInstancesOfferings. For a complete reference to the available filter keys for this operation, see the <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/">Amazon EC2 API reference</a>. <ul>
|
@@ -3595,7 +3669,7 @@ class AmazonEC2 extends CFRuntime
|
|
3595 |
* <li><code>SecurityGroup</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
3596 |
* <li><code>AdditionalInfo</code> - <code>string</code> - Optional - </li>
|
3597 |
* <li><code>UserData</code> - <code>string</code> - Optional - </li>
|
3598 |
-
* <li><code>InstanceType</code> - <code>string</code> - Optional - [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
3599 |
* <li><code>Placement</code> - <code>array</code> - Optional - Describes where an Amazon EC2 instance is running within an Amazon EC2 region. <ul>
|
3600 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
3601 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The availability zone in which an Amazon EC2 instance runs.</li>
|
@@ -3612,6 +3686,8 @@ class AmazonEC2 extends CFRuntime
|
|
3612 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
3613 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
3614 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
|
|
|
|
3615 |
* </ul></li>
|
3616 |
* </ul></li>
|
3617 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
@@ -3831,7 +3907,7 @@ class AmazonEC2 extends CFRuntime
|
|
3831 |
*
|
3832 |
* @param string $instance_id (Required) The ID of the instance whose attribute is being modified.
|
3833 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
3834 |
-
* <li><code>Attribute</code> - <code>string</code> - Optional - The name of the attribute being modified. Available attribute names: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDevice</code>, <code>blockDeviceMapping</code> [Allowed values: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code>, <code>productCodes</code>, <code>sourceDestCheck</code>, <code>groupSet</code>]</li>
|
3835 |
* <li><code>Value</code> - <code>string</code> - Optional - The new value of the instance attribute being modified. Only valid when <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code> or <code>instanceInitiateShutdownBehavior</code> is specified as the attribute being modified.</li>
|
3836 |
* <li><code>BlockDeviceMapping</code> - <code>array</code> - Optional - The new block device mappings for the instance whose attributes are being modified. Only valid when blockDeviceMapping is specified as the attribute being modified. <ul>
|
3837 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
@@ -3854,6 +3930,7 @@ class AmazonEC2 extends CFRuntime
|
|
3854 |
* <li><code>UserData.Value</code> - <code>string</code> - Optional - String value</li>
|
3855 |
* <li><code>InstanceInitiatedShutdownBehavior.Value</code> - <code>string</code> - Optional - String value</li>
|
3856 |
* <li><code>GroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
3857 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
3858 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
3859 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -4106,6 +4183,8 @@ class AmazonEC2 extends CFRuntime
|
|
4106 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
4107 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
4108 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
|
|
|
|
4109 |
* </ul></li>
|
4110 |
* </ul></li>
|
4111 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
@@ -4376,7 +4455,7 @@ class AmazonEC2 extends CFRuntime
|
|
4376 |
* <li><code>SecurityGroup</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4377 |
* <li><code>UserData</code> - <code>string</code> - Optional - Optional data, specific to a user's application, to provide in the launch request. All instances that collectively comprise the launch request have access to this data. User data is never returned through API responses.</li>
|
4378 |
* <li><code>AddressingType</code> - <code>string</code> - Optional - </li>
|
4379 |
-
* <li><code>InstanceType</code> - <code>string</code> - Optional - Specifies the instance type. [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
4380 |
* <li><code>Placement</code> - <code>array</code> - Optional - Defines a placement item. <ul>
|
4381 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
4382 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The availability zone in which an Amazon EC2 instance runs.</li>
|
@@ -4394,6 +4473,8 @@ class AmazonEC2 extends CFRuntime
|
|
4394 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
4395 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
4396 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
|
|
|
|
4397 |
* </ul></li>
|
4398 |
* </ul></li>
|
4399 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
@@ -4410,6 +4491,13 @@ class AmazonEC2 extends CFRuntime
|
|
4410 |
* <li><code>PrivateIpAddress</code> - <code>string</code> - Optional - </li>
|
4411 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4412 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - </li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4413 |
* </ul></li>
|
4414 |
* </ul></li>
|
4415 |
* <li><code>IamInstanceProfile</code> - <code>array</code> - Optional - <ul>
|
@@ -4418,6 +4506,7 @@ class AmazonEC2 extends CFRuntime
|
|
4418 |
* <li><code>Name</code> - <code>string</code> - Optional - </li>
|
4419 |
* </ul></li>
|
4420 |
* </ul></li>
|
|
|
4421 |
* </ul></li>
|
4422 |
* </ul></li>
|
4423 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
@@ -4480,7 +4569,7 @@ class AmazonEC2 extends CFRuntime
|
|
4480 |
* Resets an attribute of an instance to its default value.
|
4481 |
*
|
4482 |
* @param string $instance_id (Required) The ID of the Amazon EC2 instance whose attribute is being reset.
|
4483 |
-
* @param string $attribute (Required) The name of the attribute being reset. Available attribute names: <code>kernel</code>, <code>ramdisk</code> [Allowed values: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code>, <code>productCodes</code>, <code>sourceDestCheck</code>, <code>groupSet</code>]
|
4484 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
4485 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4486 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
@@ -4688,7 +4777,7 @@ class AmazonEC2 extends CFRuntime
|
|
4688 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4689 |
* <li><code>UserData</code> - <code>string</code> - Optional - Specifies additional information to make available to the instance(s).</li>
|
4690 |
* <li><code>AddressingType</code> - <code>string</code> - Optional - </li>
|
4691 |
-
* <li><code>InstanceType</code> - <code>string</code> - Optional - Specifies the instance type for the launched instances. [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
4692 |
* <li><code>Placement</code> - <code>array</code> - Optional - Specifies the placement constraints (Availability Zones) for launching the instances. <ul>
|
4693 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
4694 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The availability zone in which an Amazon EC2 instance runs.</li>
|
@@ -4707,6 +4796,8 @@ class AmazonEC2 extends CFRuntime
|
|
4707 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
4708 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
4709 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
|
|
|
|
4710 |
* </ul></li>
|
4711 |
* </ul></li>
|
4712 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
@@ -4732,6 +4823,13 @@ class AmazonEC2 extends CFRuntime
|
|
4732 |
* <li><code>PrivateIpAddress</code> - <code>string</code> - Optional - </li>
|
4733 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4734 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - </li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4735 |
* </ul></li>
|
4736 |
* </ul></li>
|
4737 |
* <li><code>IamInstanceProfile</code> - <code>array</code> - Optional - <ul>
|
@@ -4740,6 +4838,7 @@ class AmazonEC2 extends CFRuntime
|
|
4740 |
* <li><code>Name</code> - <code>string</code> - Optional - </li>
|
4741 |
* </ul></li>
|
4742 |
* </ul></li>
|
|
|
4743 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4744 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
4745 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -4830,6 +4929,7 @@ class AmazonEC2 extends CFRuntime
|
|
4830 |
*
|
4831 |
* @param string|array $instance_id (Required) The list of Amazon EC2 instances to start. Pass a string for a single value, or an indexed array for multiple values.
|
4832 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
|
|
4833 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4834 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
4835 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
@@ -4903,6 +5003,29 @@ class AmazonEC2 extends CFRuntime
|
|
4903 |
return $this->authenticate('TerminateInstances', $opt);
|
4904 |
}
|
4905 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4906 |
/**
|
4907 |
* Disables monitoring for a running instance.
|
4908 |
*
|
29 |
*
|
30 |
* Visit <a href="http://aws.amazon.com/ec2/">http://aws.amazon.com/ec2/</a> for more information.
|
31 |
*
|
32 |
+
* @version 2012.08.01
|
33 |
* @license See the included NOTICE.md file for complete information.
|
34 |
* @copyright See the included NOTICE.md file for complete information.
|
35 |
* @link http://aws.amazon.com/ec2/ Amazon EC2
|
138 |
*/
|
139 |
public function __construct(array $options = array())
|
140 |
{
|
141 |
+
$this->api_version = '2012-07-20';
|
142 |
$this->hostname = self::DEFAULT_URL;
|
143 |
$this->auth_class = 'AuthV2Query';
|
144 |
|
181 |
const INSTANCE_CLUSTER_8XLARGE = 'cc2.8xlarge';
|
182 |
const INSTANCE_CLUSTER_GPU_XLARGE = 'cg1.4xlarge';
|
183 |
|
184 |
+
// High I/O
|
185 |
+
const INSTANCE_HIGH_IO_4XLARGE = 'hi1.4xlarge';
|
186 |
+
|
187 |
+
|
188 |
/*%******************************************************************************************%*/
|
189 |
// SETTERS
|
190 |
|
242 |
return $this->authenticate('AllocateAddress', $opt);
|
243 |
}
|
244 |
|
245 |
+
/**
|
246 |
+
*
|
247 |
+
*
|
248 |
+
* @param string $network_interface_id (Required)
|
249 |
+
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
250 |
+
* <li><code>PrivateIpAddress</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
251 |
+
* <li><code>SecondaryPrivateIpAddressCount</code> - <code>integer</code> - Optional - </li>
|
252 |
+
* <li><code>AllowReassignment</code> - <code>boolean</code> - Optional - </li>
|
253 |
+
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
254 |
+
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
255 |
+
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
256 |
+
*/
|
257 |
+
public function assign_private_ip_addresses($network_interface_id, $opt = null)
|
258 |
+
{
|
259 |
+
if (!$opt) $opt = array();
|
260 |
+
$opt['NetworkInterfaceId'] = $network_interface_id;
|
261 |
+
|
262 |
+
// Optional list (non-map)
|
263 |
+
if (isset($opt['PrivateIpAddress']))
|
264 |
+
{
|
265 |
+
$opt = array_merge($opt, CFComplexType::map(array(
|
266 |
+
'PrivateIpAddress' => (is_array($opt['PrivateIpAddress']) ? $opt['PrivateIpAddress'] : array($opt['PrivateIpAddress']))
|
267 |
+
)));
|
268 |
+
unset($opt['PrivateIpAddress']);
|
269 |
+
}
|
270 |
+
|
271 |
+
return $this->authenticate('AssignPrivateIpAddresses', $opt);
|
272 |
+
}
|
273 |
+
|
274 |
/**
|
275 |
* The AssociateAddress operation associates an elastic IP address with an instance.
|
276 |
*
|
283 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
284 |
* <li><code>AllocationId</code> - <code>string</code> - Optional - The allocation ID that AWS returned when you allocated the elastic IP address for use with Amazon VPC.</li>
|
285 |
* <li><code>NetworkInterfaceId</code> - <code>string</code> - Optional - </li>
|
286 |
+
* <li><code>PrivateIpAddress</code> - <code>string</code> - Optional - </li>
|
287 |
+
* <li><code>AllowReassociation</code> - <code>boolean</code> - Optional - </li>
|
288 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
289 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
290 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
756 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
757 |
* <li><code>Description</code> - <code>string</code> - Optional - The description for the new AMI being created.</li>
|
758 |
* <li><code>NoReboot</code> - <code>boolean</code> - Optional - By default this property is set to <code>false</code>, which means Amazon EC2 attempts to cleanly shut down the instance before image creation and reboots the instance afterwards. When set to true, Amazon EC2 will not shut down the instance before creating the image. When this option is used, file system integrity on the created image cannot be guaranteed.</li>
|
759 |
+
* <li><code>BlockDeviceMapping</code> - <code>array</code> - Optional - The BlockDeviceMappingItemType data type. <ul>
|
760 |
+
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
761 |
+
* <li><code>VirtualName</code> - <code>string</code> - Optional - Specifies the virtual device name.</li>
|
762 |
+
* <li><code>DeviceName</code> - <code>string</code> - Optional - Specifies the device name (e.g., <code>/dev/sdh</code>).</li>
|
763 |
+
* <li><code>Ebs</code> - <code>array</code> - Optional - Specifies parameters used to automatically setup Amazon EBS volumes when the instance is launched. <ul>
|
764 |
+
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
765 |
+
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
766 |
+
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
767 |
+
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
768 |
+
* <li><code>VolumeType</code> - <code>string</code> - Optional - [Allowed values: <code>standard</code>, <code>io1</code>]</li>
|
769 |
+
* <li><code>Iops</code> - <code>integer</code> - Optional - </li>
|
770 |
+
* </ul></li>
|
771 |
+
* </ul></li>
|
772 |
+
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
773 |
+
* </ul></li>
|
774 |
+
* </ul></li>
|
775 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
776 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
777 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
781 |
if (!$opt) $opt = array();
|
782 |
$opt['InstanceId'] = $instance_id;
|
783 |
$opt['Name'] = $name;
|
784 |
+
|
785 |
+
// Optional list + map
|
786 |
+
if (isset($opt['BlockDeviceMapping']))
|
787 |
+
{
|
788 |
+
$opt = array_merge($opt, CFComplexType::map(array(
|
789 |
+
'BlockDeviceMapping' => $opt['BlockDeviceMapping']
|
790 |
+
)));
|
791 |
+
unset($opt['BlockDeviceMapping']);
|
792 |
+
}
|
793 |
|
794 |
return $this->authenticate('CreateImage', $opt);
|
795 |
}
|
963 |
* <li><code>Description</code> - <code>string</code> - Optional - </li>
|
964 |
* <li><code>PrivateIpAddress</code> - <code>string</code> - Optional - </li>
|
965 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
966 |
+
* <li><code>PrivateIpAddresses</code> - <code>array</code> - Optional - <ul>
|
967 |
+
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
968 |
+
* <li><code>PrivateIpAddress</code> - <code>string</code> - Required - </li>
|
969 |
+
* <li><code>Primary</code> - <code>boolean</code> - Optional - </li>
|
970 |
+
* </ul></li>
|
971 |
+
* </ul></li>
|
972 |
+
* <li><code>SecondaryPrivateIpAddressCount</code> - <code>integer</code> - Optional - </li>
|
973 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
974 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
975 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
987 |
)));
|
988 |
unset($opt['SecurityGroupId']);
|
989 |
}
|
990 |
+
|
991 |
+
// Optional list + map
|
992 |
+
if (isset($opt['PrivateIpAddresses']))
|
993 |
+
{
|
994 |
+
$opt = array_merge($opt, CFComplexType::map(array(
|
995 |
+
'PrivateIpAddresses' => $opt['PrivateIpAddresses']
|
996 |
+
)));
|
997 |
+
unset($opt['PrivateIpAddresses']);
|
998 |
+
}
|
999 |
|
1000 |
return $this->authenticate('CreateNetworkInterface', $opt);
|
1001 |
}
|
1230 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1231 |
* <li><code>Size</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes. Required if you are not creating a volume from a snapshot.</li>
|
1232 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which to create the new volume.</li>
|
1233 |
+
* <li><code>VolumeType</code> - <code>string</code> - Optional - [Allowed values: <code>standard</code>, <code>io1</code>]</li>
|
1234 |
+
* <li><code>Iops</code> - <code>integer</code> - Optional - </li>
|
1235 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
1236 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
1237 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
2031 |
*
|
2032 |
*
|
2033 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
2034 |
+
* <li><code>ExportTaskId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
|
|
|
|
|
|
|
|
2035 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
2036 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
2037 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
2040 |
{
|
2041 |
if (!$opt) $opt = array();
|
2042 |
|
2043 |
+
// Optional list (non-map)
|
2044 |
if (isset($opt['ExportTaskId']))
|
2045 |
{
|
2046 |
$opt = array_merge($opt, CFComplexType::map(array(
|
2047 |
+
'ExportTaskId' => (is_array($opt['ExportTaskId']) ? $opt['ExportTaskId'] : array($opt['ExportTaskId']))
|
2048 |
)));
|
2049 |
unset($opt['ExportTaskId']);
|
2050 |
}
|
2173 |
* call.
|
2174 |
*
|
2175 |
* @param string $instance_id (Required) The ID of the instance whose instance attribute is being described.
|
2176 |
+
* @param string $attribute (Required) The name of the attribute to describe. Available attribute names: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code> [Allowed values: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code>, <code>productCodes</code>, <code>sourceDestCheck</code>, <code>groupSet</code>, <code>ebsOptimized</code>]
|
2177 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
2178 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
2179 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
2708 |
*
|
2709 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
2710 |
* <li><code>ReservedInstancesOfferingId</code> - <code>string|array</code> - Optional - An optional list of the unique IDs of the Reserved Instance offerings to describe. Pass a string for a single value, or an indexed array for multiple values.</li>
|
2711 |
+
* <li><code>InstanceType</code> - <code>string</code> - Optional - The instance type on which the Reserved Instance can be used. [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>hi1.4xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
2712 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The Availability Zone in which the Reserved Instance can be used.</li>
|
2713 |
* <li><code>ProductDescription</code> - <code>string</code> - Optional - The Reserved Instance product description.</li>
|
2714 |
* <li><code>Filter</code> - <code>array</code> - Optional - A list of filters used to match properties for ReservedInstancesOfferings. For a complete reference to the available filter keys for this operation, see the <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/">Amazon EC2 API reference</a>. <ul>
|
3669 |
* <li><code>SecurityGroup</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
3670 |
* <li><code>AdditionalInfo</code> - <code>string</code> - Optional - </li>
|
3671 |
* <li><code>UserData</code> - <code>string</code> - Optional - </li>
|
3672 |
+
* <li><code>InstanceType</code> - <code>string</code> - Optional - [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>hi1.4xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
3673 |
* <li><code>Placement</code> - <code>array</code> - Optional - Describes where an Amazon EC2 instance is running within an Amazon EC2 region. <ul>
|
3674 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
3675 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The availability zone in which an Amazon EC2 instance runs.</li>
|
3686 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
3687 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
3688 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
3689 |
+
* <li><code>VolumeType</code> - <code>string</code> - Optional - [Allowed values: <code>standard</code>, <code>io1</code>]</li>
|
3690 |
+
* <li><code>Iops</code> - <code>integer</code> - Optional - </li>
|
3691 |
* </ul></li>
|
3692 |
* </ul></li>
|
3693 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
3907 |
*
|
3908 |
* @param string $instance_id (Required) The ID of the instance whose attribute is being modified.
|
3909 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
3910 |
+
* <li><code>Attribute</code> - <code>string</code> - Optional - The name of the attribute being modified. Available attribute names: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDevice</code>, <code>blockDeviceMapping</code> [Allowed values: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code>, <code>productCodes</code>, <code>sourceDestCheck</code>, <code>groupSet</code>, <code>ebsOptimized</code>]</li>
|
3911 |
* <li><code>Value</code> - <code>string</code> - Optional - The new value of the instance attribute being modified. Only valid when <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code> or <code>instanceInitiateShutdownBehavior</code> is specified as the attribute being modified.</li>
|
3912 |
* <li><code>BlockDeviceMapping</code> - <code>array</code> - Optional - The new block device mappings for the instance whose attributes are being modified. Only valid when blockDeviceMapping is specified as the attribute being modified. <ul>
|
3913 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
3930 |
* <li><code>UserData.Value</code> - <code>string</code> - Optional - String value</li>
|
3931 |
* <li><code>InstanceInitiatedShutdownBehavior.Value</code> - <code>string</code> - Optional - String value</li>
|
3932 |
* <li><code>GroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
3933 |
+
* <li><code>EbsOptimized.Value</code> - <code>boolean</code> - Optional - Boolean value</li>
|
3934 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
3935 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
3936 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
4183 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
4184 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
4185 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
4186 |
+
* <li><code>VolumeType</code> - <code>string</code> - Optional - [Allowed values: <code>standard</code>, <code>io1</code>]</li>
|
4187 |
+
* <li><code>Iops</code> - <code>integer</code> - Optional - </li>
|
4188 |
* </ul></li>
|
4189 |
* </ul></li>
|
4190 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
4455 |
* <li><code>SecurityGroup</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4456 |
* <li><code>UserData</code> - <code>string</code> - Optional - Optional data, specific to a user's application, to provide in the launch request. All instances that collectively comprise the launch request have access to this data. User data is never returned through API responses.</li>
|
4457 |
* <li><code>AddressingType</code> - <code>string</code> - Optional - </li>
|
4458 |
+
* <li><code>InstanceType</code> - <code>string</code> - Optional - Specifies the instance type. [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>hi1.4xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
4459 |
* <li><code>Placement</code> - <code>array</code> - Optional - Defines a placement item. <ul>
|
4460 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
4461 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The availability zone in which an Amazon EC2 instance runs.</li>
|
4473 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
4474 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
4475 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
4476 |
+
* <li><code>VolumeType</code> - <code>string</code> - Optional - [Allowed values: <code>standard</code>, <code>io1</code>]</li>
|
4477 |
+
* <li><code>Iops</code> - <code>integer</code> - Optional - </li>
|
4478 |
* </ul></li>
|
4479 |
* </ul></li>
|
4480 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
4491 |
* <li><code>PrivateIpAddress</code> - <code>string</code> - Optional - </li>
|
4492 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4493 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - </li>
|
4494 |
+
* <li><code>PrivateIpAddresses</code> - <code>array</code> - Optional - <ul>
|
4495 |
+
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
4496 |
+
* <li><code>PrivateIpAddress</code> - <code>string</code> - Required - </li>
|
4497 |
+
* <li><code>Primary</code> - <code>boolean</code> - Optional - </li>
|
4498 |
+
* </ul></li>
|
4499 |
+
* </ul></li>
|
4500 |
+
* <li><code>SecondaryPrivateIpAddressCount</code> - <code>integer</code> - Optional - </li>
|
4501 |
* </ul></li>
|
4502 |
* </ul></li>
|
4503 |
* <li><code>IamInstanceProfile</code> - <code>array</code> - Optional - <ul>
|
4506 |
* <li><code>Name</code> - <code>string</code> - Optional - </li>
|
4507 |
* </ul></li>
|
4508 |
* </ul></li>
|
4509 |
+
* <li><code>EbsOptimized</code> - <code>boolean</code> - Optional - </li>
|
4510 |
* </ul></li>
|
4511 |
* </ul></li>
|
4512 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4569 |
* Resets an attribute of an instance to its default value.
|
4570 |
*
|
4571 |
* @param string $instance_id (Required) The ID of the Amazon EC2 instance whose attribute is being reset.
|
4572 |
+
* @param string $attribute (Required) The name of the attribute being reset. Available attribute names: <code>kernel</code>, <code>ramdisk</code> [Allowed values: <code>instanceType</code>, <code>kernel</code>, <code>ramdisk</code>, <code>userData</code>, <code>disableApiTermination</code>, <code>instanceInitiatedShutdownBehavior</code>, <code>rootDeviceName</code>, <code>blockDeviceMapping</code>, <code>productCodes</code>, <code>sourceDestCheck</code>, <code>groupSet</code>, <code>ebsOptimized</code>]
|
4573 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
4574 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4575 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
4777 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4778 |
* <li><code>UserData</code> - <code>string</code> - Optional - Specifies additional information to make available to the instance(s).</li>
|
4779 |
* <li><code>AddressingType</code> - <code>string</code> - Optional - </li>
|
4780 |
+
* <li><code>InstanceType</code> - <code>string</code> - Optional - Specifies the instance type for the launched instances. [Allowed values: <code>t1.micro</code>, <code>m1.small</code>, <code>m1.medium</code>, <code>m1.large</code>, <code>m1.xlarge</code>, <code>m2.xlarge</code>, <code>m2.2xlarge</code>, <code>m2.4xlarge</code>, <code>c1.medium</code>, <code>c1.xlarge</code>, <code>hi1.4xlarge</code>, <code>cc1.4xlarge</code>, <code>cc2.8xlarge</code>, <code>cg1.4xlarge</code>]</li>
|
4781 |
* <li><code>Placement</code> - <code>array</code> - Optional - Specifies the placement constraints (Availability Zones) for launching the instances. <ul>
|
4782 |
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
4783 |
* <li><code>AvailabilityZone</code> - <code>string</code> - Optional - The availability zone in which an Amazon EC2 instance runs.</li>
|
4796 |
* <li><code>SnapshotId</code> - <code>string</code> - Optional - The ID of the snapshot from which the volume will be created.</li>
|
4797 |
* <li><code>VolumeSize</code> - <code>integer</code> - Optional - The size of the volume, in gigabytes.</li>
|
4798 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - Specifies whether the Amazon EBS volume is deleted on instance termination.</li>
|
4799 |
+
* <li><code>VolumeType</code> - <code>string</code> - Optional - [Allowed values: <code>standard</code>, <code>io1</code>]</li>
|
4800 |
+
* <li><code>Iops</code> - <code>integer</code> - Optional - </li>
|
4801 |
* </ul></li>
|
4802 |
* </ul></li>
|
4803 |
* <li><code>NoDevice</code> - <code>string</code> - Optional - Specifies the device name to suppress during instance launch.</li>
|
4823 |
* <li><code>PrivateIpAddress</code> - <code>string</code> - Optional - </li>
|
4824 |
* <li><code>SecurityGroupId</code> - <code>string|array</code> - Optional - Pass a string for a single value, or an indexed array for multiple values.</li>
|
4825 |
* <li><code>DeleteOnTermination</code> - <code>boolean</code> - Optional - </li>
|
4826 |
+
* <li><code>PrivateIpAddresses</code> - <code>array</code> - Optional - <ul>
|
4827 |
+
* <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
|
4828 |
+
* <li><code>PrivateIpAddress</code> - <code>string</code> - Required - </li>
|
4829 |
+
* <li><code>Primary</code> - <code>boolean</code> - Optional - </li>
|
4830 |
+
* </ul></li>
|
4831 |
+
* </ul></li>
|
4832 |
+
* <li><code>SecondaryPrivateIpAddressCount</code> - <code>integer</code> - Optional - </li>
|
4833 |
* </ul></li>
|
4834 |
* </ul></li>
|
4835 |
* <li><code>IamInstanceProfile</code> - <code>array</code> - Optional - <ul>
|
4838 |
* <li><code>Name</code> - <code>string</code> - Optional - </li>
|
4839 |
* </ul></li>
|
4840 |
* </ul></li>
|
4841 |
+
* <li><code>EbsOptimized</code> - <code>boolean</code> - Optional - </li>
|
4842 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4843 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
4844 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
4929 |
*
|
4930 |
* @param string|array $instance_id (Required) The list of Amazon EC2 instances to start. Pass a string for a single value, or an indexed array for multiple values.
|
4931 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
4932 |
+
* <li><code>AdditionalInfo</code> - <code>string</code> - Optional - </li>
|
4933 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
4934 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
4935 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
5003 |
return $this->authenticate('TerminateInstances', $opt);
|
5004 |
}
|
5005 |
|
5006 |
+
/**
|
5007 |
+
*
|
5008 |
+
*
|
5009 |
+
* @param string $network_interface_id (Required)
|
5010 |
+
* @param string|array $private_ip_address (Required) Pass a string for a single value, or an indexed array for multiple values.
|
5011 |
+
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
5012 |
+
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
5013 |
+
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
5014 |
+
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
5015 |
+
*/
|
5016 |
+
public function unassign_private_ip_addresses($network_interface_id, $private_ip_address, $opt = null)
|
5017 |
+
{
|
5018 |
+
if (!$opt) $opt = array();
|
5019 |
+
$opt['NetworkInterfaceId'] = $network_interface_id;
|
5020 |
+
|
5021 |
+
// Required list (non-map)
|
5022 |
+
$opt = array_merge($opt, CFComplexType::map(array(
|
5023 |
+
'PrivateIpAddress' => (is_array($private_ip_address) ? $private_ip_address : array($private_ip_address))
|
5024 |
+
)));
|
5025 |
+
|
5026 |
+
return $this->authenticate('UnassignPrivateIpAddresses', $opt);
|
5027 |
+
}
|
5028 |
+
|
5029 |
/**
|
5030 |
* Disables monitoring for a running instance.
|
5031 |
*
|
libs/aws/services/elasticbeanstalk.class.php
CHANGED
@@ -34,7 +34,7 @@
|
|
34 |
* <li>https://elasticbeanstalk.us-east-1.amazonaws.com</li>
|
35 |
* </ul>
|
36 |
*
|
37 |
-
* @version 2012.
|
38 |
* @license See the included NOTICE.md file for complete information.
|
39 |
* @copyright See the included NOTICE.md file for complete information.
|
40 |
* @link http://aws.amazon.com/elasticbeanstalk/ AWS ElasticBeanstalk
|
@@ -65,6 +65,36 @@ class AmazonElasticBeanstalk extends CFRuntime
|
|
65 |
*/
|
66 |
const REGION_TOKYO = self::REGION_APAC_NE1;
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* Default service endpoint.
|
70 |
*/
|
@@ -102,7 +132,7 @@ class AmazonElasticBeanstalk extends CFRuntime
|
|
102 |
/**
|
103 |
* This allows you to explicitly sets the region for the service to use.
|
104 |
*
|
105 |
-
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_APAC_NE1>.
|
106 |
* @return $this A reference to the current instance.
|
107 |
*/
|
108 |
public function set_region($region)
|
34 |
* <li>https://elasticbeanstalk.us-east-1.amazonaws.com</li>
|
35 |
* </ul>
|
36 |
*
|
37 |
+
* @version 2012.06.21
|
38 |
* @license See the included NOTICE.md file for complete information.
|
39 |
* @copyright See the included NOTICE.md file for complete information.
|
40 |
* @link http://aws.amazon.com/elasticbeanstalk/ AWS ElasticBeanstalk
|
65 |
*/
|
66 |
const REGION_TOKYO = self::REGION_APAC_NE1;
|
67 |
|
68 |
+
/**
|
69 |
+
* Specify the queue URL for the United States West (Northern California) Region.
|
70 |
+
*/
|
71 |
+
const REGION_US_W1 = 'elasticbeanstalk.us-west-1.amazonaws.com';
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Specify the queue URL for the United States West (Northern California) Region.
|
75 |
+
*/
|
76 |
+
const REGION_CALIFORNIA = self::REGION_US_W1;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Specify the queue URL for the United States West (Oregon) Region.
|
80 |
+
*/
|
81 |
+
const REGION_US_W2 = 'elasticbeanstalk.us-west-2.amazonaws.com';
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Specify the queue URL for the United States West (Oregon) Region.
|
85 |
+
*/
|
86 |
+
const REGION_OREGON = self::REGION_US_W2;
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Specify the queue URL for the Europe West (Ireland) Region.
|
90 |
+
*/
|
91 |
+
const REGION_EU_W1 = 'elasticbeanstalk.eu-west-1.amazonaws.com';
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Specify the queue URL for the Europe West (Ireland) Region.
|
95 |
+
*/
|
96 |
+
const REGION_IRELAND = self::REGION_EU_W1;
|
97 |
+
|
98 |
/**
|
99 |
* Default service endpoint.
|
100 |
*/
|
132 |
/**
|
133 |
* This allows you to explicitly sets the region for the service to use.
|
134 |
*
|
135 |
+
* @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_APAC_NE1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>.
|
136 |
* @return $this A reference to the current instance.
|
137 |
*/
|
138 |
public function set_region($region)
|
libs/aws/services/elb.class.php
CHANGED
@@ -126,7 +126,7 @@ class AmazonELB extends CFRuntime
|
|
126 |
{
|
127 |
$this->api_version = '2012-06-01';
|
128 |
$this->hostname = self::DEFAULT_URL;
|
129 |
-
$this->auth_class = '
|
130 |
|
131 |
return parent::__construct($options);
|
132 |
}
|
126 |
{
|
127 |
$this->api_version = '2012-06-01';
|
128 |
$this->hostname = self::DEFAULT_URL;
|
129 |
+
$this->auth_class = 'AuthV4Query';
|
130 |
|
131 |
return parent::__construct($options);
|
132 |
}
|
libs/aws/services/s3.class.php
CHANGED
@@ -1409,6 +1409,9 @@ class AmazonS3 extends CFRuntime
|
|
1409 |
/**
|
1410 |
* Gets the contents of an Amazon S3 object in the specified bucket.
|
1411 |
*
|
|
|
|
|
|
|
1412 |
* @param string $bucket (Required) The name of the bucket to use.
|
1413 |
* @param string $filename (Required) The file name for the object.
|
1414 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
@@ -1474,6 +1477,9 @@ class AmazonS3 extends CFRuntime
|
|
1474 |
/**
|
1475 |
* Gets the HTTP headers for the specified Amazon S3 object.
|
1476 |
*
|
|
|
|
|
|
|
1477 |
* @param string $bucket (Required) The name of the bucket to use.
|
1478 |
* @param string $filename (Required) The file name for the object.
|
1479 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
@@ -1793,6 +1799,27 @@ class AmazonS3 extends CFRuntime
|
|
1793 |
if (!$opt) $opt = array();
|
1794 |
$opt['metadataDirective'] = 'REPLACE';
|
1795 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1796 |
// Authenticate to S3
|
1797 |
return $this->copy_object(
|
1798 |
array('bucket' => $bucket, 'filename' => $filename),
|
@@ -2154,7 +2181,7 @@ class AmazonS3 extends CFRuntime
|
|
2154 |
}
|
2155 |
|
2156 |
$header = $this->get_bucket_headers($bucket);
|
2157 |
-
return (
|
2158 |
}
|
2159 |
|
2160 |
/**
|
@@ -2310,11 +2337,11 @@ class AmazonS3 extends CFRuntime
|
|
2310 |
|
2311 |
// Retrieve the original metadata
|
2312 |
$metadata = $this->get_object_metadata($bucket, $filename);
|
2313 |
-
if ($metadata && $metadata['ACL'])
|
2314 |
{
|
2315 |
$opt['acl'] = $metadata['ACL'];
|
2316 |
}
|
2317 |
-
if ($metadata && $metadata['StorageClass'])
|
2318 |
{
|
2319 |
$opt['headers']['x-amz-storage-class'] = $metadata['StorageClass'];
|
2320 |
}
|
@@ -2324,7 +2351,7 @@ class AmazonS3 extends CFRuntime
|
|
2324 |
'headers' => array(
|
2325 |
'Content-Type' => $contentType
|
2326 |
),
|
2327 |
-
'metadataDirective' => '
|
2328 |
), $opt);
|
2329 |
|
2330 |
return $this->copy_object(
|
@@ -2351,13 +2378,13 @@ class AmazonS3 extends CFRuntime
|
|
2351 |
|
2352 |
// Retrieve the original metadata
|
2353 |
$metadata = $this->get_object_metadata($bucket, $filename);
|
2354 |
-
if ($metadata && $metadata['ACL'])
|
2355 |
{
|
2356 |
$opt['acl'] = $metadata['ACL'];
|
2357 |
}
|
2358 |
-
if ($metadata && $metadata['
|
2359 |
{
|
2360 |
-
$opt['headers']['
|
2361 |
}
|
2362 |
|
2363 |
// Merge optional parameters
|
@@ -2650,6 +2677,9 @@ class AmazonS3 extends CFRuntime
|
|
2650 |
/**
|
2651 |
* Gets the collective metadata for the given Amazon S3 object.
|
2652 |
*
|
|
|
|
|
|
|
2653 |
* @param string $bucket (Required) The name of the bucket to use.
|
2654 |
* @param string $filename (Required) The file name for the Amazon S3 object.
|
2655 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1409 |
/**
|
1410 |
* Gets the contents of an Amazon S3 object in the specified bucket.
|
1411 |
*
|
1412 |
+
* The MD5 value for an object can be retrieved from the ETag HTTP header for any object that was uploaded
|
1413 |
+
* with a normal PUT/POST. This value is incorrect for multipart uploads.
|
1414 |
+
*
|
1415 |
* @param string $bucket (Required) The name of the bucket to use.
|
1416 |
* @param string $filename (Required) The file name for the object.
|
1417 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1477 |
/**
|
1478 |
* Gets the HTTP headers for the specified Amazon S3 object.
|
1479 |
*
|
1480 |
+
* The MD5 value for an object can be retrieved from the ETag HTTP header for any object that was uploaded
|
1481 |
+
* with a normal PUT/POST. This value is incorrect for multipart uploads.
|
1482 |
+
*
|
1483 |
* @param string $bucket (Required) The name of the bucket to use.
|
1484 |
* @param string $filename (Required) The file name for the object.
|
1485 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
1799 |
if (!$opt) $opt = array();
|
1800 |
$opt['metadataDirective'] = 'REPLACE';
|
1801 |
|
1802 |
+
// Retrieve the original metadata
|
1803 |
+
$metadata = $this->get_object_metadata($bucket, $filename);
|
1804 |
+
if ($metadata && isset($metadata['ACL']))
|
1805 |
+
{
|
1806 |
+
$opt['acl'] = isset($opt['acl']) ? $opt['acl'] : $metadata['ACL'];
|
1807 |
+
}
|
1808 |
+
if ($metadata && isset($metadata['StorageClass']))
|
1809 |
+
{
|
1810 |
+
$opt['headers']['x-amz-storage-class'] = $metadata['StorageClass'];
|
1811 |
+
}
|
1812 |
+
if ($metadata && isset($metadata['ContentType']))
|
1813 |
+
{
|
1814 |
+
$opt['headers']['Content-Type'] = $metadata['ContentType'];
|
1815 |
+
}
|
1816 |
+
|
1817 |
+
// Remove a header
|
1818 |
+
unset($metadata['Headers']['date']);
|
1819 |
+
|
1820 |
+
// Merge headers
|
1821 |
+
$opt['headers'] = array_merge($opt['headers'], $metadata['Headers']);
|
1822 |
+
|
1823 |
// Authenticate to S3
|
1824 |
return $this->copy_object(
|
1825 |
array('bucket' => $bucket, 'filename' => $filename),
|
2181 |
}
|
2182 |
|
2183 |
$header = $this->get_bucket_headers($bucket);
|
2184 |
+
return (integer) $header->status !== 404;
|
2185 |
}
|
2186 |
|
2187 |
/**
|
2337 |
|
2338 |
// Retrieve the original metadata
|
2339 |
$metadata = $this->get_object_metadata($bucket, $filename);
|
2340 |
+
if ($metadata && isset($metadata['ACL']))
|
2341 |
{
|
2342 |
$opt['acl'] = $metadata['ACL'];
|
2343 |
}
|
2344 |
+
if ($metadata && isset($metadata['StorageClass']))
|
2345 |
{
|
2346 |
$opt['headers']['x-amz-storage-class'] = $metadata['StorageClass'];
|
2347 |
}
|
2351 |
'headers' => array(
|
2352 |
'Content-Type' => $contentType
|
2353 |
),
|
2354 |
+
'metadataDirective' => 'REPLACE'
|
2355 |
), $opt);
|
2356 |
|
2357 |
return $this->copy_object(
|
2378 |
|
2379 |
// Retrieve the original metadata
|
2380 |
$metadata = $this->get_object_metadata($bucket, $filename);
|
2381 |
+
if ($metadata && isset($metadata['ACL']))
|
2382 |
{
|
2383 |
$opt['acl'] = $metadata['ACL'];
|
2384 |
}
|
2385 |
+
if ($metadata && isset($metadata['StorageClass']))
|
2386 |
{
|
2387 |
+
$opt['headers']['x-amz-storage-class'] = $metadata['StorageClass'];
|
2388 |
}
|
2389 |
|
2390 |
// Merge optional parameters
|
2677 |
/**
|
2678 |
* Gets the collective metadata for the given Amazon S3 object.
|
2679 |
*
|
2680 |
+
* The MD5 value for an object can be retrieved from the ETag HTTP header for any object that was uploaded
|
2681 |
+
* with a normal PUT/POST. This value is incorrect for multipart uploads.
|
2682 |
+
*
|
2683 |
* @param string $bucket (Required) The name of the bucket to use.
|
2684 |
* @param string $filename (Required) The file name for the Amazon S3 object.
|
2685 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
libs/aws/services/ses.class.php
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
* The endpoint for Amazon SES is located at: <code>https://email.us-east-1.amazonaws.com</code>
|
27 |
* </p>
|
28 |
*
|
29 |
-
* @version 2012.
|
30 |
* @license See the included NOTICE.md file for complete information.
|
31 |
* @copyright See the included NOTICE.md file for complete information.
|
32 |
* @link http://aws.amazon.com/ses/ Amazon Simple Email Service
|
@@ -152,6 +152,44 @@ class AmazonSES extends CFRuntime
|
|
152 |
return $this->authenticate('DeleteVerifiedEmailAddress', $opt);
|
153 |
}
|
154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
/**
|
156 |
* Given a list of verified identities (email addresses and/or domains), returns a structure
|
157 |
* describing identity notification attributes. For more information about feedback notification,
|
@@ -419,6 +457,40 @@ class AmazonSES extends CFRuntime
|
|
419 |
return $this->authenticate('SendRawEmail', $opt);
|
420 |
}
|
421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
/**
|
423 |
* Given an identity (email address or domain), enables or disables whether Amazon SES forwards
|
424 |
* feedback notifications as email. Feedback forwarding may only be disabled when both complaint
|
@@ -465,6 +537,34 @@ class AmazonSES extends CFRuntime
|
|
465 |
return $this->authenticate('SetIdentityNotificationTopic', $opt);
|
466 |
}
|
467 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
/**
|
469 |
* Verifies a domain.
|
470 |
*
|
26 |
* The endpoint for Amazon SES is located at: <code>https://email.us-east-1.amazonaws.com</code>
|
27 |
* </p>
|
28 |
*
|
29 |
+
* @version 2012.07.09
|
30 |
* @license See the included NOTICE.md file for complete information.
|
31 |
* @copyright See the included NOTICE.md file for complete information.
|
32 |
* @link http://aws.amazon.com/ses/ Amazon Simple Email Service
|
152 |
return $this->authenticate('DeleteVerifiedEmailAddress', $opt);
|
153 |
}
|
154 |
|
155 |
+
/**
|
156 |
+
* Returns the DNS records, or <em>tokens</em>, that must be present in order for Easy DKIM to
|
157 |
+
* sign outgoing email messages.
|
158 |
+
*
|
159 |
+
* This action takes a list of verified identities as input. It then returns the following
|
160 |
+
* information for each identity:
|
161 |
+
*
|
162 |
+
* <ul>
|
163 |
+
* <li>Whether Easy DKIM signing is enabled or disabled.</li>
|
164 |
+
* <li>The set of tokens that are required for Easy DKIM signing. These tokens must be published
|
165 |
+
* in the domain name's DNS records in order for DKIM verification to complete, and must remain
|
166 |
+
* published in order for Easy DKIM signing to operate correctly. (This information is only
|
167 |
+
* returned for domain name identities, not for email addresses.)</li>
|
168 |
+
* <li>Whether Amazon SES has successfully verified the DKIM tokens published in the domain name's
|
169 |
+
* DNS. (This information is only returned for domain name identities, not for email addresses.)</li>
|
170 |
+
* </ul>
|
171 |
+
*
|
172 |
+
* For more information about Easy DKIM signing, go to the <a href=
|
173 |
+
* "http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">Amazon SES Developer Guide</a>.
|
174 |
+
*
|
175 |
+
* @param string|array $identities (Required) A list of one or more verified identities - email addresses, domains, or both. Pass a string for a single value, or an indexed array for multiple values.
|
176 |
+
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
177 |
+
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
178 |
+
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
179 |
+
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
180 |
+
*/
|
181 |
+
public function get_identity_dkim_attributes($identities, $opt = null)
|
182 |
+
{
|
183 |
+
if (!$opt) $opt = array();
|
184 |
+
|
185 |
+
// Required list (non-map)
|
186 |
+
$opt = array_merge($opt, CFComplexType::map(array(
|
187 |
+
'Identities' => (is_array($identities) ? $identities : array($identities))
|
188 |
+
), 'member'));
|
189 |
+
|
190 |
+
return $this->authenticate('GetIdentityDkimAttributes', $opt);
|
191 |
+
}
|
192 |
+
|
193 |
/**
|
194 |
* Given a list of verified identities (email addresses and/or domains), returns a structure
|
195 |
* describing identity notification attributes. For more information about feedback notification,
|
457 |
return $this->authenticate('SendRawEmail', $opt);
|
458 |
}
|
459 |
|
460 |
+
/**
|
461 |
+
* Enables or disables Easy DKIM signing of email sent from an identity:
|
462 |
+
*
|
463 |
+
* <ul>
|
464 |
+
* <li>If Easy DKIM signing is enabled for a domain name identity (e.g.,
|
465 |
+
* <code>example.com</code>), then Amazon SES will DKIM-sign all email sent by addresses under
|
466 |
+
* that domain name (e.g., <code>user@example.com</code>).</li>
|
467 |
+
* <li>If Easy DKIM signing is enabled for an email address, then Amazon SES will DKIM-sign all
|
468 |
+
* email sent by that email address.</li>
|
469 |
+
* </ul>
|
470 |
+
*
|
471 |
+
* For email addresses (e.g., <code>user@example.com</code>), you can only enable Easy DKIM
|
472 |
+
* signing if the corresponding domain (e.g., <code>example.com</code>) has been set up for Easy
|
473 |
+
* DKIM using the AWS Console or the <code>VerifyDomainDkim</code> action.
|
474 |
+
*
|
475 |
+
* For more information about Easy DKIM signing, go to the <a href=
|
476 |
+
* "http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">Amazon SES Developer Guide</a>.
|
477 |
+
*
|
478 |
+
* @param string $identity (Required) The identity for which DKIM signing should be enabled or disabled.
|
479 |
+
* @param boolean $dkim_enabled (Required) Sets whether DKIM signing is enabled for an identity. Set to <code>true</code> to enable DKIM signing for this identity; <code>false</code> to disable it.
|
480 |
+
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
481 |
+
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
482 |
+
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
483 |
+
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
484 |
+
*/
|
485 |
+
public function set_identity_dkim_enabled($identity, $dkim_enabled, $opt = null)
|
486 |
+
{
|
487 |
+
if (!$opt) $opt = array();
|
488 |
+
$opt['Identity'] = $identity;
|
489 |
+
$opt['DkimEnabled'] = $dkim_enabled;
|
490 |
+
|
491 |
+
return $this->authenticate('SetIdentityDkimEnabled', $opt);
|
492 |
+
}
|
493 |
+
|
494 |
/**
|
495 |
* Given an identity (email address or domain), enables or disables whether Amazon SES forwards
|
496 |
* feedback notifications as email. Feedback forwarding may only be disabled when both complaint
|
537 |
return $this->authenticate('SetIdentityNotificationTopic', $opt);
|
538 |
}
|
539 |
|
540 |
+
/**
|
541 |
+
* Returns a set of DNS records, or <em>tokens</em>, that must be published in the domain name's
|
542 |
+
* DNS to complete the DKIM verification process. These tokens are DNS <code>CNAME</code> records
|
543 |
+
* that point to DKIM public keys hosted by Amazon SES. To complete the DKIM verification process,
|
544 |
+
* these tokens must be published in the domain's DNS. The tokens must remain published in order
|
545 |
+
* for Easy DKIM signing to function correctly.
|
546 |
+
*
|
547 |
+
* After the tokens are added to the domain's DNS, Amazon SES will be able to DKIM-sign email
|
548 |
+
* originating from that domain. To enable or disable Easy DKIM signing for a domain, use the
|
549 |
+
* <code>SetIdentityDkimEnabled</code> action.
|
550 |
+
*
|
551 |
+
* For more information about Easy DKIM, go to the <a href=
|
552 |
+
* "http://docs.amazonwebservices.com/ses/latest/DeveloperGuide">Amazon SES Developer Guide</a>.
|
553 |
+
*
|
554 |
+
* @param string $domain (Required) The name of the domain to be verified for Easy DKIM signing.
|
555 |
+
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
556 |
+
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
557 |
+
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
558 |
+
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
559 |
+
*/
|
560 |
+
public function verify_domain_dkim($domain, $opt = null)
|
561 |
+
{
|
562 |
+
if (!$opt) $opt = array();
|
563 |
+
$opt['Domain'] = $domain;
|
564 |
+
|
565 |
+
return $this->authenticate('VerifyDomainDkim', $opt);
|
566 |
+
}
|
567 |
+
|
568 |
/**
|
569 |
* Verifies a domain.
|
570 |
*
|
libs/aws/services/sts.class.php
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
* We will refer to Amazon Identity and Access Management using the abbreviated form IAM. All
|
43 |
* copyrights and legal protections still apply.
|
44 |
*
|
45 |
-
* @version 2012.
|
46 |
* @license See the included NOTICE.md file for complete information.
|
47 |
* @copyright See the included NOTICE.md file for complete information.
|
48 |
* @link http://aws.amazon.com/sts/ Amazon Secure Token Service
|
@@ -165,6 +165,8 @@ class AmazonSTS extends CFRuntime
|
|
165 |
*
|
166 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
167 |
* <li><code>DurationSeconds</code> - <code>integer</code> - Optional - The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 3600s (one hour) to 129600s (36 hours), with 43200s (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600s (one hour).</li>
|
|
|
|
|
168 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
169 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
170 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
42 |
* We will refer to Amazon Identity and Access Management using the abbreviated form IAM. All
|
43 |
* copyrights and legal protections still apply.
|
44 |
*
|
45 |
+
* @version 2012.06.21
|
46 |
* @license See the included NOTICE.md file for complete information.
|
47 |
* @copyright See the included NOTICE.md file for complete information.
|
48 |
* @link http://aws.amazon.com/sts/ Amazon Secure Token Service
|
165 |
*
|
166 |
* @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
|
167 |
* <li><code>DurationSeconds</code> - <code>integer</code> - Optional - The duration, in seconds, that the credentials should remain valid. Acceptable durations for IAM user sessions range from 3600s (one hour) to 129600s (36 hours), with 43200s (12 hours) as the default. Sessions for AWS account owners are restricted to a maximum of 3600s (one hour).</li>
|
168 |
+
* <li><code>SerialNumber</code> - <code>string</code> - Optional - The identification number of the Multi-Factor Authentication (MFA) device for the user. If the user has an access policy requiring MFA to access resources, provide the value here. The number is in the <strong>Security Credentials</strong> tab of the user's details pane in the IAM console. If the user has an active MFA device, the details pane displays a <strong>Multi-Factor Authentication Device</strong> value such as <code>arn:aws:iam::123456789012:mfa/user</code> for a virtual device or the device serial number for a hardware device. [Constraints: The value must be between 9 and 256 characters, and must match the following regular expression pattern: <code>[\w+=/:,.@-]*</code>]</li>
|
169 |
+
* <li><code>TokenCode</code> - <code>string</code> - Optional - The value provided by the MFA device. If the user has an access policy requiring an MFA code, provide the value here to get permission to resources as specified in the access policy. If MFA is required, and a code not provided while requesting a set of temporary security credentials, the user will receive an "access denied" response when requesting resources that require MFA. For more information, see <a href="http://docs.amazonwebservices.com/IAM/latest/UserGuide/Using_ManagingMFA.html" target="_blank">Using Multi-Factor Authentication (MFA) Devices with AWS</a> in <em>Using IAM</em>. [Constraints: The value must be between 6 and 6 characters, and must match the following regular expression pattern: <code>[\d]*</code>]</li>
|
170 |
* <li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
|
171 |
* <li><code>returnCurlHandle</code> - <code>boolean</code> - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.</li></ul>
|
172 |
* @return CFResponse A <CFResponse> object containing a parsed HTTP response.
|
libs/aws/utilities/credentials.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
/**
|
22 |
* The <CFCredentials> class enables developers to easily switch between multiple sets of credentials.
|
23 |
*
|
24 |
-
* @version
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
@@ -119,6 +119,16 @@ class CFCredentials
|
|
119 |
// Return the credential set as an object
|
120 |
return new CFCredential(self::$credentials[$credential_name]);
|
121 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
|
124 |
class CFCredentials_Exception extends Exception {}
|
21 |
/**
|
22 |
* The <CFCredentials> class enables developers to easily switch between multiple sets of credentials.
|
23 |
*
|
24 |
+
* @version 2012.07.13
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
119 |
// Return the credential set as an object
|
120 |
return new CFCredential(self::$credentials[$credential_name]);
|
121 |
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Retrieves a list of all available credential set names.
|
125 |
+
*
|
126 |
+
* @return CFArray A list of all available credential set names.
|
127 |
+
*/
|
128 |
+
public static function list_sets()
|
129 |
+
{
|
130 |
+
return new CFArray(array_keys(self::$credentials));
|
131 |
+
}
|
132 |
}
|
133 |
|
134 |
class CFCredentials_Exception extends Exception {}
|
libs/aws/utilities/hadoopbase.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
/**
|
22 |
* Contains core functionality for Hadoop helpers.
|
23 |
*
|
24 |
-
* @version
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
@@ -29,6 +29,8 @@
|
|
29 |
*/
|
30 |
class CFHadoopBase
|
31 |
{
|
|
|
|
|
32 |
/**
|
33 |
* Runs a specified script on the master node of your cluster.
|
34 |
*
|
@@ -42,7 +44,7 @@ class CFHadoopBase
|
|
42 |
array_unshift($args, $script);
|
43 |
|
44 |
return array(
|
45 |
-
'Jar' => 's3://
|
46 |
'Args' => $args
|
47 |
);
|
48 |
}
|
@@ -60,8 +62,8 @@ class CFHadoopBase
|
|
60 |
{
|
61 |
if (!$args) $args = array();
|
62 |
$args = is_array($args) ? $args : array($args);
|
63 |
-
$args = array_merge(array('--base-path', 's3://
|
64 |
|
65 |
-
return self::script_runner('s3://
|
66 |
}
|
67 |
}
|
21 |
/**
|
22 |
* Contains core functionality for Hadoop helpers.
|
23 |
*
|
24 |
+
* @version 2012.07.24
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
29 |
*/
|
30 |
class CFHadoopBase
|
31 |
{
|
32 |
+
public static $region = 'us-east-1';
|
33 |
+
|
34 |
/**
|
35 |
* Runs a specified script on the master node of your cluster.
|
36 |
*
|
44 |
array_unshift($args, $script);
|
45 |
|
46 |
return array(
|
47 |
+
'Jar' => 's3://' . self::$region . '.elasticmapreduce/libs/script-runner/script-runner.jar',
|
48 |
'Args' => $args
|
49 |
);
|
50 |
}
|
62 |
{
|
63 |
if (!$args) $args = array();
|
64 |
$args = is_array($args) ? $args : array($args);
|
65 |
+
$args = array_merge(array('--base-path', 's3://' . self::$region . '.elasticmapreduce/libs/' . $type . '/'), $args);
|
66 |
|
67 |
+
return self::script_runner('s3://' . self::$region . '.elasticmapreduce/libs/' . $type . '/' . $type . '-script', $args);
|
68 |
}
|
69 |
}
|
libs/aws/utilities/hadoopbootstrap.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
/**
|
22 |
* Contains a set of pre-built Amazon EMR Hadoop Bootstrap Actions.
|
23 |
*
|
24 |
-
* @version
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
@@ -30,18 +30,18 @@
|
|
30 |
class CFHadoopBootstrap extends CFHadoopBase
|
31 |
{
|
32 |
// Config file types
|
33 |
-
const CONFIG_SITE
|
34 |
-
const CONFIG_DEFAULT
|
35 |
-
const CONFIG_CORE
|
36 |
-
const CONFIG_HDFS
|
37 |
const CONFIG_MAPREDUCE = 'M';
|
38 |
|
39 |
// Daemon types
|
40 |
-
const DAEMON_NAME_NODE
|
41 |
-
const DAEMON_DATA_NODE
|
42 |
-
const DAEMON_JOB_TRACKER
|
43 |
const DAEMON_TASK_TRACKER = 'tasktracker';
|
44 |
-
const DAEMON_CLIENT
|
45 |
|
46 |
/**
|
47 |
* Create a new run-if bootstrap action which lets you conditionally run bootstrap actions.
|
@@ -55,7 +55,7 @@ class CFHadoopBootstrap extends CFHadoopBase
|
|
55 |
if (!$args) $args = array();
|
56 |
$args = is_array($args) ? $args : array($args);
|
57 |
|
58 |
-
return self::script_runner('s3://
|
59 |
}
|
60 |
|
61 |
/**
|
@@ -84,7 +84,7 @@ class CFHadoopBootstrap extends CFHadoopBase
|
|
84 |
}
|
85 |
}
|
86 |
|
87 |
-
return self::script_runner('s3://
|
88 |
}
|
89 |
|
90 |
/**
|
@@ -122,6 +122,6 @@ class CFHadoopBootstrap extends CFHadoopBase
|
|
122 |
}
|
123 |
}
|
124 |
|
125 |
-
return self::script_runner('s3://
|
126 |
}
|
127 |
}
|
21 |
/**
|
22 |
* Contains a set of pre-built Amazon EMR Hadoop Bootstrap Actions.
|
23 |
*
|
24 |
+
* @version 2012.07.24
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
30 |
class CFHadoopBootstrap extends CFHadoopBase
|
31 |
{
|
32 |
// Config file types
|
33 |
+
const CONFIG_SITE = 'S';
|
34 |
+
const CONFIG_DEFAULT = 'D';
|
35 |
+
const CONFIG_CORE = 'C';
|
36 |
+
const CONFIG_HDFS = 'H';
|
37 |
const CONFIG_MAPREDUCE = 'M';
|
38 |
|
39 |
// Daemon types
|
40 |
+
const DAEMON_NAME_NODE = 'namenode';
|
41 |
+
const DAEMON_DATA_NODE = 'datanode';
|
42 |
+
const DAEMON_JOB_TRACKER = 'jobtracker';
|
43 |
const DAEMON_TASK_TRACKER = 'tasktracker';
|
44 |
+
const DAEMON_CLIENT = 'client';
|
45 |
|
46 |
/**
|
47 |
* Create a new run-if bootstrap action which lets you conditionally run bootstrap actions.
|
55 |
if (!$args) $args = array();
|
56 |
$args = is_array($args) ? $args : array($args);
|
57 |
|
58 |
+
return self::script_runner('s3://' . self::$region . '.elasticmapreduce/bootstrap-actions/run-if', $args);
|
59 |
}
|
60 |
|
61 |
/**
|
84 |
}
|
85 |
}
|
86 |
|
87 |
+
return self::script_runner('s3://' . self::$region . '.elasticmapreduce/bootstrap-actions/configure-hadoop', $args);
|
88 |
}
|
89 |
|
90 |
/**
|
122 |
}
|
123 |
}
|
124 |
|
125 |
+
return self::script_runner('s3://' . self::$region . '.elasticmapreduce/bootstrap-actions/configure-daemons', $args);
|
126 |
}
|
127 |
}
|
libs/aws/utilities/hadoopstep.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
/**
|
22 |
* Contains a set of pre-built Amazon EMR Hadoop steps.
|
23 |
*
|
24 |
-
* @version
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
@@ -37,7 +37,7 @@ class CFHadoopStep extends CFHadoopBase
|
|
37 |
*/
|
38 |
public static function enable_debugging()
|
39 |
{
|
40 |
-
return self::script_runner('s3://
|
41 |
}
|
42 |
|
43 |
/**
|
@@ -76,7 +76,7 @@ class CFHadoopStep extends CFHadoopBase
|
|
76 |
*/
|
77 |
public static function install_pig()
|
78 |
{
|
79 |
-
return self::hive_pig_script('pig', '--install-pig');
|
80 |
}
|
81 |
|
82 |
/**
|
21 |
/**
|
22 |
* Contains a set of pre-built Amazon EMR Hadoop steps.
|
23 |
*
|
24 |
+
* @version 2012.07.24
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
37 |
*/
|
38 |
public static function enable_debugging()
|
39 |
{
|
40 |
+
return self::script_runner('s3://' . self::$region . '.elasticmapreduce/libs/state-pusher/0.1/fetch');
|
41 |
}
|
42 |
|
43 |
/**
|
76 |
*/
|
77 |
public static function install_pig()
|
78 |
{
|
79 |
+
return self::hive_pig_script('pig', array('--install-pig', '--pig-versions', 'latest'));
|
80 |
}
|
81 |
|
82 |
/**
|
libs/aws/utilities/json.class.php
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
/**
|
22 |
* Handles the conversion of data from JSON to other formats.
|
23 |
*
|
24 |
-
* @version 2012.
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
@@ -76,7 +76,7 @@ class CFJSON
|
|
76 |
}
|
77 |
|
78 |
// Hand off for the recursive work
|
79 |
-
$string =
|
80 |
|
81 |
return simplexml_load_string($string, $parser, LIBXML_NOCDATA);
|
82 |
}
|
21 |
/**
|
22 |
* Handles the conversion of data from JSON to other formats.
|
23 |
*
|
24 |
+
* @version 2012.07.27
|
25 |
* @license See the included NOTICE.md file for more information.
|
26 |
* @copyright See the included NOTICE.md file for more information.
|
27 |
* @link http://aws.amazon.com/php/ PHP Developer Center
|
76 |
}
|
77 |
|
78 |
// Hand off for the recursive work
|
79 |
+
$string = Transmogrifier::to_xml($json, 'rootElement');
|
80 |
|
81 |
return simplexml_load_string($string, $parser, LIBXML_NOCDATA);
|
82 |
}
|
libs/aws/utilities/response.class.php
CHANGED
@@ -19,7 +19,8 @@
|
|
19 |
// CLASS
|
20 |
|
21 |
/**
|
22 |
-
* Wraps the underlying `ResponseCore` class with some AWS-specific customizations.
|
|
|
23 |
*
|
24 |
* @version 2010.10.11
|
25 |
* @license See the included NOTICE.md file for more information.
|
19 |
// CLASS
|
20 |
|
21 |
/**
|
22 |
+
* Wraps the underlying `ResponseCore` class with some AWS-specific customizations. Response
|
23 |
+
* bodies are typically represented as CFSimpleXML objects.
|
24 |
*
|
25 |
* @version 2010.10.11
|
26 |
* @license See the included NOTICE.md file for more information.
|
libs/aws/utilities/simplexml.class.php
CHANGED
@@ -19,8 +19,10 @@
|
|
19 |
// CLASS
|
20 |
|
21 |
/**
|
22 |
-
* Wraps the underlying `SimpleXMLIterator` class with enhancements for rapidly traversing the
|
23 |
-
* converting types, and comparisons.
|
|
|
|
|
24 |
*
|
25 |
* @version 2012.05.31
|
26 |
* @license See the included NOTICE.md file for more information.
|
19 |
// CLASS
|
20 |
|
21 |
/**
|
22 |
+
* Wraps the underlying `SimpleXMLIterator` class with enhancements for rapidly traversing the
|
23 |
+
* DOM tree, converting types, and comparisons. You will need to be familiar with traversing
|
24 |
+
* objects with the PHP SimpleXML extension in order to use this class effectively. Also,
|
25 |
+
* CFResponse bodies are typically represented as CFSimpleXML objects.
|
26 |
*
|
27 |
* @version 2012.05.31
|
28 |
* @license See the included NOTICE.md file for more information.
|
libs/dropbox.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*
|
6 |
* This source file can be used to communicate with DropBox (http://dropbox.com)
|
7 |
*
|
8 |
-
* The class is documented in the file itself. If you find any bugs help me out and report them.
|
9 |
* If you report a bug, make sure you give me enough information (include your code).
|
10 |
*
|
11 |
*
|
@@ -22,7 +22,7 @@
|
|
22 |
* This software is provided by the author "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
23 |
*
|
24 |
* @author Daniel Huesken <daniel@huesken-net.de>
|
25 |
-
* @version 2.0.
|
26 |
*
|
27 |
* @copyright Copyright (c), Daniel Huesken. All rights reserved.
|
28 |
* @license GPL3 License
|
@@ -33,14 +33,14 @@ class backwpup_Dropbox {
|
|
33 |
const API_CONTENT_URL = 'https://api-content.dropbox.com/';
|
34 |
const API_WWW_URL = 'https://www.dropbox.com/';
|
35 |
const API_VERSION_URL = '1/';
|
36 |
-
|
37 |
-
private $root = '
|
38 |
private $ProgressFunction = false;
|
39 |
private $oauth_app_key ='q2jbt0unkkc54u2';
|
40 |
private $oauth_app_secret ='t5hlbxtz473hchy';
|
41 |
private $oauth_token ='';
|
42 |
private $oauth_token_secret ='';
|
43 |
-
|
44 |
public function __construct($dropbox=false) {
|
45 |
if ($dropbox)
|
46 |
$this->root = 'dropbox';
|
@@ -52,59 +52,99 @@ class backwpup_Dropbox {
|
|
52 |
$this->oauth_token = $token;
|
53 |
$this->oauth_token_secret = $secret;
|
54 |
}
|
55 |
-
|
56 |
-
public function setProgressFunction($function) {
|
57 |
if (function_exists($function))
|
58 |
$this->ProgressFunction = $function;
|
59 |
else
|
60 |
$this->ProgressFunction = false;
|
61 |
}
|
62 |
-
|
63 |
public function accountInfo(){
|
64 |
$url = self::API_URL.self::API_VERSION_URL.'account/info';
|
65 |
return $this->request($url);
|
66 |
}
|
67 |
-
|
68 |
public function upload($file, $path = '',$overwrite=true){
|
69 |
$file = str_replace("\\", "/",$file);
|
70 |
if (!is_readable($file) or !is_file($file))
|
71 |
throw new backwpup_DropboxException("Error: File \"$file\" is not readable or doesn't exist.");
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
public function download($path,$echo=false){
|
79 |
$url = self::API_CONTENT_URL.self::API_VERSION_URL.'files/'.$this->root.'/'.trim($path,'/');
|
80 |
if (!$echo)
|
81 |
return $this->request($url);
|
82 |
else
|
83 |
-
$this->request($url,'','GET','',true);
|
84 |
}
|
85 |
-
|
86 |
public function metadata($path = '', $listContents = true, $fileLimit = 10000){
|
87 |
$url = self::API_URL.self::API_VERSION_URL.'metadata/'.$this->root.'/'.trim($path,'/');
|
88 |
return $this->request($url, array('list' => ($listContents)? 'true' : 'false', 'file_limit' => $fileLimit));
|
89 |
}
|
90 |
-
|
91 |
public function search($path = '', $query , $fileLimit = 1000){
|
92 |
if (strlen($query)>=3)
|
93 |
throw new backwpup_DropboxException("Error: Query \"$query\" must three characters long.");
|
94 |
$url = self::API_URL.self::API_VERSION_URL.'search/'.$this->root.'/'.trim($path,'/');
|
95 |
return $this->request($url, array('query' => $query, 'file_limit' => $fileLimit));
|
96 |
}
|
97 |
-
|
98 |
public function shares($path = ''){
|
99 |
$url = self::API_URL.self::API_VERSION_URL.'shares/'.$this->root.'/'.trim($path,'/');
|
100 |
return $this->request($url);
|
101 |
}
|
102 |
-
|
103 |
public function media($path = ''){
|
104 |
$url = self::API_URL.self::API_VERSION_URL.'media/'.$this->root.'/'.trim($path,'/');
|
105 |
return $this->request($url);
|
106 |
}
|
107 |
-
|
108 |
public function fileopsDelete($path){
|
109 |
$url = self::API_URL.self::API_VERSION_URL.'fileops/delete';
|
110 |
return $this->request($url, array('path' => '/'.trim($path,'/'), 'root' => $this->root));
|
@@ -129,7 +169,6 @@ class backwpup_Dropbox {
|
|
129 |
curl_setopt($ch, CURLOPT_AUTOREFERER , true);
|
130 |
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
|
131 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
132 |
-
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
|
133 |
$content = curl_exec($ch);
|
134 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
135 |
if ($status>=200 and $status<300 and 0==curl_errno($ch) ) {
|
@@ -140,14 +179,14 @@ class backwpup_Dropbox {
|
|
140 |
elseif(isset($output['error']['hash']) && $output['error']['hash'] != '') $message = (string) $output['error']['hash'];
|
141 |
elseif (0!=curl_errno($ch)) $message = '('.curl_errno($ch).') '.curl_error($ch);
|
142 |
else $message = '('.$status.') Invalid response.';
|
143 |
-
throw new backwpup_DropboxException($message);
|
144 |
}
|
145 |
curl_close($ch);
|
146 |
return array( 'authurl' => self::API_WWW_URL . self::API_VERSION_URL . 'oauth/authorize?oauth_token='.$oauth_token['oauth_token'].'&oauth_callback='.urlencode($callback_url),
|
147 |
'oauth_token' => $oauth_token['oauth_token'],
|
148 |
-
'oauth_token_secret'=> $oauth_token['oauth_token_secret'] );
|
149 |
}
|
150 |
-
|
151 |
public function oAuthAccessToken($oauth_token, $oauth_token_secret) {
|
152 |
$headers[] = 'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="'.$this->oauth_app_key.'", oauth_token="'.$oauth_token.'", oauth_signature="'.$this->oauth_app_secret.'&'.$oauth_token_secret.'"';
|
153 |
$ch = curl_init();
|
@@ -162,7 +201,6 @@ class backwpup_Dropbox {
|
|
162 |
curl_setopt($ch, CURLOPT_AUTOREFERER , true);
|
163 |
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
|
164 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
165 |
-
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
|
166 |
$content = curl_exec($ch);
|
167 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
168 |
if ($status>=200 and $status<300 and 0==curl_errno($ch)) {
|
@@ -175,31 +213,28 @@ class backwpup_Dropbox {
|
|
175 |
elseif(isset($output['error']['hash']) && $output['error']['hash'] != '') $message = (string) $output['error']['hash'];
|
176 |
elseif (0!=curl_errno($ch)) $message = '('.curl_errno($ch).') '.curl_error($ch);
|
177 |
else $message = '('.$status.') Invalid response.';
|
178 |
-
throw new backwpup_DropboxException($message);
|
179 |
}
|
180 |
-
}
|
181 |
-
|
182 |
-
private function request($url, $args = null, $method = 'GET', $
|
183 |
$args = (is_array($args)) ? $args : array();
|
184 |
$url = $this->url_encode($url);
|
185 |
-
|
186 |
/* Header*/
|
187 |
$headers[]='Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="'.$this->oauth_app_key.'", oauth_token="'.$this->oauth_token.'", oauth_signature="'.$this->oauth_app_secret.'&'.$this->oauth_token_secret.'"';
|
188 |
$headers[]='Expect:';
|
189 |
-
|
190 |
/* Build cURL Request */
|
191 |
$ch = curl_init();
|
192 |
if ($method == 'POST') {
|
193 |
curl_setopt($ch, CURLOPT_POST, true);
|
194 |
-
$args = (is_array($args)) ? http_build_query($args, '', '&') : $args;
|
195 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
|
196 |
-
$headers[]='Content-Length: '.strlen($args);
|
197 |
curl_setopt($ch, CURLOPT_URL, $url);
|
198 |
} elseif ($method == 'PUT') {
|
199 |
-
$datafilefd=fopen($file,'r');
|
200 |
curl_setopt($ch,CURLOPT_PUT,true);
|
201 |
-
curl_setopt($ch,CURLOPT_INFILE,$
|
202 |
-
curl_setopt($ch,CURLOPT_INFILESIZE
|
203 |
$args = (is_array($args)) ? '?'.http_build_query($args, '', '&') : $args;
|
204 |
curl_setopt($ch, CURLOPT_URL, $url.$args);
|
205 |
} else {
|
@@ -215,7 +250,6 @@ class backwpup_Dropbox {
|
|
215 |
if (is_file(dirname(__FILE__).'/aws/lib/requestcore/cacert.pem'))
|
216 |
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__).'/aws/lib/requestcore/cacert.pem');
|
217 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
218 |
-
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
|
219 |
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
|
220 |
if (!empty($this->ProgressFunction) and function_exists($this->ProgressFunction) and defined('CURLOPT_PROGRESSFUNCTION') and $method == 'PUT') {
|
221 |
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
|
@@ -230,9 +264,7 @@ class backwpup_Dropbox {
|
|
230 |
$output = json_decode($content, true);
|
231 |
}
|
232 |
$status = curl_getinfo($ch);
|
233 |
-
|
234 |
-
fclose($datafilefd);
|
235 |
-
|
236 |
if (isset($output['error']) or $status['http_code']>=300 or $status['http_code']<200 or curl_errno($ch)>0) {
|
237 |
if(isset($output['error']) && is_string($output['error'])) $message = '('.$status['http_code'].') '.$output['error'];
|
238 |
elseif(isset($output['error']['hash']) && $output['error']['hash'] != '') $message = (string) '('.$status['http_code'].') '.$output['error']['hash'];
|
@@ -258,7 +290,7 @@ class backwpup_Dropbox {
|
|
258 |
return $output;
|
259 |
}
|
260 |
}
|
261 |
-
|
262 |
private function url_encode($string) {
|
263 |
$string = str_replace('?','%3F',$string);
|
264 |
$string = str_replace('=','%3D',$string);
|
5 |
*
|
6 |
* This source file can be used to communicate with DropBox (http://dropbox.com)
|
7 |
*
|
8 |
+
* The class is documented in the file itself. If you find any bugs help me out and report them.
|
9 |
* If you report a bug, make sure you give me enough information (include your code).
|
10 |
*
|
11 |
*
|
22 |
* This software is provided by the author "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
|
23 |
*
|
24 |
* @author Daniel Huesken <daniel@huesken-net.de>
|
25 |
+
* @version 2.0.2
|
26 |
*
|
27 |
* @copyright Copyright (c), Daniel Huesken. All rights reserved.
|
28 |
* @license GPL3 License
|
33 |
const API_CONTENT_URL = 'https://api-content.dropbox.com/';
|
34 |
const API_WWW_URL = 'https://www.dropbox.com/';
|
35 |
const API_VERSION_URL = '1/';
|
36 |
+
|
37 |
+
private $root = 'dropbox';
|
38 |
private $ProgressFunction = false;
|
39 |
private $oauth_app_key ='q2jbt0unkkc54u2';
|
40 |
private $oauth_app_secret ='t5hlbxtz473hchy';
|
41 |
private $oauth_token ='';
|
42 |
private $oauth_token_secret ='';
|
43 |
+
|
44 |
public function __construct($dropbox=false) {
|
45 |
if ($dropbox)
|
46 |
$this->root = 'dropbox';
|
52 |
$this->oauth_token = $token;
|
53 |
$this->oauth_token_secret = $secret;
|
54 |
}
|
55 |
+
|
56 |
+
public function setProgressFunction($function=null) {
|
57 |
if (function_exists($function))
|
58 |
$this->ProgressFunction = $function;
|
59 |
else
|
60 |
$this->ProgressFunction = false;
|
61 |
}
|
62 |
+
|
63 |
public function accountInfo(){
|
64 |
$url = self::API_URL.self::API_VERSION_URL.'account/info';
|
65 |
return $this->request($url);
|
66 |
}
|
67 |
+
|
68 |
public function upload($file, $path = '',$overwrite=true){
|
69 |
$file = str_replace("\\", "/",$file);
|
70 |
if (!is_readable($file) or !is_file($file))
|
71 |
throw new backwpup_DropboxException("Error: File \"$file\" is not readable or doesn't exist.");
|
72 |
+
$filesize=filesize($file);
|
73 |
+
if ($filesize<50000000) { //chunk transfer on bigger uploads
|
74 |
+
$filehandel = fopen($file,'r');
|
75 |
+
$url = self::API_CONTENT_URL.self::API_VERSION_URL.'files_put/'.$this->root.'/'.trim($path, '/');
|
76 |
+
$output = $this->request($url, array('overwrite' => ($overwrite)? 'true' : 'false'), 'PUT', $filehandel, $filesize);
|
77 |
+
fclose($filehandel);
|
78 |
+
} else {
|
79 |
+
$output = $this->chunked_upload($file, $path,$overwrite);
|
80 |
+
}
|
81 |
+
return $output;
|
82 |
}
|
83 |
+
|
84 |
+
public function chunked_upload($file, $path = '',$overwrite=true){
|
85 |
+
$file = str_replace("\\", "/",$file);
|
86 |
+
if (!is_readable($file) or !is_file($file))
|
87 |
+
throw new backwpup_DropboxException("Error: File \"$file\" is not readable or doesn't exist.");
|
88 |
+
$file_handel=fopen($file,'r');
|
89 |
+
$uploadid=null;
|
90 |
+
$offset=0;
|
91 |
+
$ProgressFunction=null;
|
92 |
+
while ($data=fread($file_handel,4194304)) { //4194304 = 4MB
|
93 |
+
$chunkHandle = fopen('php://temp', 'rw');
|
94 |
+
fwrite($chunkHandle,$data);
|
95 |
+
fseek($chunkHandle,0);
|
96 |
+
//overwrite progress function
|
97 |
+
if (!empty($this->ProgressFunction) and function_exists($this->ProgressFunction)) {
|
98 |
+
$ProgressFunction=$this->ProgressFunction;
|
99 |
+
$this->ProgressFunction=false;
|
100 |
+
}
|
101 |
+
$url = self::API_CONTENT_URL.self::API_VERSION_URL.'chunked_upload';
|
102 |
+
$output = $this->request($url, array('upload_id' => $uploadid,'offset'=>$offset), 'PUT', $chunkHandle, strlen($data));
|
103 |
+
fclose($chunkHandle);
|
104 |
+
if ($ProgressFunction) {
|
105 |
+
call_user_func($ProgressFunction,0,0,0,$offset);
|
106 |
+
$this->ProgressFunction=$ProgressFunction;
|
107 |
+
}
|
108 |
+
//args for next chunk
|
109 |
+
$offset= $output['offset'];
|
110 |
+
$uploadid=$output['upload_id'];
|
111 |
+
fseek($file_handel,$offset);
|
112 |
+
}
|
113 |
+
fclose($file_handel);
|
114 |
+
$url = self::API_CONTENT_URL.self::API_VERSION_URL.'commit_chunked_upload/'.$this->root.'/'.trim($path, '/');
|
115 |
+
return $this->request($url, array('overwrite' => ($overwrite)? 'true' : 'false','upload_id'=>$uploadid), 'POST');
|
116 |
+
}
|
117 |
+
|
118 |
public function download($path,$echo=false){
|
119 |
$url = self::API_CONTENT_URL.self::API_VERSION_URL.'files/'.$this->root.'/'.trim($path,'/');
|
120 |
if (!$echo)
|
121 |
return $this->request($url);
|
122 |
else
|
123 |
+
$this->request($url,'','GET','','',true);
|
124 |
}
|
125 |
+
|
126 |
public function metadata($path = '', $listContents = true, $fileLimit = 10000){
|
127 |
$url = self::API_URL.self::API_VERSION_URL.'metadata/'.$this->root.'/'.trim($path,'/');
|
128 |
return $this->request($url, array('list' => ($listContents)? 'true' : 'false', 'file_limit' => $fileLimit));
|
129 |
}
|
130 |
+
|
131 |
public function search($path = '', $query , $fileLimit = 1000){
|
132 |
if (strlen($query)>=3)
|
133 |
throw new backwpup_DropboxException("Error: Query \"$query\" must three characters long.");
|
134 |
$url = self::API_URL.self::API_VERSION_URL.'search/'.$this->root.'/'.trim($path,'/');
|
135 |
return $this->request($url, array('query' => $query, 'file_limit' => $fileLimit));
|
136 |
}
|
137 |
+
|
138 |
public function shares($path = ''){
|
139 |
$url = self::API_URL.self::API_VERSION_URL.'shares/'.$this->root.'/'.trim($path,'/');
|
140 |
return $this->request($url);
|
141 |
}
|
142 |
+
|
143 |
public function media($path = ''){
|
144 |
$url = self::API_URL.self::API_VERSION_URL.'media/'.$this->root.'/'.trim($path,'/');
|
145 |
return $this->request($url);
|
146 |
}
|
147 |
+
|
148 |
public function fileopsDelete($path){
|
149 |
$url = self::API_URL.self::API_VERSION_URL.'fileops/delete';
|
150 |
return $this->request($url, array('path' => '/'.trim($path,'/'), 'root' => $this->root));
|
169 |
curl_setopt($ch, CURLOPT_AUTOREFERER , true);
|
170 |
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
|
171 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
172 |
$content = curl_exec($ch);
|
173 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
174 |
if ($status>=200 and $status<300 and 0==curl_errno($ch) ) {
|
179 |
elseif(isset($output['error']['hash']) && $output['error']['hash'] != '') $message = (string) $output['error']['hash'];
|
180 |
elseif (0!=curl_errno($ch)) $message = '('.curl_errno($ch).') '.curl_error($ch);
|
181 |
else $message = '('.$status.') Invalid response.';
|
182 |
+
throw new backwpup_DropboxException($message);
|
183 |
}
|
184 |
curl_close($ch);
|
185 |
return array( 'authurl' => self::API_WWW_URL . self::API_VERSION_URL . 'oauth/authorize?oauth_token='.$oauth_token['oauth_token'].'&oauth_callback='.urlencode($callback_url),
|
186 |
'oauth_token' => $oauth_token['oauth_token'],
|
187 |
+
'oauth_token_secret'=> $oauth_token['oauth_token_secret'] );
|
188 |
}
|
189 |
+
|
190 |
public function oAuthAccessToken($oauth_token, $oauth_token_secret) {
|
191 |
$headers[] = 'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="'.$this->oauth_app_key.'", oauth_token="'.$oauth_token.'", oauth_signature="'.$this->oauth_app_secret.'&'.$oauth_token_secret.'"';
|
192 |
$ch = curl_init();
|
201 |
curl_setopt($ch, CURLOPT_AUTOREFERER , true);
|
202 |
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
|
203 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
204 |
$content = curl_exec($ch);
|
205 |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
206 |
if ($status>=200 and $status<300 and 0==curl_errno($ch)) {
|
213 |
elseif(isset($output['error']['hash']) && $output['error']['hash'] != '') $message = (string) $output['error']['hash'];
|
214 |
elseif (0!=curl_errno($ch)) $message = '('.curl_errno($ch).') '.curl_error($ch);
|
215 |
else $message = '('.$status.') Invalid response.';
|
216 |
+
throw new backwpup_DropboxException($message);
|
217 |
}
|
218 |
+
}
|
219 |
+
|
220 |
+
private function request($url, $args = null, $method = 'GET', $filehandel = null, $filesize=0, $echo=false){
|
221 |
$args = (is_array($args)) ? $args : array();
|
222 |
$url = $this->url_encode($url);
|
223 |
+
|
224 |
/* Header*/
|
225 |
$headers[]='Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="'.$this->oauth_app_key.'", oauth_token="'.$this->oauth_token.'", oauth_signature="'.$this->oauth_app_secret.'&'.$this->oauth_token_secret.'"';
|
226 |
$headers[]='Expect:';
|
227 |
+
|
228 |
/* Build cURL Request */
|
229 |
$ch = curl_init();
|
230 |
if ($method == 'POST') {
|
231 |
curl_setopt($ch, CURLOPT_POST, true);
|
|
|
232 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
|
|
|
233 |
curl_setopt($ch, CURLOPT_URL, $url);
|
234 |
} elseif ($method == 'PUT') {
|
|
|
235 |
curl_setopt($ch,CURLOPT_PUT,true);
|
236 |
+
curl_setopt($ch,CURLOPT_INFILE,$filehandel);
|
237 |
+
curl_setopt($ch,CURLOPT_INFILESIZE,$filesize);
|
238 |
$args = (is_array($args)) ? '?'.http_build_query($args, '', '&') : $args;
|
239 |
curl_setopt($ch, CURLOPT_URL, $url.$args);
|
240 |
} else {
|
250 |
if (is_file(dirname(__FILE__).'/aws/lib/requestcore/cacert.pem'))
|
251 |
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__).'/aws/lib/requestcore/cacert.pem');
|
252 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
|
|
253 |
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
|
254 |
if (!empty($this->ProgressFunction) and function_exists($this->ProgressFunction) and defined('CURLOPT_PROGRESSFUNCTION') and $method == 'PUT') {
|
255 |
curl_setopt($ch, CURLOPT_NOPROGRESS, false);
|
264 |
$output = json_decode($content, true);
|
265 |
}
|
266 |
$status = curl_getinfo($ch);
|
267 |
+
|
|
|
|
|
268 |
if (isset($output['error']) or $status['http_code']>=300 or $status['http_code']<200 or curl_errno($ch)>0) {
|
269 |
if(isset($output['error']) && is_string($output['error'])) $message = '('.$status['http_code'].') '.$output['error'];
|
270 |
elseif(isset($output['error']['hash']) && $output['error']['hash'] != '') $message = (string) '('.$status['http_code'].') '.$output['error']['hash'];
|
290 |
return $output;
|
291 |
}
|
292 |
}
|
293 |
+
|
294 |
private function url_encode($string) {
|
295 |
$string = str_replace('?','%3F',$string);
|
296 |
$string = str_replace('=','%3D',$string);
|
pages/func_backwpupeditjob.php
CHANGED
@@ -240,7 +240,7 @@ function backwpup_jobedit_metabox_destftp($jobvalue) {
|
|
240 |
<?PHP if (!is_numeric($jobvalue['ftpmaxbackups'])) $jobvalue['ftpmaxbackups']=0; ?>
|
241 |
<?PHP _e('Max. backup files in FTP folder:','backwpup'); ?> <input name="ftpmaxbackups" type="text" size="3" value="<?PHP echo $jobvalue['ftpmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('(Oldest files will be deleted first.)','backwpup');?></span><br />
|
242 |
<input class="checkbox" value="1" type="checkbox" <?php checked($jobvalue['ftpssl'],true); ?> name="ftpssl" /> <?PHP _e('Use SSL-FTP Connection.','backwpup'); ?><br />
|
243 |
-
<input class="checkbox" value="1" type="checkbox" <?php checked($jobvalue['ftppasv'],true); ?> name="ftppasv" /> <?PHP _e('Use FTP
|
244 |
<?PHP
|
245 |
}
|
246 |
|
240 |
<?PHP if (!is_numeric($jobvalue['ftpmaxbackups'])) $jobvalue['ftpmaxbackups']=0; ?>
|
241 |
<?PHP _e('Max. backup files in FTP folder:','backwpup'); ?> <input name="ftpmaxbackups" type="text" size="3" value="<?PHP echo $jobvalue['ftpmaxbackups'];?>" class="small-text" /><span class="description"><?PHP _e('(Oldest files will be deleted first.)','backwpup');?></span><br />
|
242 |
<input class="checkbox" value="1" type="checkbox" <?php checked($jobvalue['ftpssl'],true); ?> name="ftpssl" /> <?PHP _e('Use SSL-FTP Connection.','backwpup'); ?><br />
|
243 |
+
<input class="checkbox" value="1" type="checkbox" <?php checked($jobvalue['ftppasv'],true); ?> name="ftppasv" /> <?PHP _e('Use FTP Passive mode.','backwpup'); ?><br />
|
244 |
<?PHP
|
245 |
}
|
246 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: backup, database, file, ftp, xml, time, upload, multisite, cloud, dropbox, storage, amazon
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.4
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -60,6 +60,14 @@ Do backups and more for your WordPress Blog.
|
|
60 |
4. Backups Manage Page
|
61 |
|
62 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
= 2.1.13 =
|
64 |
* tweaked Gstorage upload thx Kevin
|
65 |
* fixed bug in xml file generation
|
@@ -341,7 +349,7 @@ Do backups and more for your WordPress Blog.
|
|
341 |
* added php version to log header
|
342 |
* added mysql version to log header
|
343 |
|
344 |
-
= 1.2.0 =
|
345 |
* Backup file size now in log file
|
346 |
* Paged Logs Table
|
347 |
* added Backup Archives Page
|
4 |
Tags: backup, database, file, ftp, xml, time, upload, multisite, cloud, dropbox, storage, amazon
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.4
|
7 |
+
Stable tag: 2.1.14
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
60 |
4. Backups Manage Page
|
61 |
|
62 |
== Changelog ==
|
63 |
+
= 2.1.14 =
|
64 |
+
* removed calling home function
|
65 |
+
* fixed missing ' in mysql dump
|
66 |
+
* now lager than 150MB uploads to Dropbox with there Beta API
|
67 |
+
* fixed bug in progress updates
|
68 |
+
* fixed problem with ftp dir can not empty
|
69 |
+
* Updated AWS lib to 1.5.11
|
70 |
+
|
71 |
= 2.1.13 =
|
72 |
* tweaked Gstorage upload thx Kevin
|
73 |
* fixed bug in xml file generation
|
349 |
* added php version to log header
|
350 |
* added mysql version to log header
|
351 |
|
352 |
+
= 1.2.0 =
|
353 |
* Backup file size now in log file
|
354 |
* Paged Logs Table
|
355 |
* added Backup Archives Page
|
uninstall.php
CHANGED
@@ -3,7 +3,5 @@ if (!defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN')) {
|
|
3 |
die();
|
4 |
}
|
5 |
|
6 |
-
include(ABSPATH . WPINC . '/version.php'); // include an unmodified $wp_version
|
7 |
-
wp_remote_post( 'https://api.backwpup.com', array( 'sslverify' => false, 'body'=>array('URL'=>home_url(),'ACTION'=>'delete'), 'user-agent'=>'BackWPup/0.0.0; WordPress/'.$wp_version.'; ' . home_url()));
|
8 |
delete_option('backwpup');
|
9 |
delete_option('backwpup_jobs');
|
3 |
die();
|
4 |
}
|
5 |
|
|
|
|
|
6 |
delete_option('backwpup');
|
7 |
delete_option('backwpup_jobs');
|