Friday, December 27, 2019

WordPress fails to update plugins, Posts or Sign in


NOTE: 
Although the examples concern to Linux env, an analogy may be done to other environments converting the commands and paths.
In the examples below, replace "mysite" by the name of your site folder.

>ATTEMPT #1 - FILES' PERMISSION

Check the owner of your data, if www-data, do:

chown www-data -R /home/mySite/public_html
chgrp www-data -R /home/mySite/public_html

>ATTEMPT #2 - PLUGIN'S ISSUE

CHECKING ONE BY ONE BEGINNING BY THE LAST ONES

If the issue happens after plugins' update or a new plugin installation, it is necessary to identify the plugin that causes the issue.
In this case, just remove the plugin by moving its code to a temporary folder.
If the issue disappears, the last removal indicates the responsible.
Example:

mv /home/mysite/public_html/wp-content/plugins/do-something /home/temp/plugins


REMOVING ALL AND REINSERTING ONE BY ONE 

Another method removes all and insert one by one (or small groups) until the issue comes up, identifying the cause.
Example reinserting a group of three:

mv /home/mysite/public_html/wp-content/plugins /home/temp
mkdir /home/mysite/public_html/wp-content/plugins
mv /home/temp/plugins/do-something /home/mysite/public_html/wp-content/plugins
mv /home/temp/plugins/do-something2 /home/mysite/public_html/wp-content/plugins
mv /home/temp/plugins/do-something3 /home/mysite/public_html/wp-content/plugins
chown www-data -R /home/mySite/public_html/plugins
chgrp www-data -R /home/mySite/public_html/plugins
#Go to the site, menu, plugins and activate the inserted plugins, then test.
#If the issue returns, one of the new three plugins is the responsible.
#To discover the one, repeate the operation removing the three ones and inserting one by one.
More details at:


>ATTEMPT #2 - WORDPRESS FILES' ISSUE

If the attempt one is ineffective, then it may be a major problem like Wordpress corruption, considering that any other procedure above was successful.

>PROBLEM

The site fails to update post.
Attempt to update a plugin works differently, redirecting to another page retuning a detailed log like wordpress upgrade - unusual since upgrade is done on the same page - the plugins' page.
After log off, login also fails.
The problem comes apparently from nothing.

>SOLUTION

Rename the current site to preserve its content.
Performed a new Wordpress installation but preserving its current database.
The new installation is connected to the previous database.
The configurations and contents from the previous installation are copied to the new one, including plugins, uploads and other key folders.

Example:

- database backup, just in case:
  mysqldump --all-databases --routines  --triggers -uroot -proot > dump.sql

- creating a new mysite directory to install a new wordpress:
  mv /home/mysite /home/mysite_
  mkdir /home/mysite
  chown root:root -R /home/mysite
  chmod 755 -R /home/mysite
  mkdir /home/mysite/public_html

- set permissions required by wordpress running by apache2:
  chown www-data -R /home/mysite/public_html

- create log dir:
  mkdir /home/mysite/public_html/logs

- installing the new site:
  cd /home/backup/wordpress
  unzip wordpress-5.3.2-en_GB.zip
  mv wordpress/* /home/mysite/public_html
  chown www-data -R /home/mysite/public_html
  chmod 755 -R /home/mysite/public_html

- create a symlink on apache2's /var/www folder:
  cd /var/www
  ln -s /home/ipstuff/public-html mysite

- point to mysite:  
  http://ultering.com/mysite/

- get the database information
database name: mysite
username: mysite
password: secret
host: localhost

- after the initial login, the key folders are copied from previous intallation to preserve configuration and content:

  rm -Rf /home/mysite/public_html/wp-content/plugins
  cp -R /home/temp/mysite/plugins /home/mysite/public_html/wp-content
  chown www-data -R /home/mysite/public_html
  chmod 755 -R /home/mysite/public_html

  cp -R /home/mysite_/public_html/wp-content/themes/* /home/mysite/public_html/wp-content/themes

   cd /home/mysite

- backup from previous content, just in case:   
   tar czvf itstuf_temp.tar.gz /home/mysite/public_html

- copying key folders containing content and configuration:
  cp -R /home/mysite_/public_html/wp-content/uploads /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/w3tc-config /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/wflogs /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/nfwlog /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/.tmb /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/.quarantine /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/mu-plugins /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/wp-link-status-salt.php /home/mysite/public_html/wp-content
  cp -R /home/mysite_/public_html/wp-content/index.php /home/mysite/public_html/wp-content

- moving the backup to a temp dir to be downloaded and removed:  
  mv /home/mysite/public_html/wp-content/uploads /home/temp



Tuesday, August 20, 2019

ECLIPSE - Cannot change version of project facet Dynamic Web Module to 3.1




>PROBLEM

Attempt to switch Web Module version in "Project Facets" is denied, not allowed, returning a message like this:

Cannot change version of project facet Dynamic Web Module to 3.1. sisgit2 line 1 Maven Java EE Configuration Problem



>SOLUTION

Go to the eclipse's project root directory at:

$ECLIPSE_PROJECT_ROOT\.settings\org.eclipse.wst.common.project.facet.core.xml


Change here:
From:
<installed facet="wst.jsdt.web" version="1.0"></installed>
To:
<installed facet="jst.web" version="3.1"></installed>

>ENV

Windows 10
Eclipse 2019


@FROM:
stackoverflow.com/questions/18122336/cannot-change-version-of-project-facet-dynamic-web-module-to-3-0

Sunday, August 18, 2019

VSCODE: EDITOR: Number of Opened Tabs Setup


To set the number of opened tabs on the editor, go to the menu, File, Preferences, Settings.
Follow by the images, yellow arrows.






Sunday, August 11, 2019

node.js: flash: a req.session is required!



>PROBLEM


a req.session is required!
AssertionError [ERR_ASSERTION]: a req.session is required!
    at L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\flash\index.js:6:5
    at Layer.handle [as handle_request] (L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\index.js:317:13)
    at L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\index.js:335:12)
    at next (L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\index.js:275:10)
    at logger (L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\morgan\index.js:144:5)
    at Layer.handle [as handle_request] (L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\index.js:317:13)
    at L:\work\devcli_\javascript\node\projects\tellme4\tellme4\node_modules\express\lib\router\index.js:284:7


>SOLUTION

>>WRONG:

//*** wrong place of flash configuration, before session:

app.use(flash());
app.use(passport.initialize());
app.use(passport.session());
app.use(session({
  secret: "fd34s@!@dfa453f3DF#$D&W",
  resave: false,
  saveUninitialized: true,
  cookie: { secure: !true }
}));


>>RIGHT:

app.use(passport.initialize());
app.use(passport.session());
app.use(session({
  secret: "fd34s@!@dfa453f3DF#$D&W",
  resave: false,
  saveUninitialized: true,
  cookie: { secure: !true }
}));
//*** right place after session:
app.use(flash());


>ENV
w10
node.js

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...