mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 14:52:24 +09:00
#904 autoinstall without ftp
This commit is contained in:
parent
2420ae6abf
commit
683d6c30a9
8 changed files with 253 additions and 8 deletions
|
|
@ -348,6 +348,61 @@ class autoinstallAdminModel extends autoinstall
|
|||
$this->add('package', $package);
|
||||
}
|
||||
|
||||
public function checkUseDirectModuleInstall($package)
|
||||
{
|
||||
$directModuleInstall = TRUE;
|
||||
$arrUnwritableDir = array();
|
||||
$output = $this->isWritableDir($package->path);
|
||||
if($output->toBool()==FALSE)
|
||||
{
|
||||
$directModuleInstall = FALSE;
|
||||
$arrUnwritableDir[] = $output->get('path');
|
||||
}
|
||||
|
||||
foreach($package->depends as $dep)
|
||||
{
|
||||
$output = $this->isWritableDir($dep->path);
|
||||
if($output->toBool()==FALSE)
|
||||
{
|
||||
$directModuleInstall = FALSE;
|
||||
$arrUnwritableDir[] = $output->get('path');
|
||||
}
|
||||
}
|
||||
|
||||
if($directModuleInstall==FALSE)
|
||||
{
|
||||
$output = new Object(-1, 'msg_direct_inall_invalid');
|
||||
$output->add('path', $arrUnwritableDir);
|
||||
return $output;
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
public function isWritableDir($path)
|
||||
{
|
||||
$path_list = explode('/', dirname($path));
|
||||
$real_path = './';
|
||||
|
||||
while($path_list)
|
||||
{
|
||||
$check_path = $real_path . implode('/', $path_list);
|
||||
if(FileHandler::isDir($check_path))
|
||||
{
|
||||
break;
|
||||
}
|
||||
array_pop($path_list);
|
||||
}
|
||||
|
||||
if(FileHandler::isWritableDir($check_path)==FALSE)
|
||||
{
|
||||
$output = new Object(-1, 'msg_unwritable_directory');
|
||||
$output->add('path', FileHandler::getRealPath($check_path));
|
||||
return $output;
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file autoinstall.admin.model.php */
|
||||
/* Location: ./modules/autoinstall/autoinstall.admin.model.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue