Ignore:
Timestamp:
2011/05/28 17:13:18 (13 years ago)
Author:
Seasoft
Message:

#144 (郵便番号DB のアップデート)

  • ZIP_DOWNLOAD_URL が未定義の場合、処理しないように改訂
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php

    r20952 r20960  
    103103        $this->arrErr = $objFormParam->checkError(); 
    104104        $this->arrForm = $objFormParam->getHashArray(); 
     105        $this->tpl_skip_update_csv = !defined('ZIP_DOWNLOAD_URL') || strlen(ZIP_DOWNLOAD_URL) === 0 || ZIP_DOWNLOAD_URL === false; 
    105106 
    106107        if ($this->exec) { 
     
    159160        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    160161 
    161         $this->lfDownloadZipFileFromJp(); 
    162         $this->lfExtractZipFile(); 
     162        if (!$this->tpl_skip_update_csv) { 
     163            $this->lfDownloadZipFileFromJp(); 
     164            $this->lfExtractZipFile(); 
     165        } 
    163166 
    164167        $objQuery->begin(); 
     
    362365     */ 
    363366   function lfDownloadZipFileFromJp() { 
    364        // Proxy経由を可能とする。         
    365        // TODO Proxyの設定は「DATA_REALDIR . 'module/Request.php'」内の「function HTTP_Request」へ記述する。いずれは、外部設定としたい。 
    366        $req = new HTTP_Request(); 
    367        $req->setURL(ZIP_DOWNLOAD_URL); 
     367        // Proxy経由を可能とする。 
     368        // TODO Proxyの設定は「DATA_REALDIR . 'module/Request.php'」内の「function HTTP_Request」へ記述する。いずれは、外部設定としたい。 
     369        $req = new HTTP_Request(); 
     370 
     371        $req->setURL(ZIP_DOWNLOAD_URL); 
    368372 
    369373        // 郵便番号CSVをdownloadする。 
    370        $res1 = $req->sendRequest(); 
    371         
    372        if ($res1) { 
    373             // 郵便番号CSV(zip file)を保存する。 
    374            $fp = fopen($this->zip_csv_temp_realfile, 'w'); 
    375            $res2 = fwrite($fp, $req->getResponseBody()); 
    376        } 
    377        if (!$res1 or !$res2) { 
    378             // 郵便番号CSVの「downloadに失敗」または「書き込みに失敗」 
    379            SC_Utils_Ex::sfDispException(ZIP_DOWNLOAD_URL . ' の取得または ' . $this->zip_csv_temp_realfile . ' への書き込みに失敗しました。'); 
    380        } 
    381    } 
     374        $res = $req->sendRequest(); 
     375        if (!$res) { 
     376            SC_Utils_Ex::sfDispException(ZIP_DOWNLOAD_URL . ' の取得に失敗しました。'); 
     377        } 
     378 
     379        // 郵便番号CSV(zip file)を保存する。 
     380        $fp = fopen($this->zip_csv_temp_realfile, 'w'); 
     381        if (!$fp) { 
     382            SC_Utils_Ex::sfDispException($this->zip_csv_temp_realfile . ' を開けません。'); 
     383        } 
     384        $res = fwrite($fp, $req->getResponseBody()); 
     385        if (!$res) { 
     386            SC_Utils_Ex::sfDispException($this->zip_csv_temp_realfile . ' への書き込みに失敗しました。'); 
     387        } 
     388    } 
    382389 
    383390    /** 
Note: See TracChangeset for help on using the changeset viewer.