示例#1
0
 /**
  * Add package
  *
  * @param \Magento\Framework\Connect\Package $package
  * @return void
  */
 public function addPackage($package)
 {
     $channel = $this->chanName($package->getChannel());
     $name = $package->getName();
     $record = array(self::K_VER => $package->getVersion(), self::K_STATE => $package->getStability(), self::K_XML => $package->getPackageXml(), self::K_NAME => $name, self::K_DEPS => array(), self::K_PACK_DEPS => array());
     $this->setPackageRecord($channel, $name, $record);
     $this->setPackageDependencies($channel, $name, $package->getDependencyPackages());
     $this->save();
 }
示例#2
0
 /**
  * Package installation to FS
  *
  * @param \Magento\Framework\Connect\Package $package
  * @param string $file
  * @param \Magento\Framework\Connect\Config $configObj
  * @return void
  */
 public function processInstallPackage($package, $file, $configObj)
 {
     $contents = $package->getContents();
     $arc = $this->getArchiver();
     $target = dirname($file) . '/' . $package->getReleaseFilename();
     @mkdir($target, 0777, true);
     $tar = $arc->unpack($file, $target);
     $modeFile = $this->_getFileMode($configObj);
     $modeDir = $this->_getDirMode($configObj);
     $targetPath = rtrim($configObj->magento_root, "\\/");
     foreach ($contents as $file) {
         $fileName = basename($file);
         $filePath = dirname($file);
         $source = $tar . '/' . $file;
         @mkdir($targetPath . '/' . $filePath, $modeDir, true);
         $dest = $targetPath . '/' . $filePath . '/' . $fileName;
         if (is_file($source)) {
             @copy($source, $dest);
             if ($modeFile) {
                 @chmod($dest, $modeFile);
             }
         } else {
             @mkdir($dest, $modeDir);
         }
     }
     $packageXml = $tar . \Magento\Framework\Connect\Package\Reader::DEFAULT_NAME_PACKAGE;
     if (is_file($packageXml)) {
         $destDir = $targetPath . '/' . \Magento\Framework\Connect\Package::PACKAGE_XML_DIR;
         $destFile = $package->getReleaseFilename() . '.xml';
         $dest = $destDir . '/' . $destFile;
         @copy($packageXml, $dest);
         @chmod($dest, $modeFile);
     }
     \Magento\Framework\System\Dirs::rm(array("-r", $target));
 }
示例#3
0
 /**
  * Package installation to FS
  * @param \Magento\Framework\Connect\Package $package
  * @param string $file
  * @param Config $configObj
  * @return void
  * @throws \Exception
  */
 public function processInstallPackage($package, $file, $configObj)
 {
     $contents = $package->getContents();
     $arc = $this->getArchiver();
     $target = dirname($file) . '/' . $package->getReleaseFilename();
     @mkdir($target, 0777, true);
     $mode = $configObj->global_dir_mode;
     $tar = $arc->unpack($file, $target);
     $modeFile = $configObj->global_file_mode;
     $modeDir = $configObj->global_dir_mode;
     foreach ($contents as $file) {
         $fileName = basename($file);
         $filePath = dirname($file);
         $source = $tar . '/' . $file;
         $targetPath = rtrim($configObj->magento_root, "\\/");
         @mkdir($targetPath . '/' . $filePath, $modeDir, true);
         $dest = $targetPath . '/' . $filePath . '/' . $fileName;
         if (is_file($source)) {
             @copy($source, $dest);
             if ($modeFile) {
                 @chmod($dest, $modeFile);
             }
         } else {
             @mkdir($dest, $modeDir);
         }
     }
     \Magento\Framework\System\Dirs::rm(array("-r", $target));
 }