Source for file LC_Page_Upgrade_Download.php
Documentation is available at LC_Page_Upgrade_Download.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once CLASS_PATH .
'pages/upgrade/LC_Page_Upgrade_Base.php';
require_once DATA_PATH .
'module/Tar.php';
* オーナーズストアからダウンロードデータを取得する.
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Upgrade_Download.php 17193 2008-04-01 00:37:39Z adachi $
$objLog->log('* auth start');
$objJson->setError(OSTORE_E_C_INVALID_ACCESS);
$objLog->error(OSTORE_E_C_INVALID_ACCESS);
$objLog->log('* post param check start');
$arrErr =
$this->objForm->checkError();
$objJson->setError(OSTORE_E_C_INVALID_PARAM);
$objLog->error(OSTORE_E_C_INVALID_PARAM, $_POST);
$objLog->log('* post param check error ' .
print_r($arrErr, true));
$objLog->log('* auto update check start');
if ($mode ==
'auto_update'
$objJson->setError(OSTORE_E_C_AUTOUP_DISABLE);
$objLog->error(OSTORE_E_C_AUTOUP_DISABLE, $_POST);
$objLog->log('* public key check start');
if (empty($public_key)) {
$objJson->setError(OSTORE_E_C_NO_KEY);
$objLog->error(OSTORE_E_C_NO_KEY);
$objLog->log('* http request start');
'eccube_url' =>
SITE_URL,
'public_key' =>
sha1($public_key .
$sha1_key),
'eccube_url' =>
SITE_URL,
'public_key' =>
sha1($public_key .
$sha1_key),
'product_id' =>
$this->objForm->getValue('product_id')
$objReq =
$this->request($mode, $arrPostData);
$objLog->log('* http request check start');
if (PEAR::isError($objReq)) {
$objJson->setError(OSTORE_E_C_HTTP_REQ);
$objLog->error(OSTORE_E_C_HTTP_REQ, $objReq);
$objLog->log('* http response check start');
if ($objReq->getResponseCode() !==
200) {
$objJson->setError(OSTORE_E_C_HTTP_RESP);
$objLog->error(OSTORE_E_C_HTTP_RESP, $objReq);
$body =
$objReq->getResponseBody();
$objRet =
$objJson->decode($body);
$objLog->log('* json data check start');
$objJson->setError(OSTORE_E_C_FAILED_JSON_PARSE);
$objLog->error(OSTORE_E_C_FAILED_JSON_PARSE, $objReq);
if ($objRet->status ===
OSTORE_STATUS_SUCCESS) {
$objLog->log('* save file start');
$dir =
DATA_PATH .
'downloads/tmp/';
$filename =
$time .
'.tar.gz';
$objLog->log("* open ${filename} start");
if ($fp =
@fopen($dir .
$filename, "w")) {
$objJson->setError(OSTORE_E_C_PERMISSION);
$objLog->error(OSTORE_E_C_PERMISSION, $dir .
$filename);
$exract_dir =
$dir .
$time;
$objLog->log("* mkdir ${exract_dir} start");
if (!@mkdir($exract_dir)) {
$objJson->setError(OSTORE_E_C_PERMISSION);
$objLog->error(OSTORE_E_C_PERMISSION, $exract_dir);
$objLog->log("* extract ${dir}${filename} start");
$tar =
new Archive_Tar($dir .
$filename);
$tar->extract($exract_dir);
$objLog->log("* copy batch start");
@include_once CLASS_PATH .
'batch/SC_Batch_Update.php';
$arrCopyLog =
$objBatch->execute($exract_dir);
$objLog->log("* copy batch check start");
if (count($arrCopyLog['err']) >
0) {
$objJson->setError(OSTORE_E_C_BATCH_ERR);
$objLog->error(OSTORE_E_C_BATCH_ERR, $arrCopyLog);
// dtb_module_update_logの更新
$objLog->log("* insert dtb_module_update start");
$objLog->log("* insert/update dtb_module start");
$objLog->log("* file execute start");
$objLog->log("* notify to lockon server start");
$objReq =
$this->notifyDownload($mode, $objReq->getResponseCookies());
$objLog->log('* dl commit result:' .
serialize($objReq));
$productData =
$objRet->data;
$productData->dl_file =
'';
$objJson->setSUCCESS($productData, 'インストール/アップデートに成功しました。');
$objLog->error($objRet->errcode, $objReq);
$this->objForm->addParam(
'product_id', 'product_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')
$this->objForm->setParam($_POST);
$where =
'module_id = ?';
$count =
$objQuery->count($table, $where, array($objRet->product_id));
'module_code' =>
$objRet->product_code,
'module_name' =>
$objRet->product_name,
$objQuery->update($table, $arrUpdate ,$where, array($objRet->product_id));
'module_id' =>
$objRet->product_id,
'module_code' =>
$objRet->product_code,
'module_name' =>
$objRet->product_name,
'auto_update_flg' =>
'0',
'create_date' =>
'NOW()',
$objQuery->insert($table, $arrInsert);
* @param array #arrCookies Cookie配列
$objReq =
$this->request($mode .
'_commit', $arrPOSTParams, $arrCookies);
$objLog->log('* admin login ok');
$objForm->addParam('public_key', 'public_key', MTEXT_LEN, '', array('EXIST_CHECK', 'ALNUM_CHECK', 'MAX_LENGTH_CHECK'));
$objForm->addParam('sha1_key', 'sha1_key', MTEXT_LEN, '', array('EXIST_CHECK', 'ALNUM_CHECK', 'MAX_LENGTH_CHECK'));
$objForm->setParam($_POST);
$objLog->log('* param check start');
$arrErr =
$objForm->checkError();
$objLog->log('* invalid param ' .
print_r($arrErr, true));
$objLog->log('* public_key check start');
if (empty($public_key)) {
$objLog->log('* public_key not found');
$sha1_key =
$objForm->getValue('sha1_key');
$public_key_sha1 =
$objForm->getValue('public_key');
$objLog->log('* ip check start');
&&
$public_key_sha1 ===
sha1($public_key .
$sha1_key)) {
$objLog->log('* auto update login ok');
$objLog->log('* mode invalid ' .
$mode);
'module_id' =>
$objRet->product_id,
'buckup_path' =>
$arrLog['buckup_path'],
'error_flg' =>
count($arrLog['err']),
'error' =>
implode("\n", $arrLog['err']),
'ok' =>
implode("\n", $arrLog['ok']),
'update_date' =>
'NOW()',
$objQuery->insert('dtb_module_update_logs', $arrInsert);
* LC_Update_Updater::execute()で処理を実行する.
$file =
DATA_PATH .
'downloads/update/' .
$productCode .
'_update.php';
$update =
new LC_Update_Updater;
Documentation generated on Tue, 28 Apr 2009 18:13:03 +0900 by phpDocumentor 1.4.2