[oik] plugins.com

WordPress plugins and themes

  • Home
  • 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

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

Called by

    Invoked by

      Calls

      Call hooks

      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

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

      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-weight-zone-shipping v0.2.13 oik-weight-zone-shipping v0.2.13 has been tested with WooCommerce 10.1.2 and WordPress 6.8.2 ...
      SB Children Block v1.3.0 Upgrade to SB Children Block v1.3.0 for support for PHP 8.3 and PHP 8.4  ...
      oik v4.15.3 Update to oik v4.15.3 for a couple of security fixes. Tested with WordPress 6.8.2 ...
      oik-privacy-policy v1.4.9 Update to oik-privacy-policy v1.4.9 for a security fix. Tested with WordPress 6.8.2 and PHP 8.3 and PHP 8.4 ...
      oik-nivo-slider v1.17.0 oik-nivo-slider v1.17.0 introduces the Nivo slider block - oik-nivo-slider/nivo. ...

      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-2025. All rights reserved.


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

      WordPress version: 6.8.3

      Gutenberg version: 21.7.0

      PHP version: 8.2.29