/** * 获取合图改变列表,并生成新的md5数据 * @return array */ private static function getChangeMergeImage() { static $ret = null; if (!is_null($ret)) { return $ret; } $ret = array(self::MODIFY => array(), self::ADD => array(), self::DELETE => array()); $file = C('INCRE.PATH') . '/' . C('INCRE.MD5_FILENAME'); $nData = IncreMap::getMd5Map(); if (file_exists($file)) { $oData = (include $file); } if (isset($oData)) { foreach ($nData as $key => $value) { $action = null; if (isset($oData[$key])) { // 同一张图,md5不同,则表示已修改 if ($oData[$key] !== $value) { $action = self::MODIFY; } // 从oData中删除,最后oData中剩下的值即为已删除的图片 unset($oData[$key]); } else { // 不存在,则表示是新增 $action = self::ADD; } if (!is_null($action)) { array_push($ret[$action], $key); } } $ret[self::DELETE] = array_map('basename', array_keys($oData)); } return $ret; }