Changeset 241
- Timestamp:
- 2007/02/13 17:40:07 (19 years ago)
- Location:
- branches/dev/data
- Files:
-
- 2 edited
-
conf/conf.php (modified) (1 diff)
-
lib/glib.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/dev/data/conf/conf.php
r152 r241 180 180 define ("ADMIN_MODE", 0); // ´ÉÍý¥â¡¼¥É 1:͸ú¡¡0:̵¸ú(ǼÉÊ»þ) 181 181 define ("DAILY_BATCH_MODE", false); // Çä¾å½¸·×¥Ð¥Ã¥Á¥â¡¼¥É(true:¥Ð¥Ã¥Á¤Ç½¸·×¤¹¤ë ¢¨Í×cronÀßÄê¡¢false:¥ê¥¢¥ë¥¿¥¤¥à¤Ç½¸·×¤¹¤ë) 182 define ("MAX_LOG_QUANTITY", 5); // ¥í¥°¥Õ¥¡¥¤¥ëºÇÂç¿ô(¥í¥°¥Æ¡¼¥·¥ç¥ó) 183 define ("MAX_LOG_SIZE", "10000"); // 1¤Ä¤Î¥í¥°¥Õ¥¡¥¤¥ë¤ËÊݸ¤¹¤ëºÇÂçÍÆÎÌ(byte) 182 184 183 185 define ("FORGOT_MAIL", 0); // ¥Ñ¥¹¥ï¡¼¥É˺¤ì¤Î³Îǧ¥á¡¼¥ë¤òÁ÷ÉÕ¤¹¤ë¤«Èݤ«¡£(0:Á÷¿®¤·¤Ê¤¤¡¢1:Á÷¿®¤¹¤ë) -
branches/dev/data/lib/glib.php
r17 r241 96 96 fclose( $fp ); 97 97 gfPrintLog("*** end Debug ***"); 98 99 // ¥í¥°¥Æ¡¼¥·¥ç¥ó 100 gfLogRotation(MAX_LOG_QUANTITY, MAX_LOG_SIZE, LOG_PATH); 98 101 } 99 102 … … 123 126 fwrite( $fp, $today." [".$_SERVER['PHP_SELF']."] ".$mess." from ". $_SERVER['REMOTE_ADDR']. "\n" ); 124 127 fclose( $fp ); 128 } 129 130 // ¥í¥°¥Æ¡¼¥·¥ç¥ó 131 gfLogRotation(MAX_LOG_QUANTITY, MAX_LOG_SIZE, $path); 132 } 133 134 /** 135 * ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥óµ¡Ç½ 136 * 137 * @param integer $max_log ºÇÂç¥Õ¥¡¥¤¥ë¿ô 138 * @param integer $max_size ºÇÂ祵¥¤¥º 139 * @param string $path ¥Õ¥¡¥¤¥ë¥Ñ¥¹ 140 * @return void ¤Ê¤· 141 */ 142 function gfLogRotation($max_log, $max_size, $path) { 143 144 // ¥Ç¥£¥ì¥¯¥È¥ê̾¤ò¼èÆÀ 145 $dirname = dirname($path); 146 // ¥Õ¥¡¥¤¥ë̾¤ò¼èÆÀ 147 $basename = basename($path); 148 149 // ¥Õ¥¡¥¤¥ë¤¬ºÇÂ祵¥¤¥º¤òͤ¨¤Æ¤¤¤Ê¤¤¤«¥Á¥§¥Ã¥¯ 150 if(filesize($path) > $max_size) { 151 if ($dh = opendir($dirname)) { 152 while (($file = readdir($dh)) !== false) { 153 // ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥ó¤Ë¤ÆºîÀ®¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ò¼èÆÀ 154 if(ereg("^". $basename . "\." , $file)) { 155 $arrLog[] = $file; 156 } 157 } 158 159 // ¥Õ¥¡¥¤¥ë¥í¥°¤¬ºÇÂç¸Ä¿ô¤Ê¤é°Ê¾å¤Ê¤é¸Å¤¤¥Õ¥¡¥¤¥ë¤«¤éºï½ü¤¹¤ë 160 $count = count($arrLog); 161 if($count >= $max_log) { 162 $diff = $count - $max_log; 163 for($i = 0; $diff >= $i ; $i++) { 164 unlink($dirname. "/" .array_pop($arrLog)); 165 } 166 } 167 168 // ¥í¥°¥Õ¥¡¥¤¥ë¤Îꤍ»ú¤ò¤º¤é¤¹ 169 $count = count($arrLog); 170 for($i = $count; 1 <= $i; $i--) { 171 $move_number = $i + 1; 172 173 if(file_exists("$path.$move_number")) unlink("$path.$move_number"); 174 copy("$dirname/" . $arrLog[$i - 1], "$path.$move_number"); 175 176 } 177 $ret = copy($path, "$path.1"); 178 179 // ¿·µ¬¥í¥°¥Õ¥¡¥¤¥ë¤òºîÀ® 180 if($ret) { 181 unlink($path); 182 touch($path); 183 } 184 } 125 185 } 126 186 }
Note: See TracChangeset
for help on using the changeset viewer.
