| 88 | | |
|---|
| 89 | | if (getcwd(cwd, MAXPATHLEN)) { |
|---|
| 90 | | if ((dp = opendir (".")) != NULL) { |
|---|
| 91 | | while ((entry = readdir (dp)) != NULL) { |
|---|
| 92 | | if (strstr (entry->d_name, "eaccelerator") == entry->d_name) { |
|---|
| 93 | | strncpy (s, cwd, MAXPATHLEN - 1); |
|---|
| 94 | | strlcat (s, "/", MAXPATHLEN); |
|---|
| 95 | | strlcat (s, entry->d_name, MAXPATHLEN); |
|---|
| 96 | | unlink(s); |
|---|
| | 88 | |
|---|
| | 89 | if ((dp = opendir(dir)) != NULL) { |
|---|
| | 90 | while ((entry = readdir(dp)) != NULL) { |
|---|
| | 91 | strncpy(s, dir, MAXPATHLEN - 1); |
|---|
| | 92 | strlcat(s, "/", MAXPATHLEN); |
|---|
| | 93 | strlcat(s, entry->d_name, MAXPATHLEN); |
|---|
| | 94 | if (strstr(entry->d_name, "eaccelerator") == entry->d_name) { |
|---|
| | 95 | unlink(s); |
|---|
| | 96 | } |
|---|
| | 97 | if (stat(s, &dirstat) != -1) { |
|---|
| | 98 | if (strcmp(entry->d_name, ".") == 0) |
|---|
| | 99 | continue; |
|---|
| | 100 | if (strcmp(entry->d_name, "..") == 0) |
|---|
| | 101 | continue; |
|---|
| | 102 | if (S_ISDIR(dirstat.st_mode)) { |
|---|
| | 103 | clear_filecache(s); |
|---|
| 116 | | /* WIN32 TODO: rewrite this for hashed cache dirs */ |
|---|
| 117 | | { |
|---|
| 118 | | HANDLE hList; |
|---|
| 119 | | TCHAR szDir[MAXPATHLEN]; |
|---|
| 120 | | WIN32_FIND_DATA FileData; |
|---|
| 121 | | char s[MAXPATHLEN]; |
|---|
| 122 | | |
|---|
| 123 | | snprintf (szDir, MAXPATHLEN, "%s\\eaccelerator*", EAG (cache_dir)); |
|---|
| 124 | | |
|---|
| 125 | | if ((hList = FindFirstFile (szDir, &FileData)) != INVALID_HANDLE_VALUE) { |
|---|
| | 113 | { |
|---|
| | 114 | HANDLE hFind; |
|---|
| | 115 | WIN32_FIND_DATA wfd; |
|---|
| | 116 | char path[MAXPATHLEN]; |
|---|
| | 117 | size_t dirlen = strlen(dir); |
|---|
| | 118 | |
|---|
| | 119 | memcpy(path, dir, dirlen); |
|---|
| | 120 | strcpy(path + dirlen++, "\\*"); |
|---|
| | 121 | |
|---|
| | 122 | hFind = FindFirstFile(path, &wfd); |
|---|
| | 123 | if (hFind == INVALID_HANDLE_VALUE) { |
|---|
| 127 | | strncpy (s, EAG (cache_dir), MAXPATHLEN - 1); |
|---|
| 128 | | strlcat (s, "\\", MAXPATHLEN); |
|---|
| 129 | | strlcat (s, FileData.cFileName, MAXPATHLEN); |
|---|
| 130 | | unlink (s); |
|---|
| 131 | | } |
|---|
| 132 | | while (FindNextFile (hList, &FileData)); |
|---|
| 133 | | } |
|---|
| 134 | | |
|---|
| 135 | | FindClose (hList); |
|---|
| | 125 | strcpy(path + dirlen, wfd.cFileName); |
|---|
| | 126 | if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) { |
|---|
| | 127 | clear_filecache(path); |
|---|
| | 128 | } else if (!DeleteFile(path)) { |
|---|
| | 129 | zend_error(E_CORE_WARNING, "Can't delete file %s: error %d", path, GetLastError()); |
|---|
| | 130 | } |
|---|
| | 131 | } while (FindNextFile(hFind, &wfd)); |
|---|
| | 132 | } |
|---|
| | 133 | FindClose (hFind); |
|---|