コード例 #1
0
ファイル: functions.php プロジェクト: gigikiri/WordPress
         $error = __('while cloning the database');
         break;
     case 'unzip':
         $error = __('while extracting the zip file using WP\'s zip file extractor');
         break;
     case 'pclunzip':
         $error = __('while extracting the zip file using the PclZip library');
         break;
     case 'url':
         $error = __('while downloading the zip file');
         break;
     case 'wpconfig':
         $error = __('while trying to modify the table prefix in the wp-config.php file');
         break;
         /* and a catch all for the things that aren't covered above */
     /* and a catch all for the things that aren't covered above */
     default:
         $error = sprintf(__('during the %s process'), $error);
 }
 echo '<div class="wpclone_notice updated">';
 printf(__('The plugin encountered an error %s,the following error message was returned:</br>'), $error);
 echo '<div class="error">' . __('Error Message : ') . $data . '</div></br>';
コード例 #2
0
ファイル: functions.php プロジェクト: kfwebdev/wp-atd
function wpa_wpc_get_filelist($path, $exclude, $skip = false)
{
    $i = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::CURRENT_AS_SELF | FilesystemIterator::UNIX_PATHS | FilesystemIterator::SKIP_DOTS));
    $skipped = 0;
    $size = 0;
    $files = 0;
    $list = array();
    foreach ($i as $file => $info) {
        $file = wpCloneSafePathMode($file);
        if (false !== strpos($file, WPCLONE_DIR_BACKUP)) {
            continue;
        }
        if (false !== strpos($file, WPCLONE_DIR_PLUGIN)) {
            continue;
        }
        if (!empty($exclude) && wpa_wpc_strpos_array($exclude, $file)) {
            $skipped++;
            wpa_wpc_log(sprintf('file is inside an excluded directory, and it will not be included in the backup - "%s"', str_replace(WPCLONE_ROOT, '**SITE-ROOT**/', $file)));
            continue;
        }
        if ($skip && $info->getSize() > $skip) {
            $skipped++;
            wpa_wpc_log(sprintf('file skipped, file is larger than %s - "%s"  %s', bytesToSize($skip), str_replace(WPCLONE_ROOT, '**SITE-ROOT**/', $file), bytesToSize($info->getSize())));
            continue;
        }
        if ($info->isFile()) {
            $list[] = $file;
            $files++;
            $size += $info->getSize();
        }
    }
    if ($skipped > 0) {
        wpa_wpc_log(sprintf('%d files were excluded from the backup', $skipped));
    }
    wpa_wpc_log(sprintf('number of files to include in the archive is %d, and their uncompressed size is %s', $files, bytesToSize($size)));
    return $list;
}