Source for file SC_Batch_Update.php
Documentation is available at SC_Batch_Update.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 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_REALDIR . 'batch/SC_Batch.php';
* @author LOCKON CO.,LTD.
* @version $Id: SC_Batch_Update.php 21120 2011-08-03 13:37:38Z kajiwara $
* 変換したいファイルの拡張子をカンマ区切りで羅列.
var $includes = "php,inc,tpl,css,sql,js,png,jpg,gif,swf,txt,doc,pdf";
* @param string $target アップデータファイルのディレクトリパス
$bkupDistInfoArray = array(); //バックアップファイル用のdistinfoファイル内容
$bkupPath = DATA_REALDIR . 'downloads/backup/update_' . time() . '/';
$bkupPathFile = $bkupPath . 'files/';
'buckup_path' => $bkupPath
$msg = 'バックアップディレクトリの作成に失敗しました';
foreach ($fileArrays as $path) {
$fileName = pathinfo($path, PATHINFO_BASENAME);
$suffix = pathinfo($path, PATHINFO_EXTENSION);
$distinfo = isset ($distinfo) ? $distinfo : "";
if ($fileName == "distinfo.php") {
if (in_array($fileName, $excludeArray)) {
//$arrLog['ok'][] = "次のファイルは除外されました: " . $path;
$msg = "次のファイルは除外されました: " . $path;
//$arrLog[] = $sha1 . " => " . $path;
foreach ($includeArray as $include) {
if ($suffix == $include) {
if (!empty($distinfo[$sha1])) {
$msg = "ハッシュ値が一致しないため, コピー先が取得できません: " . $path;
$msg = "同じ内容のファイルをスキップしました: " . $out;
$bkupTo = $bkupPathFile . pathinfo($out, PATHINFO_BASENAME);
if (!@copy($out, $bkupTo)) {
$msg = "バックアップファイルの作成に失敗しました: " . $out . ' -> ' . $bkupTo;
$msg = "バックアップファイルの作成に成功しました: " . $out . ' -> ' . $bkupTo;
$handle = @fopen($out, 'w');
$handle = @fopen($out, 'w');
$msg = "コピー先に書き込み権限がありません: " . $out;
if (fwrite($handle, $contents) === false) {
$msg = "コピー先に書き込み権限がありません: " . $out;
$msg = "ファイルのコピーに成功しました: " . $out;
$handle = @fopen($bkupPath . 'distinfo.php', 'w');
$msg = "distinfoファイルの作成に成功しました: " . $bkupPath . 'distinfo.php';
$msg = "distinfoファイルの作成に失敗しました: " . $bkupPath . 'distinfo.php';
* $dir を再帰的に辿ってパス名を配列で返す.
* @return array $dir より下層に存在するパス名の配列
* @see http://www.php.net/glob
static $alldirs = array();
$dirs = glob($dir . '/*');
if (is_array($dirs) && count($dirs) > 0) {
foreach ($dirs as $d) $alldirs[] = $d;
foreach ($dirs as $dir) $this->listdirs($dir);
* @param string $path 絶対パス
// HTML_REALDIR/DATA_REALDIRの判別
if (preg_match("@\Q". HTML_REALDIR. "\E@", $path) > 0) {
} elseif (preg_match("@\Q". DATA_REALDIR. "\E@", $path) > 0) {
if (!@mkdir($dir)) break;
. '$distifo = array(' . "\n";
foreach ($bkupDistInfoArray as $key => $value) {
$src .= "'${key}' => '${value}',\n";
GC_Utils_Ex::gfPrintLog($msg, DATA_REALDIR . 'logs/ownersstore_batch_update.log');
Documentation generated on Fri, 24 Feb 2012 14:02:24 +0900 by Seasoft
|