Remove error_log when some custompage is not implemented (quickly fills MB of logs)

Rename param
Complete PHPDoc
Add final return in case the file didn't exist
pull/2487/head
Yannick Warnier 8 years ago
parent eff77b0474
commit 973dbb8f99
  1. 15
      main/inc/lib/custom_pages.class.php

@ -41,22 +41,23 @@ class CustomPages
/** /**
* If enabled display a custom page and exist. Otherwise log error and returns. * If enabled display a custom page and exist. Otherwise log error and returns.
* *
* @param string $page_name * @param string $pageName
* @param array $content used to path data to the custom page * @param array $content used to pass data to the custom page
* @return bool False if custom pages is not enabled or file could not be found. Void otherwise.
*/ */
public static function display($page_name, $content = array()) public static function display($pageName, $content = array())
{ {
if (!self::enabled()) { if (!self::enabled()) {
return false; return false;
} }
$file = self::path($page_name.'.php'); $file = self::path($pageName.'.php');
// Only include file if it exists, otherwise do nothing
if (file_exists($file)) { if (file_exists($file)) {
include($file); include($file);
exit; exit; //finish the execution here - do not return
} else {
error_log('CustomPages::displayPage : could not read file '.$file);
} }
return false;
} }
/** /**

Loading…
Cancel
Save