• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP BackWPup_Option类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: jobs

 /**
  * Display a List of Jobs
  *
  * @synopsis jobs
  */
 public function jobs($args, $assoc_args)
 {
     $jobids = BackWPup_Option::get_job_ids();
     WP_CLI::line(__('List of jobs', 'backwpup'));
     WP_CLI::line('----------------------------------------------------------------------');
     foreach ($jobids as $jobid) {
         WP_CLI::line(sprintf(__('ID: %1$d Name: %2$s', 'backwpup'), $jobid, BackWPup_Option::get($jobid, 'name')));
     }
 }
开发者ID:isrealconsulting,项目名称:site,代码行数:14,代码来源:class-wp-cli.php


示例2: jobs

 /**
  * Display a List of Jobs
  *
  */
 public function jobs($args, $assoc_args)
 {
     $formatter_args = array('format' => 'table', 'fields' => array('Job ID', 'Name'), 'field' => NULL);
     $items = array();
     $formatter = new WP_CLI\Formatter($formatter_args);
     $jobids = BackWPup_Option::get_job_ids();
     foreach ($jobids as $jobid) {
         $items[] = array('Job ID' => $jobid, 'Name' => BackWPup_Option::get($jobid, 'name'));
     }
     $formatter->display_items($items);
 }
开发者ID:leotaillard,项目名称:btws2016,代码行数:15,代码来源:class-wp-cli.php


示例3: adminbar

 /**
  * @global $wp_admin_bar WP_Admin_Bar
  */
 public function adminbar()
 {
     global $wp_admin_bar;
     /* @var WP_Admin_Bar $wp_admin_bar */
     $menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data('name') . '</span>';
     $menu_herf = network_admin_url('admin.php') . '?page=backwpup';
     if (file_exists(BackWPup::get_plugin_data('running_file')) && current_user_can('backwpup_jobs_start')) {
         $menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data('name') . ' <span id="backwpup-adminbar-running">' . __('running', 'backwpup') . '</span></span>';
         $menu_herf = network_admin_url('admin.php') . '?page=backwpupjobs';
     }
     if (current_user_can('backwpup')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup', 'title' => $menu_title, 'href' => $menu_herf, 'meta' => array('title' => BackWPup::get_plugin_data('name'))));
     }
     if (file_exists(BackWPup::get_plugin_data('running_file')) && current_user_can('backwpup_jobs_start')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_working', 'parent' => 'backwpup_jobs', 'title' => __('Now Running', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupjobs'));
         $wp_admin_bar->add_menu(array('id' => 'backwpup_working_abort', 'parent' => 'backwpup_working', 'title' => __('Abort!', 'backwpup'), 'href' => wp_nonce_url(network_admin_url('admin.php') . '?page=backwpup&action=abort', 'abort-job')));
     }
     if (current_user_can('backwpup_jobs')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs', 'parent' => 'backwpup', 'title' => __('Jobs', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupjobs'));
     }
     if (current_user_can('backwpup_jobs_edit')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_new', 'parent' => 'backwpup_jobs', 'title' => __('Add new', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupeditjob&tab=job'));
     }
     if (current_user_can('backwpup_logs')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_logs', 'parent' => 'backwpup', 'title' => __('Logs', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpuplogs'));
     }
     if (current_user_can('backwpup_backups')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_backups', 'parent' => 'backwpup', 'title' => __('Backups', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupbackups'));
     }
     //add jobs
     $jobs = (array) BackWPup_Option::get_job_ids();
     foreach ($jobs as $jobid) {
         if (current_user_can('backwpup_jobs_edit')) {
             $name = BackWPup_Option::get($jobid, 'name');
             $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_' . $jobid, 'parent' => 'backwpup_jobs', 'title' => $name, 'href' => wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&tab=job&jobid=' . $jobid, 'edit-job')));
         }
         if (current_user_can('backwpup_jobs_start')) {
             $url = BackWPup_Job::get_jobrun_url('runnowlink', $jobid);
             $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_runnow_' . $jobid, 'parent' => 'backwpup_jobs_' . $jobid, 'title' => __('Run Now', 'backwpup'), 'href' => $url['url']));
         }
     }
 }
开发者ID:leotaillard,项目名称:btws2016,代码行数:45,代码来源:class-adminbar.php


示例4: save_post_form

 /**
  * Save settings form data
  */
 public static function save_post_form()
 {
     if (!current_user_can('backwpup_settings')) {
         return;
     }
     //set default options if button clicked
     if (isset($_POST['default_settings']) && $_POST['default_settings']) {
         delete_site_option('backwpup_cfg_showadminbar');
         delete_site_option('backwpup_cfg_showfoldersize');
         delete_site_option('backwpup_cfg_jobstepretry');
         delete_site_option('backwpup_cfg_jobmaxexecutiontime');
         delete_site_option('backwpup_cfg_jobziparchivemethod');
         delete_site_option('backwpup_cfg_loglevel');
         delete_site_option('backwpup_cfg_jobwaittimems');
         delete_site_option('backwpup_cfg_jobrunauthkey');
         delete_site_option('backwpup_cfg_jobdooutput');
         delete_site_option('backwpup_cfg_maxlogs');
         delete_site_option('backwpup_cfg_gzlogs');
         delete_site_option('backwpup_cfg_protectfolders');
         delete_site_option('backwpup_cfg_authentication');
         delete_site_option('backwpup_cfg_logfolder');
         delete_site_option('backwpup_cfg_dropboxappkey');
         delete_site_option('backwpup_cfg_dropboxappsecret');
         delete_site_option('backwpup_cfg_dropboxsandboxappkey');
         delete_site_option('backwpup_cfg_dropboxsandboxappsecret');
         delete_site_option('backwpup_cfg_sugarsynckey');
         delete_site_option('backwpup_cfg_sugarsyncsecret');
         delete_site_option('backwpup_cfg_sugarsyncappid');
         BackWPup_Option::default_site_options();
         BackWPup_Admin::message(__('Settings reset to default', 'backwpup'));
         return;
     }
     update_site_option('backwpup_cfg_showadminbar', isset($_POST['showadminbar']) ? 1 : 0);
     update_site_option('backwpup_cfg_showfoldersize', isset($_POST['showfoldersize']) ? 1 : 0);
     if (100 > $_POST['jobstepretry'] && 0 < $_POST['jobstepretry']) {
         $_POST['jobstepretry'] = abs((int) $_POST['jobstepretry']);
     }
     if (empty($_POST['jobstepretry']) or !is_int($_POST['jobstepretry'])) {
         $_POST['jobstepretry'] = 3;
     }
     update_site_option('backwpup_cfg_jobstepretry', $_POST['jobstepretry']);
     $max_exe_time = abs((int) $_POST['jobmaxexecutiontime']);
     if (!is_int($max_exe_time) || $max_exe_time < 0) {
         $max_exe_time = 0;
     } elseif ($max_exe_time > 300) {
         $max_exe_time = 300;
     }
     update_site_option('backwpup_cfg_jobmaxexecutiontime', $max_exe_time);
     update_site_option('backwpup_cfg_jobziparchivemethod', $_POST['jobziparchivemethod'] == '' || $_POST['jobziparchivemethod'] == 'PclZip' || $_POST['jobziparchivemethod'] == 'ZipArchive' ? $_POST['jobziparchivemethod'] : '');
     update_site_option('backwpup_cfg_loglevel', in_array($_POST['loglevel'], array('normal_translated', 'normal', 'debug_translated', 'debug')) ? $_POST['loglevel'] : 'normal_translated');
     update_site_option('backwpup_cfg_jobwaittimems', $_POST['jobwaittimems']);
     update_site_option('backwpup_cfg_jobdooutput', isset($_POST['jobdooutput']) ? 1 : 0);
     update_site_option('backwpup_cfg_maxlogs', abs((int) $_POST['maxlogs']));
     update_site_option('backwpup_cfg_gzlogs', isset($_POST['gzlogs']) ? 1 : 0);
     update_site_option('backwpup_cfg_protectfolders', isset($_POST['protectfolders']) ? 1 : 0);
     $_POST['jobrunauthkey'] = preg_replace('/[^a-zA-Z0-9]/', '', trim($_POST['jobrunauthkey']));
     update_site_option('backwpup_cfg_jobrunauthkey', $_POST['jobrunauthkey']);
     $_POST['logfolder'] = trailingslashit(str_replace('\\', '/', trim(stripslashes($_POST['logfolder']))));
     //set def. folders
     if (empty($_POST['logfolder']) || $_POST['logfolder'] === '/') {
         delete_site_option('backwpup_cfg_logfolder');
         BackWPup_Option::default_site_options();
     } else {
         update_site_option('backwpup_cfg_logfolder', $_POST['logfolder']);
     }
     $authentication = get_site_option('backwpup_cfg_authentication', array('method' => '', 'basic_user' => '', 'basic_password' => '', 'user_id' => 0, 'query_arg' => ''));
     $authentication['method'] = in_array($_POST['authentication_method'], array('user', 'basic', 'query_arg')) ? $_POST['authentication_method'] : '';
     $authentication['basic_user'] = $_POST['authentication_basic_user'];
     $authentication['basic_password'] = BackWPup_Encryption::encrypt($_POST['authentication_basic_password']);
     $authentication['query_arg'] = $_POST['authentication_query_arg'];
     $authentication['user_id'] = (int) $_POST['authentication_user_id'];
     update_site_option('backwpup_cfg_authentication', $authentication);
     delete_site_transient('backwpup_cookies');
     do_action('backwpup_page_settings_save');
     BackWPup_Admin::message(__('Settings saved', 'backwpup'));
 }
开发者ID:ksingh812,项目名称:thub-old,代码行数:79,代码来源:class-page-settings.php


示例5: job_run_archive

 /**
  * @param $job_object
  * @return bool
  */
 public function job_run_archive(&$job_object)
 {
     $job_object->substeps_todo = 2 + $job_object->backup_filesize;
     $job_object->log(sprintf(__('%d. Trying to send backup file to S3 Service&#160;&hellip;', 'backwpup'), $job_object->steps_data[$job_object->step_working]['STEP_TRY']), E_USER_NOTICE);
     try {
         $s3 = new AmazonS3(array('key' => $job_object->job['s3accesskey'], 'secret' => BackWPup_Encryption::decrypt($job_object->job['s3secretkey']), 'certificate_authority' => TRUE));
         $base_url = $this->get_s3_base_url($job_object->job['s3region'], $job_object->job['s3base_url']);
         if (stristr($base_url, 'amazonaws.com')) {
             $s3->set_region(str_replace(array('http://', 'https://'), '', $base_url));
         } else {
             $s3->set_hostname(str_replace(array('http://', 'https://'), '', $base_url));
             $s3->allow_hostname_override(FALSE);
             if (substr($base_url, -1) == '/') {
                 $s3->enable_path_style(TRUE);
             }
         }
         if (stristr($base_url, 'http://')) {
             $s3->disable_ssl();
         }
         if ($s3->if_bucket_exists($job_object->job['s3bucket'])) {
             $job_object->log(sprintf(__('Connected to S3 Bucket "%1$s" in %2$s', 'backwpup'), $job_object->job['s3bucket'], $base_url), E_USER_NOTICE);
         } else {
             $job_object->log(sprintf(__('S3 Bucket "%s" does not exist!', 'backwpup'), $job_object->job['s3bucket']), E_USER_ERROR);
             return TRUE;
         }
         //transfer file to S3
         $job_object->log(__('Starting upload to S3 Service&#160;&hellip;', 'backwpup'), E_USER_NOTICE);
         //Transfer Backup to S3
         if ($job_object->job['s3storageclass'] == 'REDUCED_REDUNDANCY') {
             //set reduced redundancy or not
             $storage = AmazonS3::STORAGE_REDUCED;
         } else {
             $storage = AmazonS3::STORAGE_STANDARD;
         }
         if (empty($job_object->job['s3ssencrypt'])) {
             $job_object->job['s3ssencrypt'] = NULL;
         }
         //set progress bar
         $s3->register_streaming_read_callback(array($job_object, 'curl_read_callback'));
         $result = $s3->create_object($job_object->job['s3bucket'], $job_object->job['s3dir'] . $job_object->backup_file, array('fileUpload' => $job_object->backup_folder . $job_object->backup_file, 'acl' => AmazonS3::ACL_PRIVATE, 'storage' => $storage, 'encryption' => $job_object->job['s3ssencrypt']));
         if ($result->status >= 200 and $result->status < 300) {
             $job_object->substeps_done = 1 + $job_object->backup_filesize;
             $job_object->log(sprintf(__('Backup transferred to %s.', 'backwpup'), $this->get_s3_base_url($job_object->job['s3region'], $job_object->job['s3base_url']) . '/' . $job_object->job['s3bucket'] . '/' . $job_object->job['s3dir'] . $job_object->backup_file), E_USER_NOTICE);
             if (!empty($job_object->job['jobid'])) {
                 BackWPup_Option::update($job_object->job['jobid'], 'lastbackupdownloadurl', network_admin_url('admin.php') . '?page=backwpupbackups&action=downloads3&file=' . $job_object->job['s3dir'] . $job_object->backup_file . '&jobid=' . $job_object->job['jobid']);
             }
         } else {
             $job_object->log(sprintf(__('Cannot transfer backup to S3! (%1$d) %2$s', 'backwpup'), $result->status, $result->body), E_USER_ERROR);
         }
     } catch (Exception $e) {
         $job_object->log(E_USER_ERROR, sprintf(__('S3 Service API: %s', 'backwpup'), htmlentities($e->getMessage())), $e->getFile(), $e->getLine());
         return FALSE;
     }
     try {
         $backupfilelist = array();
         $filecounter = 0;
         $files = array();
         $objects = $s3->list_objects($job_object->job['s3bucket'], array('prefix' => $job_object->job['s3dir']));
         if (is_object($objects)) {
             foreach ($objects->body->Contents as $object) {
                 $file = basename((string) $object->Key);
                 $changetime = strtotime((string) $object->LastModified) + get_option('gmt_offset') * 3600;
                 if ($job_object->is_backup_archive($file)) {
                     $backupfilelist[$changetime] = $file;
                 }
                 $files[$filecounter]['folder'] = $this->get_s3_base_url($job_object->job['s3region'], $job_object->job['s3base_url']) . '/' . $job_object->job['s3bucket'] . '/' . dirname((string) $object->Key);
                 $files[$filecounter]['file'] = (string) $object->Key;
                 $files[$filecounter]['filename'] = basename($object->Key);
                 $files[$filecounter]['downloadurl'] = network_admin_url('admin.php') . '?page=backwpupbackups&action=downloads3&file=' . (string) $object->Key . '&jobid=' . $job_object->job['jobid'];
                 $files[$filecounter]['filesize'] = (int) $object->Size;
                 $files[$filecounter]['time'] = $changetime;
                 $filecounter++;
             }
         }
         if ($job_object->job['s3maxbackups'] > 0 && is_object($s3)) {
             //Delete old backups
             if (count($backupfilelist) > $job_object->job['s3maxbackups']) {
                 ksort($backupfilelist);
                 $numdeltefiles = 0;
                 while ($file = array_shift($backupfilelist)) {
                     if (count($backupfilelist) < $job_object->job['s3maxbackups']) {
                         break;
                     }
                     //delete files on S3
                     $delete_s3 = $s3->delete_object($job_object->job['s3bucket'], $job_object->job['s3dir'] . $file);
                     if ($delete_s3) {
                         foreach ($files as $key => $filedata) {
                             if ($filedata['file'] == $job_object->job['s3dir'] . $file) {
                                 unset($files[$key]);
                             }
                         }
                         $numdeltefiles++;
                     } else {
                         $job_object->log(sprintf(__('Cannot delete backup from %s.', 'backwpup'), $this->get_s3_base_url($job_object->job['s3region'], $job_object->job['s3base_url']) . '/' . $job_object->job['s3bucket'] . '/' . $job_object->job['s3dir'] . $file), E_USER_ERROR);
                     }
                 }
//.........这里部分代码省略.........
开发者ID:agileontheweb,项目名称:xvp,代码行数:101,代码来源:class-destination-s3-v1.php


示例6: page

    /**
     *
     */
    public static function page()
    {
        if (!empty($_GET['jobid'])) {
            $jobid = (int) $_GET['jobid'];
        } else {
            //generate jobid if not exists
            $newjobid = BackWPup_Option::get_job_ids();
            sort($newjobid);
            $jobid = end($newjobid) + 1;
        }
        $destinations = BackWPup::get_registered_destinations();
        $job_types = BackWPup::get_job_types();
        ?>
    <div class="wrap" id="backwpup-page">
		<?php 
        echo '<h2><span id="backwpup-page-icon">&nbsp;</span>' . sprintf(__('%1$s Job: %2$s', 'backwpup'), BackWPup::get_plugin_data('name'), '<span id="h2jobtitle">' . esc_html(BackWPup_Option::get($jobid, 'name')) . '</span>') . '</h2>';
        //default tabs
        $tabs = array('job' => array('name' => __('General', 'backwpup'), 'display' => TRUE), 'cron' => array('name' => __('Schedule', 'backwpup'), 'display' => TRUE));
        //add jobtypes to tabs
        $job_job_types = BackWPup_Option::get($jobid, 'type');
        foreach ($job_types as $typeid => $typeclass) {
            $tabid = 'jobtype-' . strtolower($typeid);
            $tabs[$tabid]['name'] = $typeclass->info['name'];
            $tabs[$tabid]['display'] = TRUE;
            if (!in_array($typeid, $job_job_types)) {
                $tabs[$tabid]['display'] = FALSE;
            }
        }
        //add destinations to tabs
        $jobdests = BackWPup_Option::get($jobid, 'destinations');
        foreach ($destinations as $destid => $dest) {
            $tabid = 'dest-' . strtolower($destid);
            $tabs[$tabid]['name'] = sprintf(__('To: %s', 'backwpup'), $dest['info']['name']);
            $tabs[$tabid]['display'] = TRUE;
            if (!in_array($destid, $jobdests)) {
                $tabs[$tabid]['display'] = FALSE;
            }
        }
        //display tabs
        echo '<h2 class="nav-tab-wrapper">';
        foreach ($tabs as $id => $tab) {
            $addclass = '';
            if ($id == $_GET['tab']) {
                $addclass = ' nav-tab-active';
            }
            $display = '';
            if (!$tab['display']) {
                $display = ' style="display:none;"';
            }
            echo '<a href="' . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&tab=' . $id . '&jobid=' . $jobid, 'edit-job') . '" class="nav-tab' . $addclass . '" id="tab-' . $id . '" data-nexttab="' . $id . '" ' . $display . '>' . $tab['name'] . '</a>';
        }
        echo '</h2>';
        //display messages
        BackWPup_Admin::display_messages();
        echo '<form name="editjob" id="editjob" method="post" action="' . admin_url('admin-post.php') . '">';
        echo '<input type="hidden" id="jobid" name="jobid" value="' . $jobid . '" />';
        echo '<input type="hidden" name="tab" value="' . $_GET['tab'] . '" />';
        echo '<input type="hidden" name="nexttab" value="' . $_GET['tab'] . '" />';
        echo '<input type="hidden" name="page" value="backwpupeditjob" />';
        echo '<input type="hidden" name="action" value="backwpup" />';
        echo '<input type="hidden" name="anchor" value="" />';
        wp_nonce_field('backwpupeditjob_page');
        wp_nonce_field('backwpup_ajax_nonce', 'backwpupajaxnonce', FALSE);
        switch ($_GET['tab']) {
            case 'job':
                echo '<div class="table" id="info-tab-job">';
                ?>
				<h3 class="title"><?php 
                _e('Job Name', 'backwpup');
                ?>
</h3>
				<p></p>
				<table class="form-table">
					<tr>
						<th scope="row"><label for="name"><?php 
                _e('Please name this job.', 'backwpup');
                ?>
</label></th>
						<td>
							<input name="name" type="text" id="name" data-empty="<?php 
                _e('New Job', 'backwpup');
                ?>
"
								   value="<?php 
                echo BackWPup_Option::get($jobid, 'name');
                ?>
" class="regular-text" />
						</td>
					</tr>
				</table>

				<h3 class="title"><?php 
                _e('Job Tasks', 'backwpup');
                ?>
</h3>
				<p></p>
				<table class="form-table">
//.........这里部分代码省略.........
开发者ID:byadrenaline,项目名称:laseravalon_wp,代码行数:101,代码来源:class-page-editjob.php


示例7: mb_next_jobs

    /**
     * Displaying next jobs
     */
    private static function mb_next_jobs()
    {
        if (!current_user_can('backwpup_jobs')) {
            return;
        }
        ?>
		<table class="wp-list-table widefat" cellspacing="0">
			<caption><?php 
        _e('Next scheduled jobs', 'backwpup');
        ?>
</caption>
			<thead>
			<tr>
				<th style="width: 30%"><?php 
        _e('Time', 'backwpup');
        ?>
</th>
				<th style="width: 70%"><?php 
        _e('Job', 'backwpup');
        ?>
</th>
			</tr>
			</thead>
			<?php 
        //get next jobs
        $mainsactive = BackWPup_Option::get_job_ids('activetype', 'wpcron');
        sort($mainsactive);
        $alternate = TRUE;
        // add working job if it not in active jobs
        $job_object = BackWPup_Job::get_working_data();
        if (!empty($job_object) && !empty($job_object->job['jobid']) && !in_array($job_object->job['jobid'], $mainsactive)) {
            $mainsactive[] = $job_object->job['jobid'];
        }
        foreach ($mainsactive as $jobid) {
            $name = BackWPup_Option::get($jobid, 'name');
            if (!empty($job_object) && $job_object->job['jobid'] == $jobid) {
                $runtime = current_time('timestamp') - $job_object->job['lastrun'];
                if (!$alternate) {
                    echo '<tr>';
                    $alternate = TRUE;
                } else {
                    echo '<tr class="alternate">';
                    $alternate = FALSE;
                }
                echo '<td>' . sprintf('<span style="color:#e66f00;">' . __('working since %d seconds', 'backwpup') . '</span>', $runtime) . '</td>';
                echo '<td><span style="font-weight:bold;">' . esc_html($job_object->job['name']) . '</span><br />';
                echo "<a style=\"color:red;\" href=\"" . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupjobs&action=abort', 'abort-job') . "\">" . __('Abort', 'backwpup') . "</a>";
                echo "</td></tr>";
            } else {
                if (!$alternate) {
                    echo '<tr>';
                    $alternate = TRUE;
                } else {
                    echo '<tr class="alternate">';
                    $alternate = FALSE;
                }
                if ($nextrun = wp_next_scheduled('backwpup_cron', array('id' => $jobid)) + get_option('gmt_offset') * 3600) {
                    echo '<td>' . sprintf(__('%1$s at %2$s', 'backwpup'), date_i18n(get_option('date_format'), $nextrun, TRUE), date_i18n(get_option('time_format'), $nextrun, TRUE)) . '</td>';
                } else {
                    echo '<td><em>' . __('Not scheduled!', 'backwpup') . '</em></td>';
                }
                echo '<td><a href="' . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&jobid=' . $jobid, 'edit-job') . '" title="' . esc_attr(__('Edit Job', 'backwpup')) . '">' . $name . '</a></td></tr>';
            }
        }
        if (empty($mainsactive) and !empty($job_object)) {
            echo '<tr><td colspan="2"><i>' . __('none', 'backwpup') . '</i></td></tr>';
        }
        ?>
		</table>
		<?php 
    }
开发者ID:ksingh812,项目名称:thub-old,代码行数:74,代码来源:class-page-backwpup.php


示例8: edit_form_post_save

 /**
  * @param $id
  */
 public function edit_form_post_save($id)
 {
     global $wpdb;
     /* @var wpdb $wpdb */
     if ($_POST['dbdumpfilecompression'] == '' || $_POST['dbdumpfilecompression'] == '.gz') {
         BackWPup_Option::update($id, 'dbdumpfilecompression', $_POST['dbdumpfilecompression']);
     }
     BackWPup_Option::update($id, 'dbdumpfile', sanitize_file_name($_POST['dbdumpfile']));
     //selected tables
     $dbdumpexclude = array();
     $checked_db_tables = array();
     if (isset($_POST['tabledb'])) {
         foreach ($_POST['tabledb'] as $dbtable) {
             $checked_db_tables[] = rawurldecode($dbtable);
         }
     }
     $dbtables = $wpdb->get_results('SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N);
     foreach ($dbtables as $dbtable) {
         if (!in_array($dbtable[0], $checked_db_tables)) {
             $dbdumpexclude[] = $dbtable[0];
         }
     }
     BackWPup_Option::update($id, 'dbdumpexclude', $dbdumpexclude);
 }
开发者ID:mahassan,项目名称:shellneverknow,代码行数:27,代码来源:class-jobtype-dbdump.php


示例9: upgrade_from_version_two


//.........这里部分代码省略.........
         }
         if (!empty($jobvalue['rscUsername']) && !empty($jobvalue['rscAPIKey']) && !empty($jobvalue['rscContainer'])) {
             $jobvalue['destinations'][] = 'RSC';
         }
         if (!empty($jobvalue['msazureHost']) && !empty($jobvalue['msazureAccName']) && !empty($jobvalue['msazureKey']) && !empty($jobvalue['msazureContainer'])) {
             $jobvalue['destinations'][] = 'MSAZURE';
         }
         //convert dropbox
         $jobvalue['dropboxtoken'] = '';
         //new app key are set must reauth
         $jobvalue['dropboxsecret'] = '';
         $jobvalue['dropboxroot'] = 'dropbox';
         $jobvalue['dropboxmaxbackups'] = $jobvalue['dropemaxbackups'];
         $jobvalue['dropboxdir'] = $jobvalue['dropedir'];
         unset($jobvalue['dropetoken'], $jobvalue['dropesecret'], $jobvalue['droperoot'], $jobvalue['dropemaxbackups'], $jobvalue['dropedir']);
         //convert amazon S3
         $jobvalue['s3accesskey'] = $jobvalue['awsAccessKey'];
         $jobvalue['s3secretkey'] = BackWPup_Encryption::encrypt($jobvalue['awsSecretKey']);
         $jobvalue['s3bucket'] = $jobvalue['awsBucket'];
         //get aws region
         $jobvalue['s3region'] = 'us-east-1';
         $jobvalue['s3base_url'] = '';
         $jobvalue['s3storageclass'] = !empty($jobvalue['awsrrs']) ? 'REDUCED_REDUNDANCY' : '';
         $jobvalue['s3dir'] = $jobvalue['awsdir'];
         $jobvalue['s3maxbackups'] = $jobvalue['awsmaxbackups'];
         unset($jobvalue['awsAccessKey'], $jobvalue['awsSecretKey'], $jobvalue['awsBucket'], $jobvalue['awsrrs'], $jobvalue['awsdir'], $jobvalue['awsmaxbackups']);
         //convert google storage
         $jobvalue['s3accesskey'] = $jobvalue['GStorageAccessKey'];
         $jobvalue['s3secretkey'] = BackWPup_Encryption::encrypt($jobvalue['GStorageSecret']);
         $jobvalue['s3bucket'] = $jobvalue['GStorageBucket'];
         $jobvalue['s3region'] = 'google-storage';
         $jobvalue['s3base_url'] = '';
         $jobvalue['s3ssencrypt'] = '';
         $jobvalue['s3dir'] = $jobvalue['GStoragedir'];
         $jobvalue['s3maxbackups'] = $jobvalue['GStoragemaxbackups'];
         unset($jobvalue['GStorageAccessKey'], $jobvalue['GStorageSecret'], $jobvalue['GStorageBucket'], $jobvalue['GStoragedir'], $jobvalue['GStoragemaxbackups']);
         //convert MS Azure storage
         $jobvalue['msazureaccname'] = $jobvalue['msazureAccName'];
         $jobvalue['msazurekey'] = BackWPup_Encryption::encrypt($jobvalue['msazureKey']);
         $jobvalue['msazurecontainer'] = $jobvalue['msazureContainer'];
         unset($jobvalue['msazureHost'], $jobvalue['msazureAccName'], $jobvalue['msazureKey'], $jobvalue['msazureContainer']);
         //convert FTP
         if (preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $jobvalue['ftppass'])) {
             $jobvalue['ftppass'] = base64_decode($jobvalue['ftppass']);
         }
         $jobvalue['ftppass'] = BackWPup_Encryption::encrypt($jobvalue['ftppass']);
         if (!empty($jobvalue['ftphost']) && strstr($jobvalue['ftphost'], ':')) {
             list($jobvalue['ftphost'], $jobvalue['ftphostport']) = explode(':', $jobvalue['ftphost'], 2);
         }
         //convert Sugarsync
         //convert Mail
         $jobvalue['emailaddress'] = $jobvalue['mailaddress'];
         $jobvalue['emailefilesize'] = $jobvalue['mailefilesize'];
         unset($jobvalue['mailaddress'], $jobvalue['mailefilesize']);
         //convert RSC
         $jobvalue['rscusername'] = $jobvalue['rscUsername'];
         $jobvalue['rscapikey'] = $jobvalue['rscAPIKey'];
         $jobvalue['rsccontainer'] = $jobvalue['rscContainer'];
         //convert jobtype DB Dump
         $jobvalue['dbdumpexclude'] = $jobvalue['dbexclude'];
         unset($jobvalue['dbexclude'], $jobvalue['dbshortinsert']);
         //convert jobtype DBDUMP, DBCHECK
         $jobvalue['dbcheckrepair'] = TRUE;
         unset($jobvalue['maintenance']);
         //convert jobtype wpexport
         //convert jobtype file
         $excludes = array();
         foreach ($jobvalue['backuprootexcludedirs'] as $folder) {
             $excludes[] = basename($folder);
         }
         $jobvalue['backuprootexcludedirs'] = $excludes;
         $excludes = array();
         foreach ($jobvalue['backupcontentexcludedirs'] as $folder) {
             $excludes[] = basename($folder);
         }
         $jobvalue['backupcontentexcludedirs'] = $excludes;
         $excludes = array();
         foreach ($jobvalue['backuppluginsexcludedirs'] as $folder) {
             $excludes[] = basename($folder);
         }
         $jobvalue['backuppluginsexcludedirs'] = $excludes;
         $excludes = array();
         foreach ($jobvalue['backupthemesexcludedirs'] as $folder) {
             $excludes[] = basename($folder);
         }
         $jobvalue['backupthemesexcludedirs'] = $excludes;
         $excludes = array();
         foreach ($jobvalue['backupuploadsexcludedirs'] as $folder) {
             $excludes[] = basename($folder);
         }
         $jobvalue['backupuploadsexcludedirs'] = $excludes;
         //delete not longer needed
         unset($jobvalue['cronnextrun'], $jobvalue['fileprefix'], $jobvalue['fileformart'], $jobvalue['scheduleintervaltype'], $jobvalue['scheduleintervalteimes'], $jobvalue['scheduleinterval'], $jobvalue['dropemail'], $jobvalue['dropepass'], $jobvalue['dropesignmethod']);
         //save in options
         foreach ($jobvalue as $jobvaluename => $jobvaluevalue) {
             BackWPup_Option::update($jobvalue['jobid'], $jobvaluename, $jobvaluevalue);
         }
     }
     set_site_transient('backwpup_upgrade_from_version_two', TRUE, 3600 * 24 * 7);
 }
开发者ID:leotaillard,项目名称:btws2016,代码行数:101,代码来源:class-install.php


示例10: job_run_archive


//.........这里部分代码省略.........
         $job_object->substeps_done = 0;
     }
     //PASV
     $job_object->log(sprintf(__('FTP client command: %s', 'backwpup'), 'PASV'), E_USER_NOTICE);
     if ($job_object->job['ftppasv']) {
         if (ftp_pasv($ftp_conn_id, TRUE)) {
             $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), __('Entering passive mode', 'backwpup')), E_USER_NOTICE);
         } else {
             $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), __('Cannot enter passive mode', 'backwpup')), E_USER_WARNING);
         }
     } else {
         if (ftp_pasv($ftp_conn_id, FALSE)) {
             $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), __('Entering normal mode', 'backwpup')), E_USER_NOTICE);
         } else {
             $job_object->log(sprintf(__('FTP server reply: %s', 'backwpup'), __('Cannot enter normal mode', 'backwpup')), E_USER_WARNING);
         }
     }
     if ($job_object->substeps_done < $job_object->backup_filesize) {
         $job_object->log(__('Starting upload to FTP &#160;&hellip;', 'backwpup'), E_USER_NOTICE);
         if ($fp = fopen($job_object->backup_folder . $job_object->backup_file, 'rb')) {
             //go to actual file pos
             fseek($fp, $job_object->substeps_done);
             $ret = ftp_nb_fput($ftp_conn_id, $current_ftp_dir . $job_object->backup_file, $fp, FTP_BINARY, $job_object->substeps_done);
             while ($ret == FTP_MOREDATA) {
                 $job_object->substeps_done = ftell($fp);
                 $job_object->update_working_data();
                 $job_object->do_restart_time();
                 $ret = ftp_nb_continue($ftp_conn_id);
             }
             if ($ret != FTP_FINISHED) {
                 $job_object->log(__('Cannot transfer backup to FTP server!', 'backwpup'), E_USER_ERROR);
                 return FALSE;
             } else {
                 $job_object->substeps_done = $job_object->backup_filesize + 1;
                 $job_object->log(sprintf(__('Backup transferred to FTP server: %s', 'backwpup'), $current_ftp_dir . $job_object->backup_file), E_USER_NOTICE);
                 if (!empty($job_object->job['jobid'])) {
                     BackWPup_Option::update($job_object->job['jobid'], 'lastbackupdownloadurl', "ftp://" . $job_object->job['ftpuser'] . ":" . BackWPup_Encryption::decrypt($job_object->job['ftppass']) . "@" . $job_object->job['ftphost'] . ':' . $job_object->job['ftphostport'] . $current_ftp_dir . $job_object->backup_file);
                 }
             }
             fclose($fp);
         } else {
             $job_object->log(__('Can not open source file for transfer.', 'backwpup'), E_USER_ERROR);
             return FALSE;
         }
     }
     $backupfilelist = array();
     $filecounter = 0;
     $files = array();
     if ($filelist = ftp_nlist($ftp_conn_id, '.')) {
         foreach ($filelist as $file) {
             if (basename($file) != '.' && basename($file) != '..') {
                 if ($job_object->is_backup_archive($file)) {
                     $time = ftp_mdtm($ftp_conn_id, $file);
                     if ($time != -1) {
                         $backupfilelist[$time] = basename($file);
                     } else {
                         $backupfilelist[] = basename($file);
                     }
                 }
                 $files[$filecounter]['folder'] = 'ftp://' . $job_object->job['ftphost'] . ':' . $job_object->job['ftphostport'] . $job_object->job['ftpdir'];
                 $files[$filecounter]['file'] = $job_object->job['ftpdir'] . basename($file);
                 $files[$filecounter]['filename'] = basename($file);
                 $files[$filecounter]['downloadurl'] = 'ftp://' . rawurlencode($job_object->job['ftpuser']) . ':' . rawurlencode(BackWPup_Encryption::decrypt($job_object->job['ftppass'])) . '@' . $job_object->job['ftphost'] . ':' . $job_object->job['ftphostport'] . $job_object->job['ftpdir'] . basename($file);
                 $files[$filecounter]['filesize'] = ftp_size($ftp_conn_id, $file);
                 $files[$filecounter]['time'] = ftp_mdtm($ftp_conn_id, $file);
                 $filecounter++;
             }
         }
     }
     if (!empty($job_object->job['ftpmaxbackups']) && $job_object->job['ftpmaxbackups'] > 0) {
         //Delete old backups
         if (count($backupfilelist) > $job_object->job['ftpmaxbackups']) {
             ksort($backupfilelist);
             $numdeltefiles = 0;
             while ($file = array_shift($backupfilelist)) {
                 if (count($backupfilelist) < $job_object->job['ftpmaxbackups']) {
                     break;
                 }
                 if (ftp_delete($ftp_conn_id, $file)) {
                     //delete files on ftp
                     foreach ($files as $key => $filedata) {
                         if ($filedata['file'] == $job_object->job['ftpdir'] . $file) {
                             unset($files[$key]);
                         }
                     }
                     $numdeltefiles++;
                 } else {
                     $job_object->log(sprintf(__('Cannot delete "%s" on FTP server!', 'backwpup'), $job_object->job['ftpdir'] . $file), E_USER_ERROR);
                 }
             }
             if ($numdeltefiles > 0) {
                 $job_object->log(sprintf(_n('One file deleted on FTP server', '%d files deleted on FTP server', $numdeltefiles, 'backwpup'), $numdeltefiles), E_USER_NOTICE);
             }
         }
     }
     set_site_transient('backwpup_' . $job_object->job['jobid'] . '_ftp', $files, YEAR_IN_SECONDS);
     $job_object->substeps_done++;
     ftp_close($ftp_conn_id);
     return TRUE;
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:101,代码来源:class-destination-ftp.php


示例11: edit_form_post_save

 /**
  * @param $id
  */
 public function edit_form_post_save($id)
 {
     BackWPup_Option::update($id, 'pluginlistfile', sanitize_file_name($_POST['pluginlistfile']));
     if ($_POST['pluginlistfilecompression'] == '' || $_POST['pluginlistfilecompression'] == '.gz' || $_POST['pluginlistfilecompression'] == '.bz2') {
         BackWPup_Option::update($id, 'pluginlistfilecompression', $_POST['pluginlistfilecompression']);
     }
 }
开发者ID:kirkov,项目名称:backwpup,代码行数:10,代码来源:class-jobtype-wpplugin.php


示例12: job_run_archive

 /**
  * @param $job_object
  * @return bool
  */
 public function job_run_archive(BackWPup_Job $job_object)
 {
     $job_object->substeps_todo = 1;
     if (!empty($job_object->job['jobid'])) {
         BackWPup_Option::update($job_object->job['jobid'], 'lastbackupdownloadurl', add_query_arg(array('page' => 'backwpupbackups', 'action' => 'downloadfolder', 'file' => basename($job_object->backup_file), 'jobid' => $job_object->job['jobid']), network_admin_url('admin.php')));
     }
     //Delete old Backupfiles
     $backupfilelist = array();
     $files = array();
     if (is_writable($job_object->backup_folder) && ($dir = opendir($job_object->backup_folder))) {
         //make file list
         while (FALSE !== ($file = readdir($dir))) {
             if (is_writeable($job_object->backup_folder . $file) && !is_dir($job_object->backup_folder . $file) && !is_link($job_object->backup_folder . $file)) {
                 //list for deletion
                 if ($job_object->is_backup_archive($file)) {
                     $backupfilelist[filemtime($job_object->backup_folder . $file)] = $file;
                 }
             }
         }
         closedir($dir);
     }
     if ($job_object->job['maxbackups'] > 0) {
         if (count($backupfilelist) > $job_object->job['maxbackups']) {
             ksort($backupfilelist);
             $numdeltefiles = 0;
             while ($file = array_shift($backupfilelist)) {
                 if (count($backupfilelist) < $job_object->job['maxbackups']) {
                     break;
                 }
                 unlink($job_object->backup_folder . $file);
                 foreach ($files as $key => $filedata) {
                     if ($filedata['file'] == $job_object->backup_folder . $file) {
                         unset($files[$key]);
                     }
                 }
                 $numdeltefiles++;
             }
             if ($numdeltefiles > 0) {
                 $job_object->log(sprintf(_n('One backup file deleted', '%d backup files deleted', $numdeltefiles, 'backwpup'), $numdeltefiles), E_USER_NOTICE);
             }
         }
     }
     $job_object->substeps_done++;
     return TRUE;
 }
开发者ID:demochko-ol,项目名称:hezy,代码行数:49,代码来源:class-destination-folder.php


示例13: 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


示例14: cron_active

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Backend类代码示例发布时间:2022-05-23
下一篇:
PHP BackWPup_Job类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap