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


PHP backupbuddy_core::get_mysqldump_additional方法代码示例

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


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

示例1: backup_create_dat_file

 function backup_create_dat_file($trigger)
 {
     pb_backupbuddy::status('details', __('Creating DAT (data) file snapshotting site & backup information.', 'it-l10n-backupbuddy'));
     global $wpdb, $current_blog;
     $is_multisite = $is_multisite_export = false;
     //$from_multisite is from a site within a network
     $upload_url_rewrite = $upload_url = '';
     if (is_multisite() && $trigger == 'scheduled' || is_multisite() && is_network_admin()) {
         // MS Network Export IF ( in a network and triggered by a schedule ) OR ( in a network and logged in as network admin)
         $is_multisite = true;
     } elseif (is_multisite()) {
         // MS Export (individual site)
         $is_multisite_export = true;
         $uploads = wp_upload_dir();
         $upload_url_rewrite = site_url(str_replace(ABSPATH, '', $uploads['basedir']));
         // URL we rewrite uploads to. REAL direct url.
         $upload_url = $uploads['baseurl'];
         // Pretty virtual path to uploads directory.
     }
     // Handle wp-config.php file in a parent directory.
     if ($this->_backup['type'] == 'full') {
         $wp_config_parent = false;
         if (file_exists(ABSPATH . 'wp-config.php')) {
             // wp-config in normal place.
             pb_backupbuddy::status('details', 'wp-config.php found in normal location.');
         } else {
             // wp-config not in normal place.
             pb_backupbuddy::status('message', 'wp-config.php not found in normal location; checking parent directory.');
             if (file_exists(dirname(ABSPATH) . '/wp-config.php')) {
                 // Config in parent.
                 $wp_config_parent = true;
                 pb_backupbuddy::status('message', 'wp-config.php found in parent directory. Copying wp-config.php to temporary location for backing up.');
                 $this->_backup['wp-config_in_parent'] = true;
                 copy(dirname(ABSPATH) . '/wp-config.php', $this->_backup['temp_directory'] . 'wp-config.php');
             } else {
                 pb_backupbuddy::status('error', 'wp-config.php not found in normal location NOR parent directory. This will result in an incomplete backup which will be marked as bad.');
             }
         }
     } else {
         $wp_config_parent = false;
     }
     global $wp_version;
     $totalPosts = 0;
     foreach (wp_count_posts('post') as $counttype => $count) {
         $totalPosts += $count;
     }
     $totalPages = 0;
     foreach (wp_count_posts('page') as $counttype => $count) {
         $totalPages += $count;
     }
     $totalComments = 0;
     foreach (wp_count_comments() as $counttype => $count) {
         $totalComments += $count;
     }
     $totalUsers = count_users();
     $totalUsers = $totalUsers['total_users'];
     pb_backupbuddy::status('startSubFunction', json_encode(array('function' => 'post_count', 'title' => 'Found ' . $totalPosts . ' posts, ' . $totalPages . ' pages, and ' . $totalComments . ' comments.')));
     pb_backupbuddy::status('startSubFunction', json_encode(array('function' => 'post_count', 'title' => 'Found ' . $totalUsers . ' user accounts.')));
     $dat_content = array('backupbuddy_version' => pb_backupbuddy::settings('version'), 'wordpress_version' => $wp_version, 'backup_time' => $this->_backup['start_time'], 'backup_type' => $this->_backup['type'], 'profile' => $this->_backup['profile'], 'default_profile' => pb_backupbuddy::$options['profiles'][0], 'serial' => $this->_backup['serial'], 'trigger' => $trigger, 'wp-config_in_parent' => $wp_config_parent, 'deployment_direction' => $this->_backup['deployment_direction'], 'abspath' => ABSPATH, 'siteurl' => site_url(), 'homeurl' => home_url(), 'blogname' => get_option('blogname'), 'blogdescription' => get_option('blogdescription'), 'active_plugins' => implode(', ', get_option('active_plugins')), 'posts' => $totalPosts, 'pages' => $totalPages, 'comments' => $totalComments, 'users' => $totalUsers, 'wp_content_url' => WP_CONTENT_URL, 'wp_content_dir' => WP_CONTENT_DIR, 'db_charset' => $wpdb->charset, 'db_collate' => $wpdb->collate, 'db_prefix' => $wpdb->prefix, 'db_server' => DB_HOST, 'db_name' => DB_NAME, 'db_user' => '', 'db_password' => '', 'db_exclusions' => implode(',', backupbuddy_core::get_mysqldump_additional('excludes', $this->_backup['profile'])), 'db_inclusions' => implode(',', backupbuddy_core::get_mysqldump_additional('includes', $this->_backup['profile'])), 'db_version' => $wpdb->db_version(), 'breakout_tables' => $this->_backup['breakout_tables'], 'tables_sizes' => $this->_backup['table_sizes'], 'force_single_db_file' => $this->_backup['force_single_db_file'], 'is_multisite' => $is_multisite, 'is_multisite_export' => $is_multisite_export, 'domain' => is_object($current_blog) ? $current_blog->domain : '', 'path' => is_object($current_blog) ? $current_blog->path : '', 'upload_url' => $upload_url, 'upload_url_rewrite' => $upload_url_rewrite);
     // End setting $dat_content.
     // If currently using SSL or forcing admin SSL then we will check the hardcoded defined URL to make sure it matches.
     if (is_ssl() or defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN == true) {
         $dat_content['siteurl'] = get_option('siteurl');
         pb_backupbuddy::status('details', __('Compensating for SSL in siteurl.', 'it-l10n-backupbuddy'));
     }
     // Output for troubleshooting.
     pb_backupbuddy::status('details', 'DAT file contents (sans database user/pass): ' . str_replace("\n", '; ', print_r($dat_content, true)));
     // Remaining DB settings.
     $dat_content['db_user'] = DB_USER;
     $dat_content['db_password'] = DB_PASSWORD;
     // Serialize .dat file array.
     $dat_content = base64_encode(serialize($dat_content));
     // Write data to the dat file.
     $dat_file = $this->_backup['temp_directory'] . 'backupbuddy_dat.php';
     if (false === ($file_handle = fopen($dat_file, 'w'))) {
         pb_backupbuddy::status('details', sprintf(__('Error #9017: Temp data file is not creatable/writable. Check your permissions. (%s)', 'it-l10n-backupbuddy'), $dat_file));
         pb_backupbuddy::status('error', 'Temp data file is not creatable/writable. Check your permissions. (' . $dat_file . ')', '9017');
         return false;
     }
     fwrite($file_handle, "<?php die('Access Denied.'); // <!-- ?>\n" . $dat_content);
     fclose($file_handle);
     pb_backupbuddy::status('details', __('Finished creating DAT (data) file.', 'it-l10n-backupbuddy'));
     return true;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:84,代码来源:backup.php

示例2: get_database_size

 public static function get_database_size($profile_id = 0)
 {
     global $wpdb;
     $prefix = $wpdb->prefix;
     $prefix_length = strlen($wpdb->prefix);
     $additional_includes = backupbuddy_core::get_mysqldump_additional('includes', pb_backupbuddy::$options['profiles'][$profile_id]);
     $additional_excludes = backupbuddy_core::get_mysqldump_additional('excludes', pb_backupbuddy::$options['profiles'][$profile_id]);
     $total_size = 0;
     $total_size_with_exclusions = 0;
     $rows = $wpdb->get_results("SHOW TABLE STATUS", ARRAY_A);
     foreach ($rows as $row) {
         $excluded = true;
         // Default.
         // TABLE STATUS.
         $rowsb = $wpdb->get_results("CHECK TABLE `{$row['Name']}`", ARRAY_A);
         foreach ($rowsb as $rowb) {
             if ($rowb['Msg_type'] == 'status') {
                 $status = $rowb['Msg_text'];
             }
         }
         unset($rowsb);
         // TABLE SIZE.
         $size = $row['Data_length'] + $row['Index_length'];
         $total_size += $size;
         // HANDLE EXCLUSIONS.
         if (pb_backupbuddy::$options['profiles'][$profile_id]['backup_nonwp_tables'] == 0) {
             // Only matching prefix.
             if (substr($row['Name'], 0, $prefix_length) == $prefix or in_array($row['Name'], $additional_includes)) {
                 if (!in_array($row['Name'], $additional_excludes)) {
                     $total_size_with_exclusions += $size;
                     $excluded = false;
                 }
             }
         } else {
             // All tables.
             if (!in_array($row['Name'], $additional_excludes)) {
                 $total_size_with_exclusions += $size;
                 $excluded = false;
             }
         }
     }
     pb_backupbuddy::$options['stats']['db_size'] = $total_size;
     pb_backupbuddy::$options['stats']['db_size_excluded'] = $total_size_with_exclusions;
     pb_backupbuddy::$options['stats']['db_size_updated'] = time();
     pb_backupbuddy::save();
     unset($rows);
     return array($total_size, $total_size_with_exclusions);
 }
开发者ID:bunnywong,项目名称:freshlinker,代码行数:48,代码来源:core.php

示例3: __

		</tr>
	</thead>
	<tfoot>
		<tr class="thead">
			<?php 
echo '<th>', __('Database Table', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Status', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Settings', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Updated / Checked', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Rows', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Size', 'it-l10n-backupbuddy'), '</th>', '<th>', __('Excluded Size', 'it-l10n-backupbuddy'), '</th>';
?>
		</tr>
	</tfoot>
	<tbody>
		<?php 
global $wpdb;
$prefix = $wpdb->prefix;
$prefix_length = strlen($wpdb->prefix);
$additional_includes = backupbuddy_core::get_mysqldump_additional('includes', $profile);
$additional_excludes = backupbuddy_core::get_mysqldump_additional('excludes', $profile);
$total_size = 0;
$total_size_with_exclusions = 0;
$total_rows = 0;
$rows = $wpdb->get_results("SHOW TABLE STATUS", ARRAY_A);
foreach ($rows as $row) {
    $excluded = true;
    // Default.
    // TABLE STATUS.
    $rowsb = $wpdb->get_results("CHECK TABLE `{$row['Name']}`", ARRAY_A);
    foreach ($rowsb as $rowb) {
        if ($rowb['Msg_type'] == 'status') {
            $status = $rowb['Msg_text'];
        }
    }
    unset($rowsb);
开发者ID:elephantcode,项目名称:elephantcode,代码行数:31,代码来源:database.php


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