예제 #1
0
 public function ajaxProcessUnzip()
 {
     // @TODO : not require_once like that.
     $filepath = $this->getFilePath();
     $destExtract = $this->autoupgradePath . DIRECTORY_SEPARATOR . 'latest';
     if (file_exists($destExtract)) {
         Tools::deletedirectory($destExtract);
     }
     if (Tools::ZipExtract($filepath, $destExtract)) {
         $adminDir = str_replace($this->prodRootDir, '', $this->adminDir);
         rename($this->latestRootDir . DIRECTORY_SEPARATOR . 'admin', $this->latestRootDir . DIRECTORY_SEPARATOR . $adminDir);
         // Unsetting to force listing
         unset($this->nextParams['removeList']);
         $this->next = "removeSamples";
         $this->nextDesc = $this->l('Extract complete. removing sample files...');
         return true;
     } else {
         $this->next = "error";
         $this->nextDesc = sprintf($this->l('unable to extract %1$s into %2$s ...'), $filepath, $destExtract);
         return true;
     }
 }
 /**
  * extract last version into admin/autoupgrade/latest directory
  * 
  * @return void
  */
 public function ajaxProcessUnzip()
 {
     if (version_compare(_PS_VERSION_, '1.4.5.0', '<') and !class_exists('Tools', false)) {
         require_once 'Tools.php';
     }
     $filepath = $this->getFilePath();
     $destExtract = $this->autoupgradePath . DIRECTORY_SEPARATOR . 'latest';
     if (file_exists($destExtract)) {
         Tools::deletedirectory($destExtract);
     }
     if (self::ZipExtract($filepath, $destExtract)) {
         $adminDir = str_replace($this->prodRootDir, '', $this->adminDir);
         rename($this->latestRootDir . DIRECTORY_SEPARATOR . 'admin', $this->latestRootDir . DIRECTORY_SEPARATOR . $adminDir);
         // Unsetting to force listing
         unset($this->nextParams['removeList']);
         $this->next = "removeSamples";
         $this->nextDesc = $this->l('Extract complete. removing sample files...');
         return true;
     } else {
         $this->next = "error";
         $this->nextDesc = sprintf($this->l('unable to extract %1$s into %2$s ...'), $filepath, $destExtract);
         return true;
     }
 }