Exemplo n.º 1
0
 /**
  *
  */
 public function layoutDistAction()
 {
     $lsDependency = System::localRequest(BASE_DIR . DS . "layout" . DS . "layout.json");
     $laDependency = json_decode($lsDependency, true);
     Debug::debug($laDependency);
     if (isset($laDependency['dist']) && is_array($laDependency['dist'])) {
         System::createDir($this->_sLayoutVendor);
         foreach ($laDependency['dist'] as $lsPackage => $lsDist) {
             $laPackage = explode("/", $lsPackage);
             $lsPackageDir = $this->_sLayoutVendor . DS . $laPackage[0];
             System::createDir($lsPackageDir);
             if (is_dir($lsPackageDir)) {
                 chdir($lsPackageDir);
                 echo "Getting {$lsDist}\n";
                 System::execute("wget {$lsDist}");
                 $laDist = parse_url($lsDist);
                 $laPath = explode("/", $laDist['path']);
                 $lsGzFile = $laPath[count($laPath) - 1];
                 $lsGzFilePath = $lsPackageDir . DS . $lsGzFile;
                 if (is_file($lsGzFilePath)) {
                     if (preg_match("/.zip\$/", $lsGzFile)) {
                         System::execute("unzip {$lsGzFile}");
                     } elseif (preg_match("/.tar.gz\$/", $lsGzFile)) {
                         System::execute("tar -xzf {$lsGzFile}");
                     }
                     System::removeFile($lsGzFile);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /**
  *
  * @param string $psPath
  * @param bool $pbHtaccess
  * @param int $pnChmod
  * @param string $pnChown
  * @param string $pnChown
  */
 public function createDir($psPath, $pbHtaccess = true, $pnChmod = null, $psChown = null, $psChgrp = null)
 {
     System::createDir($psPath, $pnChmod, $psChown, $psChgrp);
     if ($pbHtaccess) {
         $lsFileContent = System::localRequest($this->_sModelPath . DS . "deny.model");
         $lsFilePath = $psPath . DS . '.htaccess';
         System::saveFile($lsFilePath, $lsFileContent);
     }
 }