当前位置: 首页>>代码示例>>PHP>>正文


PHP BackWPup::get_destination方法代码示例

本文整理汇总了PHP中BackWPup::get_destination方法的典型用法代码示例。如果您正苦于以下问题:PHP BackWPup::get_destination方法的具体用法?PHP BackWPup::get_destination怎么用?PHP BackWPup::get_destination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BackWPup的用法示例。


在下文中一共展示了BackWPup::get_destination方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: defaults_job

 /**
  *
  * Get default option for BackWPup option
  *
  * @param string $key Option key
  *
  * @internal param int $id The job id
  *
  * @return bool|mixed
  */
 public static function defaults_job($key = '')
 {
     $key = sanitize_key(trim($key));
     //set defaults
     $default['type'] = array('DBDUMP', 'FILE', 'WPPLUGIN');
     $default['destinations'] = array();
     $default['name'] = __('New Job', 'backwpup');
     $default['activetype'] = '';
     $default['logfile'] = '';
     $default['lastbackupdownloadurl'] = '';
     $default['cronselect'] = 'basic';
     $default['cron'] = '0 3 * * *';
     $default['mailaddresslog'] = sanitize_email(get_bloginfo('admin_email'));
     $default['mailaddresssenderlog'] = 'BackWPup ' . get_bloginfo('name') . ' <' . sanitize_email(get_bloginfo('admin_email')) . '>';
     $default['mailerroronly'] = true;
     $default['backuptype'] = 'archive';
     $default['archiveformat'] = '.tar.gz';
     $default['archivename'] = 'backwpup_' . BackWPup::get_plugin_data('hash') . '_%Y-%m-%d_%H-%i-%s';
     //defaults vor destinations
     foreach (BackWPup::get_registered_destinations() as $dest_key => $dest) {
         if (!empty($dest['class'])) {
             $dest_object = BackWPup::get_destination($dest_key);
             $default = array_merge($default, $dest_object->option_defaults());
         }
     }
     //defaults vor job types
     foreach (BackWPup::get_job_types() as $job_type) {
         $default = array_merge($default, $job_type->option_defaults());
     }
     //return all
     if (empty($key)) {
         return $default;
     }
     //return one default setting
     if (isset($default[$key])) {
         return $default[$key];
     } else {
         return false;
     }
 }
开发者ID:demochko-ol,项目名称:hezy,代码行数:50,代码来源:class-option.php

示例2: run


//.........这里部分代码省略.........
     @ini_set('implicit_flush', '0');
     //set temp folder
     $can_set_temp_env = true;
     $protected_env_vars = explode(',', ini_get('safe_mode_protected_env_vars'));
     //removed in php 5.4.0
     foreach ($protected_env_vars as $protected_env) {
         if (strtoupper(trim($protected_env)) == 'TMPDIR') {
             $can_set_temp_env = false;
         }
     }
     if ($can_set_temp_env) {
         @putenv('TMPDIR=' . BackWPup::get_plugin_data('TEMP'));
     }
     //Write Wordpress DB errors to log
     $wpdb->suppress_errors(false);
     $wpdb->hide_errors();
     //set wp max memory limit
     @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
     //set error handler
     if (!empty($this->logfile)) {
         if ($this->is_debug()) {
             set_error_handler(array($this, 'log'));
         } else {
             set_error_handler(array($this, 'log'), E_ALL ^ E_NOTICE);
         }
     }
     set_exception_handler(array($this, 'exception_handler'));
     // execute function on job shutdown  register_shutdown_function( array( $this, 'shutdown' ) );
     add_action('shutdown', array($this, 'shutdown'));
     if (function_exists('pcntl_signal')) {
         $signals = array('SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGABRT', 'SIGBUS', 'SIGFPE', 'SIGSEGV', 'SIGTERM', 'SIGSTKFLT', 'SIGUSR1', 'SIGUSR2', 'SIGXCPU', 'SIGXFSZ', 'SIGPWR', 'SIGSYS');
         $signals = apply_filters('backwpup_job_signals_to_handel', $signals);
         declare (ticks=1);
         $this->signal = 0;
         foreach ($signals as $signal) {
             if (defined($signal)) {
                 pcntl_signal(constant($signal), array($this, 'signal_handler'), false);
             }
         }
     }
     $job_types = BackWPup::get_job_types();
     //go step by step
     foreach ($this->steps_todo as $this->step_working) {
         //Check if step already done
         if (in_array($this->step_working, $this->steps_done, true)) {
             continue;
         }
         //calc step percent
         if (count($this->steps_done) > 0) {
             $this->step_percent = round(count($this->steps_done) / count($this->steps_todo) * 100);
         } else {
             $this->step_percent = 1;
         }
         // do step tries
         while (true) {
             if ($this->steps_data[$this->step_working]['STEP_TRY'] >= get_site_option('backwpup_cfg_jobstepretry')) {
                 $this->log(__('Step aborted: too many attempts!', 'backwpup'), E_USER_ERROR);
                 $this->temp = array();
                 $this->steps_done[] = $this->step_working;
                 $this->substeps_done = 0;
                 $this->substeps_todo = 0;
                 $this->do_restart();
                 break;
             }
             $this->steps_data[$this->step_working]['STEP_TRY']++;
             $done = false;
             //executes the methods of job process
             if ($this->step_working == 'CREATE_ARCHIVE') {
                 $done = $this->create_archive();
             } elseif ($this->step_working == 'CREATE_MANIFEST') {
                 $done = $this->create_manifest();
             } elseif ($this->step_working == 'END') {
                 $this->end();
                 break 2;
             } elseif (strstr($this->step_working, 'JOB_')) {
                 $done = $job_types[str_replace('JOB_', '', $this->step_working)]->job_run($this);
             } elseif (strstr($this->step_working, 'DEST_SYNC_')) {
                 $done = BackWPup::get_destination(str_replace('DEST_SYNC_', '', $this->step_working))->job_run_sync($this);
             } elseif (strstr($this->step_working, 'DEST_')) {
                 $done = BackWPup::get_destination(str_replace('DEST_', '', $this->step_working))->job_run_archive($this);
             } elseif (!empty($this->steps_data[$this->step_working]['CALLBACK'])) {
                 $done = $this->steps_data[$this->step_working]['CALLBACK']($this);
             }
             // set step as done
             if ($done === true) {
                 $this->temp = array();
                 $this->steps_done[] = $this->step_working;
                 $this->substeps_done = 0;
                 $this->substeps_todo = 0;
                 $this->update_working_data(true);
             }
             if (count($this->steps_done) < count($this->steps_todo) - 1) {
                 $this->do_restart();
             }
             if ($done === true) {
                 break;
             }
         }
     }
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:101,代码来源:class-job.php

示例3: page


//.........这里部分代码省略.........
                                <b><?php 
                _e('Month:', 'backwpup');
                ?>
</b><br/>
								<?php 
                echo '<label for="idcronmon"><input class="checkbox" type="checkbox"' . checked(in_array("*", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon" value="*" /> ' . __('Any (*)', 'backwpup') . '</label><br />';
                ?>
                                <div id="cron-month">
									<?php 
                echo '<label for="idcronmon-1"><input class="checkbox" type="checkbox"' . checked(in_array("1", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-1" value="1" /> ' . __('January', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-2"><input class="checkbox" type="checkbox"' . checked(in_array("2", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-2" value="2" /> ' . __('February', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-3"><input class="checkbox" type="checkbox"' . checked(in_array("3", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-3" value="3" /> ' . __('March', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-4"><input class="checkbox" type="checkbox"' . checked(in_array("4", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-4" value="4" /> ' . __('April', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-5"><input class="checkbox" type="checkbox"' . checked(in_array("5", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-5" value="5" /> ' . __('May', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-6"><input class="checkbox" type="checkbox"' . checked(in_array("6", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-6" value="6" /> ' . __('June', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-7"><input class="checkbox" type="checkbox"' . checked(in_array("7", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-7" value="7" /> ' . __('July', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-8"><input class="checkbox" type="checkbox"' . checked(in_array("8", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-8" value="8" /> ' . __('August', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-9"><input class="checkbox" type="checkbox"' . checked(in_array("9", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-9" value="9" /> ' . __('September', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-10"><input class="checkbox" type="checkbox"' . checked(in_array("10", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-10" value="10" /> ' . __('October', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-11"><input class="checkbox" type="checkbox"' . checked(in_array("11", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-11" value="11" /> ' . __('November', 'backwpup') . '</label><br />';
                echo '<label for="idcronmon-12"><input class="checkbox" type="checkbox"' . checked(in_array("12", $mon, TRUE), TRUE, FALSE) . ' name="cronmon[]" id="idcronmon-12" value="12" /> ' . __('December', 'backwpup') . '</label><br />';
                ?>
                                </div>
                            </div>
                            <div id="cron-weekday-box">
                                <b><?php 
                _e('Day of Week:', 'backwpup');
                ?>
</b><br/>
								<?php 
                echo '<label for="idcronwday"><input class="checkbox" type="checkbox"' . checked(in_array("*", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday" value="*" /> ' . __('Any (*)', 'backwpup') . '</label><br />';
                ?>
                                <div id="cron-weekday">
									<?php 
                echo '<label for="idcronwday-0"><input class="checkbox" type="checkbox"' . checked(in_array("0", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-0" value="0" /> ' . __('Sunday', 'backwpup') . '</label><br />';
                echo '<label for="idcronwday-1"><input class="checkbox" type="checkbox"' . checked(in_array("1", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-1" value="1" /> ' . __('Monday', 'backwpup') . '</label><br />';
                echo '<label for="idcronwday-2"><input class="checkbox" type="checkbox"' . checked(in_array("2", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-2" value="2" /> ' . __('Tuesday', 'backwpup') . '</label><br />';
                echo '<label for="idcronwday-3"><input class="checkbox" type="checkbox"' . checked(in_array("3", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-3" value="3" /> ' . __('Wednesday', 'backwpup') . '</label><br />';
                echo '<label for="idcronwday-4"><input class="checkbox" type="checkbox"' . checked(in_array("4", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-4" value="4" /> ' . __('Thursday', 'backwpup') . '</label><br />';
                echo '<label for="idcronwday-5"><input class="checkbox" type="checkbox"' . checked(in_array("5", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-5" value="5" /> ' . __('Friday', 'backwpup') . '</label><br />';
                echo '<label for="idcronwday-6"><input class="checkbox" type="checkbox"' . checked(in_array("6", $wday, TRUE), TRUE, FALSE) . ' name="cronwday[]" id="idcronwday-6" value="6" /> ' . __('Saturday', 'backwpup') . '</label><br />';
                ?>
                                </div>
                            </div>
                            <br class="clear"/>
						</td>
					</tr>
				</table>
				<?php 
                echo '</div>';
                break;
            default:
                echo '<div class="table" id="info-tab-' . $_GET['tab'] . '">';
                if (strstr($_GET['tab'], 'dest-')) {
                    $dest_object = BackWPup::get_destination(str_replace('dest-', '', $_GET['tab']));
                    $dest_object->edit_tab($jobid);
                }
                if (strstr($_GET['tab'], 'jobtype-')) {
                    $id = strtoupper(str_replace('jobtype-', '', $_GET['tab']));
                    $job_types[$id]->edit_tab($jobid);
                }
                echo '</div>';
        }
        echo '<p class="submit">';
        submit_button(__('Save changes', 'backwpup'), 'primary', 'save', FALSE, array('tabindex' => '2', 'accesskey' => 'p'));
        echo '</p></form>';
        ?>
    </div>

    <script type="text/javascript">
    //<![CDATA[
    jQuery(document).ready(function ($) {
        // auto post if things changed
        var changed = false;
        $( '#editjob' ).change( function () {
            changed = true;
        });
		$( '.nav-tab' ).click( function () {
			if ( changed ) {
				$( 'input[name="nexttab"]' ).val( $(this).data( "nexttab" ) );
				$( '#editjob' ).submit();
				return false;
            }
		});
		<?php 
        //add inline js
        if (strstr($_GET['tab'], 'dest-')) {
            $dest_object = BackWPup::get_destination(str_replace('dest-', '', $_GET['tab']));
            $dest_object->edit_inline_js();
        }
        if (strstr($_GET['tab'], 'jobtype-')) {
            $id = strtoupper(str_replace('jobtype-', '', $_GET['tab']));
            $job_types[$id]->edit_inline_js();
        }
        ?>
    });
    //]]>
    </script>
	<?php 
    }
开发者ID:byadrenaline,项目名称:laseravalon_wp,代码行数:101,代码来源:class-page-editjob.php

示例4: run


//.........这里部分代码省略.........
     }
     if ($can_set_temp_env) {
         $this->run['PHP']['ENV']['TEMPDIR'] = getenv('TMPDIR');
         @putenv('TMPDIR=' . BackWPup::get_plugin_data('TEMP'));
     }
     //Write Wordpress DB errors to log
     $wpdb->suppress_errors(FALSE);
     $wpdb->hide_errors();
     //set wp max memory limit
     @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
     //set error handler
     if (!empty($this->logfile)) {
         if ($this->is_debug()) {
             set_error_handler(array($this, 'log'));
         } else {
             set_error_handler(array($this, 'log'), E_ALL ^ E_NOTICE);
         }
     }
     set_exception_handler(array($this, 'exception_handler'));
     //not loading Textdomains and unload loaded
     if (!strstr($this->log_level, 'translated')) {
         add_filter('override_load_textdomain', create_function('', 'return TRUE;'));
         $GLOBALS['l10n'] = array();
     }
     // execute function on job shutdown  register_shutdown_function( array( $this, 'shutdown' ) );
     add_action('shutdown', array($this, 'shutdown'));
     //remove_action('shutdown', array( $this, 'shutdown' ));
     if (function_exists('pcntl_signal')) {
         $signals = array('SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT', 'SIGBUS', 'SIGFPE', 'SIGSEGV', 'SIGALRM', 'SIGTERM', 'SIGSTKFLT', 'SIGUSR1', 'SIGUSR2', 'SIGCHLD', 'SIGCONT', 'SIGTSTP', 'SIGTTIN', 'SIGTTOU', 'SIGURG', 'SIGXCPU', 'SIGXFSZ', 'SIGVTALRM', 'SIGPROF', 'SIGWINCH', 'SIGIO', 'SIGPWR', 'SIGSYS');
         declare (ticks=1);
         foreach ($signals as $signal) {
             if (defined($signal)) {
                 pcntl_signal(constant($signal), array($this, 'shutdown'), FALSE);
             }
         }
     }
     //clear output buffer
     while (@ob_end_clean()) {
     }
     @flush();
     $job_types = BackWPup::get_job_types();
     //go step by step
     foreach ($this->steps_todo as $this->step_working) {
         //Check if step already done
         if (in_array($this->step_working, $this->steps_done)) {
             continue;
         }
         //calc step percent
         if (count($this->steps_done) > 0) {
             $this->step_percent = round(count($this->steps_done) / count($this->steps_todo) * 100);
         } else {
             $this->step_percent = 1;
         }
         // do step tries
         while (TRUE) {
             if ($this->steps_data[$this->step_working]['STEP_TRY'] >= get_site_option('backwpup_cfg_jobstepretry')) {
                 $this->log(__('Step aborted: too many attempts!', 'backwpup'), E_USER_ERROR);
                 $this->temp = array();
                 $this->steps_done[] = $this->step_working;
                 $this->substeps_done = 0;
                 $this->substeps_todo = 0;
                 $this->do_restart();
                 break;
             }
             $this->steps_data[$this->step_working]['STEP_TRY']++;
             $done = FALSE;
             //executes the methods of job process
             if ($this->step_working == 'CREATE_ARCHIVE') {
                 $done = $this->create_archive();
             } elseif ($this->step_working == 'CREATE_MANIFEST') {
                 $done = $this->create_manifest();
             } elseif ($this->step_working == 'END') {
                 $this->end();
                 break 2;
             } elseif (strstr($this->step_working, 'JOB_')) {
                 $done = $job_types[str_replace('JOB_', '', $this->step_working)]->job_run($this);
             } elseif (strstr($this->step_working, 'DEST_SYNC_')) {
                 $done = BackWPup::get_destination(str_replace('DEST_SYNC_', '', $this->step_working))->job_run_sync($this);
             } elseif (strstr($this->step_working, 'DEST_')) {
                 $done = BackWPup::get_destination(str_replace('DEST_', '', $this->step_working))->job_run_archive($this);
             } elseif (!empty($this->steps_data[$this->step_working]['CALLBACK'])) {
                 $done = $this->steps_data[$this->step_working]['CALLBACK']($this);
             }
             // set step as done
             if ($done === TRUE) {
                 $this->temp = array();
                 $this->steps_done[] = $this->step_working;
                 $this->substeps_done = 0;
                 $this->substeps_todo = 0;
                 $this->write_running_file();
             }
             if (count($this->steps_done) < count($this->steps_todo) - 1) {
                 $this->do_restart();
             }
             if ($done === TRUE) {
                 break;
             }
         }
     }
 }
开发者ID:Giede,项目名称:backwpup,代码行数:101,代码来源:class-job.php

示例5: load

 /**
  *
  */
 public static function load()
 {
     //Create Table
     self::$listtable = new self();
     switch (self::$listtable->current_action()) {
         case 'delete':
             //Delete Job
             if (!current_user_can('backwpup_jobs_edit')) {
                 break;
             }
             if (is_array($_GET['jobs'])) {
                 check_admin_referer('bulk-jobs');
                 foreach ($_GET['jobs'] as $jobid) {
                     wp_clear_scheduled_hook('backwpup_cron', array('id' => absint($jobid)));
                     BackWPup_Option::delete_job(absint($jobid));
                 }
             }
             break;
         case 'copy':
             //Copy Job
             if (!current_user_can('backwpup_jobs_edit')) {
                 break;
             }
             $old_job_id = absint($_GET['jobid']);
             check_admin_referer('copy-job_' . $old_job_id);
             //create new
             $newjobid = BackWPup_Option::get_job_ids();
             sort($newjobid);
             $newjobid = end($newjobid) + 1;
             $old_options = BackWPup_Option::get_job($old_job_id);
             foreach ($old_options as $key => $option) {
                 if ($key === "jobid") {
                     $option = $newjobid;
                 }
                 if ($key === "name") {
                     $option = __('Copy of', 'backwpup') . ' ' . $option;
                 }
                 if ($key === "activetype") {
                     $option = '';
                 }
                 if ($key === "archivename") {
                     $option = str_replace($old_job_id, $newjobid, $option);
                 }
                 if ($key === "logfile" || $key === "lastbackupdownloadurl" || $key === "lastruntime" || $key === "lastrun") {
                     continue;
                 }
                 BackWPup_Option::update($newjobid, $key, $option);
             }
             break;
         case 'runnow':
             $jobid = absint($_GET['jobid']);
             if ($jobid) {
                 if (!current_user_can('backwpup_jobs_start')) {
                     wp_die(__('Sorry, you don\'t have permissions to do that.', 'backwpup'));
                 }
                 check_admin_referer('backwpup_job_run-runnowlink');
                 //check temp folder
                 $temp_folder_message = BackWPup_File::check_folder(BackWPup::get_plugin_data('TEMP'), TRUE);
                 BackWPup_Admin::message($temp_folder_message, TRUE);
                 //check log folder
                 $log_folder = get_site_option('backwpup_cfg_logfolder');
                 $log_folder = BackWPup_File::get_absolute_path($log_folder);
                 $log_folder_message = BackWPup_File::check_folder($log_folder);
                 BackWPup_Admin::message($log_folder_message, TRUE);
                 //check backup destinations
                 $job_types = BackWPup::get_job_types();
                 $job_conf_types = BackWPup_Option::get($jobid, 'type');
                 $creates_file = FALSE;
                 foreach ($job_types as $id => $job_type_class) {
                     if (in_array($id, $job_conf_types, true) && $job_type_class->creates_file()) {
                         $creates_file = TRUE;
                         break;
                     }
                 }
                 if ($creates_file) {
                     $job_conf_dests = BackWPup_Option::get($jobid, 'destinations');
                     $destinations = 0;
                     /* @var BackWPup_Destinations $dest_class */
                     foreach (BackWPup::get_registered_destinations() as $id => $dest) {
                         if (!in_array($id, $job_conf_dests, true) || empty($dest['class'])) {
                             continue;
                         }
                         $dest_class = BackWPup::get_destination($id);
                         $job_settings = BackWPup_Option::get_job($jobid);
                         if (!$dest_class->can_run($job_settings)) {
                             BackWPup_Admin::message(sprintf(__('The job "%s" destination "%s" is not configured properly', 'backwpup'), esc_attr(BackWPup_Option::get($jobid, 'name')), $id), TRUE);
                         }
                         $destinations++;
                     }
                     if ($destinations < 1) {
                         BackWPup_Admin::message(sprintf(__('The job "%s" needs properly configured destinations to run!', 'backwpup'), esc_attr(BackWPup_Option::get($jobid, 'name'))), TRUE);
                     }
                 }
                 //only start job if messages empty
                 $log_messages = BackWPup_Admin::get_messages();
                 if (empty($log_messages)) {
                     $old_log_file = BackWPup_Option::get($jobid, 'logfile');
//.........这里部分代码省略.........
开发者ID:skinnard,项目名称:FTL-2,代码行数:101,代码来源:class-page-jobs.php

示例6: load

 /**
  *
  */
 public static function load()
 {
     //Create Table
     self::$listtable = new self();
     switch (self::$listtable->current_action()) {
         case 'delete':
             //Delete Job
             if (!current_user_can('backwpup_jobs_edit')) {
                 break;
             }
             if (is_array($_GET['jobs'])) {
                 check_admin_referer('bulk-jobs');
                 foreach ($_GET['jobs'] as $jobid) {
                     wp_clear_scheduled_hook('backwpup_cron', array('id' => $jobid));
                     BackWPup_Option::delete_job($jobid);
                 }
             }
             break;
         case 'copy':
             //Copy Job
             if (!current_user_can('backwpup_jobs_edit')) {
                 break;
             }
             $old_job_id = (int) $_GET['jobid'];
             check_admin_referer('copy-job_' . $_GET['jobid']);
             //create new
             $newjobid = BackWPup_Option::get_job_ids();
             sort($newjobid);
             $newjobid = end($newjobid) + 1;
             $old_options = BackWPup_Option::get_job($old_job_id);
             foreach ($old_options as $key => $option) {
                 if ($key == "jobid") {
                     $option = $newjobid;
                 }
                 if ($key == "name") {
                     $option = __('Copy of', 'backwpup') . ' ' . $option;
                 }
                 if ($key == "activetype") {
                     $option = '';
                 }
                 if ($key == "archivename") {
                     $option = str_replace($_GET['jobid'], $newjobid, $option);
                 }
                 if ($key == "logfile" || $key == "lastbackupdownloadurl" || $key == "lastruntime" || $key == "lastrun") {
                     continue;
                 }
                 BackWPup_Option::update($newjobid, $key, $option);
             }
             break;
         case 'runnow':
             $_GET['jobid'] = (int) $_GET['jobid'];
             if (!empty($_GET['jobid'])) {
                 if (!current_user_can('backwpup_jobs_start')) {
                     wp_die(__('Sorry, you don\'t have permissions to do that.', 'backwpup'));
                 }
                 check_admin_referer('backwpup_job_run-runnowlink');
                 //check temp folder
                 $temp_folder_message = BackWPup_File::check_folder(BackWPup::get_plugin_data('TEMP'), TRUE);
                 BackWPup_Admin::message($temp_folder_message, TRUE);
                 //check log folder
                 $log_folder = get_site_option('backwpup_cfg_logfolder');
                 $log_folder = BackWPup_File::get_absolute_path($log_folder);
                 $log_folder_message = BackWPup_File::check_folder($log_folder);
                 BackWPup_Admin::message($log_folder_message, TRUE);
                 //check backup destinations
                 $job_types = BackWPup::get_job_types();
                 $job_conf_types = BackWPup_Option::get($_GET['jobid'], 'type');
                 $creates_file = FALSE;
                 foreach ($job_types as $id => $job_type_class) {
                     if (in_array($id, $job_conf_types) && $job_type_class->creates_file()) {
                         $creates_file = TRUE;
                         break;
                     }
                 }
                 if ($creates_file) {
                     $job_conf_dests = BackWPup_Option::get($_GET['jobid'], 'destinations');
                     $destinations = 0;
                     /* @var BackWPup_Destinations $dest_class */
                     foreach (BackWPup::get_registered_destinations() as $id => $dest) {
                         if (!in_array($id, $job_conf_dests) || empty($dest['class'])) {
                             continue;
                         }
                         $dest_class = BackWPup::get_destination($id);
                         $job_settings = BackWPup_Option::get_job($_GET['jobid']);
                         if (!$dest_class->can_run($job_settings)) {
                             BackWPup_Admin::message(sprintf(__('The job "%s" destination "%s" is not configured properly', 'backwpup'), esc_attr(BackWPup_Option::get($_GET['jobid'], 'name')), $id), TRUE);
                         }
                         $destinations++;
                     }
                     if ($destinations < 1) {
                         BackWPup_Admin::message(sprintf(__('The job "%s" needs properly configured destinations to run!', 'backwpup'), esc_attr(BackWPup_Option::get($_GET['jobid'], 'name'))), TRUE);
                     }
                 }
                 //check server callback
                 $raw_response = BackWPup_Job::get_jobrun_url('test');
                 $test_result = '';
                 if (is_wp_error($raw_response)) {
//.........这里部分代码省略.........
开发者ID:NgocNH-NTQ,项目名称:wordpress-training,代码行数:101,代码来源:class-page-jobs.php

示例7: load

 /**
  *
  */
 public static function load()
 {
     //Create Table
     self::$listtable = new BackWPup_Page_Backups();
     switch (self::$listtable->current_action()) {
         case 'delete':
             //Delete Backup archives
             check_admin_referer('bulk-backups');
             if (!current_user_can('backwpup_backups_delete')) {
                 wp_die(__('Sorry, you don\'t have permissions to do that.', 'backwpup'));
             }
             $jobdest = '_';
             if (!empty($_GET['jobdest'])) {
                 $jobdest = $_GET['jobdest'];
             }
             if (!empty($_GET['jobdest-top'])) {
                 $jobdest = $_GET['jobdest-top'];
             }
             $_GET['jobdest'] = $jobdest;
             if ($jobdest == '_') {
                 return;
             }
             list($jobid, $dest) = explode('_', $jobdest);
             $dest_class = BackWPup::get_destination($dest);
             $files = $dest_class->file_get_list($jobdest);
             foreach ($_GET['backupfiles'] as $backupfile) {
                 foreach ($files as $file) {
                     if (is_array($file) && $file['file'] == $backupfile) {
                         $dest_class->file_delete($jobdest, $backupfile);
                     }
                 }
             }
             break;
         default:
             $dest = strtoupper(str_replace('download', '', self::$listtable->current_action()));
             if (!empty($dest) && strstr(self::$listtable->current_action(), 'download')) {
                 if (!current_user_can('backwpup_backups_download')) {
                     wp_die(__('Sorry, you don\'t have permissions to do that.', 'backwpup'));
                 }
                 check_admin_referer('download-backup');
                 $dest_class = BackWPup::get_destination($dest);
                 $dest_class->file_download((int) $_GET['jobid'], $_GET['file']);
                 die;
             }
             break;
     }
     //Save per page
     if (isset($_POST['screen-options-apply']) && isset($_POST['wp_screen_options']['option']) && isset($_POST['wp_screen_options']['value']) && $_POST['wp_screen_options']['option'] == 'backwpupbackups_per_page') {
         check_admin_referer('screen-options-nonce', 'screenoptionnonce');
         global $current_user;
         if ($_POST['wp_screen_options']['value'] > 0 && $_POST['wp_screen_options']['value'] < 1000) {
             update_user_option($current_user->ID, 'backwpupbackups_per_page', (int) $_POST['wp_screen_options']['value']);
             wp_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
             exit;
         }
     }
     add_screen_option('per_page', array('label' => __('Backup Files', 'backwpup'), 'default' => 20, 'option' => 'backwpupbackups_per_page'));
     self::$listtable->prepare_items();
 }
开发者ID:congtrieu112,项目名称:anime,代码行数:62,代码来源:class-page-backups.php

示例8: admin_init

 /**
  * Admin init function
  */
 public function admin_init()
 {
     //only add action if ajax call
     if (defined('DOING_AJAX') && DOING_AJAX && defined('WP_ADMIN') && WP_ADMIN) {
         //ajax calls
         add_action('wp_ajax_backwpup_working', array('BackWPup_Page_Jobs', 'ajax_working'));
         add_action('wp_ajax_backwpup_cron_text', array('BackWPup_Page_Editjob', 'ajax_cron_text'));
         //ajax or view logs
         add_action('wp_ajax_backwpup_view_log', array('BackWPup_Page_Logs', 'ajax_view_log'));
         //ajax calls for job types
         if ($jobtypes = BackWPup::get_job_types()) {
             foreach ($jobtypes as $id => $jobtypeclass) {
                 add_action('wp_ajax_backwpup_jobtype_' . strtolower($id), array($jobtypeclass, 'edit_ajax'));
             }
         }
         //ajax calls for destinations
         if ($dests = BackWPup::get_registered_destinations()) {
             foreach ($dests as $id => $dest) {
                 if (!empty($dest['class'])) {
                     add_action('wp_ajax_backwpup_dest_' . strtolower($id), array(BackWPup::get_destination($id), 'edit_ajax'));
                 }
             }
         }
     }
     //display about page after Update
     if (!defined('DOING_AJAX') && !get_site_option('backwpup_about_page', FALSE) && !isset($_GET['activate-multi'])) {
         update_site_option('backwpup_about_page', TRUE);
         wp_redirect(network_admin_url('admin.php') . '?page=backwpupabout');
         exit;
     }
 }
开发者ID:demochko-ol,项目名称:hezy,代码行数:34,代码来源:class-admin.php

示例9: download_backup

 public function download_backup()
 {
     if (!isset($_GET['type']) || empty($_GET['type']) || !isset($_GET['_wpnonce']) || empty($_GET['_wpnonce'])) {
         die('-1');
     }
     if (!current_user_can('backwpup_backups_download')) {
         die('-2');
     }
     if (!$this->verify_nonce_without_session($_GET['_wpnonce'], 'mainwp_download_backup')) {
         die('-3');
     }
     $dest = strtoupper(str_replace('download', '', $_GET['type']));
     if (!empty($dest) && strstr($_GET['type'], 'download')) {
         $dest_class = BackWPup::get_destination($dest);
         if (is_null($dest_class)) {
             die('-4');
         }
         $dest_class->file_download((int) $_GET['jobid'], $_GET['file']);
     } else {
         die('-5');
     }
     die;
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:23,代码来源:class-mainwp-child-back-wp-up.php

示例10: run


//.........这里部分代码省略.........
     foreach ($protected_env_vars as $protected_env) {
         if (strtoupper(trim($protected_env)) == 'TMPDIR') {
             $can_set_temp_env = FALSE;
         }
     }
     if ($can_set_temp_env) {
         $this->temp['PHP']['ENV']['TEMPDIR'] = getenv('TMPDIR');
         @putenv('TMPDIR=' . BackWPup::get_plugin_data('TEMP'));
     }
     //Write Wordpress DB errors to log
     $wpdb->suppress_errors(FALSE);
     $wpdb->hide_errors();
     //set wp max memory limit
     @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
     //set error handler
     set_error_handler(array($this, 'log'), E_ALL ^ E_STRICT);
     set_exception_handler(array($this, 'exception_handler'));
     //not loading Textdomains and unload loaded
     if (get_site_option('backwpup_cfg_jobnotranslate')) {
         add_filter('override_load_textdomain', create_function('', 'return TRUE;'));
         $GLOBALS['l10n'] = array();
     }
     // execute function on job shutdown  register_shutdown_function( array( $this, 'shutdown' ) );
     add_action('shutdown', array($this, 'shutdown'));
     //remove_action('shutdown', array( $this, 'shutdown' ));
     if (function_exists('pcntl_signal')) {
         declare (ticks=1);
         //set ticks
         pcntl_signal(15, array($this, 'shutdown'));
         //SIGTERM
         //pcntl_signal(9, array($this,'shutdown')); //SIGKILL
         pcntl_signal(2, array($this, 'shutdown'));
         //SIGINT
     }
     //clear output buffer
     while (@ob_end_clean()) {
     }
     @flush();
     $job_types = BackWPup::get_job_types();
     //go step by step
     foreach ($this->steps_todo as $this->step_working) {
         //Check if step already done
         if (in_array($this->step_working, $this->steps_done)) {
             continue;
         }
         //calc step percent
         if (count($this->steps_done) > 0) {
             $this->step_percent = round(count($this->steps_done) / count($this->steps_todo) * 100);
         } else {
             $this->step_percent = 1;
         }
         // do step tries
         while ($this->steps_data[$this->step_working]['STEP_TRY'] < get_site_option('backwpup_cfg_jobstepretry')) {
             // break if try has marked as done for no more tries
             if (in_array($this->step_working, $this->steps_done)) {
                 break;
             }
             $this->steps_data[$this->step_working]['STEP_TRY']++;
             $this->update_working_data(TRUE);
             $done = FALSE;
             //executes the methods of job process
             if ($this->step_working == 'CREATE_ARCHIVE') {
                 $done = $this->create_archive();
             } elseif ($this->step_working == 'CREATE_MANIFEST') {
                 $done = $this->create_manifest();
             } elseif ($this->step_working == 'END') {
                 $this->end();
                 break 2;
             } elseif (strstr($this->step_working, 'JOB_')) {
                 $done = $job_types[str_replace('JOB_', '', $this->step_working)]->job_run($this);
             } elseif (strstr($this->step_working, 'DEST_SYNC_')) {
                 $done = BackWPup::get_destination(str_replace('DEST_SYNC_', '', $this->step_working))->job_run_sync($this);
             } elseif (strstr($this->step_working, 'DEST_')) {
                 $done = BackWPup::get_destination(str_replace('DEST_', '', $this->step_working))->job_run_archive($this);
             } elseif (!empty($this->steps_data[$this->step_working]['CALLBACK'])) {
                 $done = $this->steps_data[$this->step_working]['CALLBACK']($this);
             }
             // set step as done or  if step has too many tries
             if ($done === TRUE) {
                 $this->temp = array();
                 //Clean temp
                 $this->steps_done[] = $this->step_working;
                 $this->substeps_done = 0;
                 $this->substeps_todo = 0;
             }
             if (!$done && $this->steps_data[$this->step_working]['STEP_TRY'] >= get_site_option('backwpup_cfg_jobstepretry')) {
                 $this->log(__('Step aborted: too many attempts!', 'backwpup'), E_USER_ERROR);
                 $this->temp = array();
                 //Clean temp
                 $this->steps_done[] = $this->step_working;
                 $this->substeps_done = 0;
                 $this->substeps_todo = 0;
             }
             //restart on every job step expect end and only on http connection
             if (get_site_option('backwpup_cfg_jobsteprestart')) {
                 $this->do_restart();
             }
         }
     }
 }
开发者ID:isrealconsulting,项目名称:site,代码行数:101,代码来源:class-job.php


注:本文中的BackWPup::get_destination方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。