Ошибка в админке wordpress «failed to open stream: No such file or directory» — как исправить?

119
10 апреля 2019, 05:40

Есть сайт на wordpress с установленным плагином WP Hide Post. Есть необходимость переноса сайта на новый хостинг, но решил перестраховаться и проверить его работоспособность после импорта на локальный Open Server. И не зря - вверху админпанели получаю следующие ошибки:

fopen(C:\OSPanel\domains\localhost\site/wp-content/plugins/C:\OSPanel\domains\localhost\site\wp-content\plugins\wp-hide-post\wp-hide-post.php): failed to open stream: No such file or directory in in C:\OSPanel\domains\localhost\site\wp-includes\functions.php on line 4848

Warning: fread() expects parameter 1 to be resource, boolean given in C:\OSPanel\domains\localhost\site\wp-includes\functions.php on line 4851

Warning: fclose() expects parameter 1 to be resource, boolean given in C:\OSPanel\domains\localhost\site\wp-includes\functions.php on line 4854

На которые указывает следующие строки кода в functions.php

/**
 * Retrieve metadata from a file.
 *
 * Searches for metadata in the first 8kiB of a file, such as a plugin or theme.
 * Each piece of metadata must be on its own line. Fields can not span multiple
 * lines, the value will get cut at the end of the first line.
 *
 * If the file data is not within that first 8kiB, then the author should correct
 * their plugin file and move the data headers to the top.
 *
 * @link https://codex.wordpress.org/File_Header
 *
 * @since 2.9.0
 *
 * @param string $file            Path to the file.
 * @param array  $default_headers List of headers, in the format array('HeaderKey' => 'Header Name').
 * @param string $context         Optional. If specified adds filter hook {@see 'extra_$context_headers'}.
 *                                Default empty.
 * @return array Array of file headers in `HeaderKey => Header Value` format.
 */
function get_file_data( $file, $default_headers, $context = '' ) {
  // We don't need to write to the file, so just open for reading.
  $fp = fopen( $file, 'r' );
  // Pull only the first 8kiB of the file in.
  $file_data = fread( $fp, 8192 );
  // PHP will close file handle, but we are good citizens.
  fclose( $fp );
  // Make sure we catch CR-only line endings.
  $file_data = str_replace( "\r", "\n", $file_data );
...
}

Как можно их исправить? Если плагин деактивирую - ошибка исчезает. Как можно исправить ошибки в включенным плагином?

Или это ошибка только из-за локального сервера? Кеш очищал.

P.S. Перед функцией fopen вставил следующую запись

error_log('$file: ' . print_r($file, true) . PHP_EOL , 3, __DIR__ . '/log.log');

В итоге получаю:

$file: C:\OSPanel\domains\localhost\site/wp-content/plugins/C:\OSPanel\domains\localhost\site\wp-content\plugins\wp-hide-post\wp-hide-post.php

$file: C:\OSPanel\domains\localhost\site/wp-content/plugins/wp-hide-post/index.php

$file: C:\OSPanel\domains\localhost\site/wp-content/plugins/wp-hide-post/uninstall.php

$file: C:\OSPanel\domains\localhost\site/wp-content/plugins/wp-hide-post/wp-hide-post.php

объявление константы define('WPHP_PLUGIN_DIR', __DIR__ . "/");

public function define_globals()
    {
        $this->info['dir'] = WPHP_PLUGIN_DIR;
        $this->info['url'] = WPHP_PLUGIN_URL;
        $this->info['title']    = __('WP Hide Post', 'scb_plugin');
        $this->info['file']     = WPHP_PLUGIN_FILE;
        $this->info['basename'] = plugin_basename($this->info['file']);
    }
}

object(wp_hide_post)#7451 (6) { array(5) { ["dir"]=> string(72) "C:\OSPanel\domains\localhost\site\wp-content\plugins\wp-hide-post/"

["url"]=> string(60) "localhost/site/wp-content/plugins/wp-hide-post"

["title"]=> string(12) "WP Hide Post" ["file"]=> string(88) "C:\OSPanel\domains\localhost\site\wp-content\plugins\wp-hide-post\wp-hide-post.php"

["basename"]=> string(29) "wp-hide-post/wp-hide-post.php" }

}

READ ALSO
1C Soap Web Service

1C Soap Web Service

Необходимо запустить проект, где есть 1С на СУБД postgreSQL на северной части, и должно быть клиентское, мобильное приложение Android, которое при...

137
Пользовательские фоновые задачи Laravel

Пользовательские фоновые задачи Laravel

Суть вопроса следующаяКаждый пользователь может создавать задачи

133
Установка PHP расширения (PECL)

Установка PHP расширения (PECL)

Пытаюсь установить вот эту библиотеку http://peclphp

112
cUrl запрос в python

cUrl запрос в python

есть код на PHP для GET запроса, нужно сделать такой же запрос в Python , никак не могу реализовать

150