Update WordPress using WP-CLI: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 50: Regel 50:
 
define('FS_METHOD', 'direct');
 
define('FS_METHOD', 'direct');
 
</pre>
 
</pre>
 +
 +
== Update Translation ==
 +
 +
{|
 +
|[[file:20181219-1105.png|thumb|'''New translations vailable''']]
 +
|[[file:20181219-1106.png|thumb|<code>wp language core update</code>]]
 +
|[[file:20181219-1107.png|thumb|Het leven is goed]]
 +
|}
  
 
== Zie ook ==
 
== Zie ook ==

Versie van 19 dec 2018 10:08

Dit artikel behandelt geautomatiseerde updates, dus zonder gebruik te maken van de GUI.

WP-CLI

Dit dus:

wp plugin update --all && wp wc update && wp theme update --all && wp core update
  • Is wp theme update --all misschien tricky, zoals bij Drupal? We gaan het meemaken ;)
  • Dit werkt niet voor betaalde plugins. Zie Plugins handmatig bijwerken (WordPress) voor details
  • WordPress werk je bij middels wp wc update, niet via wp plugin update. Als je dit commando uitvoert op een site zonder WooCommerce, krijg je deze foutmelding: Error: 'wc' is not a registered wp command. See 'wp help' for available commands. - Ook geen probleem
  • Het update-commando hier bovenaan kan nog iets uitgebreider, met de toevoeging wp language core update, maar dat lijkt me overkill.

Varianten:

wp plugin update --all && wp theme update --all && wp core update && wp plugin update --all && wp theme update --all && wp core update && wp wc update

Force direct download

Om een of andere reden, will WordPress updates per se middels FTP downloaden. Dat kun je gelukkig aanpassen [1]:

WordPress will only prompt you for your FTP connection information while trying to install 
plugins or a WordPress update if it cannot write to /wp-content directly. Otherwise, if your 
web server has write access to the necessary files, it will take care of the updates and 
installation automatically. This method does not require you to have FTP/SFTP or SSH access, 
but it does require your to have specific file permissions set up on your webserver.

It will try various methods in order, and fall back on FTP if Direct and SSH methods are 
unavailable.

https://github.com/WordPress/WordPress/blob/4.2.2/wp-admin/includes/file.php#L912

WordPress will try to write a temporary file to your /wp-content directory. If this succeeds,
it compares the ownership of the file with its own uid, and if there is a match it will allow 
you to use the 'direct' method of installing plugins, themes, or updates.

Now, if for some reason you do not want to rely on the automatic check for which filesystem
method to use, you can define a constant, 'FS_METHOD' in your wp-config.php file, that is 
either 'direct', 'ssh', 'ftpext' or 'ftpsockets' and it will use that method. Keep in mind 
that if you set this to 'direct', but your web user (the username under which your web server 
runs) does not have proper write permissions, you will receive an error.

In summary, if you do not want to (or you cannot) change permissions on wp-content so your 
web server has write permissions, then add this to your wp-config.php file:

define('FS_METHOD', 'direct');

Update Translation

New translations vailable
wp language core update
Het leven is goed

Zie ook

Bronnen