• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

[oik] plugins.com

WordPress plugins and themes

  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

oik_yourehavingmeon() – Log missing files

You appear to be a bot. Output may be restricted

Description

Log missing files

In my symlinked environment in Windows I often get reports that a file does not exist when it pretty certainly does, albeit a symlinked file. This code, which used to be in the oik_boot shared library attempts to report what's wrong. But it created serious problems for REST APIs which only expect to see JSON responses. I changed it to check for WP_DEBUG before echoing anything. Then I realised that I needed better information for problem determination so I chose to log the output to the PHP error log using the error_log() function. The 'you're having me on' function is now a builtin callback function that may eventually be deprecated once the problem determination is complete. In most cases, where oik_require() has been invoked correctly we do expect the file to exist. The second test checks that the file really doesn't exist.

Usage

$string = oik_yourehavingmeon( $file );

Parameters

$file
( string ) required – the fully qualified file name

Returns

string some additional information that may help debugging.

Source

File name: oik-libs/libs/bwtrace_log.php
Lines:
1 to 32 of 32
function oik_yourehavingmeon( $file ) {
  if ( file_exists( $file ) ) {
    $file = "exists now";
    return $file;
  }
  if ( defined( 'WP_DEBUG') && WP_DEBUG ) {
    $type = bw_array_get( $_SERVER, 'request_type', null );
    if ( $type != 'rest' ) {
      echo "<!-- File does not exist:$file! -->" ;
      if ( !is_file( $file ) ) {
        echo "<!-- File is not a real file:$file! -->" ;
      }
      echo "<!-- ";
      echo __FILE__ ; 
      echo PHP_EOL;
      print_r( debug_backtrace() );
      echo " -->";
    }
  }
  
  if ( file_exists( $file ) ) {
  
    //gob(); this is not expected... but perhaps that's part of the problem!
    
    if ( defined( 'WP_DEBUG') && WP_DEBUG && $type != 'rest' ) {
      echo "<!-- Oh. And now it does exist! $file -->";
    }  
    $file = "exists a bit later";
    
  }
  return( $file );  
}
 
 View on GitHub

Published: November 14, 2017 | Last updated: December 18, 2017

Primary Sidebar

Information

Function name: oik_yourehavingmeon
Plugin ref: oik-libs: Shared Library Repository
Version: 0.4.3
Sourcefile: libs/bwtrace_log.php
File ref: libs/bwtrace_log.php
Deprecated?: No
API Letters: O,Y

Recent plugin updates

oik-fields v1.55.1
oik-fields v1.55.1 oik-fields v1.55.1 has been tested with WordPress 7.1. ...
oik v4.16.0
oik v4.16.0 Upgrade to oik v4.16.0 for many accessibility (a11y) improvements for both the front end and admin areas, plus a security fix. ...
oik-fields v1.55.0
oik-fields v1.55.0 Upgrade to oik-fields v1.55.0 for accessibility improvements to the featured image virtual field. ...
oik-css v2.4.0
oik-css v2.4.0 Upgrade to oik-css v2.4.0 for accessibility improvements for Low Color Contrast errors. ...
oik-unloader v0.4.0
oik-unloader v0.4.0 Update to oik-unloader v0.4.0 for improved accessibility of the active-plugins shortcode. Tested with WordPress 6.9 and PHP 8.4 ...

Footer

Plugins

  • All Plugins
  • oik base plugin
  • FREE oik plugins
  • WordPress plugins
  • Premium oik plugins

Themes

  • FREE themes
  • Bespoke themes
  • Premium themes

Blocks

  • All Blocks
  • Block examples
  • About Blocks

Shortcodes

  • All Shortcodes
  • Shortcode examples
  • About Shortcodes

Reference

  • About APIs
  • All APIs
  • All Classes
  • All Files
  • All Hooks

Support

  • Contact
  • Cookies policy
  • Get API key
  • Privacy
  • Request support
  • Sitemap
  • Stay informed
  • Terms and Conditions
oik-plugins
Email: herb@bobbingwide.com

Weight shipping plugins

Find out which cart weight shipping plugin you need for your WooCommerce site.
Which cart weight based plugin do I need?

Site:  www.oik-plugins.com
© Copyright oik-plugins 2011-2026. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins

WordPress version: 7.1.2

Gutenberg version: 24.0.0

PHP version: 8.2.35