Merge pull request #5577 from claudiosmweb/improve-system-status-logs

Stop "no such file or directory" warnings
This commit is contained in:
Mike Jolley 2014-05-28 19:32:39 +01:00
commit 978268dfa6
1 changed files with 4 additions and 4 deletions

View File

@ -154,7 +154,7 @@ class WC_Admin_Status {
break; break;
} }
} }
// Display message if settings settings have been saved // Display message if settings settings have been saved
if ( isset( $_REQUEST['settings-updated'] ) ) { if ( isset( $_REQUEST['settings-updated'] ) ) {
echo '<div class="updated"><p>' . __( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>'; echo '<div class="updated"><p>' . __( 'Your changes have been saved.', 'woocommerce' ) . '</p></div>';
@ -247,7 +247,7 @@ class WC_Admin_Status {
return $version ; return $version ;
} }
/** /**
* Scan the template files * Scan the template files
* *
@ -280,11 +280,11 @@ class WC_Admin_Status {
* @return array * @return array
*/ */
public function scan_log_files() { public function scan_log_files() {
$files = scandir( WC_LOG_DIR ); $files = @scandir( WC_LOG_DIR );
$result = array(); $result = array();
if ( $files ) { if ( $files ) {
foreach ( $files as $key => $value ) { foreach ( $files as $key => $value ) {
if ( ! in_array( $value, array( ".",".." ) ) ) { if ( ! in_array( $value, array( '.', '..' ) ) ) {
if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) { if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
$result[ sanitize_title( $value ) ] = $value; $result[ sanitize_title( $value ) ] = $value;
} }