mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-24 04:20:56 -04:00
Merge pull request #666 from kiwix/implement_skip_option_2
kiwix-serve: Skip invalid ZIM files and continue startup #659
This commit is contained in:
commit
3377f9e8bb
@ -88,6 +88,10 @@ Override the welcome page with a custom HTML file.
|
|||||||
\fB-L N, --ipConnectionLimit=N\fR
|
\fB-L N, --ipConnectionLimit=N\fR
|
||||||
Max number of (concurrent) connections per IP (default: infinite, recommended: >= 6).
|
Max number of (concurrent) connections per IP (default: infinite, recommended: >= 6).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fB-k, --skipInvalid\fR
|
||||||
|
Startup even when ZIM files are invalid (those will be skipped)
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fB-v, --verbose\fR
|
\fB-v, --verbose\fR
|
||||||
Print debug log to STDOUT.
|
Print debug log to STDOUT.
|
||||||
|
@ -77,6 +77,7 @@ void usage()
|
|||||||
<< "\t-z, --nodatealiases\tCreate URL aliases for each content by removing the date" << std::endl
|
<< "\t-z, --nodatealiases\tCreate URL aliases for each content by removing the date" << std::endl
|
||||||
<< "\t-c, --customIndex\tAdd path to custom index.html for welcome page" << std::endl
|
<< "\t-c, --customIndex\tAdd path to custom index.html for welcome page" << std::endl
|
||||||
<< "\t-L, --ipConnectionLimit\tMax number of (concurrent) connections per IP (default: infinite, recommended: >= 6)" << std::endl
|
<< "\t-L, --ipConnectionLimit\tMax number of (concurrent) connections per IP (default: infinite, recommended: >= 6)" << std::endl
|
||||||
|
<< "\t-k, --skipInvalid\tStartup even when ZIM files are invalid (those will be skipped)" << std::endl
|
||||||
<< std::endl
|
<< std::endl
|
||||||
|
|
||||||
<< "Documentation:" << std::endl
|
<< "Documentation:" << std::endl
|
||||||
@ -217,6 +218,7 @@ int main(int argc, char** argv)
|
|||||||
unsigned int PPID = 0;
|
unsigned int PPID = 0;
|
||||||
int ipConnectionLimit = 0;
|
int ipConnectionLimit = 0;
|
||||||
int searchLimit = 0;
|
int searchLimit = 0;
|
||||||
|
bool skipInvalid = false;
|
||||||
|
|
||||||
static struct option long_options[]
|
static struct option long_options[]
|
||||||
= {{"daemon", no_argument, 0, 'd'},
|
= {{"daemon", no_argument, 0, 'd'},
|
||||||
@ -237,6 +239,7 @@ int main(int argc, char** argv)
|
|||||||
{"monitorLibrary", no_argument, 0, 'M'},
|
{"monitorLibrary", no_argument, 0, 'M'},
|
||||||
{"ipConnectionLimit", required_argument, 0, 'L'},
|
{"ipConnectionLimit", required_argument, 0, 'L'},
|
||||||
{"searchLimit", required_argument, 0, 's'},
|
{"searchLimit", required_argument, 0, 's'},
|
||||||
|
{"skipInvalid", no_argument, 0, 'k'},
|
||||||
{0, 0, 0, 0}};
|
{0, 0, 0, 0}};
|
||||||
|
|
||||||
std::set<int> usedOptions;
|
std::set<int> usedOptions;
|
||||||
@ -307,6 +310,9 @@ int main(int argc, char** argv)
|
|||||||
case 's':
|
case 's':
|
||||||
searchLimit = atoi(optarg);
|
searchLimit = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'k':
|
||||||
|
skipInvalid = true;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
return 2;
|
return 2;
|
||||||
@ -348,9 +354,13 @@ int main(int argc, char** argv)
|
|||||||
std::vector<std::string>::iterator it;
|
std::vector<std::string>::iterator it;
|
||||||
for (it = zimPathes.begin(); it != zimPathes.end(); it++) {
|
for (it = zimPathes.begin(); it != zimPathes.end(); it++) {
|
||||||
if (!manager.addBookFromPath(*it, *it, "", false)) {
|
if (!manager.addBookFromPath(*it, *it, "", false)) {
|
||||||
std::cerr << "Unable to add the ZIM file '" << *it
|
if (skipInvalid) {
|
||||||
<< "' to the internal library." << std::endl;
|
std::cerr << "Skipping invalid '" << *it << "' ...continuing" << std::endl;
|
||||||
exit(1);
|
} else {
|
||||||
|
std::cerr << "Unable to add the ZIM file '" << *it
|
||||||
|
<< "' to the internal library." << std::endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user