- add support for multiple directories
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
* @author Froxlor Team <team@froxlor.org>
|
* @author Froxlor Team <team@froxlor.org>
|
||||||
* @copyright 2010 the authors
|
* @copyright 2010 the authors
|
||||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||||
* @version SVN: $Id: class.FroxlorPkgCreator.php 1376 2010-10-20 19:07:51Z scarya $
|
* @version SVN: $Id$
|
||||||
* @link http://www.froxlor.org/
|
* @link http://www.froxlor.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -39,30 +39,39 @@
|
|||||||
*/
|
*/
|
||||||
class FroxlorDeployfileCreator
|
class FroxlorDeployfileCreator
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Contains the file listing.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
public static $_list = null;
|
public static $_list = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function iterates through the $dir and generates the deploy list.
|
* This function iterates through the $dir and generates the deploy list.
|
||||||
*
|
*
|
||||||
* @param string $dir dir to deploy
|
* @param array $dir dir to deploy
|
||||||
*
|
*
|
||||||
* @return array file listing
|
* @return array file listing
|
||||||
*/
|
*/
|
||||||
public static function createList($dir)
|
public static function createList($dirList)
|
||||||
{
|
{
|
||||||
$list = array();
|
$list = array();
|
||||||
|
|
||||||
if (is_dir($dir)) {
|
foreach ($dirList as $dir) {
|
||||||
$its = new RecursiveIteratorIterator(
|
if (is_dir($dir)) {
|
||||||
new RecursiveDirectoryIterator($dir)
|
$its = new RecursiveIteratorIterator(
|
||||||
);
|
new RecursiveDirectoryIterator($dir)
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($its as $fullFileName => $it ) {
|
foreach ($its as $fullFileName => $it ) {
|
||||||
if (!preg_match("/userdata.inc.php$/i", $it->getFilename())) {
|
if (!preg_match("/(userdata.inc.php|navigation|configfiles)/i", $it->getFilename())) {
|
||||||
$list[] = strstr($fullFileName, "lib/");
|
$list[] = $fullFileName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new Exception($dir." is not a directory!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_list = $list;
|
self::$_list = $list;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class FroxlorPkgCreator
|
|||||||
|
|
||||||
// parse the config
|
// parse the config
|
||||||
if (!$this->_checkConfig()) {
|
if (!$this->_checkConfig()) {
|
||||||
die("Error in FroxlorPkgCreator::_checkConfig()");
|
throw new Exception("Error in FroxlorPkgCreator::_checkConfig()");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pack($toPath);
|
$this->pack($toPath);
|
||||||
@@ -99,7 +99,6 @@ class FroxlorPkgCreator
|
|||||||
private function _checkConfig()
|
private function _checkConfig()
|
||||||
{
|
{
|
||||||
foreach ($this->_config as $key => $var) {
|
foreach ($this->_config as $key => $var) {
|
||||||
// TODO maybe more excluded files?
|
|
||||||
if (strstr($var, "userdata.inc")) {
|
if (strstr($var, "userdata.inc")) {
|
||||||
// delete this entry
|
// delete this entry
|
||||||
unset($this->_config[$key]);
|
unset($this->_config[$key]);
|
||||||
@@ -132,7 +131,8 @@ class FroxlorPkgCreator
|
|||||||
if ($zip->open($toPath, ZIPARCHIVE::OVERWRITE)) {
|
if ($zip->open($toPath, ZIPARCHIVE::OVERWRITE)) {
|
||||||
// write data
|
// write data
|
||||||
foreach ($this->_config as $var) {
|
foreach ($this->_config as $var) {
|
||||||
$zip->addFile($var, strstr($var, "lib/"));
|
$name = str_replace("froxlor/", "", strstr($var, "froxlor/"));
|
||||||
|
$zip->addFile($var, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// close it
|
// close it
|
||||||
|
|||||||
Reference in New Issue
Block a user