[eluser]bubbafoley[/eluser]
[quote author="InsiteFX" date="1299670535"]You might be able to chmod them zip them and then chmod them back.
The problem is that web servers hide them because of the .
Mine are set at 644 which will only allow the owner to read/write anyone else only has read access.
It may also be that the zip library is flagging the .
InsiteFX[/quote]
The zip library only needs read access. It makes a copy of the files and then archives them. The htaccess file isn't being archived because the function read_dir() ignore files starting with a '.'.
spec, here's what you can do to make read_dir() work the way you want.
- Create a file in application/libraries/ called MY_Zip.php
- Override read_dir() to include files starting with a '.'
Ex:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Zip extends CI_Zip {
/**
* Read a directory and add it to the zip.
*
* This function recursively reads a folder and everything it contains (including
* sub-folders) and creates a zip based on it. Whatever directory structure
* is in the original file path will be recreated in the zip file.
*
* @access public
* @param string path to source
* @return bool
*/
function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
{
if ( ! $fp = @opendir($path))
{
return FALSE;
}
// Set the original directory root for child dir's to use as relative
if ($root_path === NULL)
{
$root_path = dirname($path).'/';
}
while (FALSE !== ($file = readdir($fp)))
{
if ($file == '.' OR $file == '..')
{
continue;
}
if (@is_dir($path.$file))
{
$this->read_dir($path.$file."/", $preserve_filepath, $root_path);
}
else
{
if (FALSE !== ($data = file_get_contents($path.$file)))
{
$name = str_replace("\\", "/", $path);
if ($preserve_filepath === FALSE)
{
$name = str_replace($root_path, '', $name);
}
$this->add_data($name.$file, $data);
}
}
}
return TRUE;
}
}