Changeset 16420
- Timestamp:
- 2007/10/14 22:55:13 (16 years ago)
- Location:
- branches/feature-module-update/data/class
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update/data/class/batch/SC_Batch_Update.php
r16343 r16420 37 37 */ 38 38 function execute($target = ".") { 39 $arrLog = array(); 39 40 $includeArray = explode(',', $this->includes); 40 41 $excludeArray = explode(',', $this->excludes); … … 55 56 // distinfo.php を読み込む 56 57 if ($fileName == "distinfo.php") { 57 include_once($ fileName);58 include_once($path); 58 59 } 59 60 60 61 // 除外ファイルをスキップ 61 62 if (in_array($fileName, $excludeArray)) { 62 echo"excludes by " . $path . "\n";63 $arrLog[] = "excludes by " . $path . "\n"; 63 64 continue; 64 65 } … … 67 68 $sha1 = sha1_file($path); 68 69 69 echo$sha1 . " => " . $path . "\n";70 $arrLog[] = $sha1 . " => " . $path . "\n"; 70 71 71 72 … … 81 82 $out = $distinfo[$sha1]; 82 83 } else { 83 die("ハッシュ値が一致しないため, コピー先が取得できません."); 84 $arrLog[] = "ハッシュ値が一致しないため, コピー先が取得できません."; 85 die(); 84 86 } 85 87 86 88 // ファイルを書き出しモードで開く 87 $handle = fopen($out, "w");89 $handle = @fopen($out, "w"); 88 90 if (!$handle) { 89 echo "Cannot open file (". $out . ")"; 90 continue; 91 // ディレクトリ作成を行ってリトライ 92 $this->mkdir_p($out); 93 $handle = @fopen($out, "w"); 94 if (!$handle) { 95 $arrLog[] = "Cannot open file (". $out . ")\n"; 96 continue; 97 } 91 98 } 92 99 93 100 // 取得した内容を書き込む 94 101 if (fwrite($handle, $contents) === false) { 95 echo "Cannot write to file (" . $out . ")";102 $arrLog[] = "Cannot write to file (" . $out . ")\n"; 96 103 continue; 97 104 } 98 105 99 echo"copyed " . $out . "\n";106 $arrLog[] = "copyed " . $out . "\n"; 100 107 // ファイルを閉じる 101 108 fclose($handle); … … 104 111 } 105 112 } 106 echo "Finished Successful!\n"; 113 $arrLog[] = "Finished Successful!\n"; 114 return $arrLog; 107 115 } 108 116 … … 123 131 return $alldirs; 124 132 } 133 134 /** 135 * mkdir -p 136 * 137 * @param string $path 絶対パス 138 */ 139 function mkdir_p($path){ 140 $path = dirname($path); 141 $path = str_replace ('\\', '/', $path); 142 143 $arrDirs = explode("/", $path); 144 $dir = ''; 145 146 foreach($arrDirs as $n){ 147 $dir .= $n . '/'; 148 if(!file_exists($dir)) { 149 if (!@mkdir($dir)) return; 150 } 151 } 152 } 125 153 } 126 154 ?> -
branches/feature-module-update/data/class/pages/upgrade/LC_Page_Upgrade_Base.php
r16383 r16420 1 1 <?php 2 /* 3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 4 * 5 * http://www.lockon.co.jp/ 6 */ 2 7 8 // {{{ requires 9 require_once CLASS_PATH . 'pages/LC_Page.php'; 10 11 /** 12 * オーナーズストア連携の基底クラス 13 * 14 * @package Page 15 * @author LOCKON CO.,LTD. 16 * @version $Id$ 17 */ 18 class LC_Page_Upgrade_Base extends LC_Page { 19 20 // }}} 21 // {{{ functions 22 23 function LC_Page_Upgrade_Base() { 24 $this->objJson = new Services_Json(); 25 } 26 /** 27 * 配信サーバへリクエストを送信する. 28 * 29 * @param string $mode 30 * @param array $arrParams 追加パラメータ.連想配列で渡す. 31 * @return string|object レスポンスボディ|エラー時にはPEAR::Errorオブジェクトを返す. 32 */ 33 function request($mode, $arrParams = array()) { 34 $objReq = new HTTP_Request(); 35 $objReq->setUrl('http://cube-shopaccount/upgrade/index.php'); 36 $objReq->setMethod('POST'); 37 $objReq->addPostData('mode', $mode); 38 $objReq->addPostData('site_url', SITE_URL); 39 $objReq->addPostData('ssl_url', SSL_URL); 40 $objReq->addPostDataArray($arrParams); 41 42 $e = $objReq->sendRequest(); 43 if (PEAR::isError($e)) { 44 return $e; 45 } 46 47 if (($code = $objReq->getResponseCode()) !== 200) { 48 return PEAR::raiseError('HTTP RESPONSE CODE:' . $code); 49 } 50 51 return $objReq->getResponseBody(); 52 } 53 54 /** 55 * ユーザへ結果を通知する. 56 * 57 * @param integer $status ステータスコード 58 * @param string $message ステータスメッセージ 59 * @param array arrParam 追加パラメータ 60 * @return void 61 */ 62 function displayJson($status, $message, $arrParam = array()) { 63 $arrData = array( 64 'status' => $status, 65 'body' => $message 66 ); 67 echo $this->objJson->encode(array_merge($arrData, $arrParam)); 68 } 69 70 /** 71 * ログ出力を行う 72 * 73 * @param integer $message logメッセージ 74 * @param string $val debug用パラメータ 75 */ 76 function log($message, $val = null) { 77 $msg = sprintf("%s / debug: %s", $message, serialize($val)); 78 GC_Utils::gfPrintLog($msg, DATA_PATH . 'logs/ownersstore.log'); 79 } 80 } 3 81 ?> -
branches/feature-module-update/data/class/pages/upgrade/LC_Page_Upgrade_ProductsList.php
r16383 r16420 8 8 // {{{ requires 9 9 require_once CLASS_PATH . 'pages/LC_Page.php'; 10 require_once DATA_PATH . 'module/Services/JSON.php';11 require_once DATA_PATH . 'module/Request.php';12 10 13 11 /** … … 39 37 function process() { 40 38 $objSess = new SC_Session(); 41 if ( 39 if ($objSess->isSuccess() !== true) { 42 40 // TODO エラー処理 43 41 } … … 71 69 parent::destroy(); 72 70 } 73 74 75 function createResponceHTML() {}76 71 } 77 72 ?>
Note: See TracChangeset
for help on using the changeset viewer.