post-indexer causing fatal errors

PHP Fatal error:  Uncaught Error: Call to undefined function is_plugin_active_for_network() in .../wp-content/plugins/post-indexer/extra/wpmudev-dash-notification.php:538
Stack trace:
#0 .../wp-includes/plugin.php(600): WPMUDEV_Dashboard_Notice4->updates_check()
#1 .../wp-cron.php(117): do_action_ref_array('wpmudev_schedul...', Array)
#2 {main}
  thrown in .../wp-content/plugins/post-indexer/extra/wpmudev-dash-notification.php on line 538

It seems that this plugin is missing a require_once( ABSPATH . 'wp-admin/includes/plugin.php' );.

  • Adam Czajczyk

    Hello dxw,

    I hope you're well today and thank you for your question!

    This error suggests that the Post Indexer plugin may not be installed on WordPress Multisite and it's compatible only with Multisite. It will not work on regular "single" WP installations.

    Is your site a single WP or Multisite? If it's single, could you please tell me what is the reason for using Post Indexer so I could suggest better solution?

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Tom!

    Thank you for your replay!

    The plugin shouldn't have to include the /wp-admin/includes/plugin.php file because that file is loaded in the admin area and that check that's indicated in the error is triggered by back-end processes. That is why I assumed that the plugin may have somehow been installed on the MultiSite.

    That is a bit weird though so could you please start with just a simple re-install of Post Indexer plugin? Could you please also install and activate our WP DEV Dashboard plugin to see if that affects the issue? It shouldn't but it's worth checking.

    Finally, if none of above helps, please run a full theme/plugin conflict test and let me know about it's results. The procedure is described on a flowchart in this article:

    https://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    Best regards,
    Adam

  • dxw

    Hi Adam,

    > The plugin shouldn't have to include the /wp-admin/includes/plugin.php file because that file is loaded in the admin area and that check that's indicated in the error is triggered by back-end processes.

    This error isn't happening in the admin area. It's being triggered by wpmudev_scheduled_jobs which is scheduled to run twice a day. So this is happening inside wp cron, where /wp-admin/includes/plugin.php is not loaded.

    Note that there is code inside this plugin that loads /wp-admin/includes/plugin.php. But it's only loaded when a plugin called wpmudev-updates is available.

    Tom

    (Edited to fix the formatting)

  • dxw

    Hi Adam

    Following up on Tom's posts above, I've now replicated the error on a clean WordPress install (latest version of WordPress & Post Indexer). This happens almost immediately after Post Indexer is network activated as the only plugin on a multisite:

    [Thu Jan 19 15:27:04.044162 2017] [:error] [pid 17] [client ::1:52124] PHP Fatal error:  Uncaught Error: Call to undefined function is_plugin_active_for_network() in /var/www/html/wp-content/plugins/post-indexer/extra/wpmudev-dash-notification.php:538
    Stack trace:
    #0 /var/www/html/wp-includes/plugin.php(600): WPMUDEV_Dashboard_Notice4->updates_check()
    #1 /var/www/html/wp-cron.php(117): do_action_ref_array('wpmudev_schedul...', Array)
    #2 {main}
    thrown in /var/www/html/wp-content/plugins/post-indexer/extra/wpmudev-dash-notification.php on line 538, referer: http://localhost/wp-cron.php?doing_wp_cron=1484839623.4194369316101074218750
    ::1 - - [19/Jan/2017:15:27:03 +0000] "POST /wp-cron.php?doing_wp_cron=1484839623.4194369316101074218750 HTTP/1.1" 500 211 "http://localhost/wp-cron.php?doing_wp_cron=1484839623.4194369316101074218750"

    Having the WPMU Dev Dashboard plugin installed does seem to stop the issue, but that's not really a solution that's practical for us I'm afraid.

    As Tom said, the error is being triggered by a scheduled event (see last line of stack trace), and therefore /wp-admin/includes/plugin.php is not included by default.

    Thanks

    Rob

  • Dimitris

    Hey there dxw,

    hope you're doing good and don't mind me chiming in!

    This is indeed an error due to the absence of WPMUDEV Dashboard plugin in your installation.
    I already escalated that to our dev team so we could find out if there can be an error-free installation of Post Indexer without our Dashboard plugin in place.
    Your patience here is highly appreciated as their response times are quite larger than ours here in support forums.

    Warm regards,
    Dimitris

  • Dimitris

    Hey there,

    I just had some feedback from our dev team. They proposed to simply exclude the embedded Dashboard instance in Post Indexer plugin and that should be enough.

    Could you please try to go to line 37 in next file
    /wp-content/plugins/post-indexer/classes/class.postindexeradmin.php
    and just remove (or comment) the code in that line, it should be the following
    include_once( dirname( __FILE__ ) . '/../extra/wpmudev-dash-notification.php' );

    Let me know how that goes!
    Warm regards,
    Dimitris

  • Dimitris

    Hey there dxw,

    hope everything's going well for you!

    I'm glad we sorted out those error messages. As for the future, I don't think we stepped on a bug here. This code is in place in order to integrate dashboard messages via WPMUDEV Dashboard plugin even though it isn't necessary for Post Indexer to work.

    As for future plugin updates, you can always advise the plugin's changelog before updating.
    If you see that this isn't implemented, you should re-do this little change.

    Take care,
    Dimitris