首页 > Web开发 > 详细

[PHP]Use PHP script to tidy Dojo toolkit

时间:2014-03-28 17:40:39      阅读:506      评论:0      收藏:0      [点我收藏+]

In the Dojo toolkit, there are some unused files so it is better to remove them.

<?php

@set_time_limit(0);

$target_path = getcwd().DIRECTORY_SEPARATOR.‘wp-includes‘.DIRECTORY_SEPARATOR.‘js‘.DIRECTORY_SEPARATOR.‘dojo‘;

$files = list_files($target_path);

foreach ($files as $file) {
    if(stripos($file, ‘uncompressed‘)){
      echo $file;
      echo ‘<br>‘;
      @unlink($file);
    }   
}

function list_files( $folder = ‘‘, $levels = 100 ) {
	if ( empty($folder) )
		return false;

	if ( ! $levels )
		return false;

	$files = array();
	if ( $dir = @opendir( $folder ) ) {
		while (($file = readdir( $dir ) ) !== false ) {
			if ( in_array($file, array(‘.‘, ‘..‘) ) )
				continue;
			if ( is_dir( $folder . ‘/‘ . $file ) ) {
				$files2 = list_files( $folder . ‘/‘ . $file, $levels - 1);
				if ( $files2 )
					$files = array_merge($files, $files2 );
				else
					$files[] = $folder . ‘/‘ . $file . ‘/‘;
			} else {
				$files[] = $folder . ‘/‘ . $file;
			}
		}
	}
	@closedir( $dir );
	return $files;
}


[PHP]Use PHP script to tidy Dojo toolkit,布布扣,bubuko.com

[PHP]Use PHP script to tidy Dojo toolkit

原文:http://blog.csdn.net/wonderfan/article/details/22309775

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!