• Najnowsze pytania
  • Bez odpowiedzi
  • Zadaj pytanie
  • Kategorie
  • Tagi
  • Zdobyte punkty
  • Ekipa ninja
  • IRC
  • FAQ
  • Regulamin
  • Książki warte uwagi

Wordpress on Linux

Object Storage Arubacloud
0 głosów
245 wizyt
pytanie zadane 27 października 2018 w Systemy operacyjne, programy przez BinaryMan Stary wyjadacz (12,620 p.)

Witam !
System: Ubuntu 18.04
Zainstalowana wersja Xampp: 7.2.10

Mam taki problem: 
Zainstalowałem sobie Wordpress na xampp aby zrobić stronę. Doinstalowałem wtyczkę do wordpress - Elementor. Po edycji strony w Elemenorze kiedy nacisnę upload pojawia się tan komunikat: 

Warning: file_put_contents(/opt/lampp/htdocs/wordpress/wp-content/uploads/elementor/css/post-16.css): failed to open stream: No such file or directory in /opt/lampp/htdocs/wordpress/wp-content/plugins/elementor/core/files/base.php on line 112

To co wpisałem w np pole textowe w elementorze zostaje wyświetlone, tylko nie ma żadnego formatowania np: pole textowe w podglądzie elementora zajmuje 2/3 a już po publikacji jest jak by w ogóle niezmienione.


Dodam, że ta pierwsza ścieżka w ogóle nie istnieje. 
Wrzucam plik base.php
 

<?php

namespace Elementor\Core\Files;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

abstract class Base {

	const UPLOADS_DIR = 'elementor/';

	const DEFAULT_FILES_DIR = 'css/';

	const META_KEY = '';

	private static $wp_uploads_dir;

	private $files_dir;

	private $file_name;

	/**
	 * File path.
	 *
	 * Holds the file path.
	 *
	 * @access private
	 *
	 * @var string
	 */
	private $path;

	/**
	 * Content.
	 *
	 * Holds the file content.
	 *
	 * @access private
	 *
	 * @var string
	 */
	private $content;

	public static function get_base_uploads_dir() {
		$wp_upload_dir = self::get_wp_uploads_dir();

		return $wp_upload_dir['basedir'] . '/' . self::UPLOADS_DIR;
	}

	public static function get_base_uploads_url() {
		$wp_upload_dir = self::get_wp_uploads_dir();

		return $wp_upload_dir['baseurl'] . '/' . self::UPLOADS_DIR;
	}

	public function __construct( $file_name ) {
		$this->set_file_name( $file_name );

		$this->set_files_dir( static::DEFAULT_FILES_DIR );

		$this->set_path();
	}

	public function set_files_dir( $files_dir ) {
		$this->files_dir = $files_dir;
	}

	public function set_file_name( $file_name ) {
		$this->file_name = $file_name;
	}

	public function get_file_name() {
		return $this->file_name;
	}

	public function get_url() {
		$url = set_url_scheme( self::get_base_uploads_url() . $this->files_dir . $this->file_name );

		return add_query_arg( [ 'ver' => $this->get_meta( 'time' ) ], $url );
	}

	public function get_content() {
		if ( ! $this->content ) {
			$this->content = $this->parse_content();
		}

		return $this->content;
	}

	public function update() {
		$this->update_file();

		$meta = $this->get_meta();

		$meta['time'] = time();

		$this->update_meta( $meta );
	}

	public function update_file() {
		$this->content = $this->parse_content();

		if ( $this->content ) {
			$this->write();
		} else {
			$this->delete();
		}
	}

	public function write() {
		return file_put_contents( $this->path, $this->content );
	}

	public function delete() {
		if ( file_exists( $this->path ) ) {
			unlink( $this->path );
		}

		$this->delete_meta();
	}

	/**
	 * Get meta data.
	 *
	 * Retrieve the CSS file meta data. Returns an array of all the data, or if
	 * custom property is given it will return the property value, or `null` if
	 * the property does not exist.
	 *
	 * @since 2.1.0
	 * @access public
	 *
	 * @param string $property Optional. Custom meta data property. Default is
	 *                         null.
	 *
	 * @return array|null An array of all the data, or if custom property is
	 *                    given it will return the property value, or `null` if
	 *                    the property does not exist.
	 */
	public function get_meta( $property = null ) {
		$default_meta = $this->get_default_meta();

		$meta = array_merge( $default_meta, (array) $this->load_meta() );

		if ( $property ) {
			return isset( $meta[ $property ] ) ? $meta[ $property ] : null;
		}

		return $meta;
	}

	abstract protected function parse_content();

	/**
	 * Load meta.
	 *
	 * Retrieve the file meta data.
	 *
	 * @since  2.1.0
	 * @access protected
	 */
	protected function load_meta() {
		return get_option( static::META_KEY );
	}

	/**
	 * Update meta.
	 *
	 * Update the file meta data.
	 *
	 * @since  2.1.0
	 * @access protected
	 *
	 * @param array $meta New meta data.
	 */
	protected function update_meta( $meta ) {
		update_option( static::META_KEY, $meta );
	}

	/**
	 * Delete meta.
	 *
	 * Delete the file meta data.
	 *
	 * @since  2.1.0
	 * @access protected
	 */
	protected function delete_meta() {
		delete_option( static::META_KEY );
	}

	protected function get_default_meta() {
		return [
			'time' => 0,
		];
	}

	private static function get_wp_uploads_dir() {
		if ( ! self::$wp_uploads_dir ) {
			self::$wp_uploads_dir = wp_upload_dir( null, false );
		}

		return self::$wp_uploads_dir;
	}

	private function set_path() {
		$dir_path = self::get_base_uploads_dir() . $this->files_dir;

		if ( ! is_dir( $dir_path ) ) {
			wp_mkdir_p( $dir_path );
		}

		$this->path = $dir_path . $this->file_name;
	}
}

 

komentarz 27 października 2018 przez niezalogowany
utwórz tą ścieżkę ręcznie w katalogu uploads. Plik powinien się stworzyć sam po wywołaniu funkcji file_put_contents, ale katalogi muszą istnieć
komentarz 27 października 2018 przez BinaryMan Stary wyjadacz (12,620 p.)
spróbuję
komentarz 27 października 2018 przez BinaryMan Stary wyjadacz (12,620 p.)

Warning: file_put_contents(/opt/lampp/htdocs/wordpress/wp-content/uploads/elementor/css/post-16.css): failed to open stream: Permission denied in /opt/lampp/htdocs/wordpress/wp-content/plugins/elementor/core/files/base.php on line 112

Nie utworzyłem aby pliku post-16.css na końcu 

komentarz 27 października 2018 przez BinaryMan Stary wyjadacz (12,620 p.)
Zrobione !!! Należało zmienić aby uprawnienia !
komentarz 27 października 2018 przez niezalogowany
edycja 27 października 2018
no dokładnie ;)

Upsi, przez przypadek kliknąłem zgłoszenie :) proszę o wybaczenie :)
komentarz 27 października 2018 przez Benek Szeryf (90,870 p.)
Zawsze możesz je cofnąć.
komentarz 27 października 2018 przez niezalogowany
patrz, nie wiedziałem

Zaloguj lub zarejestruj się, aby odpowiedzieć na to pytanie.

Podobne pytania

0 głosów
0 odpowiedzi 58 wizyt
0 głosów
1 odpowiedź 1,173 wizyt
pytanie zadane 31 stycznia 2021 w PHP przez kamil.litwin Nowicjusz (120 p.)
0 głosów
0 odpowiedzi 176 wizyt
pytanie zadane 21 grudnia 2020 w Systemy CMS przez Rozdrabniarka Początkujący (470 p.)

92,555 zapytań

141,403 odpowiedzi

319,554 komentarzy

61,940 pasjonatów

Motyw:

Akcja Pajacyk

Pajacyk od wielu lat dożywia dzieci. Pomóż klikając w zielony brzuszek na stronie. Dziękujemy! ♡

Oto polecana książka warta uwagi.
Pełną listę książek znajdziesz tutaj.

Akademia Sekuraka

Kolejna edycja największej imprezy hakerskiej w Polsce, czyli Mega Sekurak Hacking Party odbędzie się już 20 maja 2024r. Z tej okazji mamy dla Was kod: pasjamshp - jeżeli wpiszecie go w koszyku, to wówczas otrzymacie 40% zniżki na bilet w wersji standard!

Więcej informacji na temat imprezy znajdziecie tutaj. Dziękujemy ekipie Sekuraka za taką fajną zniżkę dla wszystkich Pasjonatów!

Akademia Sekuraka

Niedawno wystartował dodruk tej świetnej, rozchwytywanej książki (około 940 stron). Mamy dla Was kod: pasja (wpiszcie go w koszyku), dzięki któremu otrzymujemy 10% zniżki - dziękujemy zaprzyjaźnionej ekipie Sekuraka za taki bonus dla Pasjonatów! Książka to pierwszy tom z serii o ITsec, który łagodnie wprowadzi w świat bezpieczeństwa IT każdą osobę - warto, polecamy!

...