本文整理汇总了PHP中DUP_Util::GetDirectorySize方法的典型用法代码示例。如果您正苦于以下问题:PHP DUP_Util::GetDirectorySize方法的具体用法?PHP DUP_Util::GetDirectorySize怎么用?PHP DUP_Util::GetDirectorySize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DUP_Util
的用法示例。
在下文中一共展示了DUP_Util::GetDirectorySize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: printf
</div>
<div class='dup-scan-info dup-info-box'>
<?php
//VERSION CHECK
echo '<span id="data-srv-wp-version"></span> <b>' . DUP_Util::__('WordPress Version') . ":</b> '{$wp_version}' <br/>";
echo '<small>';
printf(DUP_Util::__('It is recommended to have a version of WordPress that is greater than %1$s'), DUPLICATOR_SCAN_MIN_WP);
echo '</small>';
//CORE FILES
echo '<hr size="1" /><span id="data-srv-wp-core"></span> <b>' . DUP_Util::__('Core Files') . "</b> <br/>";
echo '<small>';
DUP_Util::_e("If the scanner is unable to locate the wp-config.php file in the root directory, then you will need to manually copy it to its new location.");
echo '</small>';
//CACHE DIR
$cache_path = $cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
$cache_size = DUP_Util::ByteSize(DUP_Util::GetDirectorySize($cache_path));
echo '<hr size="1" /><span id="data-srv-wp-cache"></span> <b>' . DUP_Util::__('Cache Path') . ":</b> '{$cache_path}' ({$cache_size}) <br/>";
echo '<small>';
DUP_Util::_e("Cached data will lead to issues at install time and increases your archive size. It is recommended to empty your cache directory at build time. Use caution when removing data from the cache directory. If you have a cache plugin review the documentation for how to empty it; simply removing files might cause errors on your site. The cache size minimum threshold is currently set at ");
echo DUP_Util::ByteSize(DUPLICATOR_SCAN_CACHESIZE) . '.';
echo '</small>';
?>
</div>
</div>
</div><!-- end .dup-panel -->
</div><!-- end .dup-panel-panel -->
<h2 style="font-size:18px; font-weight:bold; margin:-15px 0 0 10px"><i class="fa fa-file-archive-o"></i> <?php
DUP_Util::_e('Archive');
?>
</h2>
示例4: GetServerChecks
public function GetServerChecks()
{
$dup_checks = array();
//CHK-SRV-100
$test = ini_get("open_basedir");
$dup_checks['CHK-SRV-100'] = empty($test) ? 'Good' : 'Warn';
//CHK-SRV-101
$cache_path = DUP_Util::SafePath(WP_CONTENT_DIR) . '/cache';
$dirEmpty = DUP_Util::IsDirectoryEmpty($cache_path);
$dirSize = DUP_Util::GetDirectorySize($cache_path);
//50K
$dup_checks['CHK-SRV-101'] = $dirEmpty || $dirSize < 50000 ? 'Good' : 'Warn';
//CHK-SRV-102
$test = ini_get("max_execution_time");
$dup_checks['CHK-SRV-102'] = $test > DUPLICATOR_SCAN_TIMEOUT || strcmp($test, 'Off') == 0 || $test == 0 ? 'Good' : 'Warn';
//RESULTS
$result = in_array('Warn', $dup_checks);
$dup_checks['Success'] = !$result;
return $dup_checks;
}