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


PHP pb_backupbuddy::message方法代码示例

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


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

示例1: import_database

/**
 *	import_database()
 *
 *	Parses various submitted options and settings from step 1.
 *
 *	@return		array		array( import_success, import_complete ).
 *							import_success: false if unable to import into database, true if import is working thus far/completed.
 *							import_complete: If incomplete, an integer of the next query to begin on. If complete, true. False if import_success = false.
 */
function import_database()
{
    pb_backupbuddy::set_greedy_script_limits();
    // Migrate htaccess.
    pb_backupbuddy::$classes['import']->migrate_htaccess();
    if (true === pb_backupbuddy::$options['skip_database_import']) {
        pb_backupbuddy::status('message', 'Skipping database restore based on settings.');
        return array(true, true);
    }
    pb_backupbuddy::status('message', 'Verifying database connection and settings...');
    if (pb_backupbuddy::$classes['import']->connect_database() === false) {
        pb_backupbuddy::alert('ERROR: Unable to select your specified database. Verify the database name and that you have set up proper permissions for your specified username to access it. Details: ' . mysql_error(), true, '9007');
        return array(false, false);
    } else {
        pb_backupbuddy::status('message', 'Database connection and settings verified. Connected to database `' . pb_backupbuddy::$options['db_name'] . '`.');
        // Import database unless disabled.
        $db_continue = false;
        // Wipe database with matching prefix if option was selected.
        if (pb_backupbuddy::$options['wipe_database'] == true) {
            if (isset($_POST['db_continue']) && is_numeric($_POST['db_continue'])) {
                // do nothing
            } else {
                // dont wipe on substeps of db import.
                pb_backupbuddy::status('message', 'Wiping existing database tables with the same prefix based on settings...');
                $failed = !pb_backupbuddy::$classes['import']->wipe_database(pb_backupbuddy::$options['db_prefix']);
                if (false !== $failed) {
                    pb_backupbuddy::message('error', 'Unable to wipe database as configured in the settings.');
                    pb_backupbuddy::alert('Unable to wipe database as configured in the settings.', true);
                }
            }
        }
        // Wipe database of ALL TABLES if option was selected.
        if (pb_backupbuddy::$options['wipe_database_all'] == true) {
            if (isset($_POST['db_continue']) && is_numeric($_POST['db_continue'])) {
                // do nothing
            } else {
                // dont wipe on substeps of db import.
                pb_backupbuddy::status('message', 'Wiping ALL existing database tables based on settings (use with caution)...');
                $failed = !pb_backupbuddy::$classes['import']->wipe_database_all(true);
                if (false !== $failed) {
                    pb_backupbuddy::message('error', 'Unable to wipe database as configured in the settings.');
                    pb_backupbuddy::alert('Unable to wipe database as configured in the settings.', true);
                }
            }
        }
        // Sanitize db continuation value if needed.
        if (isset($_POST['db_continue']) && is_numeric($_POST['db_continue'])) {
            // do nothing
        } else {
            $_POST['db_continue'] = 0;
        }
        // Look through and try to find .SQL file to import.
        $possible_sql_files = array(ABSPATH . 'wp-content/uploads/temp_' . pb_backupbuddy::$options['zip_id'] . '/db.sql', ABSPATH . 'db.sql', ABSPATH . 'wp-content/uploads/backupbuddy_temp/' . pb_backupbuddy::$options['zip_id'] . '/db_1.sql', ABSPATH . 'db_1.sql');
        if (!defined('PB_STANDALONE')) {
            // When in WordPress add import paths also.
            $possible_sql_files[] = ABSPATH . 'wp-content/uploads/backupbuddy_temp/import_' . pb_backupbuddy::$options['zip_id'] . '/wp-content/uploads/backupbuddy_temp/' . pb_backupbuddy::$options['zip_id'] . '/db_1.sql';
            // Multisite import >= 2.0.
            $possible_sql_files[] = pb_backupbuddy::$options['database_directory'] . 'db_1.sql';
            // Multisite import >= v2.0.
        }
        $sql_file = '';
        foreach ($possible_sql_files as $possible_sql_file) {
            // Check each file location to see which hits.
            if (file_exists($possible_sql_file)) {
                $sql_file = $possible_sql_file;
                // Set SQL file location.
                break;
                // Search is over. Use ths found file.
            }
        }
        // End foreach().
        unset($possible_sql_files);
        if ($sql_file == '') {
            pb_backupbuddy::status('error', 'Unable to find db_1.sql or other expected database file in the extracted files. Make sure you did not rename your backup ZIP file. You may manually restore your SQL file if you can find it via phpmyadmin or similar tool then on Step 1 of ImportBuddy select the advanced option to skip database import. This will allow you to proceed.');
        }
        // Whether or not to ignore existing tables errors.
        if (pb_backupbuddy::$options['ignore_sql_errors'] != false) {
            $ignore_existing = true;
        } else {
            $ignore_existing = false;
        }
        /********** Start mysqlbuddy use **********/
        $force_mysqlbuddy_methods = array();
        // Default, not forcing of methods.
        if (pb_backupbuddy::$options['mysqlbuddy_compatibility'] != false) {
            // mysqldump compatibility mode.
            $force_mysqlbuddy_methods = array('php');
        }
        require_once pb_backupbuddy::plugin_path() . '/lib/mysqlbuddy/mysqlbuddy.php';
        pb_backupbuddy::$classes['mysqlbuddy'] = new pb_backupbuddy_mysqlbuddy(pb_backupbuddy::$options['db_server'], pb_backupbuddy::$options['db_name'], pb_backupbuddy::$options['db_user'], pb_backupbuddy::$options['db_password'], pb_backupbuddy::$options['db_prefix'], $force_mysqlbuddy_methods);
        // $database_host, $database_name, $database_user, $database_pass, $old_prefix, $force_method = array()
//.........这里部分代码省略.........
开发者ID:heyjones,项目名称:crossfitpurpose,代码行数:101,代码来源:4.php


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