Finished speed optimize mbfile index command
This commit is contained in:
parent
429b98994a
commit
c9f50a1b23
@ -193,7 +193,7 @@ void Check(long AreaNr)
|
|||||||
free(sAreas);
|
free(sAreas);
|
||||||
free(fAreas);
|
free(fAreas);
|
||||||
|
|
||||||
Syslog('+', "Check Areas [%5d] Files [%5d] Errors [%5d]", iAreasNew, iTotal, iErrors);
|
Syslog('+', "Check Areas [%6d] Files [%6d] Errors [%6d]", iAreasNew, iTotal, iErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ int lastfile; /* Last file number */
|
|||||||
long gfilepos = 0; /* Global file position */
|
long gfilepos = 0; /* Global file position */
|
||||||
int TotalHtml = 0; /* Total html files */
|
int TotalHtml = 0; /* Total html files */
|
||||||
int AreasHtml = 0; /* Total html areas */
|
int AreasHtml = 0; /* Total html areas */
|
||||||
|
int aUpdate = 0; /* Updated areas */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -262,7 +263,6 @@ FILE *newpage(char *Path, char *Name, time_t later, int inArea, int Current, FIL
|
|||||||
char linebuf[1024], outbuf[1024];
|
char linebuf[1024], outbuf[1024];
|
||||||
static FILE* fa;
|
static FILE* fa;
|
||||||
|
|
||||||
Syslog('f', "newpage %s %s %d %d", Path, Name, inArea, Current);
|
|
||||||
lastfile = Current;
|
lastfile = Current;
|
||||||
if (Current)
|
if (Current)
|
||||||
sprintf(linebuf, "%s/index%d.temp", Path, Current / CFG.www_files_page);
|
sprintf(linebuf, "%s/index%d.temp", Path, Current / CFG.www_files_page);
|
||||||
@ -291,8 +291,6 @@ void closepage(FILE *fa, char *Path, int inArea, int Current, FILE *fi)
|
|||||||
{
|
{
|
||||||
char *temp1, *temp2;
|
char *temp1, *temp2;
|
||||||
|
|
||||||
Syslog('f', "closepage %s %d %d", Path, inArea, Current);
|
|
||||||
|
|
||||||
if (fa == NULL)
|
if (fa == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -325,7 +323,7 @@ void ReqIndex(void)
|
|||||||
FILE *pAreas, *pIndex, *fp;
|
FILE *pAreas, *pIndex, *fp;
|
||||||
unsigned long i, iAreas, iAreasNew = 0, record;
|
unsigned long i, iAreas, iAreasNew = 0, record;
|
||||||
int iTotal = 0, j, z, x = 0;
|
int iTotal = 0, j, z, x = 0;
|
||||||
int fbAreas = 0, fbFiles = 0;
|
int fbAreas = 0, fbFiles = 0, fbUpdate = 0;
|
||||||
char *sAreas, *newdir = NULL, *sIndex, *temp;
|
char *sAreas, *newdir = NULL, *sIndex, *temp;
|
||||||
Findex *fdx = NULL;
|
Findex *fdx = NULL;
|
||||||
Findex *tmp;
|
Findex *tmp;
|
||||||
@ -428,6 +426,7 @@ void ReqIndex(void)
|
|||||||
WriteError("$Can't create %s", temp);
|
WriteError("$Can't create %s", temp);
|
||||||
} else {
|
} else {
|
||||||
fbAreas++;
|
fbAreas++;
|
||||||
|
fbUpdate++;
|
||||||
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
|
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
|
||||||
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
|
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
|
||||||
if (!fdb.Deleted) {
|
if (!fdb.Deleted) {
|
||||||
@ -441,6 +440,17 @@ void ReqIndex(void)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
chmod(temp, 0644);
|
chmod(temp, 0644);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Just count for statistics
|
||||||
|
*/
|
||||||
|
fbAreas++;
|
||||||
|
fseek(fdb_area->fp, fdbhdr.hdrsize, SEEK_SET);
|
||||||
|
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
|
||||||
|
if (!fdb.Deleted) {
|
||||||
|
fbFiles++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -501,8 +511,8 @@ void ReqIndex(void)
|
|||||||
fclose(pIndex);
|
fclose(pIndex);
|
||||||
tidy_index(&fdx);
|
tidy_index(&fdx);
|
||||||
|
|
||||||
Syslog('+', "FREQ. Areas [%5d] Files [%5d]", iAreasNew, iTotal);
|
Syslog('+', "FREQ. Areas [%6d] Files [%6d] Updated [%6d]", iAreasNew, iTotal, fbUpdate);
|
||||||
Syslog('+', "Index Areas [%5d] Files [%5d]", fbAreas, fbFiles);
|
Syslog('+', "Index Areas [%6d] Files [%6d] Updated [%6d]", fbAreas, fbFiles, fbUpdate);
|
||||||
|
|
||||||
free(sAreas);
|
free(sAreas);
|
||||||
free(sIndex);
|
free(sIndex);
|
||||||
@ -533,6 +543,7 @@ void HtmlIndex(char *Lang)
|
|||||||
|
|
||||||
AreasHtml = 0;
|
AreasHtml = 0;
|
||||||
TotalHtml = 0;
|
TotalHtml = 0;
|
||||||
|
aUpdate = 0;
|
||||||
later = time(NULL) + 86400;
|
later = time(NULL) + 86400;
|
||||||
|
|
||||||
IsDoing("Create html");
|
IsDoing("Create html");
|
||||||
@ -655,6 +666,7 @@ void HtmlIndex(char *Lang)
|
|||||||
x++;
|
x++;
|
||||||
TotalHtml++;
|
TotalHtml++;
|
||||||
aTotal++;
|
aTotal++;
|
||||||
|
aUpdate++;
|
||||||
if (CFG.slow_util && do_quiet && ((x % 3) == 0))
|
if (CFG.slow_util && do_quiet && ((x % 3) == 0))
|
||||||
msleep(1);
|
msleep(1);
|
||||||
|
|
||||||
@ -818,7 +830,7 @@ void Index(void)
|
|||||||
{
|
{
|
||||||
ReqIndex();
|
ReqIndex();
|
||||||
HtmlIndex(NULL);
|
HtmlIndex(NULL);
|
||||||
Syslog('+', "HTML Areas [%5d] Files [%5d]", AreasHtml, TotalHtml);
|
Syslog('+', "HTML Areas [%6d] Files [%6d] Updated [%6d]", AreasHtml, TotalHtml, aUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ void PackFileBase(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(pAreas);
|
fclose(pAreas);
|
||||||
Syslog('+', "Pack Areas [%5d] Files [%5d] Removed [%5d]", iAreasNew, iTotal, iRemoved);
|
Syslog('+', "Pack Areas [%6d] Files [%6d] Removed [%6d]", iAreasNew, iTotal, iRemoved);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("\r \r");
|
printf("\r \r");
|
||||||
|
Reference in New Issue
Block a user