function wsl_component_tools_do_repair()
{
    global $wpdb;
    wsl_database_install();
    // update_option( 'wsl_settings_development_mode_enabled', 1 );
    ?>
<div class="metabox-holder columns-2" id="post-body">
	<div class="stuffbox">
		<h3>
			<label><?php 
    _wsl_e("Repair Wordpress Social Login tables", 'wordpress-social-login');
    ?>
</label>
		</h3>
		<div class="inside"> 
			<p>
				<?php 
    _wsl_e("All Wordpress Social Login tables and fields <em>should</em> be now restored", 'wordpress-social-login');
    ?>
.
			</p>
			<p>
				<?php 
    _wsl_e("If this still didn't work, please report this as a issue", 'wordpress-social-login');
    ?>
.
			</p>
			<hr />
			<a class="button-secondary" href="options-general.php?page=wordpress-social-login&wslp=tools">&larr; <?php 
    _wsl_e("Back to Tools", 'wordpress-social-login');
    ?>
</a>
		</div>
	</div>
</div>
<?php 
    # ain't this clever :p
    $db_check_profiles = $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wslusersprofiles'") === $wpdb->prefix . 'wslusersprofiles' ? 1 : 0;
    $db_check_contacts = $wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}wsluserscontacts'") === $wpdb->prefix . 'wsluserscontacts' ? 1 : 0;
    if ($db_check_profiles && $db_check_contacts) {
        ?>
			<style>.wsl-error-db-tables{display:none;}</style>
		<?php 
    }
}
/**
* Attempt to install/migrate/repair WSL upon activation
*
* Create wsl tables
* Migrate old versions
* Register default components
*/
function wsl_install()
{
    wsl_database_install();
    wsl_update_compatibilities();
    wsl_register_components();
}
예제 #3
0
* http://miled.github.io/wordpress-social-login/ | https://github.com/miled/wordpress-social-login
*  (c) 2011-2014 Mohamed Mrassi and contributors | http://wordpress.org/plugins/wordpress-social-login/
*/
session_start();
global $wpdb;
$_SERVER['HTTP_HOST'] = 'localhost';
define('WORDPRESS_SOCIAL_LOGIN_ABS_PATH', dirname(__FILE__) . '/../');
$_tests_dir = getenv('WP_TESTS_DIR');
if (!$_tests_dir) {
    $_tests_dir = '/tmp/wordpress-tests-lib';
}
echo "Booting...\n";
echo "PHP:session_id()=" . session_id() . "\n";
echo "WPT:WP_TESTS_DIR=" . $_tests_dir . "\n";
echo "WSL:WORDPRESS_SOCIAL_LOGIN_ABS_PATH=" . realpath(WORDPRESS_SOCIAL_LOGIN_ABS_PATH) . "\n";
require_once $_tests_dir . '/includes/functions.php';
function _manually_load_plugin()
{
    require_once WORDPRESS_SOCIAL_LOGIN_ABS_PATH . 'wp-social-login.php';
}
tests_add_filter('muplugins_loaded', '_manually_load_plugin');
require $_tests_dir . '/includes/bootstrap.php';
echo "Activate WSL...\n";
activate_plugin('wordpress-social-login/wp-social-login.php');
echo "Uninstall WSL...\n";
wsl_database_uninstall();
echo "Install WSL...\n";
wsl_database_install();
echo "ReInstall WSL...\n";
wsl_install();
echo "Testing WSL...\n";