WordPress : Jetpack : Uncaught Error: Class ‘Automattic\Jetpack\Roles’

J’ai donc eu l’erreur suivante sur le plugin Jetpack : Uncaught Error: Class ‘Automattic\Jetpack\Roles’ .

Dans le détails :

WordPress version 5.3
Thème actuel : Twenty Eleven (version 3.3)
Extension actuelle : Jetpack by WordPress.com (version 8.0)
PHP version 7.2.25

Une erreur de type E_ERROR a été causée dans la ligne 270 du fichier .../wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/Listener.php. Message d’erreur : Uncaught Error: Class 'Automattic\Jetpack\Roles' not found in .../wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/Listener.php:270
Stack trace:
#0 .../wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/Listener.php(239): Automattic\Jetpack\Sync\Listener->get_actor('jetpack_plugins...', Array)
#1 .../wp-content/plugins/jetpack/vendor/automattic/jetpack-sync/src/Listener.php(114): Automattic\Jetpack\Sync\Listener->enqueue_action('jetpack_plugins...', Array, Object(Automattic\Jetpack\Sync\Queue))
#2 .../wp-includes/class-wp-hook.php(288): Automattic\Jetpack\Sync\Listener->action_handler(Array, Array)
#3 .../wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array)
#4 .../wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#5 ....

Rien de grave si on lit : https://wordpress.org/support/topic/fatal-error-when-updating-to-jetpack-8-0-read-this/ .

The error may have been sent to you via an email with the subject line “Your Site is Experiencing a Technical Issue”, or it may have displayed in the Plugins page when you tried to update Jetpack.

This happened because we moved some files around in this Jetpack release, which triggers an error when they cannot be found in their old locations. Your site should still have upgraded to Jetpack 8.0, so refreshing the Plugins page in your dashboard should show that version. The error should only happen once, on upgrade, and not after that

As for the frontend of the site, that should also work fine, though you may want to clear any caches you have just to be sure.

 

WordPress 5.1 : Un vrai plus sur la securité !

J’ai donc fait la mise à jours :

La dernière version va surement me permettre de ne plus utiliser WordFence, elle permet de sécuriser le site :

L’interface est vraiment simple à comprendre …

A suivre !

How to import data of WordPress (Feed RSS) to Joplin ?

Install JOPLIN : https://joplin.cozic.net ,  and start REST API. (Easy)

Step 1 : Put this script in folder.

Step 2 : Edit the script and put your token 

Step 3 : Run the script

The script :

#
# Version 1 
# for Python 3
# 
#   ARIAS Frederic
#   Sorry ... It's difficult for me the python :)
#

import feedparser
from os import listdir
from pathlib import Path
import glob
import csv
import locale
import os
import time
from datetime import datetime
import json
import requests

#Token
ip = "127.0.0.1"
port = "41184"
token = "Put your token here"

nb_import = 0;
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}

url_notes = (
    "http://"+ip+":"+port+"/notes?"
    "token="+token
)
url_folders = (
    "http://"+ip+":"+port+"/folders?"
    "token="+token
)
url_tags = (
    "http://"+ip+":"+port+"/tags?"
    "token="+token
)
url_ressources = (
    "http://"+ip+":"+port+"/ressources?"
    "token="+token
)

#Init
Wordpress_UID = "12345678901234567801234567890123"
UID = {}

payload = {
    "id":Wordpress_UID,
    "title":"Wordpress Import"
}

try:
    resp = requests.post(url_folders, data=json.dumps(payload, separators=(',',':')), headers=headers)
    resp.raise_for_status()
    resp_dict = resp.json()
    print(resp_dict)
    print("My ID")
    print(resp_dict['id'])
    WordPress_UID_real = resp_dict['id']
    save = str(resp_dict['id'])
    UID[Wordpress_UID]= save
except requests.exceptions.HTTPError as e:
    print("Bad HTTP status code:", e)
except requests.exceptions.RequestException as e:
    print("Network error:", e)

feed = feedparser.parse("https://www.cyber-neurones.org/feed/")

feed_title = feed['feed']['title']
feed_entries = feed.entries

numero = -2
nb_entries = 1
nb_metadata_import = 1

while nb_entries > 0 : 
  print ("----- Page ",numero,"-------")
  numero += 2
  url = "https://www.cyber-neurones.org/feed/?paged="+str(numero)
  feed = feedparser.parse(url)
  feed_title = feed['feed']['title']
  feed_entries = feed.entries
  nb_entries = len(feed['entries'])
  for entry in feed.entries:
     nb_metadata_import += 1
     my_title = entry.title
     my_link = entry.link
     article_published_at = entry.published # Unicode string
     article_published_at_parsed = entry.published_parsed # Time object
     article_author = entry.author
     timestamp = time.mktime(entry.published_parsed)*1000
     print("Published at "+article_published_at)
     my_body = entry.description
     payload_note = {
         "parent_id":Wordpress_UID_real,
         "title":my_title,
         "source":"Wordpress",
         "source_url":my_link,
         "order":nb_metadata_import,
         "user_created_time":timestamp,
         "user_updated_time":timestamp,
         "author":article_author,
         "body_html":my_body
         }
     payload_note_put = {
         "source":"Wordpress",
         "order":nb_metadata_import,
         "source_url":my_link,
         "user_created_time":timestamp,
         "user_updated_time":timestamp,
         "author":article_author
         }

     try:
         resp = requests.post(url_notes, json=payload_note)
         resp.raise_for_status()
         resp_dict = resp.json()
         print(resp_dict)
         print(resp_dict['id'])
         myuid= resp_dict['id']
     except requests.exceptions.HTTPError as e:
         print("Bad HTTP status code:", e)
     except requests.exceptions.RequestException as e:
         print("Network error:", e)

     url_notes_put = (
    "http://"+ip+":"+port+"/notes/"+myuid+"?"
    "token="+token
)
     try:
         resp = requests.put(url_notes_put, json=payload_note_put)
         resp.raise_for_status()
         resp_dict = resp.json()
         print(resp_dict)
     except requests.exceptions.HTTPError as e:
         print("Bad HTTP status code:", e)
     except requests.exceptions.RequestException as e:
         print("Network error:", e)