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

PHP backupbuddy_core类代码示例

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

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



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

示例1: stats

 function stats()
 {
     echo '<style type="text/css">';
     echo '	.pb_fancy {';
     echo '		font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;';
     echo '		font-size: 18px;';
     echo '		color: #21759B;';
     echo '	}';
     echo '</style>';
     echo '<div>';
     $backup_url = 'admin.php?page=pb_backupbuddy_backup';
     $files = glob(backupbuddy_core::getBackupDirectory() . 'backup*.zip');
     if (!is_array($files) || empty($files)) {
         $files = array();
     }
     echo sprintf(__('You currently have %s stored backups.', 'it-l10n-backupbuddy'), '<span class="pb_fancy"><a href="' . $backup_url . '">' . count($files) . '</a></span>');
     if (pb_backupbuddy::$options['last_backup_finish'] == 0) {
         echo ' ', __('You have not successfully created any backups.', 'it-l10n-backupbuddy');
     } else {
         echo ' ', sprintf(__(' Your most recent successful backup was %s ago.', 'it-l10n-backupbuddy'), '<span class="pb_fancy"><a href="' . $backup_url . '">' . pb_backupbuddy::$format->time_ago(pb_backupbuddy::$options['last_backup_finish']) . '</a></span>');
     }
     echo ' ', sprintf(__('There have been %s post/page modifications since your last backup.', 'it-l10n-backupbuddy'), '<span class="pb_fancy"><a href="' . $backup_url . '">' . pb_backupbuddy::$options['edits_since_last'] . '</a></span>');
     echo ' <span class="pb_fancy"><a href="' . $backup_url . '">', __('Go create a backup!', 'it-l10n-backupbuddy'), '</a></span>';
     echo '</div>';
 }
开发者ID:netfor,项目名称:nextrading,代码行数:25,代码来源:dashboard.php


示例2: test

 public static function test($settings)
 {
     $email = $settings['address'];
     pb_backupbuddy::status('details', 'Testing email destination. Sending ImportBuddy.php.');
     $importbuddy_temp = backupbuddy_core::getTempDirectory() . 'importbuddy_' . pb_backupbuddy::random_string(10) . '.php.tmp';
     // Full path & filename to temporary importbuddy
     backupbuddy_core::importbuddy($importbuddy_temp);
     // Create temporary importbuddy.
     $files = array($importbuddy_temp);
     if (pb_backupbuddy::$options['email_return'] != '') {
         $email_return = pb_backupbuddy::$options['email_return'];
     } else {
         $email_return = get_option('admin_email');
     }
     $headers = 'From: BackupBuddy <' . $email_return . '>' . "\r\n";
     $wp_mail_result = wp_mail($email, 'BackupBuddy Test', 'BackupBuddy destination test for ' . site_url(), $headers, $files);
     pb_backupbuddy::status('details', 'Sent test email.');
     @unlink($importbuddy_temp);
     if ($wp_mail_result === true) {
         // WP sent. Hopefully it makes it!
         return true;
     } else {
         // WP couldn't try to send.
         echo 'WordPress was unable to attempt to send email. Check your WordPress & server settings.';
         return false;
     }
 }
开发者ID:FelixNong1990,项目名称:andy,代码行数:27,代码来源:init.php


示例3: generate_queue

 public function generate_queue($root = '', $generate_sha1 = true)
 {
     if ($root == '') {
         $root = backupbuddy_core::getLogDirectory();
     }
     echo 'mem:' . memory_get_usage(true) . '<br>';
     $files = (array) pb_backupbuddy::$filesystem->deepglob($root);
     echo 'mem:' . memory_get_usage(true) . '<br>';
     $root_len = strlen($root);
     $new_files = array();
     foreach ($files as $file_id => &$file) {
         $stat = stat($file);
         if (FALSE === $stat) {
             pb_backupbuddy::status('error', 'Unable to read file `' . $file . '` stat.');
         }
         $new_file = substr($file, $root_len);
         $sha1 = '';
         if (true === $generate_sha1 && $stat['size'] < 1073741824) {
             // < 100mb
             $sha1 = sha1_file($file);
         }
         $new_files[$new_file] = array('scanned' => time(), 'size' => $stat['size'], 'modified' => $stat['mtime'], 'sha1' => $sha1);
         unset($files[$file_id]);
         // Better to free memory or leave out for performance?
     }
     unset($files);
     echo 'mem:' . memory_get_usage(true) . '<br>';
     function pb_queuearray_size_compare($a, $b)
     {
         return $a['size'] > $b['size'];
     }
     uasort($new_files, 'pb_queuearray_size_compare');
     echo '<pre>';
     print_r($new_files);
     echo '</pre>';
     // fileoptions file live_signatures.txt
     //backupbuddy_core::st_stable_options( 'xxx', 'test', 5 );
     // get file listing of site: glob and store in an array
     // open previously generated master list (master file listing since last queue generation).
     // loop through and compare file specs to specs in master list. ( anything changed AND not yet in queue AND not maxed out send attempts ) gets added into $queue_files[];
     // add master file to end of list so it will be backed up as soon files are finished sending. to keep it up to date.
     // sort list smallest to largest
     // store in $queue_files[] in format:
     /*
     	array(
     		'size'		=>	434344,
     		'attempts'	=>	0,
     		
     	);
     */
     // open current queue file (if exists)
     // combine new files into queue
     // serialize $queue_files
     // base64 encode
     // write to queue file
     pb_backupbuddy::status('details', '12 new or modified files added into Stash queue.');
     // Schedule process_queue() to run in 30 seconds from now _IF_ not already scheduled to run.
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:58,代码来源:live.php


示例4: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     pb_backupbuddy::$options['remote_destinations'][] = $arguments['settings'];
     pb_backupbuddy::save();
     $newDestination = array();
     $newDestination['title'] = $arguments['settings']['title'];
     $newDestination['type'] = $arguments['settings']['type'];
     backupbuddy_core::addNotification('destination_created', 'Remote destination created', 'A new remote destination "' . $newDestination['title'] . '" has been created.', $newDestination);
     $highest_destination_index = end(array_keys(pb_backupbuddy::$options['remote_destinations']));
     return array('api' => '1', 'status' => 'ok', 'message' => 'Destination added.', 'destination_id' => $highest_destination_index);
 }
开发者ID:Coop920,项目名称:Sterling-Wellness,代码行数:12,代码来源:backupbuddy-add-destination.php


示例5: bb_build_remote_destinations

function bb_build_remote_destinations($destinations_list)
{
    $remote_destinations = explode('|', $destinations_list);
    $remote_destinations_html = '';
    foreach ($remote_destinations as $destination) {
        if (isset($destination) && $destination != '') {
            $remote_destinations_html .= '<li id="pb_remotedestination_' . $destination . '">';
            if (!isset(pb_backupbuddy::$options['remote_destinations'][$destination])) {
                $remote_destinations_html .= '{destination no longer exists}';
            } else {
                $remote_destinations_html .= pb_backupbuddy::$options['remote_destinations'][$destination]['title'];
                $remote_destinations_html .= ' (' . backupbuddy_core::pretty_destination_type(pb_backupbuddy::$options['remote_destinations'][$destination]['type']) . ') ';
            }
            $remote_destinations_html .= '<img class="pb_remotedestionation_delete" src="' . pb_backupbuddy::plugin_url() . '/images/redminus.png" style="vertical-align: -3px; cursor: pointer;" title="' . __('Remove remote destination from this schedule.', 'it-l10n-backupbuddy') . '" />';
            $remote_destinations_html .= '</li>';
        }
    }
    $remote_destinations = '<ul id="pb_backupbuddy_remotedestinations_list">' . $remote_destinations_html . '</ul>';
    return $remote_destinations;
}
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:20,代码来源:scheduling.php


示例6: shutdown_function

function shutdown_function()
{
    // Get error message.
    // Error types: http://php.net/manual/en/errorfunc.constants.php
    $e = error_get_last();
    if ($e === NULL) {
        // No error of any kind.
        return;
    } else {
        // Some type of error.
        if (!is_array($e) || $e['type'] != E_ERROR && $e['type'] != E_USER_ERROR) {
            // Return if not a fatal error.
            //echo '<!-- ' . print_r( $e, true ) . ' -->' . "\n";
            return;
        }
    }
    // Calculate log directory.
    $log_directory = backupbuddy_core::getLogDirectory();
    // Also handle when in importbuddy.
    $main_file = $log_directory . 'log-' . pb_backupbuddy::$options['log_serial'] . '.txt';
    // Determine if writing to a serial log.
    if (pb_backupbuddy::$_status_serial != '') {
        $serial = pb_backupbuddy::$_status_serial;
        $serial_file = $log_directory . 'status-' . $serial . '_' . pb_backupbuddy::$options['log_serial'] . '.txt';
        $write_serial = true;
    } else {
        $write_serial = false;
    }
    // Format error message.
    $e_string = '----- FATAL ERROR ----- A fatal PHP error was encountered: ';
    foreach ((array) $e as $e_line_title => $e_line) {
        $e_string .= $e_line_title . ' => ' . $e_line . "; ";
    }
    $e_string = rtrim($e_string, '; ') . '.';
    // Write to log.
    @file_put_contents($main_file, $e_string, FILE_APPEND);
    // IMPORTBUDDY
    $status = pb_backupbuddy::$format->date(time()) . "\t" . sprintf("%01.2f", round(microtime(true) - pb_backupbuddy::$start_time, 2)) . "\t" . sprintf("%01.2f", round(memory_get_peak_usage() / 1048576, 2)) . "\t" . 'error' . "\t\t" . str_replace(chr(9), '   ', $e_string);
    $status = str_replace('\\', '/', $status);
    echo '<script type="text/javascript">pb_status_append("' . str_replace('"', '&quot;', $status) . '");</script>';
}
开发者ID:elephantcode,项目名称:elephantcode,代码行数:41,代码来源:default.php


示例7: run

 public function run($arguments)
 {
     $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments);
     if ('' == $arguments['password']) {
         // no password send in arguments.
         if (!isset(pb_backupbuddy::$options)) {
             pb_backupbuddy::load();
         }
         if ('' == pb_backupbuddy::$options['importbuddy_pass_hash']) {
             // no default password is set on Settings page.
             return array('api' => '0', 'status' => 'error', 'message' => 'No ImportBuddy password was entered and no default has been set on the Settings page.');
         } else {
             // Use default.
             $importbuddy_pass_hash = pb_backupbuddy::$options['importbuddy_pass_hash'];
         }
     } else {
         // Password passed in arguments.
         $importbuddy_pass_hash = md5($arguments['password']);
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     return array('api' => '4', 'status' => 'ok', 'message' => 'ImportBuddy retrieved.', 'importbuddy' => base64_encode(backupbuddy_core::importbuddy('', $importbuddy_pass_hash, $returnNotEcho = true)));
 }
开发者ID:FelixNong1990,项目名称:andy,代码行数:22,代码来源:backupbuddy-get-importbuddy.php


示例8: get_archives_list

/**
 *	get_archives_list()
 *
 *	Returns an array of backup archive zip filenames found.
 *
 *	@return		array		Array of .zip filenames; path NOT included.
 */
function get_archives_list()
{
    Auth::require_authentication();
    if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
        require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
        pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(ABSPATH);
    }
    // List backup files in this directory.
    $backup_archives = array();
    $backup_archives_glob = glob(ABSPATH . 'backup*.zip');
    if (!is_array($backup_archives_glob) || empty($backup_archives_glob)) {
        // On failure glob() returns false or an empty array depending on server settings so normalize here.
        $backup_archives_glob = array();
    }
    foreach ($backup_archives_glob as $backup_archive) {
        $comment = pb_backupbuddy::$classes['zipbuddy']->get_comment($backup_archive);
        $comment = backupbuddy_core::normalize_comment_data($comment);
        $this_archive = array('file' => basename($backup_archive), 'comment' => $comment);
        $backup_archives[] = $this_archive;
    }
    unset($backup_archives_glob);
    return $backup_archives;
}
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:30,代码来源:del-1.php


示例9: wipePrefix

 /**
  *	wipePrefix()
  *
  *	Clear out tables matching supplied prefix.
  *
  *	@return			boolean		Currently always true.
  */
 function wipePrefix($prefix, $confirm = false)
 {
     if ($confirm !== true) {
         die('Error #5466566b: Parameter 2 to wipePrefix() must be boolean true to proceed.');
     }
     if ($prefix == '') {
         pb_backupbuddy::status('warning', 'No database prefix specified to wipe.');
         return false;
     }
     pb_backupbuddy::status('message', 'Beginning wipe of database tables matching prefix `' . $prefix . '`...');
     // Connect to database.
     //$this->connect_database();
     global $wpdb;
     $rows = $wpdb->get_results("SELECT table_name FROM information_schema.tables WHERE table_name LIKE '" . backupbuddy_core::dbEscape(str_replace('_', '\\_', $prefix)) . "%' AND table_schema = DATABASE()", ARRAY_A);
     $table_wipe_count = count($rows);
     foreach ($rows as $row) {
         pb_backupbuddy::status('details', 'Dropping table `' . $row['table_name'] . '`.');
         $wpdb->query('DROP TABLE `' . $row['table_name'] . '`');
     }
     unset($rows);
     pb_backupbuddy::status('message', 'Wiped database of ' . $table_wipe_count . ' tables.');
     return true;
 }
开发者ID:ryankrieg,项目名称:wordpress-base,代码行数:30,代码来源:import.php


示例10: _priorRollbackCleanup

 private function _priorRollbackCleanup()
 {
     $this->_before(__FUNCTION__);
     pb_backupbuddy::status('details', 'Checking for any prior failed rollback data to clean up.');
     global $wpdb;
     $shortSerial = substr($this->_state['serial'], 0, 4);
     // NEW prefix
     $sql = "SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'BBnew-" . $shortSerial . "\\_%' AND table_schema = DATABASE()";
     $results = $wpdb->get_results($sql, ARRAY_A);
     pb_backupbuddy::status('details', 'Found ' . count($results) . ' tables to drop with the prefix `BBnew-' . $shortSerial . '_`.');
     $dropCount = 0;
     foreach ($results as $result) {
         if (false === $wpdb->query("DROP TABLE `" . backupbuddy_core::dbEscape($result['table_name']) . "`")) {
             $this->_error('Unable to delete table `' . $result['table_name'] . '`.');
         } else {
             $dropCount++;
         }
     }
     pb_backupbuddy::status('details', 'Dropped `' . $dropCount . '` new tables.');
     // OLD prefix
     $sql = "SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'BBold-" . $shortSerial . "\\_%' AND table_schema = DATABASE()";
     $results = $wpdb->get_results($sql, ARRAY_A);
     pb_backupbuddy::status('details', 'Found ' . count($results) . ' tables to drop with the prefix `BBold-' . $shortSerial . '_`.');
     $dropCount = 0;
     foreach ($results as $result) {
         if (false === $wpdb->query("DROP TABLE `" . backupbuddy_core::dbEscape($result['table_name']) . "`")) {
             $this->_error('Unable to delete table `' . $result['table_name'] . '`.');
         } else {
             $dropCount++;
         }
     }
     pb_backupbuddy::status('details', 'Dropped `' . $dropCount . '` old tables.');
     pb_backupbuddy::status('details', 'Finished prior rollback cleanup.');
 }
开发者ID:arobbins,项目名称:iab,代码行数:34,代码来源:restore.php


示例11: add_action

// Register BackupBuddy API. As of BackupBuddy v5.0. Access credentials will be checked within callback.
add_action('wp_ajax_backupbuddy_api', array(pb_backupbuddy::$_ajax, 'api'));
add_action('wp_ajax_nopriv_backupbuddy_api', array(pb_backupbuddy::$_ajax, 'api'));
/********** DASHBOARD (admin) **********/
// Display stats in Dashboard.
//if ( pb_backupbuddy::$options['dashboard_stats'] == '1' ) {
if (!is_multisite() || is_multisite() && is_network_admin()) {
    // Only show if standalon OR in main network admin.
    pb_backupbuddy::add_dashboard_widget('stats', 'BackupBuddy v' . pb_backupbuddy::settings('version'), 'godmode');
}
//}
/********** FILTERS (admin) **********/
pb_backupbuddy::add_filter('plugin_row_meta', 10, 2);
/********** PAGES (admin) **********/
$icon = '';
if (is_multisite() && backupbuddy_core::is_network_activated() && !defined('PB_DEMO_MODE')) {
    // Multisite installation.
    if (defined('PB_BACKUPBUDDY_MULTISITE_EXPERIMENT') && PB_BACKUPBUDDY_MULTISITE_EXPERIMENT == TRUE) {
        // comparing with bool but loose so string is acceptable.
        if (is_network_admin()) {
            // Network Admin pages
            pb_backupbuddy::add_page('', 'backup', array(pb_backupbuddy::settings('name'), __('Backup', 'it-l10n-backupbuddy')), 'manage_network', $icon);
            pb_backupbuddy::add_page('backup', 'migrate_restore', __('Migrate, Restore', 'it-l10n-backupbuddy'), 'manage_network');
            pb_backupbuddy::add_page('backup', 'destinations', __('Remote Destinations', 'it-l10n-backupbuddy'), pb_backupbuddy::$options['role_access']);
            pb_backupbuddy::add_page('backup', 'multisite_import', __('MS Import (beta)', 'it-l10n-backupbuddy'), 'manage_network');
            pb_backupbuddy::add_page('backup', 'server_tools', __('Server Tools', 'it-l10n-backupbuddy'), 'manage_network');
            pb_backupbuddy::add_page('backup', 'malware_scan', __('Malware Scan', 'it-l10n-backupbuddy'), 'manage_network');
            pb_backupbuddy::add_page('backup', 'scheduling', __('Schedules', 'it-l10n-backupbuddy'), 'manage_network');
            pb_backupbuddy::add_page('backup', 'settings', __('Settings', 'it-l10n-backupbuddy'), 'manage_network');
        } else {
            // Subsite pages.
开发者ID:adrianjonmiller,项目名称:vadsupplies,代码行数:31,代码来源:init_admin.php


示例12: die

<?php

backupbuddy_core::verifyAjaxAccess();
// Note: importbuddy, backup files, etc should have already been cleaned up by importbuddy itself at this point.
$serial = pb_backupbuddy::_POST('serial');
$direction = pb_backupbuddy::_POST('direction');
pb_backupbuddy::load();
if ('pull' == $direction) {
    // Local so clean up here.
    backupbuddy_core::cleanup_temp_tables($serial);
    die('1');
} elseif ('push' == $direction) {
    // Remote so call API to clean up.
    require_once pb_backupbuddy::plugin_path() . '/classes/remote_api.php';
    $destinationID = pb_backupbuddy::_POST('destinationID');
    if (!isset(pb_backupbuddy::$options['remote_destinations'][$destinationID])) {
        die('Error #8383983: Invalid destination ID `' . htmlentities($destinationID) . '`.');
    }
    $destinationArray = pb_backupbuddy::$options['remote_destinations'][$destinationID];
    if ('site' != $destinationArray['type']) {
        die('Error #8378332: Destination with ID `' . htmlentities($destinationID) . '` not of "site" type.');
    }
    $apiKey = $destinationArray['api_key'];
    $apiSettings = backupbuddy_remote_api::key_to_array($apiKey);
    if (false === ($response = backupbuddy_remote_api::remoteCall($apiSettings, 'confirmDeployment', array('serial' => $serial), 10, null, null, null, null, null, null, null, $returnRaw = true))) {
        $message = 'Error #2378378324. Unable to confirm remote deployment with serial `' . $serial . '` via remote API.';
        pb_backupbuddy::status('error', $message);
        die($message);
    } else {
        if (false === ($response = json_decode($response, true))) {
            $message = 'Error #239872373. Unable to decode remote deployment response with serial `' . $serial . '` via remote API. Remote server response: `' . print_r($response) . '`.';
开发者ID:shelbyneilsmith,项目名称:wptools,代码行数:31,代码来源:deploy_confirm.php


示例13: unset

            // End foreach.
            unset($item);
            unset($item_name);
        }
        // End foreach.
        unset($event);
        unset($hook_name);
    }
    // End if is_numeric.
}
// End foreach.
unset($cron_item);
unset($time);
// Cleanup any old notifications.
$notifications = backupbuddy_core::getNotifications();
// Load notifications.
$updateNotifications = false;
$maxTimeDiff = pb_backupbuddy::$options['max_notifications_age_days'] * 24 * 60 * 60;
foreach ($notifications as $i => $notification) {
    if (time() - $notification['time'] > $maxTimeDiff) {
        unset($notifications[$i]);
        $updateNotifications = true;
    }
}
if (true === $updateNotifications) {
    pb_backupbuddy::status('details', 'Periodic cleanup: Replacing notifications.');
    backupbuddy_core::replaceNotifications($notifications);
}
@clearstatcache();
// Clears file info stat cache.
pb_backupbuddy::status('message', 'Finished cleanup procedure.');
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:31,代码来源:_periodicCleanup.php


示例14: backupbuddy_hourpad

		if( jQuery( '#' + target_id ).length == 0 ) { // No status box yet so suppress.
			return;
		}
		jQuery( '#' + target_id ).append( "\n" + message );
		textareaelem = document.getElementById( target_id );
		textareaelem.scrollTop = textareaelem.scrollHeight;
	}
	
	function backupbuddy_hourpad(n) { return ("0" + n).slice(-2); }
</script>
<?php 
$success = false;
global $pb_backupbuddy_js_status;
$pb_backupbuddy_js_status = true;
echo pb_backupbuddy::status_box('Restoring . . .');
echo '<div id="pb_backupbuddy_working" style="width: 100px;"><br><center><img src="' . pb_backupbuddy::plugin_url() . '/images/working.gif" title="Working... Please wait as this may take a moment..."></center></div>';
pb_backupbuddy::set_status_serial('restore');
global $wp_version;
pb_backupbuddy::status('details', 'BackupBuddy v' . pb_backupbuddy::settings('version') . ' using WordPress v' . $wp_version . ' on ' . PHP_OS . '.');
$archive_file = pb_backupbuddy::_GET('archive');
// archive to extract from.
require pb_backupbuddy::plugin_path() . '/classes/_restoreFiles.php';
$result = backupbuddy_restore_files::restore(backupbuddy_core::getBackupDirectory() . $archive_file, $files, $finalPath = ABSPATH);
echo '<script type="text/javascript">jQuery("#pb_backupbuddy_working").hide();</script>';
pb_backupbuddy::flush();
if (false === $result) {
} else {
}
pb_backupbuddy::$ui->ajax_footer();
pb_backupbuddy::$ui->ajax_footer();
die;
开发者ID:elephantcode,项目名称:elephantcode,代码行数:31,代码来源:restore_file_restore.php


示例15: deepglob

 /**
  *	pluginbuddy_filesystem->deepglob()
  *
  *	Like the glob() function except walks down into paths to create a full listing of all results in the directory and all subdirectories.
  *	This is essentially a recursive glob() although it does not use recursion to perform this.
  *
  *	@param		string		$dir		Path to pass to glob and walk through.
  *	@param		array 		$excludes	Array of directories to exclude, relative to the $dir.  Include beginning slash.
  *	@return		array					Returns array of all matches found.
  */
 function deepglob($dir, $excludes = array())
 {
     $dir = rtrim($dir, '/\\');
     // Make sure no trailing slash.
     $excludes = str_replace($dir, '', $excludes);
     $dir_len = strlen($dir);
     $items = glob($dir . '/*');
     if (false === $items) {
         $items = array();
     }
     for ($i = 0; $i < count($items); $i++) {
         // If this file/directory begins with an exclusion then jump to next file/directory.
         foreach ($excludes as $exclude) {
             if (backupbuddy_core::startsWith(substr($items[$i], $dir_len), $exclude)) {
                 unset($items[$i]);
                 continue 2;
             }
         }
         if (is_dir($items[$i])) {
             $add = glob($items[$i] . '/*');
             if (false === $add) {
                 $add = array();
             }
             $items = array_merge($items, $add);
         }
     }
     return $items;
 }
开发者ID:elephantcode,项目名称:elephantcode,代码行数:38,代码来源:filesystem.php


示例16: esc_attr

    echo esc_attr($i);
    ?>
'><?php 
    echo esc_html(basename($file));
    ?>
</label><br />
			<?php 
}
if (count($files) == 0) {
    _e('No BackupBuddy backups found in the root directory of the site.', 'it-l10n-backupbuddy');
    echo '<br>';
}
echo '<br>';
echo 'Existing backups in this site\'s backup directory:';
echo '<br>';
$files = glob(backupbuddy_core::getBackupDirectory() . 'backup*.zip');
if (!is_array($files) || empty($files)) {
    $files = array();
}
foreach ($files as $i => $file) {
    ?>
			<input style="width: auto;" type='radio' id='backup_<?php 
    echo esc_attr($i);
    ?>
' value='<?php 
    echo esc_attr($file);
    ?>
'
			<?php 
    if (count($files) == 1) {
        echo ' CHECKED';
开发者ID:adrianjonmiller,项目名称:animalhealth,代码行数:31,代码来源:_step1.php


示例17: str_replace

// Change slashes to handle Windows as we store backup_directory with Linux-style slashes even on Windows.
$backup_dir = str_replace('\\', '/', backupbuddy_core::getBackupDirectory());
// Make sure file to download is in a publicly accessible location (beneath WP web root technically).
if (FALSE === stristr($backup_dir, $abspath)) {
    die('Error #5432532. You cannot download backups stored outside of the WordPress web root. Please use FTP or other means.');
}
// Made it this far so download dir is within this WP install.
$sitepath = str_replace($abspath, '', $backup_dir);
$download_url = rtrim(site_url(), '/\\') . '/' . trim($sitepath, '/\\') . '/' . pb_backupbuddy::_GET('backupbuddy_backup');
if (pb_backupbuddy::$options['lock_archives_directory'] == '1') {
    // High security mode.
    if (file_exists(backupbuddy_core::getBackupDirectory() . '.htaccess')) {
        $unlink_status = @unlink(backupbuddy_core::getBackupDirectory() . '.htaccess');
        if ($unlink_status === false) {
            die('Error #844594. Unable to temporarily remove .htaccess security protection on archives directory to allow downloading. Please verify permissions of the BackupBuddy archives directory or manually download via FTP.');
        }
    }
    header('Location: ' . $download_url);
    ob_clean();
    flush();
    sleep(8);
    // Wait 8 seconds before creating security file.
    $htaccess_creation_status = @file_put_contents(backupbuddy_core::getBackupDirectory() . '.htaccess', 'deny from all');
    if ($htaccess_creation_status === false) {
        die('Error #344894545. Security Warning! Unable to create security file (.htaccess) in backups archive directory. This file prevents unauthorized downloading of backups should someone be able to guess the backup location and filenames. This is unlikely but for best security should be in place. Please verify permissions on the backups directory.');
    }
} else {
    // Normal mode.
    header('Location: ' . $download_url);
}
die;
开发者ID:elephantcode,项目名称:elephantcode,代码行数:31,代码来源:download_archive.php


示例18: die

<?php

backupbuddy_core::verifyAjaxAccess();
pb_backupbuddy::load();
if (false === ($results = backupbuddy_core::php_memory_test_results())) {
    $tested_memory_sofar = '';
    $test_file = backupbuddy_core::getLogDirectory() . 'php_memory_test.txt';
    if (file_exists($test_file)) {
        if (false !== ($tested_memory = @file_get_contents($test_file))) {
            if (is_numeric(trim($tested_memory))) {
                $tested_memory_sofar = ' ' . $tested_memory . ' ' . __('MB so far.', 'it-l10n-backupbuddy');
            }
        }
    }
    die(__('This may take a few minutes...', 'it-l10n-backupbuddy') . $tested_memory_sofar);
} else {
    die($results);
}
开发者ID:arobbins,项目名称:spellestate,代码行数:18,代码来源:run_php_memory_test_results.php


示例19: test

 public static function test($settings)
 {
     $remote_path = self::get_remote_path($settings['directory']);
     // Has leading and trailng slashes.
     $manage_data = pb_backupbuddy_destination_stash::get_manage_data($settings);
     if (!is_array($manage_data['credentials'])) {
         // Credentials were somehow faulty. User changed password after prior page? Unlikely but you never know...
         $error_msg = 'Error #8484383c: Your authentication credentials for Stash failed. Verify your login and password to Stash. You may need to update the Stash destination settings. Perhaps you recently changed your password?';
         pb_backupbuddy::status('error', $error_msg);
         return $error_msg;
     }
     // Try sending a file.
     $send_response = pb_backupbuddy_destinations::send($settings, dirname(dirname(__FILE__)) . '/remote-send-test.php', $send_id = 'TEST-' . pb_backupbuddy::random_string(12));
     // 3rd param true forces clearing of any current uploads.
     if (false === $send_response) {
         $send_response = 'Error sending test file to Stash.';
     } else {
         $send_response = 'Success.';
     }
     // S3 object for managing files.
     $credentials = pb_backupbuddy_destination_stash::get_manage_data($settings);
     $s3_manage = new AmazonS3($manage_data['credentials']);
     if ($settings['ssl'] == 0) {
         @$s3_manage->disable_ssl(true);
     }
     // Delete sent file.
     $delete_response = 'Success.';
     $delete_response = $s3_manage->delete_object($manage_data['bucket'], $manage_data['subkey'] . $remote_path . 'remote-send-test.php');
     if (!$delete_response->isOK()) {
         $delete_response = 'Unable to delete test Stash file `remote-send-test.php`. Details: `' . print_r($response, true) . '`.';
         pb_backupbuddy::status('details', $delete_response);
     } else {
         $delete_response = 'Success.';
     }
     // Load destination fileoptions.
     pb_backupbuddy::status('details', 'About to load fileoptions data.');
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     $fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
     if (true !== ($result = $fileoptions_obj->is_ok())) {
         pb_backupbuddy::status('error', __('Fatal Error #9034.84838. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
         return false;
     }
     pb_backupbuddy::status('details', 'Fileoptions data loaded.');
     $fileoptions =& $fileoptions_obj->options;
     if ('Success.' != $send_response || 'Success.' != $delete_response) {
         $fileoptions['status'] = 'failure';
         $fileoptions_obj->save();
         unset($fileoptions_obj);
         return 'Send details: `' . $send_response . '`. Delete details: `' . $delete_response . '`.';
     } else {
         $fileoptions['status'] = 'success';
         $fileoptions['finish_time'] = time();
     }
     $fileoptions_obj->save();
     unset($fileoptions_obj);
     return true;
 }
开发者ID:adrianjonmiller,项目名称:animalhealth,代码行数:57,代码来源:init.php


示例20: send


//.........这里部分代码省略.........
             $dataRemains = false;
         }
         $isFileTest = false;
         if (false !== stristr(basename($file), 'remote-send-test.php')) {
             $isFileTest = true;
             $settings['sendType'] = 'test';
         }
         if (true === $dataRemains) {
             $isFileDone = false;
         } else {
             $isFileDone = true;
         }
         if (!isset($size)) {
             $size = '';
         }
         pb_backupbuddy::status('details', 'Connecting to remote server to send data.');
         $response = backupbuddy_remote_api::remoteCall($apiSettings, 'sendFile_' . $settings['sendType'], array(), $settings['max_time'], $file, $fileData, $prevPointer, $isFileTest, $isFileDone, $size, $filePath);
         unset($fileData);
         // Free up memory.
         $settings['chunks_sent']++;
         if (true === $dataRemains) {
             // More chunks remain.
             pb_backupbuddy::status('details', 'Connection finished sending part ' . $settings['chunks_sent'] . ' of ~' . $settings['chunks_total'] . '.');
         } else {
             // No more chunks remain.
             pb_backupbuddy::status('details', 'Connection finished sending final part ' . $settings['chunks_sent'] . '.');
         }
         if (false === $response) {
             echo implode(', ', backupbuddy_remote_api::getErrors()) . ' ';
             pb_backupbuddy::status('error', 'Errors encountered details: ' . implode(', ', backupbuddy_remote_api::getErrors()));
             global $pb_backupbuddy_destination_errors;
             $pb_backupbuddy_destination_errors[] = backupbuddy_remote_api::getErrors();
             return false;
             //implode( ', ', backupbuddy_remote_api::getErrors() );
         }
         if (FALSE === ($prevPointer = ftell($fs))) {
             pb_backupbuddy::status('error', 'Error #438347844: Unable to get ftell pointer of file handle for passing to prevPointer.');
             @fclose($fs);
             return false;
         } else {
             pb_backupbuddy::status('details', 'File pointer: `' . $prevPointer . '`.');
         }
         if (true === $dataRemains) {
             // More data remains so see if we need to consider chunking to a new PHP process.
             // If we are within X second of reaching maximum PHP runtime then stop here so that it can be picked up in another PHP process...
             if (microtime(true) - self::$_timeStart + self::TIME_WIGGLE_ROOM >= $settings['max_time']) {
                 pb_backupbuddy::status('message', 'Approaching limit of available PHP chunking time of `' . $settings['max_time'] . '` sec. Ran for ' . round(microtime(true) - self::$_timeStart, 3) . ' sec. Proceeding to use chunking.');
                 @fclose($fs);
                 // Tells next chunk where to pick up.
                 $settings['resume_point'] = $prevPointer;
                 // Schedule cron.
                 $cronTime = time();
                 $cronArgs = array($settings, $files, $send_id, $delete_after);
                 $cronHashID = md5($cronTime . serialize($cronArgs));
                 $cronArgs[] = $cronHashID;
                 $schedule_result = backupbuddy_core::schedule_single_event($cronTime, pb_backupbuddy::cron_tag('destination_send'), $cronArgs);
                 if (true === $schedule_result) {
                     pb_backupbuddy::status('details', 'Next Site chunk step cron event scheduled.');
                 } else {
                     pb_backupbuddy::status('error', 'Next Site chunk step cron even FAILED to be scheduled.');
                 }
                 spawn_cron(time() + 150);
                 // Adds > 60 seconds to get around once per minute cron running limit.
                 update_option('_transient_doing_cron', 0);
                 // Prevent cron-blocking for next item.
                 return array($prevPointer, 'Sent part ' . $settings['chunks_sent'] . ' of ~' . $settings['chunks_total'] . ' parts.');
                 // filepointer location, elapsed time during the import
             } else {
                 // End if.
                 pb_backupbuddy::status('details', 'Not approaching time limit.');
             }
         } else {
             pb_backupbuddy::status('details', 'No more data remains (eg for chunking) so finishing up.');
         }
     }
     // end while data remains in file.
     // Update fileoptions stats.
     pb_backupbuddy::status('details', 'About to load fileoptions data.');
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     pb_backupbuddy::status('details', 'Fileoptions instance #20.');
     $fileoptions_obj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/send-' . $send_id . '.txt', $read_only = false, $ignore_lock = false, $create_file = false);
     if (true !== ($result = $fileoptions_obj->is_ok())) {
         pb_backupbuddy::status('error', __('Fatal Error #9034.279327. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
         return false;
     }
     pb_backupbuddy::status('details', 'Fileoptions data loaded.');
     $fileoptions =& $fileoptions_obj->options;
     $fileoptions['finish_time'] = microtime(true);
     $fileoptions['status'] = 'success';
     $fileoptions['_multipart_status'] = 'Sent all parts.';
     if (isset($uploaded_speed)) {
         $fileoptions['write_speed'] = $uploaded_speed;
     }
     $fileoptions_obj->save();
     unset($fileoptions);
     // Made it this far so completed!
     pb_backupbuddy::status('message', 'Finished sending file. Took ' . round(microtime(true) - self::$_timeStart, 3) . ' seconds this round.');
     pb_backupbuddy::status('deployFileSent', 'File sent.');
     return true;
 }
开发者ID:elephantcode,项目名称:elephantcode,代码行数:101,代码来源:init.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP badge类代码示例发布时间:2022-05-23
下一篇:
PHP backup_nested_element类代码示例发布时间: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