[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

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

Information

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

Recent plugin updates

oik v4.7.2 oik v4.7.2 includes a fix to the logic to render blocks for Content and Excerpts in the bw_pages shortcode. ...
oik v4.7.1 Upgrade to oik v4.7.1 for bw_pages rendering blocks for Content and Excerpts, and support for post_name attribute for shortcode which query posts ...
oik-shortcodes v1.41.1 Upgrade to oik-shortcodes v1.41.1 for a couple of minor changes. ...
oik-bob-bing-wide v2.2.2 Upgrade to oik-bob-bing-wide v2.2.2 for improvements to bw_dash examples and fixes to some SVG icon's visibility. ...
oik-bwtrace v3.3.1 Upgrade to oik-bwtrace v3.3.1 to measure plugin load times and ad hoc action timing points. ...

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: [email protected]

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


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 6.0.1. PHP: 7.4.30. Memory limit: 768M