Plugin Directory


Ignore:
Timestamp:
10/29/2026 03:41:15 AM (16 hours ago)
Author:
xplodedthemes
Message:

Update v3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wpide/trunk/App/App.php

    r3236183 r3771999  
    5656    public function activate() {
    5757        $this->installDropIn();
     58
     59        \WPIDE\App\Services\Snippets\Schema::maybeInstall();
    5860    }
    5961
    … …  
    114116    }
    115117
     118    /**
     119     * Whether the installed fatal-error-handler.php drop-in belongs to WPIDE.
     120     */
     121    public function isOwnDropIn(): bool
     122    {
     123        $file = CONTENT_DIR.'/'.FATAL_ERROR_DROPIN;
     124
     125        if(!is_readable($file)) {
     126            return false;
     127        }
     128
     129        $header = (string) file_get_contents($file, false, null, 0, 512);
     130
     131        return strpos($header, 'WPide - Fatal Error Handler - Drop-In') !== false;
     132    }
     133
    116134    public function installDropIn() {
    117135
    … …  
    119137
    120138        if($fs->fileExists(FATAL_ERROR_DROPIN)) {
     139
     140            // Never replace a drop-in installed by another recovery provider.
     141            if(!$this->isOwnDropIn()) {
     142                update_option(FATAL_ERROR_DROPIN_VERSION_OPT.'_conflict', true);
     143                return;
     144            }
     145
    121146            $this->unInstallDropIn();
    122147        }
    … …  
    125150
    126151        update_option(FATAL_ERROR_DROPIN_VERSION_OPT, FATAL_ERROR_DROPIN_VERSION);
     152        delete_option(FATAL_ERROR_DROPIN_VERSION_OPT.'_conflict');
    127153    }
    128154
    … …  
    131157        $fs = LocalFileSystem::load(CONTENT_DIR);
    132158
    133         if($fs->fileExists(FATAL_ERROR_DROPIN)) {
     159        if($fs->fileExists(FATAL_ERROR_DROPIN) && $this->isOwnDropIn()) {
    134160            $fs->deleteFile(FATAL_ERROR_DROPIN);
    135161        }
     162    }
     163
     164    public function dropInConflictNotice() {
     165
     166        if(!get_option(FATAL_ERROR_DROPIN_VERSION_OPT.'_conflict') || !current_user_can('manage_options')) {
     167            return;
     168        }
     169        ?>
     170        <div class="notice notice-warning wpide-notice" data-slug="<?php echo esc_attr(SLUG); ?>">
     171            <p><?php echo esc_html__('WPIDE did not install its file recovery drop-in because wp-content/fatal-error-handler.php belongs to another plugin. File recovery after a fatal error is unavailable until that file is removed.', 'wpide'); ?></p>
     172        </div>
     173        <?php
    136174    }
    137175
    … …  
    149187            $this->installDropIn();
    150188        }
     189
     190        add_action('admin_notices', [$this, 'dropInConflictNotice']);
    151191
    152192        $this->loadTextDomain();
    … …  
    286326            ],
    287327            [
     328                'title' => __( 'Snippets', 'wpide' ),
     329                'slug' => SLUG.'#/snippets',
     330                'callback' => [$this, 'bootstrap'],
     331                'position' => 30
     332            ],
     333            [
    288334                'title' => __( 'Settings', 'wpide' ),
    289335                'slug' => SLUG.'#/settings',
    … …  
    515561     * @since     1.0.0
    516562     */
    517     public function getExternalUrl(string $utm_content = null, string $url = null): string
     563    public function getExternalUrl(?string $utm_content = null, ?string $url = null): string
    518564    {
    519565
Note: See TracChangeset for help on using the changeset viewer.