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


PHP UpdraftPlus_Options::update_updraft_option方法代码示例

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


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

示例1: set

 /**
  * Set an OAuth token in the database by type
  * If the encryption object is set then encrypt the token before storing
  * @param \stdClass Token object to set
  * @param string $type Token type
  * @return void
  */
 public function set($token, $type)
 {
     if ($type != 'request_token' && $type != 'access_token') {
         throw new Dropbox_Exception("Expected a type of either 'request_token' or 'access_token', got '{$type}'");
     } else {
         $token = $this->encrypt($token);
         UpdraftPlus_Options::update_updraft_option($this->option_name_prefix . $type, $token);
     }
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:16,代码来源:WordPress.php

示例2: authorise

 /**
  * Obtain user authorisation
  * The user will be redirected to Dropbox' web endpoint
  * @link http://tools.ietf.org/html/rfc5849#section-2.2
  * @return void
  */
 private function authorise()
 {
     // Only redirect if using CLI
     if (PHP_SAPI !== 'cli' && (!defined('DOING_CRON') || !DOING_CRON)) {
         $url = $this->getAuthoriseUrl();
         header('Location: ' . $url);
         exit;
     }
     global $updraftplus;
     $updraftplus->log('Dropbox reauthorisation needed; but we are running from cron or the CLI, so this is not possible');
     UpdraftPlus_Options::update_updraft_option("updraft_dropboxtk_request_token", '');
     $updraftplus->log(sprintf(__('You need to re-authenticate with %s, as your existing credentials are not working.', 'updraftplus'), 'Dropbox'), 'error');
     exit;
 }
开发者ID:brandmobility,项目名称:kikbak,代码行数:20,代码来源:ConsumerAbstract.php

示例3: updraft_migrate_newdestination

 public function updraft_migrate_newdestination()
 {
     global $updraftplus;
     $ret = array();
     if (empty($_POST['key'])) {
         $ret['e'] = sprintf(__("Failure: No %s was given.", 'updraftplus'), __('key', 'updraftplus'));
     } else {
         $ud_rpc = $updraftplus->get_udrpc();
         // A bundle has these keys: key, name_indicator, url
         $decode_bundle = $ud_rpc->decode_portable_bundle($_POST['key'], 'base64_with_count');
         if (!is_array($decode_bundle) || !empty($decode_bundle['code'])) {
             $ret['e'] = __('Error:', 'updraftplus');
             if (!empty($decode_bundle['code']) && $decode_bundle['code'] == 'invalid_wrong_length') {
                 $ret['e'] .= ' ' . __('The entered key was the wrong length - please try again.', 'updraftplus');
             } elseif (!empty($decode_bundle['code']) && $decode_bundle['code'] == 'invalid_corrupt') {
                 $ret['e'] .= ' ' . __('The entered key was corrupt - please try again.', 'updraftplus') . ' (' . $decode_bundle['data'] . ')';
             } elseif (empty($decode_bundle['key']) || empty($decode_bundle['url'])) {
                 $ret['e'] .= ' ' . __('The entered key was corrupt - please try again.', 'updraftplus');
                 $ret['data'] = $decode_bundle;
             }
         } elseif (empty($decode_bundle['key']) || empty($decode_bundle['url'])) {
             $ret['e'] = __('Error:', 'updraftplus') . ' ' . __('The entered key was corrupt - please try again.', 'updraftplus');
             $ret['data'] = $decode_bundle;
         } else {
             if ($decode_bundle['url'] == trailingslashit(network_site_url())) {
                 $ret['e'] = __('Error:', 'updraftplus') . ' ' . __('The entered key does not belong to a remote site (it belongs to this one).', 'updraftplus');
             } else {
                 // Store the information
                 $remotesites = UpdraftPlus_Options::get_updraft_option('updraft_remotesites');
                 if (!is_array($remotesites)) {
                     $remotesites = array();
                 }
                 foreach ($remotesites as $k => $rsite) {
                     if (!is_array($rsite)) {
                         continue;
                     }
                     if ($rsite['url'] == $decode_bundle['url']) {
                         unset($remotesites[$k]);
                     }
                 }
                 $remotesites[] = $decode_bundle;
                 UpdraftPlus_Options::update_updraft_option('updraft_remotesites', $remotesites);
                 $ret['selector'] = $this->get_remotesites_selector($remotesites);
                 // Return the new HTML widget to the front end
                 $ret['r'] = __('The key was successfully added.', 'updraftplus') . ' ' . __('It is for sending backups to the following site: ', 'updraftplus') . htmlspecialchars($decode_bundle['url']);
             }
         }
     }
     echo json_encode($ret);
     die;
 }
开发者ID:beyond-z,项目名称:braven,代码行数:51,代码来源:migrator.php

示例4: deleteset

 private function deleteset()
 {
     global $updraftplus;
     $backups = $updraftplus->get_backup_history();
     $timestamp = $_POST['backup_timestamp'];
     if (!isset($backups[$timestamp])) {
         $bh = $this->build_historystatus();
         return array('result' => 'error', 'message' => __('Backup set not found', 'updraftplus'), 'updraft_historystatus' => $bh['h'], 'updraft_count_backups' => $bh['c']);
     }
     // You need a nonce before you can set job data. And we certainly don't yet have one.
     $updraftplus->backup_time_nonce();
     // Set the job type before logging, as there can be different logging destinations
     $updraftplus->jobdata_set('job_type', 'delete');
     $updraftplus->jobdata_set('job_time_ms', $updraftplus->job_time_ms);
     if (UpdraftPlus_Options::get_updraft_option('updraft_debug_mode')) {
         $updraftplus->logfile_open($updraftplus->nonce);
         set_error_handler(array($updraftplus, 'php_error'), E_ALL & ~E_STRICT);
     }
     $updraft_dir = $updraftplus->backups_dir_location();
     $backupable_entities = $updraftplus->get_backupable_file_entities(true, true);
     $nonce = isset($backups[$timestamp]['nonce']) ? $backups[$timestamp]['nonce'] : '';
     $delete_from_service = array();
     if (isset($_POST['delete_remote']) && 1 == $_POST['delete_remote']) {
         // Locate backup set
         if (isset($backups[$timestamp]['service'])) {
             $services = is_string($backups[$timestamp]['service']) ? array($backups[$timestamp]['service']) : $backups[$timestamp]['service'];
             if (is_array($services)) {
                 foreach ($services as $service) {
                     if ($service != 'none') {
                         $delete_from_service[] = $service;
                     }
                 }
             }
         }
     }
     $files_to_delete = array();
     foreach ($backupable_entities as $key => $ent) {
         if (isset($backups[$timestamp][$key])) {
             $files_to_delete[$key] = $backups[$timestamp][$key];
         }
     }
     // Delete DB
     if (isset($backups[$timestamp]['db'])) {
         $files_to_delete['db'] = $backups[$timestamp]['db'];
     }
     // Also delete the log
     if ($nonce && !UpdraftPlus_Options::get_updraft_option('updraft_debug_mode')) {
         $files_to_delete['log'] = "log.{$nonce}.txt";
     }
     unset($backups[$timestamp]);
     UpdraftPlus_Options::update_updraft_option('updraft_backup_history', $backups);
     $message = '';
     $local_deleted = 0;
     $remote_deleted = 0;
     add_action('http_request_args', array($updraftplus, 'modify_http_options'));
     foreach ($files_to_delete as $key => $files) {
         # Local deletion
         if (is_string($files)) {
             $files = array($files);
         }
         foreach ($files as $file) {
             if (is_file($updraft_dir . '/' . $file)) {
                 if (@unlink($updraft_dir . '/' . $file)) {
                     $local_deleted++;
                 }
             }
         }
         if ('log' != $key && count($delete_from_service) > 0) {
             foreach ($delete_from_service as $service) {
                 if ('email' == $service) {
                     continue;
                 }
                 if (file_exists(UPDRAFTPLUS_DIR . "/methods/{$service}.php")) {
                     require_once UPDRAFTPLUS_DIR . "/methods/{$service}.php";
                 }
                 $objname = 'UpdraftPlus_BackupModule_' . $service;
                 $deleted = -1;
                 if (class_exists($objname)) {
                     # TODO: Re-use the object (i.e. prevent repeated connection setup/teardown)
                     $remote_obj = new $objname();
                     $deleted = $remote_obj->delete($files);
                 }
                 if ($deleted === -1) {
                     //echo __('Did not know how to delete from this cloud service.', 'updraftplus');
                 } elseif ($deleted !== false) {
                     $remote_deleted = $remote_deleted + count($files);
                 } else {
                     // Do nothing
                 }
             }
         }
     }
     remove_action('http_request_args', array($updraftplus, 'modify_http_options'));
     $message .= __('The backup set has been removed.', 'updraftplus') . "\n";
     $message .= sprintf(__('Local archives deleted: %d', 'updraftplus'), $local_deleted) . "\n";
     $message .= sprintf(__('Remote archives deleted: %d', 'updraftplus'), $remote_deleted) . "\n";
     $updraftplus->log('Local archives deleted: ' . $local_deleted);
     $updraftplus->log('Remote archives deleted: ' . $remote_deleted);
     if (UpdraftPlus_Options::get_updraft_option('updraft_debug_mode')) {
         restore_error_handler();
//.........这里部分代码省略.........
开发者ID:jexmex,项目名称:mainwp-child,代码行数:101,代码来源:class-mainwp-child-updraft-plus-backups.php

示例5: bootstrap


//.........这里部分代码省略.........
     }
     // 		$included_paths = explode(PATH_SEPARATOR, get_include_path());
     // 		if (!in_array(UPDRAFTPLUS_DIR.'/includes', $included_paths)) {
     // 			set_include_path(UPDRAFTPLUS_DIR.'/includes'.PATH_SEPARATOR.get_include_path());
     // 		}
     $spl = spl_autoload_functions();
     if (is_array($spl)) {
         // Workaround for Google Drive CDN plugin's autoloader
         if (in_array('wpbgdc_autoloader', $spl)) {
             spl_autoload_unregister('wpbgdc_autoloader');
         }
         // http://www.wpdownloadmanager.com/download/google-drive-explorer/ - but also others, since this is the default function name used by the Google SDK
         if (in_array('google_api_php_client_autoload', $spl)) {
             spl_autoload_unregister('google_api_php_client_autoload');
         }
     }
     /*
     		if (!class_exists('Google_Config')) require_once 'Google/Config.php';
     		if (!class_exists('Google_Client')) require_once 'Google/Client.php';
     		if (!class_exists('Google_Service_Drive')) require_once 'Google/Service/Drive.php';
     		if (!class_exists('Google_Http_Request')) require_once 'Google/Http/Request.php';
     */
     if ((!class_exists('Google_Config') || !class_exists('Google_Client') || !class_exists('Google_Service_Drive') || !class_exists('Google_Http_Request')) && !function_exists('google_api_php_client_autoload_updraftplus')) {
         require_once UPDRAFTPLUS_DIR . '/includes/Google/autoload.php';
     }
     $config = new Google_Config();
     $config->setClassConfig('Google_IO_Abstract', 'request_timeout_seconds', 60);
     # In our testing, $service->about->get() fails if gzip is not disabled when using the stream wrapper
     if (!function_exists('curl_version') || !function_exists('curl_exec') || defined('UPDRAFTPLUS_GOOGLEDRIVE_DISABLEGZIP') && UPDRAFTPLUS_GOOGLEDRIVE_DISABLEGZIP) {
         $config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
     }
     $client = new Google_Client($config);
     $client->setClientId($opts['clientid']);
     $client->setClientSecret($opts['secret']);
     // 			$client->setUseObjects(true);
     if (empty($access_token)) {
         $access_token = $this->access_token($opts['token'], $opts['clientid'], $opts['secret']);
     }
     // Do we have an access token?
     if (empty($access_token) || is_wp_error($access_token)) {
         $updraftplus->log('ERROR: Have not yet obtained an access token from Google (has the user authorised?)');
         $updraftplus->log(__('Have not yet obtained an access token from Google - you need to authorise or re-authorise your connection to Google Drive.', 'updraftplus'), 'error');
         return $access_token;
     }
     $client->setAccessToken(json_encode(array('access_token' => $access_token, 'refresh_token' => $opts['token'])));
     $io = $client->getIo();
     $setopts = array();
     if (is_a($io, 'Google_IO_Curl')) {
         $setopts[CURLOPT_SSL_VERIFYPEER] = UpdraftPlus_Options::get_updraft_option('updraft_ssl_disableverify') ? false : true;
         if (!UpdraftPlus_Options::get_updraft_option('updraft_ssl_useservercerts')) {
             $setopts[CURLOPT_CAINFO] = UPDRAFTPLUS_DIR . '/includes/cacert.pem';
         }
         // Raise the timeout from the default of 15
         $setopts[CURLOPT_TIMEOUT] = 60;
         $setopts[CURLOPT_CONNECTTIMEOUT] = 15;
         if (defined('UPDRAFTPLUS_IPV4_ONLY') && UPDRAFTPLUS_IPV4_ONLY) {
             $setopts[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
         }
     } elseif (is_a($io, 'Google_IO_Stream')) {
         $setopts['timeout'] = 60;
         # We had to modify the SDK to support this
         # https://wiki.php.net/rfc/tls-peer-verification - before PHP 5.6, there is no default CA file
         if (!UpdraftPlus_Options::get_updraft_option('updraft_ssl_useservercerts') || version_compare(PHP_VERSION, '5.6.0', '<')) {
             $setopts['cafile'] = UPDRAFTPLUS_DIR . '/includes/cacert.pem';
         }
         if (UpdraftPlus_Options::get_updraft_option('updraft_ssl_disableverify')) {
             $setopts['disable_verify_peer'] = true;
         }
     }
     $io->setOptions($setopts);
     $service = new Google_Service_Drive($client);
     $this->client = $client;
     $this->service = $service;
     try {
         # Get the folder name, if not previously known (this is for the legacy situation where an id, not a name, was stored)
         if (!empty($opts['parentid']) && (!is_array($opts['parentid']) || empty($opts['parentid']['name']))) {
             $rootid = $this->root_id();
             $title = '';
             $parentid = is_array($opts['parentid']) ? $opts['parentid']['id'] : $opts['parentid'];
             while (!empty($parentid) && $parentid != $rootid) {
                 $resource = $service->files->get($parentid);
                 $title = $title ? $resource->getTitle() . '/' . $title : $resource->getTitle();
                 $parents = $resource->getParents();
                 if (is_array($parents) && count($parents) > 0) {
                     $parent = array_shift($parents);
                     $parentid = is_a($parent, 'Google_Service_Drive_ParentReference') ? $parent->getId() : false;
                 } else {
                     $parentid = false;
                 }
             }
             if (!empty($title)) {
                 $opts['parentid'] = array('id' => is_array($opts['parentid']) ? $opts['parentid']['id'] : $opts['parentid'], 'name' => $title);
                 UpdraftPlus_Options::update_updraft_option('updraft_googledrive', $opts);
             }
         }
     } catch (Exception $e) {
         $updraftplus->log("Google Drive: failed to obtain name of parent folder: " . $e->getMessage() . ' (line: ' . $e->getLine() . ', file: ' . $e->getFile() . ')');
     }
     return $this->service;
 }
开发者ID:jzornow,项目名称:changingdenver,代码行数:101,代码来源:googledrive.php

示例6: maybe_save_backup_history_and_reschedule

 private function maybe_save_backup_history_and_reschedule($backup_history)
 {
     static $last_saved_at = 0;
     if (!$last_saved_at) {
         $last_saved_at = time();
     }
     if (time() - $last_saved_at >= 10) {
         global $updraftplus;
         $updraftplus->log("Retain: saving new backup history, because at least 10 seconds have passed since the last save (sets now: " . count($backup_history) . ")");
         UpdraftPlus_Options::update_updraft_option('updraft_backup_history', $backup_history, false);
         $updraftplus->something_useful_happened();
         $last_saved_at = time();
     }
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:14,代码来源:backup.php

示例7: backups_dir_location

 public function backups_dir_location()
 {
     if (!empty($this->backup_dir)) {
         return $this->backup_dir;
     }
     $updraft_dir = untrailingslashit(UpdraftPlus_Options::get_updraft_option('updraft_dir'));
     # When newly installing, if someone had (e.g.) wp-content/updraft in their database from a previous, deleted pre-1.7.18 install but had removed the updraft directory before re-installing, without this fix they'd end up with wp-content/wp-content/updraft.
     if (preg_match('/^wp-content\\/(.*)$/', $updraft_dir, $matches) && ABSPATH . 'wp-content' === WP_CONTENT_DIR) {
         UpdraftPlus_Options::update_updraft_option('updraft_dir', $matches[1]);
         $updraft_dir = WP_CONTENT_DIR . '/' . $matches[1];
     }
     $default_backup_dir = WP_CONTENT_DIR . '/updraft';
     $updraft_dir = $updraft_dir ? $updraft_dir : $default_backup_dir;
     // Do a test for a relative path
     if ('/' != substr($updraft_dir, 0, 1) && "\\" != substr($updraft_dir, 0, 1) && !preg_match('/^[a-zA-Z]:/', $updraft_dir)) {
         # Legacy - file paths stored related to ABSPATH
         if (is_dir(ABSPATH . $updraft_dir) && is_file(ABSPATH . $updraft_dir . '/index.html') && is_file(ABSPATH . $updraft_dir . '/.htaccess') && !is_file(ABSPATH . $updraft_dir . '/index.php') && false !== strpos(file_get_contents(ABSPATH . $updraft_dir . '/.htaccess', false, null, 0, 20), 'deny from all')) {
             $updraft_dir = ABSPATH . $updraft_dir;
         } else {
             # File paths stored relative to WP_CONTENT_DIR
             $updraft_dir = trailingslashit(WP_CONTENT_DIR) . $updraft_dir;
         }
     }
     // Check for the existence of the dir and prevent enumeration
     // index.php is for a sanity check - make sure that we're not somewhere unexpected
     if ((!is_dir($updraft_dir) || !is_file($updraft_dir . '/index.html') || !is_file($updraft_dir . '/.htaccess')) && !is_file($updraft_dir . '/index.php') || !is_file($updraft_dir . '/web.config')) {
         @mkdir($updraft_dir, 0775, true);
         @file_put_contents($updraft_dir . '/index.html', "<html><body><a href=\"https://updraftplus.com\">WordPress backups by UpdraftPlus</a></body></html>");
         if (!is_file($updraft_dir . '/.htaccess')) {
             @file_put_contents($updraft_dir . '/.htaccess', 'deny from all');
         }
         if (!is_file($updraft_dir . '/web.config')) {
             @file_put_contents($updraft_dir . '/web.config', "<configuration>\n<system.webServer>\n<authorization>\n<deny users=\"*\" />\n</authorization>\n</system.webServer>\n</configuration>\n");
         }
     }
     $this->backup_dir = $updraft_dir;
     return $updraft_dir;
 }
开发者ID:santikrass,项目名称:apache,代码行数:38,代码来源:class-updraftplus.php

示例8: admin_action_upgrade_theme

 public function admin_action_upgrade_theme()
 {
     if (!current_user_can('update_themes')) {
         return;
     }
     $theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
     check_admin_referer('upgrade-theme_' . $theme);
     $title = __('Update Theme');
     $parent_file = 'themes.php';
     $submenu_file = 'themes.php';
     require_once ABSPATH . 'wp-admin/admin-header.php';
     # Did the user get the opportunity to indicate whether they wanted a backup?
     if (!isset($_POST['updraft_autobackup_answer'])) {
         $this->auto_backup_form_and_die();
     }
     # Do not use bools here - conflicts with get_option() with a non-default value
     $autobackup = isset($_POST['updraft_autobackup']) && $_POST['updraft_autobackup'] == 'yes' ? 1 : 0;
     if (!empty($_POST['updraft_autobackup_setdefault']) && 'yes' == $_POST['updraft_autobackup_setdefault']) {
         UpdraftPlus_Options::update_updraft_option('updraft_autobackup_default', $autobackup);
     }
     if ($autobackup) {
         echo '<div class="wrap"><h2>' . __('Automatic Backup', 'updraftplus') . '</h2>';
         $this->autobackup_go('themes', true);
         echo '</div>';
     }
     # Now, the backup is (if chosen) done... but the upgrade may not directly proceed. If WP needed filesystem credentials, then it may put up an intermediate screen, which we need to insert a field in to prevent an endless circle
     add_filter('request_filesystem_credentials', array($this, 'request_filesystem_credentials'));
 }
开发者ID:jimrucinski,项目名称:Vine,代码行数:28,代码来源:autobackup.php

示例9: show_authed_admin_warning

 public function show_authed_admin_warning()
 {
     global $updraftplus_admin, $updraftplus;
     $dropbox = $this->bootstrap();
     if (false === $dropbox) {
         return false;
     }
     try {
         $accountInfo = $dropbox->accountInfo();
     } catch (Exception $e) {
         $accountinfo_err = sprintf(__("%s error: %s", 'updraftplus'), 'Dropbox', $e->getMessage()) . ' (' . $e->getCode() . ')';
     }
     $message = "<strong>" . __('Success:', 'updraftplus') . '</strong> ' . sprintf(__('you have authenticated your %s account', 'updraftplus'), 'Dropbox');
     # We log, because otherwise people get confused by the most recent log message of 'Parameter not found: oauth_token' and raise support requests
     $updraftplus->log(__('Success:', 'updraftplus') . ' ' . sprintf(__('you have authenticated your %s account', 'updraftplus'), 'Dropbox'));
     if (empty($accountInfo['code']) || "200" != $accountInfo['code']) {
         $message .= " (" . __('though part of the returned information was not as expected - your mileage may vary', 'updraftplus') . ")" . $accountInfo['code'];
         if (!empty($accountinfo_err)) {
             $message .= "<br>" . htmlspecialchars($accountinfo_err);
         }
     } else {
         $body = $accountInfo['body'];
         $message .= ". <br>" . sprintf(__('Your %s account name: %s', 'updraftplus'), 'Dropbox', htmlspecialchars($body->display_name));
         $opts = $this->get_opts();
         $opts['ownername'] = '';
         if (!empty($body->display_name)) {
             $opts['ownername'] = $body->display_name;
         }
         UpdraftPlus_Options::update_updraft_option('updraft_dropbox', $opts);
         try {
             $quota_info = $body->quota_info;
             $total_quota = max($quota_info->quota, 1);
             $normal_quota = $quota_info->normal;
             $shared_quota = $quota_info->shared;
             $available_quota = $total_quota - ($normal_quota + $shared_quota);
             $used_perc = round(($normal_quota + $shared_quota) * 100 / $total_quota, 1);
             $message .= ' <br>' . sprintf(__('Your %s quota usage: %s %% used, %s available', 'updraftplus'), 'Dropbox', $used_perc, round($available_quota / 1048576, 1) . ' Mb');
         } catch (Exception $e) {
         }
     }
     $updraftplus_admin->show_admin_warning($message);
 }
开发者ID:santikrass,项目名称:apache,代码行数:42,代码来源:dropbox.php

示例10: delete

 /**
  * Delete the request and access tokens currently stored in the database
  * @return bool
  */
 public function delete()
 {
     $opts = UpdraftPlus_Options::get_updraft_option($this->option_array);
     $opts[$this->option_name_prefix . 'request_token'] = '';
     $opts[$this->option_name_prefix . 'access_token'] = '';
     UpdraftPlus_Options::update_updraft_option($this->option_array, $opts);
     return true;
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:12,代码来源:WordPress.php

示例11: die

<?php

if (!defined('UPDRAFTPLUS_DIR')) {
    die('No direct access allowed.');
}
require_once UPDRAFTPLUS_DIR . '/methods/s3.php';
# Migrate options to new-style storage - Jan 2014
if (!is_array(UpdraftPlus_Options::get_updraft_option('updraft_dreamobjects')) && '' != UpdraftPlus_Options::get_updraft_option('updraft_dreamobjects_login', '')) {
    $opts = array('accesskey' => UpdraftPlus_Options::get_updraft_option('updraft_dreamobjects_login'), 'secretkey' => UpdraftPlus_Options::get_updraft_option('updraft_dreamobjects_pass'), 'path' => UpdraftPlus_Options::get_updraft_option('updraft_dreamobjects_remote_path'));
    UpdraftPlus_Options::update_updraft_option('updraft_dreamobjects', $opts);
    UpdraftPlus_Options::delete_updraft_option('updraft_dreamobjects_login');
    UpdraftPlus_Options::delete_updraft_option('updraft_dreamobjects_pass');
    UpdraftPlus_Options::delete_updraft_option('updraft_dreamobjects_remote_path');
}
class UpdraftPlus_BackupModule_dreamobjects extends UpdraftPlus_BackupModule_s3
{
    protected function set_region($obj, $region, $bucket_name = '')
    {
        $config = $this->get_config();
        global $updraftplus;
        $updraftplus->log("Set endpoint: " . $config['endpoint']);
        $obj->setEndpoint($config['endpoint']);
    }
    public function get_credentials()
    {
        return array('updraft_dreamobjects');
    }
    protected function get_config()
    {
        global $updraftplus;
        $opts = $updraftplus->get_job_option('updraft_dreamobjects');
开发者ID:erikdukker,项目名称:medisom,代码行数:31,代码来源:dreamobjects.php

示例12: delete

 /**
  * Delete the request and access tokens currently stored in the database
  * @return bool
  */
 public function delete()
 {
     $opts = UpdraftPlus_Options::get_updraft_option($this->option_array);
     $opts[$this->option_name_prefix . 'request_token'] = null;
     $opts[$this->option_name_prefix . 'access_token'] = null;
     unset($opts['ownername']);
     unset($opts['upgraded']);
     UpdraftPlus_Options::update_updraft_option($this->option_array, $opts);
     return true;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-Cambridge,代码行数:14,代码来源:WordPress.php

示例13: authorise

 /**
  * Obtain user authorisation
  * The user will be redirected to Dropbox' web endpoint
  * @link http://tools.ietf.org/html/rfc5849#section-2.2
  * @return void
  */
 private function authorise()
 {
     // Only redirect if not using CLI
     if (PHP_SAPI !== 'cli' && (!defined('DOING_CRON') || !DOING_CRON) && (!defined('DOING_AJAX') || !DOING_AJAX)) {
         $url = $this->getAuthoriseUrl();
         if (!headers_sent()) {
             header('Location: ' . $url);
             exit;
         } else {
             throw new Dropbox_Exception(sprintf(__('The %s authentication could not go ahead, because something else on your site is breaking it. Try disabling your other plugins and switching to a default theme. (Specifically, you are looking for the component that sends output (most likely PHP warnings/errors) before the page begins. Turning off any debugging settings may also help).', 'updraftplus'), 'Dropbox'));
         }
         return false;
     }
     global $updraftplus;
     $updraftplus->log('Dropbox reauthorisation needed; but we are running from cron, AJAX or the CLI, so this is not possible');
     $opts = UpdraftPlus_Options::get_updraft_option("updraft_dropbox");
     $opts['tk_request_token'] = '';
     UpdraftPlus_Options::update_updraft_option("updraft_dropbox", $opts);
     throw new Dropbox_Exception(sprintf(__('You need to re-authenticate with %s, as your existing credentials are not working.', 'updraftplus'), 'Dropbox'));
     #$updraftplus->log(sprintf(__('You need to re-authenticate with %s, as your existing credentials are not working.', 'updraftplus'), 'Dropbox'), 'error');
     return false;
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:28,代码来源:ConsumerAbstract.php

示例14: rebuild_backup_history

 function rebuild_backup_history()
 {
     global $updraftplus;
     $known_files = array();
     $known_nonces = array();
     $changes = false;
     $backup_history = UpdraftPlus_Options::get_updraft_option('updraft_backup_history');
     if (!is_array($backup_history)) {
         $backup_history = array();
     }
     $updraft_dir = $updraftplus->backups_dir_location();
     if (!is_dir($updraft_dir)) {
         return;
     }
     // Accumulate a list of known files
     foreach ($backup_history as $btime => $bdata) {
         $found_file = false;
         foreach ($bdata as $key => $values) {
             // Record which set this file is found in
             if (!is_array($values)) {
                 $values = array($values);
             }
             foreach ($values as $val) {
                 if (is_string($val) && preg_match('/^backup_([\\-0-9]{15})_.*_([0-9a-f]{12})-[\\-a-z]+([0-9]+(of[0-9]+)?)?+\\.(zip|gz|gz\\.crypt)$/i', $val, $matches)) {
                     $nonce = $matches[2];
                     if (isset($bdata['service']) && $bdata['service'] == 'none' && !is_file($updraft_dir . '/' . $val)) {
                         # File no longer present
                     } else {
                         $found_file = true;
                         $known_files[$val] = $nonce;
                         $known_nonces[$nonce] = $btime;
                     }
                 }
             }
         }
         if (!$found_file) {
             unset($backup_history[$btime]);
             $changes = true;
         }
     }
     if (!($handle = opendir($updraft_dir))) {
         return;
     }
     while (false !== ($entry = readdir($handle))) {
         if ($entry != "." && $entry != "..") {
             if (preg_match('/^backup_([\\-0-9]{15})_.*_([0-9a-f]{12})-([\\-a-z]+)([0-9]+(of[0-9]+)?)?\\.(zip|gz|gz\\.crypt)$/i', $entry, $matches)) {
                 $btime = strtotime($matches[1]);
                 if ($btime > 100) {
                     if (!isset($known_files[$entry])) {
                         $changes = true;
                         $nonce = $matches[2];
                         $type = $matches[3];
                         $index = empty($matches[4]) ? '0' : max((int) $matches[4] - 1, 0);
                         $itext = $index == 0 ? '' : $index;
                         // The time from the filename does not include seconds. Need to identify the seconds to get the right time
                         if (isset($known_nonces[$nonce])) {
                             $btime = $known_nonces[$nonce];
                         }
                         // No cloud backup known of this file
                         if (!isset($backup_history[$btime])) {
                             $backup_history[$btime] = array('service' => 'none');
                         }
                         $backup_history[$btime][$type][$index] = $entry;
                         $fs = @filesize($updraft_dir . '/' . $entry);
                         if (false !== $fs) {
                             $backup_history[$btime][$type . $itext . '-size'] = $fs;
                         }
                         $backup_history[$btime]['nonce'] = $nonce;
                     }
                 }
             }
         }
     }
     if ($changes) {
         UpdraftPlus_Options::update_updraft_option('updraft_backup_history', $backup_history);
     }
 }
开发者ID:jeanpage,项目名称:ca_learn,代码行数:77,代码来源:admin.php

示例15: prune_retained_backups


//.........这里部分代码省略.........
                 }
             }
             if ($prune_it) {
                 // This should only be able to happen if you import backups with a future timestamp
                 if (!empty($backup_to_examine['nonce']) && $backup_to_examine['nonce'] == $updraftplus->nonce) {
                     $updraftplus->log("This backup set ({$backup_datestamp}) is the backup set just made, so will not be deleted.");
                 } else {
                     if (!empty($data)) {
                         foreach ($services as $service => $sd) {
                             $this->prune_file($service, $data, $sd[0], $sd[1]);
                         }
                     }
                     unset($backup_to_examine[$key]);
                     $updraftplus->record_still_alive();
                 }
             }
         }
         # Files
         foreach ($backupable_entities as $entity => $info) {
             if (!empty($backup_to_examine[$entity])) {
                 if ($is_autobackup && $file_entities_backups_found[$entity] < $updraft_retain) {
                     $updraftplus->log("This backup set ({$backup_datestamp}) was an automatic backup, and we have not yet reached the retain limit, so it will not be counted or pruned. Skipping.");
                     continue;
                 }
                 $prune_it = false;
                 if ($remote_sent) {
                     $prune_it = true;
                 } else {
                     $file_entities_backups_found[$entity]++;
                     if ($file_entities_backups_found[$entity] > $updraft_retain) {
                         $prune_it = true;
                     }
                 }
                 if ($prune_it) {
                     $prune_this = $backup_to_examine[$entity];
                     if (is_string($prune_this)) {
                         $prune_this = array($prune_this);
                     }
                     // This should only be able to happen if you import backups with a future timestamp
                     if (!empty($backup_to_examine['nonce']) && $backup_to_examine['nonce'] == $updraftplus->nonce) {
                         $updraftplus->log("This backup set ({$backup_datestamp}) is the backup set just made, so will not be deleted, despite being over the retain limit.");
                         continue;
                     }
                     foreach ($prune_this as $prune_file) {
                         if ($remote_sent) {
                             $updraftplus->log("{$entity}: {$backup_datestamp}: was sent to remote site; will remove from local record (only)");
                         } else {
                             $updraftplus->log("{$entity}: {$backup_datestamp}: over retain limit ({$updraft_retain}); will delete this file ({$prune_file})");
                         }
                         $files_to_prune[] = $prune_file;
                     }
                     unset($backup_to_examine[$entity]);
                 }
             }
         }
         # Actually delete the files
         foreach ($services as $service => $sd) {
             $this->prune_file($service, $files_to_prune, $sd[0], $sd[1]);
             $updraftplus->record_still_alive();
         }
         // Get new result, post-deletion; anything left in this set?
         $contains_files = 0;
         foreach ($backupable_entities as $entity => $info) {
             if (isset($backup_to_examine[$entity])) {
                 $contains_files = 1;
                 break;
             }
         }
         $contains_db = 0;
         foreach ($backup_to_examine as $key => $data) {
             if ('db' == strtolower(substr($key, 0, 2)) && '-size' != substr($key, -5, 5)) {
                 $contains_db = 1;
                 break;
             }
         }
         // Delete backup set completely if empty, o/w just remove DB
         // We search on the four keys which represent data, allowing other keys to be used to track other things
         if (!$contains_files && !$contains_db) {
             $updraftplus->log("{$backup_datestamp}: this backup set is now empty; will remove from history");
             unset($backup_history[$backup_datestamp]);
             if (isset($backup_to_examine['nonce'])) {
                 $fullpath = $this->updraft_dir . '/log.' . $backup_to_examine['nonce'] . '.txt';
                 if (is_file($fullpath)) {
                     $updraftplus->log("{$backup_datestamp}: deleting log file (log." . $backup_to_examine['nonce'] . ".txt)");
                     @unlink($fullpath);
                 } else {
                     $updraftplus->log("{$backup_datestamp}: corresponding log file not found - must have already been deleted");
                 }
             } else {
                 $updraftplus->log("{$backup_datestamp}: no nonce record found in the backup set, so cannot delete any remaining log file");
             }
         } else {
             $updraftplus->log("{$backup_datestamp}: this backup set remains non-empty ({$contains_files}/{$contains_db}); will retain in history");
             $backup_history[$backup_datestamp] = $backup_to_examine;
         }
         # Loop over backup sets
     }
     $updraftplus->log("Retain: saving new backup history (sets now: " . count($backup_history) . ") and finishing retain operation");
     UpdraftPlus_Options::update_updraft_option('updraft_backup_history', $backup_history, false);
 }
开发者ID:santikrass,项目名称:apache,代码行数:101,代码来源:backup.php


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