diff options
author | michael pereira | 2011-03-21 15:19:20 +0100 |
---|---|---|
committer | michael pereira | 2011-03-21 15:19:20 +0100 |
commit | 5236e6ae88b1614df492886c0427f7f1b6660459 (patch) | |
tree | f56825655de51c3708c413da3f0a0bc0219be9dd | |
parent | Preboot download working (diff) | |
download | pbs2-5236e6ae88b1614df492886c0427f7f1b6660459.tar.gz pbs2-5236e6ae88b1614df492886c0427f7f1b6660459.tar.xz pbs2-5236e6ae88b1614df492886c0427f7f1b6660459.zip |
Preboot und BootISO fertig
-rw-r--r-- | application/modules/dev/controllers/BootisoController.php | 9 | ||||
-rw-r--r-- | application/modules/dev/controllers/PrebootController.php | 24 | ||||
-rw-r--r-- | application/modules/dev/views/scripts/bootiso/index.phtml | 3 | ||||
-rw-r--r-- | pbs.sql | 2 |
4 files changed, 25 insertions, 13 deletions
diff --git a/application/modules/dev/controllers/BootisoController.php b/application/modules/dev/controllers/BootisoController.php index b0f4c2f..901c901 100644 --- a/application/modules/dev/controllers/BootisoController.php +++ b/application/modules/dev/controllers/BootisoController.php @@ -34,6 +34,7 @@ class dev_BootisoController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(); $prebootID = $this->_request->getParam('prebootID'); + $serialnumber = $this->_request->getParam('serialnumber'); if(is_dir("../resources/bootmedium/$prebootID/") && is_numeric($prebootID)){ @@ -43,11 +44,15 @@ class dev_BootisoController extends Zend_Controller_Action header('Pragma: no-cache'); header('Expires: 0'); + $fp = fopen("bootisoSerial.txt", "w"); + fputs ($fp, $serialnumber); + fclose ($fp); + // create the gzipped tarfile. - chdir("../resources/bootmedium/$prebootID/"); + chdir("../resources/bootmedium/$prebootID/preboot/"); passthru("zip -r - ./"); - } + } 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'); } diff --git a/application/modules/dev/views/scripts/bootiso/index.phtml b/application/modules/dev/views/scripts/bootiso/index.phtml index cb06be6..d3e954b 100644 --- a/application/modules/dev/views/scripts/bootiso/index.phtml +++ b/application/modules/dev/views/scripts/bootiso/index.phtml @@ -33,7 +33,8 @@ 'module' => 'dev', 'controller' => 'bootiso', 'action' => 'downloadbootiso', - 'prebootID' => $bootiso->getprebootID() + 'prebootID' => $bootiso->getprebootID(), + 'serialnumber' => $bootiso->getSerialnumber() ), 'default', true, false) ?>"><img src='/media/img/download.png' alt='Download BootMedium' /></a></td> @@ -189,7 +189,7 @@ CREATE TABLE IF NOT EXISTS `pbs_bootiso` ( `membershipID` int(11), `groupID` int(11) NOT NULL, `prebootID` int(11) NOT NULL, - `serialnumber` int(11) NOT NULL, + `serialnumber` varchar(30) NOT NULL UNIQUE, `created` VARCHAR(14) NOT NULL, `expires` VARCHAR(14), `public` int(11) NOT NULL, |