Beispiel #1
0
/**
 * @since 2.0.6
 */
function wpa_copy($source, $target)
{
    global $wp_filesystem;
    if (is_readable($source)) {
        if (is_dir($source)) {
            if (!file_exists($target)) {
                $wp_filesystem->mkdir($target);
            }
            $d = dir($source);
            while (FALSE !== ($entry = $d->read())) {
                if ($entry == '.' || $entry == '..') {
                    continue;
                }
Beispiel #2
0
function wpa_wpc_sysinfo()
{
    global $wpdb;
    echo '<div class="info width-60">';
    echo '<h3>System Info:</h3><p>';
    echo 'Memory limit: ' . ini_get('memory_limit');
    if (false === ini_set('memory_limit', '257M')) {
        echo '&nbsp;<span style="color:#660000">memory limit cannot be increased</span></br>';
    } else {
        echo '</br>';
    }
    echo 'Maximum execution time: ' . ini_get('max_execution_time') . ' seconds</br>';
    echo 'PHP version : ' . phpversion() . '</br>';
    echo 'MySQL version : ' . $wpdb->db_version() . '</br>';
    if (ini_get('safe_mode')) {
        echo '<span style="color:#f11">PHP is running in safemode!</span></br>';
    }
    printf('Root directory : <code>%s</code></br>', WPCLONE_ROOT);
    if (!file_exists(WPCLONE_DIR_BACKUP)) {
        echo 'Backup path :<span style="color:#660000">Backup directory not found. ' . 'Unless there is a permissions or ownership issue, refreshing the backup list should create the directory.</span></br>';
    } else {
        echo 'Backup directory : <code>' . WPCLONE_DIR_BACKUP . '</code></br>';
    }
    echo 'Files : <span id="filesize"><img src="' . esc_url(admin_url('images/spinner.gif')) . '"></span></br>';
    if (file_exists(WPCLONE_DIR_BACKUP) && !is_writable(WPCLONE_DIR_BACKUP)) {
        echo '<span style="color:#f11">Backup directory is not writable, please change its permissions.</span></br>';
    }
    if (!is_writable(WPCLONE_WP_CONTENT)) {
        echo '<span style="color:#f11">wp-content is not writable, please change its permissions before you perform a restore.</span></br>';
    }
    if (!is_writable(wpa_wpconfig_path())) {
        echo '<span style="color:#f11">wp-config.php is not writable, please change its permissions before you perform a restore.</span></br>';
    }
    echo '</p></div>';
}
Beispiel #3
0
/**
 * @since 2.0.6
 */
function wpa_replace_prefix($current, $new)
{
    $wpconfig = wpa_wpconfig_path();
    global $wp_filesystem;
    if (!$wp_filesystem->is_writable($wpconfig)) {
        if (false === $wp_filesystem->chmod($wpconfig)) {
            wpa_backup_error('wpconfig', sprintf(__("<code>%s</code> is not writable and wpclone was unable to change the file permissions."), $wpconfig), true);
        }
    }
    $content = file($wpconfig);
    foreach ($content as $key => $value) {
        if (false !== strpos($value, '$table_prefix')) {
            $content[$key] = str_replace($current, $new, $value);
        }
    }
    $content = implode($content);
    $wp_filesystem->put_contents($wpconfig, $content, 0600);
}