add error handling
Signed-off-by: Jasmine Amalia <67263692+jasm1nii@users.noreply.github.com>
This commit is contained in:
parent
3f1287d172
commit
6ca25658c5
|
@ -1,14 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
date_default_timezone_set($timezone);
|
date_default_timezone_set($timezone);
|
||||||
|
|
||||||
$i = 0;
|
if (glob($blog_entries.'.php')) {
|
||||||
foreach ((glob($blog_entries.'.php')) as $article_php) {
|
$i = 0;
|
||||||
ob_start();
|
foreach ((glob($blog_entries.'.php')) as $article_php) {
|
||||||
include $article_php;
|
ob_start();
|
||||||
$compiled = ob_get_contents();
|
include $article_php;
|
||||||
ob_end_clean();
|
$compiled = ob_get_contents();
|
||||||
file_put_contents($article_php.'_generator-tmp.html', $compiled);
|
ob_end_clean();
|
||||||
if(++$i > ($max_entries-1) ) break;
|
file_put_contents($article_php.'_generator-tmp.html', $compiled);
|
||||||
|
if(++$i > ($max_entries-1) ) break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$article_php = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
@ -168,13 +172,16 @@
|
||||||
|
|
||||||
$sxe->saveXML($blog_root . DIRECTORY_SEPARATOR . $file);
|
$sxe->saveXML($blog_root . DIRECTORY_SEPARATOR . $file);
|
||||||
|
|
||||||
$del_tmp = unlink($article_php.'_generator-tmp.html');
|
|
||||||
|
|
||||||
echo nl2br(strtoupper(date("h:i:sa")) . ' - Feed successfully generated in ' . realpath($blog_root) . DIRECTORY_SEPARATOR . $file . "\n");
|
echo nl2br(strtoupper(date("h:i:sa")) . ' - Feed successfully generated in ' . realpath($blog_root) . DIRECTORY_SEPARATOR . $file . "\n");
|
||||||
if ($del_tmp) {
|
|
||||||
echo 'Temporary generator files successfully deleted.';
|
if(file_exists($article_php)) {
|
||||||
} else {
|
$del_tmp = unlink($article_php.'_generator-tmp.html');
|
||||||
echo 'Temporary generator files could not be automatically deleted - check your directories to delete them manually.';
|
if ($del_tmp) {
|
||||||
|
echo 'Temporary generator files successfully deleted.';
|
||||||
|
} else {
|
||||||
|
echo 'Temporary generator files could not be automatically deleted - check your directories to delete them manually.';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 'Validate your feed at https://validator.w3.org/feed/';
|
echo 'Validate your feed at https://validator.w3.org/feed/';
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue