• Resolved Carsten Bach

    (@carstenbach)


    ??</img> Dear @olliejones, I really enjoy the christmas-present, you made to the community in the end of last year. Thank you very, very much! ??</img>

    After 3 weeks of testing, there was only one small caveat I had to come around.

    For some unknown reason and during one of this crazy development nights, at some point my logs screamed at me:

    01:06:45 UTC] Exception: database disk image is malformed in [..]/wp-content/object-cache.php:490
    01:06:45 UTC] sqlite_object_cache connection failure, deleting sqlite files to retry. 1
    01:06:45 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function __() in [...]/wp-admin/includes/file.php:16

    So I went down the rabbit hole and found out, that I can avoid this fatal.

    // needed for __()
    require_once ABSPATH . 'wp-includes/l10n.php';

    I added this to your existing private function delete_offending_files() at around line 1821, in the object-cache.php dropin.

    With this fix in place the regeneration of the corrupted db, was not a problem anymore.

    Was this a proper solution?
    And would you like to implement this in a upcoming release?

    Maybe you could have a look into this.

    I could also create an Issue & PR at github if you want.

    • This topic was modified 2 years, 2 months ago by Carsten Bach.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author OllieJones

    (@olliejones)

    This is very useful indeed. Thanks, @carstenbach ! I’ll put it in.

    Plugin Author OllieJones

    (@olliejones)

    I ended up using the following code. That pattern comes up elsewhere, and looks like the way to do this loading of the translation functions if they’re not yet loaded. (They’re not loaded when the object cahce drop-in is first loaded.)

    if ( ! function_exists( '__' ) ) {
    wp_load_translations_early();
    }

    Thanks again.

    • This reply was modified 2 years, 1 month ago by OllieJones.
    • This reply was modified 2 years, 1 month ago by OllieJones.
    Thread Starter Carsten Bach

    (@carstenbach)

    ??</img> Looks way better!

    Great you found my hint useful and were able to implement a nicer solution so fast. Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Call to undefined function __()’ is closed to new replies.