Tips rápidos para WP-CLI
##Introducción Wp-cli es una herramienta muy potente para los webmaster y administradores de sitios. Es un cansancio y una hartura la falta de compromiso de los clientes y de sus empresas de mantenimiento de la página web (esos mismo que luego van diciendole al cliente que deberían migrar su contenido a sus servidores, que ellos, son diseñadores, desarrolladores, hostess, pintores y mecanicos de vuelo, si hace falta, pero luego no tienen ni backups, ni seguridad, ni nada)
Actualiza todo
Funcionara si no hay problemas derivados por php obsoleto, algun plugin desastre, etc,
Estructura de cPanel
cd ~/public_html && wp core update && wp plugin upgrade --all && wp theme upgrade --all
-
Algunas veces puede darnos problemas de memoria. Un tip rápido Error con WP-CLI en el shell con cPanel - PHP Fatal error: Allowed memory size of bytes exhausted
-
Otras veces tenemos problemas con las versiones obsoletas de php, Problemas por la versión shell usada y wp-cli
php -d memory_limit=512M "$(which wp)" core update && php -d memory_limit=512M "$(which wp)" plugin upgrade --all && php -d memory_limit=512M "$(which wp)" theme upgrade --all
Normal
wp core update && wp plugin upgrade --all && wp theme upgrade --all
Usuarios
Crear un administrador de Wordpress con wp cli
# wp user create
$ wp user create castris fake@castris.com --role=administrator
Success: Created user 12.
Password: 0VV3gUlNMECOPIESQUENOVALGOGFO4ht
Borrar un usuario de Wordpress con wp-cli
wp user delete
wp user delete 12
--reassign parameter not passed. All associated posts will be deleted. Proceed? [y/n] y
Success: Removed user 12 from http://www.dunlopillo.es.
Forzar la actualizacion del WP con WP Cli
A veces entramos en un bucle feo, proque el usuario tiene o anda con versiones 54, o simialr, y no hay manera.
Quizas tambien fue hackeado y manipulado.
wp core download --force
Atención a este método. Siempre backup antes, por favor
Ejemplo
[comprascc@srv109 public_html]$ php -d memory_limit=512M "$(which wp)" core update && php -d memory_limit=512M "$(which wp)" plugin upgrade --all && php -d memory_limit=512M "$(which wp)" theme upgrade --all
Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /home/comprascc/public_html/wp-includes/load.php:926
Stack trace:
#0 /home/comprascc/public_html/wp-settings.php(400): wp_magic_quotes()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1374): require('/home/comprascc...')
#2 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1293): WP_CLI\Runner->load_wordpress()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#6 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('phar:///usr/loc...')
#7 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#8 {main}
thrown in /home/comprascc/public_html/wp-includes/load.php on line 926
Error: El sitio está experimentando dificultades técnicas.
[comprascc@srv109 public_html]$ wp core update
Fatal error: Uncaught Error: Call to undefined function get_magic_quotes_gpc() in /home/comprascc/public_html/wp-includes/load.php:926
Stack trace:
#0 /home/comprascc/public_html/wp-settings.php(400): wp_magic_quotes()
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1374): require('/home/comprascc...')
#2 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1293): WP_CLI\Runner->load_wordpress()
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#6 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('phar:///usr/loc...')
#7 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#8 {main}
thrown in /home/comprascc/public_html/wp-includes/load.php on line 926
Error: El sitio está experimentando dificultades técnicas.
[comprascc@srv109 public_html]$ wp core update^C
[comprascc@srv109 public_html]$ wp core download --force
Downloading WordPress 6.6.1 (en_US)...
md5 hash verified: a15f676931133623b7b347f1fabc966b
Cleaning up files...
File removed: wp-includes/images/wlw/wp-comments.png
File removed: wp-includes/images/wlw/wp-watermark.png
File removed: wp-includes/images/wlw/wp-icon.png
File removed: wp-includes/Requests/Transport/fsockopen.php
File removed: wp-includes/Requests/Transport/cURL.php
File removed: wp-includes/Requests/Cookie/Jar.php
File removed: wp-includes/Requests/Auth.php
File removed: wp-includes/Requests/Hooker.php
File removed: wp-includes/Requests/IPv6.php
File removed: wp-includes/Requests/Exception/Transport/cURL.php
File removed: wp-includes/Requests/Exception/HTTP.php
File removed: wp-includes/Requests/Exception/Transport.php
File removed: wp-includes/Requests/Exception/HTTP/502.php
File removed: wp-includes/Requests/Exception/HTTP/Unknown.php
File removed: wp-includes/Requests/Exception/HTTP/412.php
File removed: wp-includes/Requests/Exception/HTTP/408.php
File removed: wp-includes/Requests/Exception/HTTP/431.php
File removed: wp-includes/Requests/Exception/HTTP/501.php
File removed: wp-includes/Requests/Exception/HTTP/500.php
File removed: wp-includes/Requests/Exception/HTTP/407.php
File removed: wp-includes/Requests/Exception/HTTP/416.php
File removed: wp-includes/Requests/Exception/HTTP/428.php
File removed: wp-includes/Requests/Exception/HTTP/406.php
File removed: wp-includes/Requests/Exception/HTTP/504.php
File removed: wp-includes/Requests/Exception/HTTP/411.php
File removed: wp-includes/Requests/Exception/HTTP/414.php
File removed: wp-includes/Requests/Exception/HTTP/511.php
File removed: wp-includes/Requests/Exception/HTTP/410.php
File removed: wp-includes/Requests/Exception/HTTP/403.php
File removed: wp-includes/Requests/Exception/HTTP/400.php
File removed: wp-includes/Requests/Exception/HTTP/505.php
File removed: wp-includes/Requests/Exception/HTTP/413.php
File removed: wp-includes/Requests/Exception/HTTP/404.php
File removed: wp-includes/Requests/Exception/HTTP/306.php
File removed: wp-includes/Requests/Exception/HTTP/304.php
File removed: wp-includes/Requests/Exception/HTTP/405.php
File removed: wp-includes/Requests/Exception/HTTP/429.php
File removed: wp-includes/Requests/Exception/HTTP/417.php
File removed: wp-includes/Requests/Exception/HTTP/409.php
File removed: wp-includes/Requests/Exception/HTTP/402.php
File removed: wp-includes/Requests/Exception/HTTP/418.php
File removed: wp-includes/Requests/Exception/HTTP/305.php
File removed: wp-includes/Requests/Exception/HTTP/415.php
File removed: wp-includes/Requests/Exception/HTTP/401.php
File removed: wp-includes/Requests/Exception/HTTP/503.php
File removed: wp-includes/Requests/Response.php
File removed: wp-includes/Requests/Utility/CaseInsensitiveDictionary.php
File removed: wp-includes/Requests/Utility/FilteredIterator.php
File removed: wp-includes/Requests/IRI.php
File removed: wp-includes/Requests/Response/Headers.php
File removed: wp-includes/Requests/Cookie.php
File removed: wp-includes/Requests/IDNAEncoder.php
File removed: wp-includes/Requests/Auth/Basic.php
File removed: wp-includes/Requests/Proxy.php
File removed: wp-includes/Requests/Transport.php
File removed: wp-includes/Requests/Session.php
File removed: wp-includes/Requests/Hooks.php
File removed: wp-includes/Requests/SSL.php
File removed: wp-includes/Requests/Proxy/HTTP.php
File removed: wp-includes/Requests/Exception.php
File removed: wp-includes/css/dist/editor/editor-styles-rtl.css
File removed: wp-includes/css/dist/editor/editor-styles-rtl.min.css
File removed: wp-includes/css/dist/editor/editor-styles.css
File removed: wp-includes/css/dist/editor/editor-styles.min.css
File removed: wp-includes/ID3/license.commercial.txt
File removed: wp-includes/wlwmanifest.xml
File removed: wp-includes/js/jquery/ui/widget.min.js
File removed: wp-includes/js/jquery/ui/position.min.js
File removed: wp-includes/js/wp-a11y.min.js
File removed: wp-includes/js/wp-a11y.js
File removed: wp-includes/random_compat/random.php
File removed: wp-includes/random_compat/byte_safe_strings.php
File removed: wp-includes/random_compat/random_bytes_com_dotnet.php
File removed: wp-includes/random_compat/random_bytes_dev_urandom.php
File removed: wp-includes/random_compat/random_int.php
File removed: wp-includes/random_compat/random_bytes_libsodium_legacy.php
File removed: wp-includes/random_compat/random_bytes_libsodium.php
File removed: wp-includes/random_compat/cast_to_int.php
File removed: wp-includes/random_compat/error_polyfill.php
File removed: wp-includes/random_compat/random_bytes_mcrypt.php
File removed: wp-admin/css/ie-rtl.css
File removed: wp-admin/css/ie.min.css
File removed: wp-admin/css/ie-rtl.min.css
File removed: wp-admin/css/ie.css
File removed: wp-admin/js/wp-fullscreen-stub.js
File removed: wp-admin/js/wp-fullscreen-stub.min.js
86 files cleaned up.
Success: WordPress downloaded.
Actualizar WP Cli
Como root si la aplicación esta en el sistema de forma global
sudo wp cli update
You have version 2.5.0-alpha-3f4c34b. Would you like to update to 2.5.0? [y/n] Y
Downloading from https://github.com/wp-cli/wp-cli/releases/download/v2.5.0/wp-cli-2.5.0.phar...
md5 hash verified: 20ab512b12d766a2d2f51cc8f5c43411
New version works. Proceeding to replace.
Success: Updated WP-CLI to 2.5.0.
Aviso
Esta documentación y su contenido, no implica que funcione en tu caso o determinados casos. También implica que tienes conocimientos sobre lo que trata, y que en cualquier caso tienes copias de seguridad. El contenido el contenido se entrega, tal y como está, sin que ello implique ningún obligación ni responsabilidad por parte de Castris
Si necesitas soporte profesional puedes contratar con Castris soporte profesional.