Changeset 237
- Timestamp:
- 07/24/06 14:49:43 (4 years ago)
- Location:
- eaccelerator/trunk
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
Makefile.in (modified) (1 diff)
-
cache.c (modified) (2 diffs)
-
ea_info.c (modified) (4 diffs)
-
eaccelerator.c (modified) (2 diffs)
-
eaccelerator.h (modified) (1 diff)
-
eaccelerator_version.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
eaccelerator/trunk/ChangeLog
r236 r237 1 2006-07-24 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 2 3 * Make clean routine support dir hashing. Again, this should be tested 4 on win32! 5 * Use a define for the magic string in the eAccelerator file headers 6 * Bump up version to 0.9.5-rc1 7 * Put -O2 back on for -rc1 8 1 9 2006-07-23 Hans Rakers <hans at parse dot nl> 2 10 * Fix for ticket #47 and #63, related to problems restoring empty -
eaccelerator/trunk/Makefile.in
r202 r237 3 3 LTLIBRARY_SHARED_NAME = eaccelerator.la 4 4 5 EXTRA_CFLAGS = -O2 5 EXTRA_CFLAGS = -O2 -g -Wall 6 6 7 7 include $(top_srcdir)/build/dynlib.mk -
eaccelerator/trunk/cache.c
r207 r237 270 270 mm_file_header hdr; 271 271 EACCELERATOR_FLOCK(f, LOCK_EX); 272 strncpy(hdr.magic, "EACCELERATOR", 8);272 strncpy(hdr.magic, EA_MAGIC, 8); 273 273 hdr.eaccelerator_version = binary_eaccelerator_version; 274 274 hdr.zend_version = binary_zend_version; … … 392 392 393 393 EACCELERATOR_FLOCK(f, LOCK_SH); 394 if (read(f, &hdr, sizeof(hdr)) != sizeof(hdr) || strncmp(hdr.magic, "EACCELERATOR", 8) != 0 ||394 if (read(f, &hdr, sizeof(hdr)) != sizeof(hdr) || strncmp(hdr.magic, EA_MAGIC, 8) != 0 || 395 395 hdr.eaccelerator_version != binary_eaccelerator_version || hdr.zend_version != binary_zend_version 396 396 || hdr.php_version != binary_php_version) { -
eaccelerator/trunk/ea_info.c
r232 r237 107 107 closedir (dp); 108 108 } else { 109 ea_debug_error(" eAccelerator: Could not open cachedir %s\n", dir);109 ea_debug_error("[%s] Could not open cachedir %s\n", EACCELERATOR_EXTENSION_NAME, dir); 110 110 } 111 111 } … … 118 118 119 119 memcpy(path, dir, dirlen); 120 strcpy(path + dirlen++, "\\ *");120 strcpy(path + dirlen++, "\\eaccelerator*"); 121 121 122 122 hFind = FindFirstFile(path, &wfd); … … 127 127 clear_filecache(path); 128 128 } else if (!DeleteFile(path)) { 129 zend_error(E_CORE_WARNING, "Can't delete file %s: error %d", path, GetLastError()); 129 ea_debug_error("[%s] Can't delete file %s: error %d\n", EACCELERATOR_EXTENSION_NAME, path, GetLastError()); 130 } 131 } while (FindNextFile(hFind, &wfd)); 132 } 133 FindClose (hFind); 134 } 135 #endif 136 /* }}} */ 137 138 /* {{{ clean_file: check if the given file is expired */ 139 static inline void clean_file(char *file, time_t t) 140 { 141 int f; 142 143 if ((f = open(file, O_RDONLY | O_BINARY)) > 0) { 144 mm_file_header hdr; 145 EACCELERATOR_FLOCK (f, LOCK_SH); 146 if (read(f, &hdr, sizeof(hdr)) != sizeof(hdr) 147 || strncmp (hdr.magic, EA_MAGIC, 8) != 0 148 || (hdr.mtime != 0 && hdr.mtime < t)) { 149 EACCELERATOR_FLOCK (f, LOCK_UN); 150 close (f); 151 unlink (file); 152 } else { 153 EACCELERATOR_FLOCK (f, LOCK_UN); 154 close (f); 155 } 156 } 157 } 158 /* }}} */ 159 160 /* {{{ clean_filecache(): Helper function for eaccelerator_clean, it will remove all expired entries from the user cache */ 161 static void clean_filecache(const char* dir, time_t t) 162 #ifndef ZEND_WIN32 163 { 164 DIR *dp; 165 struct dirent *entry; 166 char s[MAXPATHLEN]; 167 struct stat dirstat; 168 169 if ((dp = opendir(dir)) != NULL) { 170 while ((entry = readdir(dp)) != NULL) { 171 strncpy(s, dir, MAXPATHLEN - 1); 172 strlcat(s, "/", MAXPATHLEN); 173 strlcat(s, entry->d_name, MAXPATHLEN); 174 if (strstr(entry->d_name, "eaccelerator-user") == entry->d_name) { 175 clean_file(s, t); 176 } 177 if (stat(s, &dirstat) != -1) { 178 if (strcmp(entry->d_name, ".") == 0) 179 continue; 180 if (strcmp(entry->d_name, "..") == 0) 181 continue; 182 if (S_ISDIR(dirstat.st_mode)) { 183 clean_filecache(s, t); 184 } 185 } 186 } 187 closedir (dp); 188 } else { 189 ea_debug_error("[%s] Could not open cachedir %s\n", EACCELERATOR_EXTENSION_NAME, dir); 190 } 191 } 192 #else 193 { 194 HANDLE hFind; 195 WIN32_FIND_DATA wfd; 196 char path[MAXPATHLEN]; 197 size_t dirlen = strlen(dir); 198 199 memcpy(path, dir, dirlen); 200 strcpy(path + dirlen++, "\\eaccelerator-user*"); 201 202 hFind = FindFirstFile(path, &wfd); 203 if (hFind == INVALID_HANDLE_VALUE) { 204 do { 205 strcpy(path + dirlen, wfd.cFileName); 206 if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) { 207 clear_filecache(path); 208 } else { 209 clean_file(path, t); 130 210 } 131 211 } while (FindNextFile(hFind, &wfd)); … … 202 282 203 283 /* Remove expired keys (session data, content) from disk cache */ 204 #ifndef ZEND_WIN32 205 /* clear file cache */ 206 { 207 DIR *dp; 208 struct dirent *entry; 209 char s[MAXPATHLEN]; 210 211 if ((dp = opendir (EAG (cache_dir))) != NULL) { 212 while ((entry = readdir (dp)) != NULL) { 213 if (strstr(entry->d_name, "eaccelerator-user") == entry->d_name) { 214 int f; 215 strncpy (s, EAG (cache_dir), MAXPATHLEN - 1); 216 strlcat (s, "/", MAXPATHLEN); 217 strlcat (s, entry->d_name, MAXPATHLEN); 218 if ((f = open (s, O_RDONLY | O_BINARY)) > 0) { 219 mm_file_header hdr; 220 EACCELERATOR_FLOCK (f, LOCK_SH); 221 if (read (f, &hdr, sizeof (hdr)) != sizeof (hdr) 222 || strncmp (hdr.magic, "EACCELERATOR", 8) != 0 || (hdr.mtime != 0 && hdr.mtime < t)) { 223 EACCELERATOR_FLOCK (f, LOCK_UN); 224 close (f); 225 unlink (s); 226 } else { 227 EACCELERATOR_FLOCK (f, LOCK_UN); 228 close (f); 229 } 230 } 231 } 232 } 233 closedir (dp); 234 } 235 } 236 #else 237 { 238 HANDLE hList; 239 TCHAR szDir[MAXPATHLEN]; 240 WIN32_FIND_DATA FileData; 241 char s[MAXPATHLEN]; 242 243 snprintf (szDir, MAXPATHLEN, "%s\\eaccelerator-user*", EAG (cache_dir)); 244 245 if ((hList = FindFirstFile (szDir, &FileData)) != INVALID_HANDLE_VALUE) { 246 do { 247 int f; 248 strncpy (s, EAG (cache_dir), MAXPATHLEN - 1); 249 strlcat (s, "\\", MAXPATHLEN); 250 strlcat (s, FileData.cFileName, MAXPATHLEN); 251 if ((f = open (s, O_RDONLY | O_BINARY)) > 0) { 252 mm_file_header hdr; 253 EACCELERATOR_FLOCK (f, LOCK_SH); 254 if (read (f, &hdr, sizeof (hdr)) != sizeof (hdr) 255 || strncmp (hdr.magic, "EACCELERATOR", 8) != 0 || (hdr.mtime != 0 && hdr.mtime < t)) { 256 EACCELERATOR_FLOCK (f, LOCK_UN); 257 close (f); 258 unlink (s); 259 } else { 260 EACCELERATOR_FLOCK (f, LOCK_UN); 261 close (f); 262 } 263 } 264 } 265 while (FindNextFile (hList, &FileData)); 266 } 267 FindClose (hList); 268 } 269 #endif 284 clean_filecache(EAG(cache_dir), t); 285 270 286 /* Remove expired keys (session data, content) from shared memory */ 271 287 eaccelerator_gc (TSRMLS_C); -
eaccelerator/trunk/eaccelerator.c
r228 r237 634 634 return NULL; 635 635 } 636 if (strncmp(hdr.magic, "EACCELERATOR",8) != 0 ||636 if (strncmp(hdr.magic, EA_MAGIC, 8) != 0 || 637 637 hdr.eaccelerator_version != binary_eaccelerator_version || 638 638 hdr.zend_version != binary_zend_version || … … 732 732 if (f > 0) { 733 733 EACCELERATOR_FLOCK(f, LOCK_EX); 734 strncpy(hdr.magic, "EACCELERATOR", 8);734 strncpy(hdr.magic, EA_MAGIC, 8); 735 735 hdr.eaccelerator_version = binary_eaccelerator_version; 736 736 hdr.zend_version = binary_zend_version; -
eaccelerator/trunk/eaccelerator.h
r222 r237 486 486 #define EACCELERATOR_LOADER_EXTENSION_NAME "eLoader" 487 487 488 #define EA_MAGIC "EACCELERATOR" 489 488 490 #define EA_ENCODER_VERSION 0x00000004 489 491 #define EA_ENCODER_END 0x00 -
eaccelerator/trunk/eaccelerator_version.h
r197 r237 1 1 #ifndef EACCELERATOR_VERSION 2 #define EACCELERATOR_VERSION "0.9.5- beta2"2 #define EACCELERATOR_VERSION "0.9.5-rc1" 3 3 #endif
Note: See TracChangeset
for help on using the changeset viewer.