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


PHP BackWPup_Option::update方法代码示例

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


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

示例1: check_cleanup

 /**
  * Check Jobs worked and Cleanup logs and so on
  */
 public static function check_cleanup()
 {
     $job_object = BackWPup_Job::get_working_data();
     $log_folder = get_site_option('backwpup_cfg_logfolder');
     $log_folder = BackWPup_File::get_absolute_path($log_folder);
     // check aborted jobs for longer than a tow hours, abort them courtly and send mail
     if (is_object($job_object) && !empty($job_object->logfile)) {
         $not_worked_time = microtime(TRUE) - $job_object->timestamp_last_update;
         if ($not_worked_time > 3600) {
             $job_object->log(E_USER_ERROR, __('Aborted, because no progress for one hour!', 'backwpup'), __FILE__, __LINE__);
             unlink(BackWPup::get_plugin_data('running_file'));
             $job_object->update_working_data();
         }
     }
     //Compress not compressed logs
     if (is_readable($log_folder) && function_exists('gzopen') && get_site_option('backwpup_cfg_gzlogs') && !is_object($job_object)) {
         //Compress old not compressed logs
         if ($dir = opendir($log_folder)) {
             $jobids = BackWPup_Option::get_job_ids();
             while (FALSE !== ($file = readdir($dir))) {
                 if (is_writeable($log_folder . $file) && '.html' == substr($file, -5)) {
                     $compress = new BackWPup_Create_Archive($log_folder . $file . '.gz');
                     if ($compress->add_file($log_folder . $file)) {
                         unlink($log_folder . $file);
                         //change last logfile in jobs
                         foreach ($jobids as $jobid) {
                             $job_logfile = BackWPup_Option::get($jobid, 'logfile');
                             if (!empty($job_logfile) && $job_logfile === $log_folder . $file) {
                                 BackWPup_Option::update($jobid, 'logfile', $log_folder . $file . '.gz');
                             }
                         }
                     }
                     unset($compress);
                 }
             }
             closedir($dir);
         }
     }
     //Jobs cleanings
     if (!is_object($job_object)) {
         //remove restart cron
         wp_clear_scheduled_hook('backwpup_cron', array('id' => 'restart'));
         //temp cleanup
         BackWPup_Job::clean_temp_folder();
     }
     //check scheduling jobs that not found will removed because there are single scheduled
     $activejobs = BackWPup_Option::get_job_ids('activetype', 'wpcron');
     if (!empty($activejobs)) {
         foreach ($activejobs as $jobid) {
             $cron_next = wp_next_scheduled('backwpup_cron', array('id' => $jobid));
             if (!$cron_next || $cron_next < time()) {
                 wp_unschedule_event($cron_next, 'backwpup_cron', array('id' => $jobid));
                 $cron_next = BackWPup_Cron::cron_next(BackWPup_Option::get($jobid, 'cron'));
                 wp_schedule_single_event($cron_next, 'backwpup_cron', array('id' => $jobid));
             }
         }
     }
 }
开发者ID:leotaillard,项目名称:btws2016,代码行数:61,代码来源:class-cron.php

示例2: update

 public static function update($backwpup_jobid)
 {
     $params = array('id' => NULL, 'email_me' => 0, 'log_output_length' => 0, 'testfirst' => 0);
     if (empty($backwpup_jobid)) {
         $params['id'] = get_site_option('backwpup_cfg_easycronjobid');
         $params['cron_job_name'] = sprintf('WordPress on %s', home_url());
         $params['cron_expression'] = '*/5 * * * *';
         $url = BackWPup_Job::get_jobrun_url('runext', 0);
         $url = remove_query_arg('_nonce', $url['url']);
         $url = remove_query_arg('doing_wp_cron', $url);
         $url = remove_query_arg('backwpup_run', $url);
         $url = add_query_arg(array('doing_wp_cron' => ''), $url);
         $cookies = get_site_transient('backwpup_cookies');
         $params['url'] = $url;
         if (!empty($cookies)) {
             $params['cookies'] = http_build_query($cookies);
         }
     } else {
         $params['id'] = BackWPup_Option::get($backwpup_jobid, 'easycronjobid');
         if (empty($params['id'])) {
             $params['id'] = NULL;
         }
         $params['cron_job_name'] = sprintf('BackWPup %s on %s', BackWPup_Option::get($backwpup_jobid, 'name'), home_url());
         $params['cron_expression'] = BackWPup_Option::get($backwpup_jobid, 'cron');
         $url = BackWPup_Job::get_jobrun_url('runext', $backwpup_jobid);
         $cookies = get_site_transient('backwpup_cookies');
         $params['url'] = $url['url'];
         if (!empty($cookies)) {
             $params['cookies'] = http_build_query($cookies);
         }
     }
     if (empty($params['id'])) {
         $message = self::query_api('add', $params);
     } else {
         $message = self::query_api('edit', $params);
     }
     delete_site_transient('backwpup_easycron_' . $params['id']);
     if ($message['status'] == 'success' && !empty($message['cron_job_id'])) {
         if (empty($backwpup_jobid)) {
             update_site_option('backwpup_cfg_easycronjobid', $message['cron_job_id']);
         } else {
             BackWPup_Option::update($backwpup_jobid, 'easycronjobid', $message['cron_job_id']);
         }
         return TRUE;
     } else {
         if ($message['error']['code'] == 25) {
             if (empty($backwpup_jobid)) {
                 delete_site_option('backwpup_cfg_easycronjobid');
             } else {
                 BackWPup_Option::delete($backwpup_jobid, 'easycronjobid');
             }
         }
     }
     return FALSE;
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:55,代码来源:class-easycron.php

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

示例4: edit_form_post_save

 /**
  * @param $jobid
  */
 public function edit_form_post_save($jobid)
 {
     BackWPup_Option::update($jobid, 'dbcheckwponly', !empty($_POST['dbcheckwponly']));
     BackWPup_Option::update($jobid, 'dbcheckrepair', !empty($_POST['dbcheckrepair']));
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:8,代码来源:class-jobtype-dbcheck.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: save_post_form

 /**
  * Save Form data
  */
 public static function save_post_form($tab, $jobid)
 {
     if (!current_user_can('backwpup_jobs_edit')) {
         return __('Sorry, you don\'t have permissions to do that.', 'backwpup');
     }
     $destinations = BackWPup::get_registered_destinations();
     $job_types = BackWPup::get_job_types();
     switch ($tab) {
         case 'job':
             BackWPup_Option::update($jobid, 'jobid', $jobid);
             if (isset($_POST['type']) && is_array($_POST['type'])) {
                 foreach ((array) $_POST['type'] as $typeid) {
                     if (empty($job_types[$typeid])) {
                         unset($_POST['type'][$typeid]);
                     }
                 }
                 if (is_array($_POST['type'])) {
                     sort($_POST['type']);
                 }
             } else {
                 $_POST['type'] = array();
             }
             //test if job type makes backup
             /* @var BackWPup_JobTypes $job_type */
             $makes_file = FALSE;
             foreach ($job_types as $type_id => $job_type) {
                 if (in_array($type_id, $_POST['type'])) {
                     if ($job_type->creates_file()) {
                         $makes_file = TRUE;
                         break;
                     }
                 }
             }
             if (!$makes_file) {
                 $_POST['destinations'] = array();
             }
             BackWPup_Option::update($jobid, 'type', $_POST['type']);
             if (isset($_POST['destinations']) && is_array($_POST['destinations'])) {
                 foreach ((array) $_POST['destinations'] as $key => $destid) {
                     if (empty($destinations[$destid])) {
                         //remove all destinations that not exists
                         unset($_POST['destinations'][$key]);
                     }
                     if (class_exists('BackWPup_Pro', FALSE) && $_POST['backuptype'] == 'sync') {
                         //if sync remove all not sync destinations
                         if (!$destinations[$destid]['can_sync']) {
                             unset($_POST['destinations'][$key]);
                         }
                     }
                 }
                 if (is_array($_POST['destinations'])) {
                     sort($_POST['destinations']);
                 }
             } else {
                 $_POST['destinations'] = array();
             }
             BackWPup_Option::update($jobid, 'destinations', $_POST['destinations']);
             $name = esc_html(trim($_POST['name']));
             if (empty($name) || $_POST['name'] == __('New Job', 'backwpup')) {
                 $name = sprintf(__('Job with ID %d', 'backwpup'), $jobid);
             }
             BackWPup_Option::update($jobid, 'name', $name);
             $emails = explode(',', $_POST['mailaddresslog']);
             foreach ($emails as $key => $email) {
                 $emails[$key] = sanitize_email(trim($email));
                 if (!is_email($emails[$key])) {
                     unset($emails[$key]);
                 }
             }
             $mailaddresslog = implode(', ', $emails);
             BackWPup_Option::update($jobid, 'mailaddresslog', $mailaddresslog);
             $_POST['mailaddresssenderlog'] = trim($_POST['mailaddresssenderlog']);
             if (empty($_POST['mailaddresssenderlog'])) {
                 BackWPup_Option::delete($jobid, 'mailaddresssenderlog');
             } else {
                 BackWPup_Option::update($jobid, 'mailaddresssenderlog', $_POST['mailaddresssenderlog']);
             }
             BackWPup_Option::update($jobid, 'mailerroronly', isset($_POST['mailerroronly']) && $_POST['mailerroronly'] == 1 ? TRUE : FALSE);
             if (class_exists('BackWPup_Pro', FALSE)) {
                 BackWPup_Option::update($jobid, 'backuptype', esc_html($_POST['backuptype']));
             } else {
                 BackWPup_Option::update($jobid, 'backuptype', 'archive');
             }
             BackWPup_Option::update($jobid, 'archiveformat', esc_html($_POST['archiveformat']));
             BackWPup_Option::update($jobid, 'archivename', BackWPup_Job::sanitize_file_name($_POST['archivename']));
             break;
         case 'cron':
             if ($_POST['activetype'] == '' || $_POST['activetype'] == 'wpcron' || $_POST['activetype'] == 'easycron' || $_POST['activetype'] == 'link') {
                 BackWPup_Option::update($jobid, 'activetype', $_POST['activetype']);
             }
             BackWPup_Option::update($jobid, 'cronselect', $_POST['cronselect'] == 'advanced' ? 'advanced' : 'basic');
             if (isset($_POST['cronselect']) && $_POST['cronselect'] == 'advanced') {
                 //save advanced
                 if (empty($_POST['cronminutes']) || $_POST['cronminutes'][0] == '*') {
                     if (!empty($_POST['cronminutes'][1])) {
                         $_POST['cronminutes'] = array('*/' . $_POST['cronminutes'][1]);
                     } else {
//.........这里部分代码省略.........
开发者ID:byadrenaline,项目名称:laseravalon_wp,代码行数:101,代码来源:class-page-editjob.php

示例7: job_run_archive

 /**
  * @param $job_object BackWPup_Job
  * @return bool
  */
 public function job_run_archive(BackWPup_Job $job_object)
 {
     $job_object->substeps_todo = 2 + $job_object->backup_filesize;
     $job_object->log(sprintf(__('%d. Try to send backup to SugarSync&#160;&hellip;', 'backwpup'), $job_object->steps_data[$job_object->step_working]['STEP_TRY']), E_USER_NOTICE);
     try {
         $sugarsync = new BackWPup_Destination_SugarSync_API($job_object->job['sugarrefreshtoken']);
         //Check Quota
         $user = $sugarsync->user();
         if (!empty($user->nickname)) {
             $job_object->log(sprintf(__('Authenticated to SugarSync with nickname %s', 'backwpup'), $user->nickname), E_USER_NOTICE);
         }
         $sugarsyncfreespase = (double) $user->quota->limit - (double) $user->quota->usage;
         //float fixes bug for display of no free space
         if ($job_object->backup_filesize > $sugarsyncfreespase) {
             $job_object->log(sprintf(_x('Not enough disk space available on SugarSync. Available: %s.', 'Available space on SugarSync', 'backwpup'), size_format($sugarsyncfreespase, 2)), E_USER_ERROR);
             $job_object->substeps_todo = 1 + $job_object->backup_filesize;
             return TRUE;
         } else {
             $job_object->log(sprintf(__('%s available at SugarSync', 'backwpup'), size_format($sugarsyncfreespase, 2)), E_USER_NOTICE);
         }
         //Create and change folder
         $sugarsync->mkdir($job_object->job['sugardir'], $job_object->job['sugarroot']);
         $dirid = $sugarsync->chdir($job_object->job['sugardir'], $job_object->job['sugarroot']);
         //Upload to SugarSync
         $job_object->substeps_done = 0;
         $job_object->log(__('Starting upload to SugarSync&#160;&hellip;', 'backwpup'), E_USER_NOTICE);
         self::$backwpup_job_object =& $job_object;
         $reponse = $sugarsync->upload($job_object->backup_folder . $job_object->backup_file);
         if (is_object($reponse)) {
             if (!empty($job_object->job['jobid'])) {
                 BackWPup_Option::update($job_object->job['jobid'], 'lastbackupdownloadurl', network_admin_url('admin.php') . '?page=backwpupbackups&action=downloadsugarsync&file=' . (string) $reponse . '&jobid=' . $job_object->job['jobid']);
             }
             $job_object->substeps_done++;
             $job_object->log(sprintf(__('Backup transferred to %s', 'backwpup'), 'https://' . $user->nickname . '.sugarsync.com/' . $sugarsync->showdir($dirid) . $job_object->backup_file), E_USER_NOTICE);
         } else {
             $job_object->log(__('Cannot transfer backup to SugarSync!', 'backwpup'), E_USER_ERROR);
             return FALSE;
         }
         $backupfilelist = array();
         $files = array();
         $filecounter = 0;
         $dir = $sugarsync->showdir($dirid);
         $getfiles = $sugarsync->getcontents('file');
         if (is_object($getfiles)) {
             foreach ($getfiles->file as $getfile) {
                 $getfile->displayName = utf8_decode((string) $getfile->displayName);
                 if ($job_object->is_backup_archive($getfile->displayName)) {
                     $backupfilelist[strtotime((string) $getfile->lastModified)] = (string) $getfile->ref;
                 }
                 $files[$filecounter]['folder'] = 'https://' . (string) $user->nickname . '.sugarsync.com/' . $dir;
                 $files[$filecounter]['file'] = (string) $getfile->ref;
                 $files[$filecounter]['filename'] = (string) $getfile->displayName;
                 $files[$filecounter]['downloadurl'] = network_admin_url('admin.php') . '?page=backwpupbackups&action=downloadsugarsync&file=' . (string) $getfile->ref . '&jobid=' . $job_object->job['jobid'];
                 $files[$filecounter]['filesize'] = (int) $getfile->size;
                 $files[$filecounter]['time'] = strtotime((string) $getfile->lastModified) + get_option('gmt_offset') * 3600;
                 $filecounter++;
             }
         }
         if (!empty($job_object->job['sugarmaxbackups']) && $job_object->job['sugarmaxbackups'] > 0) {
             //Delete old backups
             if (count($backupfilelist) > $job_object->job['sugarmaxbackups']) {
                 ksort($backupfilelist);
                 $numdeltefiles = 0;
                 while ($file = array_shift($backupfilelist)) {
                     if (count($backupfilelist) < $job_object->job['sugarmaxbackups']) {
                         break;
                     }
                     $sugarsync->delete($file);
                     //delete files on Cloud
                     foreach ($files as $key => $filedata) {
                         if ($filedata['file'] == $file) {
                             unset($files[$key]);
                         }
                     }
                     $numdeltefiles++;
                 }
                 if ($numdeltefiles > 0) {
                     $job_object->log(sprintf(_n('One file deleted on SugarSync folder', '%d files deleted on SugarSync folder', $numdeltefiles, 'backwpup'), $numdeltefiles), E_USER_NOTICE);
                 }
             }
         }
         set_site_transient('BackWPup_' . $job_object->job['jobid'] . '_SUGARSYNC', $files, 60 * 60 * 24 * 7);
     } catch (Exception $e) {
         $job_object->log(E_USER_ERROR, sprintf(__('SugarSync API: %s', 'backwpup'), $e->getMessage()), $e->getFile(), $e->getLine());
         return FALSE;
     }
     $job_object->substeps_done++;
     return TRUE;
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:93,代码来源:class-destination-sugarsync.php

示例8: upgrade_from_version_two

 private static function upgrade_from_version_two()
 {
     //load options
     $cfg = get_option('backwpup');
     //only exists in Version 2
     $jobs = get_option('backwpup_jobs');
     //delete old options
     delete_option('backwpup');
     delete_option('backwpup_jobs');
     //add new option default structure and without auto load cache
     if (!is_multisite()) {
         add_option('backwpup_jobs', array(), NULL, 'no');
     }
     //upgrade cfg
     //if old value switch it to new
     if (!empty($cfg['dirlogs'])) {
         $cfg['logfolder'] = $cfg['dirlogs'];
     }
     if (!empty($cfg['httpauthpassword'])) {
         if (preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $cfg['httpauthpassword'])) {
             $cfg['httpauthpassword'] = base64_decode($cfg['httpauthpassword']);
         }
         $cfg['httpauthpassword'] = BackWPup_Encryption::encrypt($cfg['httpauthpassword']);
     }
     // delete old not needed vars
     unset($cfg['dirtemp'], $cfg['dirlogs'], $cfg['logfilelist'], $cfg['jobscriptruntime'], $cfg['jobscriptruntimelong'], $cfg['last_activate'], $cfg['disablewpcron'], $cfg['phpzip'], $cfg['apicronservice'], $cfg['mailsndemail'], $cfg['mailsndname'], $cfg['mailmethod'], $cfg['mailsendmail'], $cfg['mailhost'], $cfg['mailpass'], $cfg['mailhostport'], $cfg['mailsecure'], $cfg['mailuser']);
     //save in options
     foreach ($cfg as $cfgname => $cfgvalue) {
         update_site_option('backwpup_cfg_' . $cfgname, $cfgvalue);
     }
     //Put old jobs to new if exists
     foreach ($jobs as $jobid => $jobvalue) {
         //convert general settings
         if (empty($jobvalue['jobid'])) {
             $jobvalue['jobid'] = $jobid;
         }
         if (empty($jobvalue['activated'])) {
             $jobvalue['activetype'] = '';
         } else {
             $jobvalue['activetype'] = 'wpcron';
         }
         if (!isset($jobvalue['cronselect']) && !isset($jobvalue['cron'])) {
             $jobvalue['cronselect'] = 'basic';
         } elseif (!isset($jobvalue['cronselect']) && isset($jobvalue['cron'])) {
             $jobvalue['cronselect'] = 'advanced';
         }
         $jobvalue['backuptype'] = 'archive';
         $jobvalue['type'] = explode('+', $jobvalue['type']);
         //save as array
         foreach ($jobvalue['type'] as $key => $type) {
             if ($type == 'DB') {
                 $jobvalue['type'][$key] = 'DBDUMP';
             }
             if ($type == 'OPTIMIZE') {
                 unset($jobvalue['type'][$key]);
             }
             if ($type == 'CHECK') {
                 $jobvalue['type'][$key] = 'DBCHECK';
             }
             if ($type == 'MAIL') {
                 $jobvalue['type'][$key] = 'EMAIL';
             }
         }
         $jobvalue['archivename'] = $jobvalue['fileprefix'] . '%Y-%m-%d_%H-%i-%s';
         $jobvalue['archiveformat'] = $jobvalue['fileformart'];
         //convert active destinations
         $jobvalue['destinations'] = array();
         if (!empty($jobvalue['backupdir']) && $jobvalue['backupdir'] != '/') {
             $jobvalue['destinations'][] = 'FOLDER';
         }
         if (!empty($jobvalue['mailaddress'])) {
             $jobvalue['destinations'][] = 'MAIL';
         }
         if (!empty($jobvalue['ftphost']) && !empty($jobvalue['ftpuser']) && !empty($jobvalue['ftppass'])) {
             $jobvalue['destinations'][] = 'FTP';
         }
         if (!empty($jobvalue['dropetoken']) && !empty($jobvalue['dropesecret'])) {
             $jobvalue['destinations'][] = 'DROPBOX';
         }
         if (!empty($jobvalue['sugarrefreshtoken']) && !empty($jobvalue['sugarroot'])) {
             $jobvalue['destinations'][] = 'SUGARSYNC';
         }
         if (!empty($jobvalue['awsAccessKey']) && !empty($jobvalue['awsSecretKey']) && !empty($jobvalue['awsBucket'])) {
             $jobvalue['destinations'][] = 'S3';
         }
         if (!empty($jobvalue['GStorageAccessKey']) and !empty($jobvalue['GStorageSecret']) && !empty($jobvalue['GStorageBucket']) && !in_array('S3', $jobvalue['destinations'])) {
             $jobvalue['destinations'][] = 'S3';
         }
         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'];
//.........这里部分代码省略.........
开发者ID:leotaillard,项目名称:btws2016,代码行数:101,代码来源:class-install.php

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

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

示例11: edit_form_post_save

 /**
  * @param $jobid
  */
 public function edit_form_post_save($jobid)
 {
     BackWPup_Option::update($jobid, 'dbcheckwponly', isset($_POST['dbcheckwponly']) && $_POST['dbcheckwponly'] == 1 ? TRUE : FALSE);
     BackWPup_Option::update($jobid, 'dbcheckrepair', isset($_POST['dbcheckrepair']) && $_POST['dbcheckrepair'] == 1 ? TRUE : FALSE);
 }
开发者ID:mahassan,项目名称:shellneverknow,代码行数:8,代码来源:class-jobtype-dbcheck.php

示例12: 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 'start_cli':
             //Get cmd start file
             if (!current_user_can('backwpup_jobs_start')) {
                 break;
             }
             check_admin_referer('start_cli');
             if (empty($_GET['jobid'])) {
                 break;
             }
             if (FALSE === strpos(PHP_OS, "WIN")) {
                 header("Pragma: public");
                 header("Expires: 0");
                 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                 header("Content-Type: application/octet-stream");
                 header("Content-Disposition: attachment; filename=BackWPup_cmd_start_job_" . $_GET['jobid'] . ".sh;");
                 if (defined('PHP_BINDIR')) {
                     echo "#!/bin/sh" . PHP_EOL;
                 }
                 echo "@\$1php -c \"" . php_ini_loaded_file() . "\" -r \"\$_SERVER[ 'SERVER_ADDR' ] = '" . $_SERVER['SERVER_ADDR'] . "'; \$_SERVER[ 'REMOTE_ADDR' ] = '" . $_SERVER['REMOTE_ADDR'] . "'; \$_SERVER[ 'HTTP_HOST' ] = '" . $_SERVER['HTTP_HOST'] . "'; \$_SERVER[ 'HTTP_USER_AGENT' ] = '" . BackWPup::get_plugin_data('name') . "'; define( 'DOING_CRON', TRUE ); require '" . ABSPATH . "wp-load.php'; if( class_exists( 'BackWPup_Job' ) ) BackWPup_Job::start_cli( " . $_GET['jobid'] . " );\"";
                 die;
             } else {
                 header("Pragma: public");
                 header("Expires: 0");
                 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                 header("Content-Type: application/octet-stream");
                 header("Content-Disposition: attachment; filename=BackWPup_cmd_start_job_" . $_GET['jobid'] . ".cmd;");
                 echo "@%1php.exe -c \"" . php_ini_loaded_file() . "\" -r \"\$_SERVER[ 'SERVER_ADDR' ] = '" . $_SERVER['SERVER_ADDR'] . "'; \$_SERVER[ 'REMOTE_ADDR' ] = '" . $_SERVER['REMOTE_ADDR'] . "'; \$_SERVER[ 'HTTP_HOST' ] = '" . $_SERVER['HTTP_HOST'] . "'; \$_SERVER[ 'HTTP_USER_AGENT' ] = '" . BackWPup::get_plugin_data('name') . "'; define( 'DOING_CRON', TRUE ); require '" . ABSPATH . "wp-load.php'; if( class_exists( 'BackWPup_Job' ) ) BackWPup_Job::start_cli( " . $_GET['jobid'] . " );\"";
                 die;
             }
             break;
         case 'runnow':
             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
                 BackWPup_Job::check_folder(BackWPup::get_plugin_data('TEMP'), TRUE);
                 //check log folder
                 BackWPup_Job::check_folder(get_site_option('backwpup_cfg_logfolder'));
                 //check server callback
                 $raw_response = BackWPup_Job::get_jobrun_url('test');
                 $test_result = '';
                 if (is_wp_error($raw_response)) {
                     $test_result .= sprintf(__('The HTTP response test get an error "%s"', 'backwpup'), $raw_response->get_error_message());
                 } elseif (200 != wp_remote_retrieve_response_code($raw_response) && 204 != wp_remote_retrieve_response_code($raw_response)) {
                     $test_result .= sprintf(__('The HTTP response test get a false http status (%s)', 'backwpup'), wp_remote_retrieve_response_code($raw_response));
                 }
//.........这里部分代码省略.........
开发者ID:kirkov,项目名称:backwpup,代码行数:101,代码来源:class-page-jobs.php

示例13: edit_form_post_save

 /**
  * @param $id
  */
 public function edit_form_post_save($id)
 {
     $fileexclude = explode(',', stripslashes(str_replace(array("\r\n", "\r"), ',', $_POST['fileexclude'])));
     foreach ($fileexclude as $key => $value) {
         $fileexclude[$key] = str_replace('//', '/', str_replace('\\', '/', trim($value)));
         if (empty($fileexclude[$key])) {
             unset($fileexclude[$key]);
         }
     }
     sort($fileexclude);
     BackWPup_Option::update($id, 'fileexclude', implode(',', $fileexclude));
     $dirinclude = explode(',', stripslashes(str_replace(array("\r\n", "\r"), ',', $_POST['dirinclude'])));
     foreach ($dirinclude as $key => $value) {
         $dirinclude[$key] = trailingslashit(str_replace('//', '/', str_replace('\\', '/', trim($value))));
         if ($dirinclude[$key] == '/' || empty($dirinclude[$key]) || !is_dir($dirinclude[$key])) {
             unset($dirinclude[$key]);
         }
     }
     sort($dirinclude);
     BackWPup_Option::update($id, 'dirinclude', implode(',', $dirinclude));
     BackWPup_Option::update($id, 'backupexcludethumbs', isset($_POST['backupexcludethumbs']) && $_POST['backupexcludethumbs'] == 1 ? TRUE : FALSE);
     BackWPup_Option::update($id, 'backupspecialfiles', isset($_POST['backupspecialfiles']) && $_POST['backupspecialfiles'] == 1 ? TRUE : FALSE);
     BackWPup_Option::update($id, 'backuproot', isset($_POST['backuproot']) && $_POST['backuproot'] == 1 ? TRUE : FALSE);
     if (!isset($_POST['backuprootexcludedirs']) || !is_array($_POST['backuprootexcludedirs'])) {
         $_POST['backuprootexcludedirs'] = array();
     }
     sort($_POST['backuprootexcludedirs']);
     BackWPup_Option::update($id, 'backuprootexcludedirs', $_POST['backuprootexcludedirs']);
     BackWPup_Option::update($id, 'backupcontent', isset($_POST['backupcontent']) && $_POST['backupcontent'] == 1 ? TRUE : FALSE);
     if (!isset($_POST['backupcontentexcludedirs']) || !is_array($_POST['backupcontentexcludedirs'])) {
         $_POST['backupcontentexcludedirs'] = array();
     }
     sort($_POST['backupcontentexcludedirs']);
     BackWPup_Option::update($id, 'backupcontentexcludedirs', $_POST['backupcontentexcludedirs']);
     BackWPup_Option::update($id, 'backupplugins', isset($_POST['backupplugins']) && $_POST['backupplugins'] == 1 ? TRUE : FALSE);
     if (!isset($_POST['backuppluginsexcludedirs']) || !is_array($_POST['backuppluginsexcludedirs'])) {
         $_POST['backuppluginsexcludedirs'] = array();
     }
     sort($_POST['backuppluginsexcludedirs']);
     BackWPup_Option::update($id, 'backuppluginsexcludedirs', $_POST['backuppluginsexcludedirs']);
     BackWPup_Option::update($id, 'backupthemes', isset($_POST['backupthemes']) && $_POST['backupthemes'] == 1 ? TRUE : FALSE);
     if (!isset($_POST['backupthemesexcludedirs']) || !is_array($_POST['backupthemesexcludedirs'])) {
         $_POST['backupthemesexcludedirs'] = array();
     }
     sort($_POST['backupthemesexcludedirs']);
     BackWPup_Option::update($id, 'backupthemesexcludedirs', $_POST['backupthemesexcludedirs']);
     BackWPup_Option::update($id, 'backupuploads', isset($_POST['backupuploads']) && $_POST['backupuploads'] == 1 ? TRUE : FALSE);
     if (!isset($_POST['backupuploadsexcludedirs']) || !is_array($_POST['backupuploadsexcludedirs'])) {
         $_POST['backupuploadsexcludedirs'] = array();
     }
     sort($_POST['backupuploadsexcludedirs']);
     BackWPup_Option::update($id, 'backupuploadsexcludedirs', $_POST['backupuploadsexcludedirs']);
 }
开发者ID:congtrieu112,项目名称:anime,代码行数:56,代码来源:class-jobtype-file.php

示例14: edit_form_post_save

 public function edit_form_post_save($id)
 {
     BackWPup_Option::update($id, 'widgetlistfile', BackWPup_Job::sanitize_file_name($_POST['widgetlistfile']));
 }
开发者ID:rufas-hajdu,项目名称:backwpup-widget,代码行数:4,代码来源:class-jobtype-wpwidget.php

示例15: insert_or_update_jobs

 protected function insert_or_update_jobs()
 {
     $settings = $_POST['settings'];
     if (!is_array($settings) || !isset($settings['value'])) {
         return array('error' => __('Missing array settings', $this->plugin_translate));
     }
     if (!isset($settings['tab'])) {
         return array('error' => __('Missing tab', $this->plugin_translate));
     }
     if (!isset($settings['job_id'])) {
         return array('error' => __('Missing job id', $this->plugin_translate));
     }
     if (!class_exists('BackWPup')) {
         return array('error' => __('Install BackWPup on child website', $this->plugin_translate));
     }
     if ($settings['job_id'] > 0) {
         $job_id = intval($settings['job_id']);
     } else {
         //generate jobid if not exists
         $newjobid = BackWPup_Option::get_job_ids();
         sort($newjobid);
         $job_id = end($newjobid) + 1;
     }
     update_site_option('backwpup_messages', array());
     foreach ($settings['value'] as $key => $val) {
         $_POST[$key] = $val;
     }
     BackWPup_Page_Editjob::save_post_form($settings['tab'], $job_id);
     $return = $this->check_backwpup_messages();
     if (isset($return['error'])) {
         return array('success' => 1, 'error_message' => __('Cannot save jobs: ' . $return['error'], $this->plugin_translate));
     }
     if (isset($settings['value']['sugarrefreshtoken'])) {
         BackWPup_Option::update($job_id, 'sugarrefreshtoken', $settings['value']['sugarrefreshtoken']);
     }
     if (isset($settings['value']['gdriverefreshtoken'])) {
         BackWPup_Option::update($job_id, 'gdriverefreshtoken', $settings['value']['gdriverefreshtoken']);
     }
     if (isset($settings['value']['dbdumpspecialsetalltables']) && $settings['value']['dbdumpspecialsetalltables']) {
         BackWPup_Option::update($job_id, 'dbdumpexclude', array());
     }
     if (isset($settings['value']['dropboxtoken']) && isset($settings['value']['dropboxroot'])) {
         BackWPup_Option::update($job_id, 'dropboxtoken', $settings['value']['dropboxtoken']);
         BackWPup_Option::update($job_id, 'dropboxroot', $settings['value']['dropboxroot']);
     }
     $changes_array = array();
     foreach ($settings['value'] as $key => $val) {
         $temp_value = BackWPup_Option::get($job_id, $key);
         if (is_string($temp_value)) {
             if (isset($this->exclusions[$settings['tab']])) {
                 if (!in_array($key, $this->exclusions[$settings['tab']]) && strcmp($temp_value, $val) != 0) {
                     $changes_array[$key] = $temp_value;
                 }
             } else {
                 if (strcmp($temp_value, $val) != 0) {
                     $changes_array[$key] = $temp_value;
                 }
             }
         }
     }
     return array('success' => 1, 'job_id' => $job_id, 'changes' => $changes_array, 'message' => $return['message']);
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:62,代码来源:class-mainwp-child-back-wp-up.php


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