version 3.37
parent
32ed2070bd
commit
8e76436034
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -505,33 +505,6 @@ function copy_dir($source, $dest){
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动文件&文件夹;(同名文件夹则特殊处理)
|
||||
* 问题:win下,挂载磁盘移动到系统盘时rmdir导致遍历不完全;
|
||||
*/
|
||||
function move_path2($source,$dest,$repeat_add='',$repeat_type='replace'){
|
||||
if (!$dest) return false;
|
||||
if (is_dir($source) && $source == substr($dest,0,strlen($source))) return false;//防止父文件夹拷贝到子文件夹,无限递归
|
||||
ignore_timeout();
|
||||
if (is_file($source)) {
|
||||
return move_file($source,$dest,$repeat_add,$repeat_type);
|
||||
}else if(is_dir($source)) {
|
||||
if ($dest[strlen($dest)-1] == '/') {
|
||||
$dest = $dest . basename($source);
|
||||
}
|
||||
if (!file_exists($dest)) {
|
||||
@mkdir($dest,DEFAULT_PERRMISSIONS);
|
||||
}
|
||||
if (!$dh = opendir($source)) return false;
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($file =='.' || $file =='..') continue;
|
||||
move_path($source."/".$file, $dest."/".$file,$repeat_add,$repeat_type);
|
||||
}
|
||||
closedir($dh);
|
||||
return @rmdir($source);
|
||||
}
|
||||
}
|
||||
|
||||
function move_file($source,$dest,$repeat_add,$repeat_type){
|
||||
if ($dest[strlen($dest)-1] == '/') {
|
||||
$dest = $dest . "/" . basename($source);
|
||||
|
@ -541,16 +514,38 @@ function move_file($source,$dest,$repeat_add,$repeat_type){
|
|||
}
|
||||
return intval(@rename($source,$dest));
|
||||
}
|
||||
|
||||
/**
|
||||
* [move_path description]
|
||||
* @param [type] $source [源文件]
|
||||
* @param [type] $dest [目标路径]
|
||||
* @param string $repeat_add [文件重复则追加]
|
||||
* @param string $repeat_type [重复处理方式]
|
||||
* @return [type] [bool]
|
||||
*
|
||||
* rename:先用rename
|
||||
* 1.文件,rename可以在不同盘符之间移动.
|
||||
* 2.空文件夹:也可以在不同盘符之间移动.但是目标文件夹的父目录必须存在
|
||||
* 3.对于非空文件夹,只能在同一盘符下移动.
|
||||
*/
|
||||
function move_path($source,$dest,$repeat_add='',$repeat_type='replace'){
|
||||
if (!$dest || !file_exists($source)) return false;
|
||||
if (is_dir($source) && $source == substr($dest,0,strlen($source))) return false;//防止父文件夹拷贝到子文件夹,无限递归
|
||||
|
||||
ignore_timeout();
|
||||
if(is_file($source)){
|
||||
return move_file($source,$dest,$repeat_add,$repeat_type);
|
||||
}else if(is_dir($source)){
|
||||
//尝试直接重命名
|
||||
$the_dest = $dest;
|
||||
if(file_exists($the_dest)){
|
||||
$the_dest = get_filename_auto($dest,$repeat_add,$repeat_type);
|
||||
}
|
||||
if( @rename(rtrim($source,'/'),rtrim($the_dest,'/')) ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
recursion_dir($source,$dirs,$files,-1,0);
|
||||
|
||||
ignore_timeout();
|
||||
recursion_dir($source,$dirs,$files,-1,0);
|
||||
@mkdir($dest);
|
||||
foreach($dirs as $f){
|
||||
$path = $dest.'/'.substr($f,strlen($source));
|
||||
|
|
|
@ -46,7 +46,6 @@ function update_clear(){
|
|||
del_file(THE_DATA_PATH.'2.0-3.34.zip');
|
||||
del_file(THE_DATA_PATH.'2.0-3.35.zip');
|
||||
del_file(THE_DATA_PATH.'2.0-'.KOD_VERSION.'.zip');
|
||||
del_file(THE_DATA_PATH.'system/update.lock');
|
||||
|
||||
del_dir(THE_DATA_PATH.'i18n');
|
||||
del_dir(THE_DATA_PATH.'thumb');
|
||||
|
@ -112,25 +111,18 @@ class updateToV330{
|
|||
private $user_array;
|
||||
private $role_array;
|
||||
function __construct() {
|
||||
$update_lock = THE_DATA_PATH.'system/update.lock';
|
||||
if(file_exists($update_lock)){
|
||||
show_tips("正在升级中,请稍后(Updating...)");
|
||||
}else{
|
||||
@touch($update_lock);
|
||||
if(!file_exists($update_lock)){
|
||||
show_tips("data path can't writable!");
|
||||
}
|
||||
}
|
||||
|
||||
$this->user_array = array();
|
||||
$this->role_array = array();
|
||||
$this->init_role();
|
||||
$this->init_user();
|
||||
$this->init_group();
|
||||
$this->init_system();
|
||||
$this->init_group();//移动文件夹;耗时操作
|
||||
}
|
||||
private function init_role(){
|
||||
$file_in = THE_DATA_PATH.'system/group.php';
|
||||
if(!file_exists($file_in)){
|
||||
return;
|
||||
}
|
||||
$file_out = THE_DATA_PATH.'system/system_role.php';
|
||||
$data = fileCache::load($file_in);
|
||||
$data_new = array();
|
||||
|
@ -176,6 +168,7 @@ class updateToV330{
|
|||
$data_new[$id] = $value;
|
||||
}
|
||||
fileCache::save($file_out,$data_new);
|
||||
del_file(THE_DATA_PATH.'system/group.php');
|
||||
}
|
||||
private function init_group(){//新建
|
||||
$file_out = THE_DATA_PATH.'system/system_group.php';
|
||||
|
@ -198,18 +191,20 @@ class updateToV330{
|
|||
mk_dir($group_path);
|
||||
touch($group_path.'index.html');
|
||||
|
||||
$public = THE_DATA_PATH.'public/';
|
||||
$item_path = $group_path.$arr['path'].'/';
|
||||
mk_dir($item_path.'home/share');
|
||||
mk_dir($item_path.'home/document');
|
||||
$public = THE_DATA_PATH.'public';
|
||||
$item_path = iconv_system($group_path.$arr['path'].'/');
|
||||
mk_dir($item_path.'data');
|
||||
mk_dir($item_path.'recycle');
|
||||
if(file_exists($public)){
|
||||
if(! @rename($public,$item_path.'home')){
|
||||
move_path($public,$item_path.'home');
|
||||
}
|
||||
}
|
||||
mk_dir($item_path.'home/share');
|
||||
mk_dir($item_path.'home/document');
|
||||
}
|
||||
private function reset_user_config(&$user){
|
||||
$user_path = THE_DATA_PATH.'User/'.$user['name'].'/';
|
||||
$user_path = iconv_system(THE_DATA_PATH.'User/'.$user['name'].'/');
|
||||
$file_in = $user_path.'data/config.php';
|
||||
$data = fileCache::load($file_in);
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue