summaryrefslogtreecommitdiffstats
path: root/application/modules/dev/controllers/PrebootController.php
diff options
context:
space:
mode:
authormichael pereira2011-03-21 15:19:20 +0100
committermichael pereira2011-03-21 15:19:20 +0100
commit5236e6ae88b1614df492886c0427f7f1b6660459 (patch)
treef56825655de51c3708c413da3f0a0bc0219be9dd /application/modules/dev/controllers/PrebootController.php
parentPreboot download working (diff)
downloadpbs2-5236e6ae88b1614df492886c0427f7f1b6660459.tar.gz
pbs2-5236e6ae88b1614df492886c0427f7f1b6660459.tar.xz
pbs2-5236e6ae88b1614df492886c0427f7f1b6660459.zip
Preboot und BootISO fertig
Diffstat (limited to 'application/modules/dev/controllers/PrebootController.php')
-rw-r--r--application/modules/dev/controllers/PrebootController.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/application/modules/dev/controllers/PrebootController.php b/application/modules/dev/controllers/PrebootController.php
index e319058..cfcbeca 100644
--- a/application/modules/dev/controllers/PrebootController.php
+++ b/application/modules/dev/controllers/PrebootController.php
@@ -53,9 +53,11 @@ class dev_PrebootController extends Zend_Controller_Action
$prebootID = $prebootmapper->save($preboot);
$path_preboot = "../resources/bootmedium/$prebootID/";
+ mkdir($path_preboot."preboot/",0777,true);
- exec("wget -P ".$path_preboot." -r -nH --cut-dirs=1 -np -R '*.html*' -N ".$preboot->getPath_preboot());
+ exec("wget -O '".$path_preboot."preboot.tgz' ".$preboot->getPath_preboot());
+ exec("tar -xvf ".$path_preboot."preboot.tgz "."-C ".$path_preboot."preboot/");
}catch(Zend_Exception $e)
{
@@ -63,7 +65,7 @@ class dev_PrebootController extends Zend_Controller_Action
echo "Message: " . $e->getMessage() . "<br/>";
}
- $this->_redirect('/dev/preboot');
+ //$this->_redirect('/dev/preboot');
}
}
@@ -72,15 +74,15 @@ class dev_PrebootController extends Zend_Controller_Action
public function checkupdateAction($preboot)
{
- exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())."changed 2>&1 | grep 'Last-Modified:'", $prebootdate);
+ $prebootID = $preboot->getID();
+ exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'Last-Modified:'", $prebootdate);
//print_a($prebootdate);
$prebootdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($prebootdate))));
- $prebootname = array_pop(scandir("../resources/bootmedium/".$preboot->getID()."/"));
- if($prebootname != "." && $prebootname != "..")
- $prebootolddate = filemtime("../resources/bootmedium/".$preboot->getID()."/".$prebootname);
+ if(is_file("../resources/bootmedium/$prebootID/preboot.tgz"))
+ $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.tgz");
else
$prebootolddate = false;
@@ -97,14 +99,18 @@ class dev_PrebootController extends Zend_Controller_Action
public function updateprebootAction()
{
$prebootID = $this->_request->getParam('prebootID');
+
$prebootmapper = new Application_Model_PreBootMapper();
$preboot = new Application_Model_PreBoot();
$prebootmapper->find($prebootID,$preboot);
$path_preboot = "../resources/bootmedium/$prebootID/";
-
- exec("wget -P ".$path_preboot." -r -nH --cut-dirs=1 -np -R '*.html*' -N ".$preboot->getPath_preboot());
-
+
+ exec("rm -r $path_preboot"."preboot/*");
+
+ exec("wget -O '".$path_preboot."preboot.tgz' ".$preboot->getPath_preboot());
+ exec("tar -xvf ".$path_preboot."preboot.tgz "."-C ".$path_preboot."preboot/");
+
$this->_redirect('/dev/preboot');
}