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


PHP DUP_Util::SafePath方法代码示例

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


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

示例1: createFromTemplate

 /**
  *  createFromTemplate
  *  Generates the final installer file from the template file
  */
 private function createFromTemplate($template)
 {
     global $wpdb;
     DUP_Log::Info("INSTALLER FILE: Preping for use");
     $installer = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP) . "/{$this->Package->NameHash}_installer.php";
     //$tablePrefix = (is_multisite()) ? $wpdb->get_blog_prefix() : $wpdb->prefix;
     //Option values to delete at install time
     $deleteOpts = $GLOBALS['DUPLICATOR_OPTS_DELETE'];
     $replace_items = array("fwrite_url_old" => get_option('siteurl'), "fwrite_package_name" => "{$this->Package->NameHash}_archive.zip", "fwrite_package_notes" => $this->Package->Notes, "fwrite_secure_name" => $this->Package->NameHash, "fwrite_url_new" => $this->Package->Installer->OptsURLNew, "fwrite_dbhost" => $this->Package->Installer->OptsDBHost, "fwrite_dbname" => $this->Package->Installer->OptsDBName, "fwrite_dbuser" => $this->Package->Installer->OptsDBUser, "fwrite_dbpass" => '', "fwrite_ssl_admin" => $this->Package->Installer->OptsSSLAdmin, "fwrite_ssl_login" => $this->Package->Installer->OptsSSLLogin, "fwrite_cache_wp" => $this->Package->Installer->OptsCacheWP, "fwrite_cache_path" => $this->Package->Installer->OptsCachePath, "fwrite_wp_tableprefix" => $wpdb->prefix, "fwrite_opts_delete" => json_encode($deleteOpts), "fwrite_blogname" => esc_html(get_option('blogname')), "fwrite_wproot" => DUPLICATOR_WPROOTPATH, "fwrite_duplicator_version" => DUPLICATOR_VERSION);
     if (file_exists($template) && is_readable($template)) {
         $err_msg = "ERROR: Unable to read/write installer. \nERROR INFO: Check permission/owner on file and parent folder.\nInstaller File = <{$installer}>";
         $install_str = $this->parseTemplate($template, $replace_items);
         empty($install_str) ? DUP_Log::Error("{$err_msg}", "DUP_Installer::createFromTemplate => file-empty-read") : DUP_Log::Info("INSTALLER FILE: Template parsed with new data");
         //INSTALLER FILE
         $fp = !file_exists($installer) ? fopen($installer, 'x+') : fopen($installer, 'w');
         if (!$fp || !fwrite($fp, $install_str, strlen($install_str))) {
             DUP_Log::Error("{$err_msg}", "DUP_Installer::createFromTemplate => file-write-error");
         }
         @fclose($fp);
     } else {
         DUP_Log::Error("Installer Template missing or unreadable.", "Template [{$template}]");
     }
     @unlink($template);
     DUP_Log::Info("INSTALLER FILE: Complete [{$installer}]");
 }
开发者ID:tlandn,项目名称:akvo-web,代码行数:29,代码来源:package.installer.php

示例2: GetChecks

 /** 
  * Gets the system checks which are not required
  * @return array   An array of system checks
  */
 public static function GetChecks()
 {
     $checks = array();
     //WEB SERVER
     $web_test1 = false;
     foreach ($GLOBALS['DUPLICATOR_SERVER_LIST'] as $value) {
         if (stristr($_SERVER['SERVER_SOFTWARE'], $value)) {
             $web_test1 = true;
             break;
         }
     }
     $checks['SRV']['WEB']['model'] = $web_test1;
     $checks['SRV']['WEB']['ALL'] = $web_test1 ? 'Good' : 'Warn';
     //PHP SETTINGS
     $php_test1 = ini_get("open_basedir");
     $php_test1 = empty($php_test1) ? true : false;
     $php_test2 = ini_get("max_execution_time");
     $php_test2 = $php_test2 > DUPLICATOR_SCAN_TIMEOUT || (strcmp($php_test2, 'Off') == 0 || $php_test2 == 0) ? true : false;
     $php_test3 = function_exists('mysqli_connect');
     $checks['SRV']['PHP']['openbase'] = $php_test1;
     $checks['SRV']['PHP']['maxtime'] = $php_test2;
     $checks['SRV']['PHP']['mysqli'] = $php_test3;
     $checks['SRV']['PHP']['ALL'] = $php_test1 && $php_test2 && $php_test3 ? 'Good' : 'Warn';
     //WORDPRESS SETTINGS
     global $wp_version;
     $wp_test1 = version_compare($wp_version, DUPLICATOR_SCAN_MIN_WP) >= 0 ? true : false;
     //Core Files
     $files = array();
     $files['wp-config.php'] = file_exists(DUP_Util::SafePath(DUPLICATOR_WPROOTPATH . '/wp-config.php'));
     $wp_test2 = $files['wp-config.php'];
     //Cache
     $Package = DUP_Package::GetActive();
     $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
     $dirEmpty = DUP_Util::IsDirectoryEmpty($cache_path);
     $dirSize = DUP_Util::GetDirectorySize($cache_path);
     $cach_filtered = in_array($cache_path, explode(';', $Package->Archive->FilterDirs));
     $wp_test3 = $cach_filtered || $dirEmpty || $dirSize < DUPLICATOR_SCAN_CACHESIZE ? true : false;
     $checks['SRV']['WP']['version'] = $wp_test1;
     $checks['SRV']['WP']['core'] = $wp_test2;
     $checks['SRV']['WP']['cache'] = $wp_test3;
     $checks['SRV']['WP']['ALL'] = $wp_test1 && $wp_test2 && $wp_test3 ? 'Good' : 'Warn';
     return $checks;
 }
开发者ID:DylanGroenewoud,项目名称:PVNG,代码行数:47,代码来源:server.php

示例3: GetChecks

 /** 
  * Gets the system checks which are not required
  * @return array   An array of system checks
  */
 public static function GetChecks()
 {
     $checks = array();
     //CHK-SRV-100: PHP SETTINGS
     $php_test1 = ini_get("open_basedir");
     $php_test1 = empty($php_test1) ? true : false;
     $php_test2 = ini_get("max_execution_time");
     $php_test2 = $php_test2 > DUPLICATOR_SCAN_TIMEOUT || strcmp($php_test2, 'Off') == 0 || $php_test2 == 0 ? 'Good' : 'Warn';
     $checks['CHK-SRV-100'] = $php_test1 && $php_test2 ? 'Good' : 'Warn';
     //CHK-SRV-101: WORDPRESS SETTINGS
     //Version
     global $wp_version;
     $version_test = version_compare($wp_version, DUPLICATOR_SCAN_MIN_WP) >= 0 ? true : false;
     //Cache
     $Package = DUP_Package::GetActive();
     $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
     $dirEmpty = DUP_Util::IsDirectoryEmpty($cache_path);
     $dirSize = DUP_Util::GetDirectorySize($cache_path);
     $cach_filtered = in_array($cache_path, explode(';', $Package->Archive->FilterDirs));
     $cache_test = $cach_filtered || $dirEmpty || $dirSize < DUPLICATOR_SCAN_CACHESIZE ? true : false;
     //Core Files
     $files = array();
     $files['wp-config.php'] = file_exists(DUP_Util::SafePath(DUPLICATOR_WPROOTPATH . '/wp-config.php'));
     $files_test = $files['wp-config.php'];
     $checks['CHK-SRV-101'] = $files_test && $cache_test && $version_test ? 'Good' : 'Warn';
     //CHK-SRV-102: WEB SERVER
     $servers = $GLOBALS['DUPLICATOR_SERVER_LIST'];
     $test = false;
     foreach ($servers as $value) {
         if (stristr($_SERVER['SERVER_SOFTWARE'], $value)) {
             $test = true;
             break;
         }
     }
     $checks['CHK-SRV-102'] = $test ? 'Good' : 'Warn';
     //RESULTS
     $result = in_array('Warn', $checks);
     $checks['Success'] = !$result;
     return $checks;
 }
开发者ID:tofubuddha,项目名称:example,代码行数:44,代码来源:server.php

示例4: InitSnapshotDirectory

 /**
  *  Creates the snapshot directory if it doesn't already exisit
  */
 public static function InitSnapshotDirectory()
 {
     $path_wproot = DUP_Util::SafePath(DUPLICATOR_WPROOTPATH);
     $path_ssdir = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH);
     $path_plugin = DUP_Util::SafePath(DUPLICATOR_PLUGIN_PATH);
     //--------------------------------
     //CHMOD DIRECTORY ACCESS
     //wordpress root directory
     @chmod($path_wproot, 0755);
     //snapshot directory
     @mkdir($path_ssdir, 0755);
     @chmod($path_ssdir, 0755);
     //snapshot tmp directory
     $path_ssdir_tmp = $path_ssdir . '/tmp';
     @mkdir($path_ssdir_tmp, 0755);
     @chmod($path_ssdir_tmp, 0755);
     //plugins dir/files
     @chmod($path_plugin . 'files', 0755);
     //--------------------------------
     //FILE CREATION
     //SSDIR: Create Index File
     $ssfile = @fopen($path_ssdir . '/index.php', 'w');
     @fwrite($ssfile, '<?php error_reporting(0);  if (stristr(php_sapi_name(), "fcgi")) { $url  =  "http://" . $_SERVER["HTTP_HOST"]; header("Location: {$url}/404.html");} else { header("HTTP/1.1 404 Not Found", true, 404);} exit(); ?>');
     @fclose($ssfile);
     //SSDIR: Create token file in snapshot
     $tokenfile = @fopen($path_ssdir . '/dtoken.php', 'w');
     @fwrite($tokenfile, '<?php error_reporting(0);  if (stristr(php_sapi_name(), "fcgi")) { $url  =  "http://" . $_SERVER["HTTP_HOST"]; header("Location: {$url}/404.html");} else { header("HTTP/1.1 404 Not Found", true, 404);} exit(); ?>');
     @fclose($tokenfile);
     //SSDIR: Create .htaccess
     $storage_htaccess_off = DUP_Settings::Get('storage_htaccess_off');
     if ($storage_htaccess_off) {
         @unlink($path_ssdir . '/.htaccess');
     } else {
         $htfile = @fopen($path_ssdir . '/.htaccess', 'w');
         $htoutput = "Options -Indexes";
         @fwrite($htfile, $htoutput);
         @fclose($htfile);
     }
     //SSDIR: Robots.txt file
     $robotfile = @fopen($path_ssdir . '/robots.txt', 'w');
     @fwrite($robotfile, "User-agent: * \nDisallow: /" . DUPLICATOR_SSDIR_NAME . '/');
     @fclose($robotfile);
     //PLUG DIR: Create token file in plugin
     $tokenfile2 = @fopen($path_plugin . 'installer/dtoken.php', 'w');
     @fwrite($tokenfile2, '<?php @error_reporting(0); @require_once("../../../../wp-admin/admin.php"); global $wp_query; $wp_query->set_404(); header("HTTP/1.1 404 Not Found", true, 404); header("Status: 404 Not Found"); @include(get_template_directory () . "/404.php"); ?>');
     @fclose($tokenfile2);
 }
开发者ID:jccultima123,项目名称:technovative-inc,代码行数:50,代码来源:utility.php

示例5: DUP_Settings

// If uninstall not called from WordPress, then exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
require_once 'define.php';
require_once 'classes/settings.php';
require_once 'classes/utility.php';
global $wpdb;
$DUP_Settings = new DUP_Settings();
$table_name = $wpdb->prefix . "duplicator_packages";
$wpdb->query("DROP TABLE `{$table_name}`");
delete_option('duplicator_version_plugin');
//Remvoe entire wp-snapshots directory
if (DUP_Settings::Get('uninstall_files')) {
    $ssdir = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH);
    $ssdir_tmp = DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP);
    //Sanity check for strange setup
    $check = glob("{$ssdir}/wp-config.php");
    if (count($check) == 0) {
        //PHP sanity check
        foreach (glob("{$ssdir}/*_database.sql") as $file) {
            if (strstr($file, '_database.sql')) {
                @unlink("{$file}");
            }
        }
        foreach (glob("{$ssdir}/*_installer.php") as $file) {
            if (strstr($file, '_installer.php')) {
                @unlink("{$file}");
            }
        }
        foreach (glob("{$ssdir}/*_archive.zip") as $file) {
开发者ID:renztoygwapo,项目名称:lincoln,代码行数:31,代码来源:uninstall.php

示例6: dirsToArray_New

 private function dirsToArray_New($path)
 {
     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
     $files = iterator_to_array($iterator);
     $items = array();
     foreach ($files as $file) {
         if ($file->isDir()) {
             $items[] = DUP_Util::SafePath($file->getRealPath());
         }
     }
     return $items;
 }
开发者ID:carlosburbano,项目名称:lb_009_cchc_saloninmobiliario,代码行数:12,代码来源:package.archive.php

示例7: getDirs

 private function getDirs()
 {
     $rootPath = DUP_Util::SafePath(rtrim(DUPLICATOR_WPROOTPATH, '//'));
     $this->Dirs = array();
     //If the root directory is a filter then we will only need the root files
     if (in_array($this->PackDir, $this->FilterDirsAll)) {
         $this->Dirs[] = $this->PackDir;
     } else {
         $this->Dirs = $this->dirsToArray($rootPath);
         $this->Dirs[] = $this->PackDir;
     }
     //Filter Directories
     //Invalid test contains checks for: characters over 250, invlaid characters,
     //empty string and directories ending with period (Windows incompatable)
     foreach ($this->Dirs as $key => $val) {
         //Remove path filter directories
         foreach ($this->FilterDirsAll as $item) {
             if (strstr($val, $item . '/') || $val == $item) {
                 unset($this->Dirs[$key]);
                 continue 2;
             }
         }
         //Locate invalid directories and warn
         $name = basename($val);
         $invalid_test = strlen($val) > 250 || preg_match('/(\\/|\\*|\\?|\\>|\\<|\\:|\\|\\|)/', $name) || trim($name) == "" || strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.';
         if ($invalid_test || preg_match('/[^\\x20-\\x7f]/', $name)) {
             $this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
         }
         //Dir is not readble remove and flag
         if (!is_readable($this->Dirs[$key])) {
             unset($this->Dirs[$key]);
             $this->FilterInfo->Dirs->Unreadable[] = $val;
             $this->FilterDirsAll[] = $val;
         }
     }
 }
开发者ID:renztoygwapo,项目名称:lincoln,代码行数:36,代码来源:package.archive.php

示例8: _e

				<li class="tabs"><a href="javascript:void(0)" onclick="Duplicator.Pack.ToggleOptTabs(1, this)"><?php 
_e('Files', 'wpduplicator');
?>
</a></li>
				<li><a href="javascript:void(0)"onclick="Duplicator.Pack.ToggleOptTabs(2, this)"><?php 
_e('Database', 'wpduplicator');
?>
</a></li>
			</ul>

			<!-- TAB1: PACKAGE -->
			<div class="tabs-panel" id="dup-pack-opts-tabs-panel-1">
				<!-- FILTERS -->
				<?php 
$uploads = wp_upload_dir();
$upload_dir = DUP_Util::SafePath($uploads['basedir']);
?>
				<fieldset>
					<legend><b> <i class="fa fa-filter"></i> <?php 
_e("Filters", 'wpduplicator');
?>
</b></legend>
					
					<div class="dup-enable-filters">
						<input type="checkbox" id="filter-on" name="filter-on" onclick="Duplicator.Pack.ToggleFileFilters()" <?php 
echo $Package->Archive->FilterOn ? "checked='checked'" : "";
?>
 />	
						<label for="filter-on"><?php 
_e("Enable Filters", 'wpduplicator');
?>
开发者ID:tlandn,项目名称:akvo-web,代码行数:31,代码来源:new1.inc-b.form.php

示例9: getDirs

 private function getDirs()
 {
     $rootPath = DUP_Util::SafePath(rtrim(DUPLICATOR_WPROOTPATH, '//'));
     $this->Dirs = array();
     //If the root directory is a filter then we will only need the root files
     if (in_array($this->PackDir, $this->FilterDirsAll)) {
         $this->Dirs[] = $this->PackDir;
     } else {
         $this->Dirs = $this->dirsToArray($rootPath, $this->FilterDirsAll);
         $this->Dirs[] = $this->PackDir;
     }
     //Filter Directories
     //Invalid test contains checks for: characters over 250, invlaid characters,
     //empty string and directories ending with period (Windows incompatable)
     foreach ($this->Dirs as $key => $val) {
         //WARNING: Find OS items that may have issues
         // was commented out in pro
         $name = basename($val);
         $warn_test = strlen($val) > 250 || preg_match('/(\\/|\\*|\\?|\\>|\\<|\\:|\\|\\|)/', $name) || trim($name) == "" || strrpos($name, '.') == strlen($name) - 1 && substr($name, -1) == '.' || preg_match('/[^\\x20-\\x7f]/', $name);
         if ($warn_test) {
             $this->FilterInfo->Dirs->Warning[] = DUP_Encoding::toUTF8($val);
         }
         //UNREADABLE: Directory is unreadable flag it
         if (!is_readable($this->Dirs[$key])) {
             unset($this->Dirs[$key]);
             $this->FilterInfo->Dirs->Unreadable[] = $val;
             $this->FilterDirsAll[] = $val;
         }
     }
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:30,代码来源:package.archive.php

示例10: _e

				<td><?php 
_e("ABSPATH", 'wpduplicator');
?>
</td>
				<td><?php 
echo ABSPATH;
?>
</td>
			</tr>			
			<tr>
				<td><?php 
_e("Plugins Path", 'wpduplicator');
?>
</td>
				<td><?php 
echo DUP_Util::SafePath(WP_PLUGIN_DIR);
?>
</td>
			</tr>
			<tr>
				<td><?php 
_e("Loaded PHP INI", 'wpduplicator');
?>
</td>
				<td><?php 
echo php_ini_loaded_file();
?>
</td>
			</tr>	
			<tr>
				<td class='dup-settings-diag-header' colspan="2">WordPress</td>
开发者ID:donwea,项目名称:nhap.org,代码行数:31,代码来源:diagnostics.php

示例11: glob

<?php

require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
$logs = glob(DUPLICATOR_SSDIR_PATH . '/*.log');
if ($logs != false && count($logs)) {
    usort($logs, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
    @chmod(DUP_Util::SafePath($logs[0]), 0644);
}
$logname = isset($_GET['logname']) ? trim($_GET['logname']) : "";
$refresh = isset($_POST['refresh']) && $_POST['refresh'] == 1 ? 1 : 0;
$auto = isset($_POST['auto']) && $_POST['auto'] == 1 ? 1 : 0;
//Check for invalid file
if (isset($_GET['logname'])) {
    $validFiles = array_map('basename', $logs);
    if (validate_file($logname, $validFiles) > 0) {
        unset($logname);
    }
    unset($validFiles);
}
if (!isset($logname) || !$logname) {
    $logname = count($logs) > 0 ? basename($logs[0]) : "";
}
$logurl = get_site_url(null, '', is_ssl() ? 'https' : 'http') . '/' . DUPLICATOR_SSDIR_NAME . '/' . $logname;
$logfound = strlen($logname) > 0 ? true : false;
?>

<style>
	div#dup-refresh-count {display: inline-block}
	table#dup-log-panels {width:100%; }
	td#dup-log-panel-left {width:75%;}
开发者ID:KimcoBlogSC,项目名称:Blog,代码行数:31,代码来源:logging.php

示例12: parseDirectoryFilter

 private function parseDirectoryFilter($dirs = "")
 {
     $filter_dirs = "";
     foreach (explode(";", $dirs) as $val) {
         if (strlen($val) >= 2) {
             $filter_dirs .= DUP_Util::SafePath(trim(rtrim($val, "/\\"))) . ";";
         }
     }
     return $filter_dirs;
 }
开发者ID:carlosburbano,项目名称:lb_009_cchc_saloninmobiliario,代码行数:10,代码来源:package.php

示例13: _e

</label><br/>

            </td>
        </tr>
        <tr valign="top">
            <th scope="row"><label><?php 
_e("Storage", 'wpduplicator');
?>
</label></th>
            <td>
                <?php 
_e("Full Path", 'wpduplicator');
?>
: 
                <?php 
echo DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH);
?>
<br/><br/>
                <input type="checkbox" name="storage_htaccess_off" id="storage_htaccess_off" <?php 
echo $storage_htaccess_off ? 'checked="checked"' : '';
?>
 /> 
                <label for="storage_htaccess_off"><?php 
_e("Disable .htaccess File In Storage Directory", 'wpduplicator');
?>
 </label>
                <p class="description">
                    <?php 
_e("Disable if issues occur when downloading installer/archive files.", 'wpduplicator');
?>
                </p>
开发者ID:ICONVI,项目名称:sigmacatweb,代码行数:31,代码来源:general.php

示例14: recurseDirsWithFilters

 private static function recurseDirsWithFilters($directory)
 {
     $currentPath = DUP_Util::SafePath($directory);
     //EXCLUDE: Snapshot directory
     if (strstr($currentPath, DUPLICATOR_SSDIR_PATH) || empty($currentPath)) {
         return;
     }
     //DIRECTORIES
     $dh = new DirectoryIterator($currentPath);
     foreach ($dh as $file) {
         if (!$file->isDot()) {
             $fullPath = "{$currentPath}/{$file}";
             $zipPath = str_replace(self::$compressDir, '', $currentPath);
             $zipPath = empty($zipPath) ? $file : ltrim("{$zipPath}/{$file}", '/');
             if ($file->isDir()) {
                 if (!in_array($fullPath, self::$filterDirsArray)) {
                     if (preg_match('/(\\/|\\*|\\?|\\>|\\<|\\:|\\|\\|)/', $file) || trim($file) == "") {
                         DUP_Log::Info("WARNING: Excluding invalid directory - [{$fullPath}]");
                     } else {
                         if ($file->isReadable() && self::$zipArchive->addEmptyDir($zipPath)) {
                             self::$countDirs++;
                             self::recurseDirsWithFilters($fullPath);
                         } else {
                             DUP_Log::Info("WARNING: Unable to add directory: {$fullPath}");
                         }
                     }
                 } else {
                     DUP_Log::Info("- filter@ [{$fullPath}]");
                 }
             } else {
                 if ($file->isFile() && $file->isReadable()) {
                     if (self::$filterExtsOn) {
                         $ext = @pathinfo($fullPath, PATHINFO_EXTENSION);
                         if (!in_array($ext, self::$filterExtsArray) || empty($ext)) {
                             self::$zipArchive->addFile($fullPath, $zipPath);
                             self::$countFiles++;
                         }
                     } else {
                         self::$zipArchive->addFile($fullPath, $zipPath) ? self::$countFiles++ : DUP_Log::Info("WARNING: Unable to add file: {$fullPath}");
                     }
                 } else {
                     if ($file->isLink()) {
                         self::$countLinks++;
                     }
                 }
             }
             self::$limitItems++;
             $fileSize = filesize($fullPath);
             $fileSize = $fileSize ? $fileSize : 0;
             self::$size = self::$size + $fileSize;
         }
     }
     @closedir($dh);
     if (self::$networkFlush) {
         self::flushResponse();
     }
 }
开发者ID:tlandn,项目名称:akvo-web,代码行数:57,代码来源:package.archive.zip.php

示例15: runDirStats

 private function runDirStats($directory)
 {
     $currentPath = DUP_Util::SafePath($directory);
     //EXCLUDE: Snapshot directory
     if (strstr($currentPath, DUPLICATOR_SSDIR_PATH) || empty($currentPath)) {
         return;
     }
     $dh = new DirectoryIterator($currentPath);
     foreach ($dh as $file) {
         if (!$file->isDot()) {
             $nextpath = "{$currentPath}/{$file}";
             if ($file->isDir()) {
                 if (!in_array($nextpath, $this->filterDirsArray)) {
                     if (preg_match('/(\\/|\\*|\\?|\\>|\\<|\\:|\\|\\|)/', $file) || trim($file) == "") {
                         array_push($this->InvalidFileList, $nextpath);
                     }
                     $result = $this->runDirStats($nextpath);
                     $this->DirCount++;
                 }
             } else {
                 if ($file->isFile() && $file->isReadable()) {
                     if (!in_array(@pathinfo($nextpath, PATHINFO_EXTENSION), $this->filterExtsArray)) {
                         $fileSize = filesize($nextpath);
                         $fileSize = $fileSize ? $fileSize : 0;
                         $this->Size += $fileSize;
                         $this->FileCount++;
                         if (strlen($nextpath) > 200 || preg_match('/(\\/|\\*|\\?|\\>|\\<|\\:|\\|\\|)/', $file)) {
                             array_push($this->InvalidFileList, $nextpath);
                         }
                         if ($fileSize > DUPLICATOR_SCAN_BIGFILE) {
                             array_push($this->BigFileList, $nextpath . ' [' . DUP_Util::ByteSize($fileSize) . ']');
                         }
                     }
                 } else {
                     if ($file->isLink()) {
                         $this->LinkCount++;
                     }
                 }
             }
         }
     }
     @closedir($dh);
 }
开发者ID:tlandn,项目名称:akvo-web,代码行数:43,代码来源:package.archive.php


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