Changeset 23388 for branches/version-2_13-dev/data/class/pages/admin/system/LC_Page_Admin_System_Bkup.php
- Timestamp:
- 2014/05/01 16:34:42 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/pages/admin/system/LC_Page_Admin_System_Bkup.php
r23124 r23388 42 42 ); 43 43 44 /** ヘッダーを出力するか (cbOutputCSV 用) */ 45 private $output_header = false; 46 44 47 /** 45 48 * Page を初期化する. … … 185 188 186 189 // ダウンロード開始 187 Header("Content-disposition: attachment; filename=${filename}"); 188 Header("Content-type: application/octet-stream; name=${filename}"); 189 header('Content-Length: ' .filesize($dl_file)); 190 readfile ($dl_file); 191 exit(); 190 SC_Response_Ex::headerForDownload($filename); 191 header('Content-Length: ' . filesize($dl_file)); 192 readfile($dl_file); 193 SC_Response_Ex::actionExit(); 192 194 break; 193 195 } … … 289 291 // dataをCSV出力 290 292 $csv_file = $work_dir . $table . '.csv'; 291 $ fp = fopen($csv_file, 'w');292 if (!$ fp) {293 $this->fpOutput = fopen($csv_file, 'w');; 294 if (!$this->fpOutput) { 293 295 return __LINE__; 294 296 } … … 297 299 $sql = 'SELECT * FROM ' . $objQuery->conn->quoteIdentifier($table); 298 300 299 $this->fpOutput =& $fp; 300 $this->first_line = true; 301 $this->output_header = true; 301 302 $success = $objQuery->doCallbackAll(array(&$this, 'cbOutputCSV'), $sql); 302 unset($this->fpOutput); 303 304 fclose($this->fpOutput); 303 305 304 306 if ($success === false) { 305 307 return __LINE__; 306 308 } 307 308 fclose($fp);309 309 310 310 // タイムアウトを防ぐ … … 351 351 public function cbOutputCSV($data) 352 352 { 353 $line = ''; 354 if ($this->first_line) { 355 // カラム名 356 $line .= SC_Helper_CSV_Ex::sfArrayToCsv(array_keys($data)) . "\n"; 357 $this->first_line = false; 358 } 359 $line .= SC_Helper_CSV_Ex::sfArrayToCsv($data); 360 $line .= "\n"; 353 // 1行目のみヘッダーを出力する 354 if ($this->output_header) { 355 fputcsv($this->fpOutput, array_keys($data)); 356 $this->output_header = false; 357 } 358 fputcsv($this->fpOutput, $data); 361 359 SC_Utils_Ex::extendTimeOut(); 362 360 363 return fwrite($this->fpOutput, $line);361 return true; 364 362 } 365 363
Note: See TracChangeset
for help on using the changeset viewer.