Remove files unrelated to WordPress from uploads

I don’t know whether there is a better WP-CLI way or not, but you could write a simple script that recursively crawls your uploads directory (or it’s subdirectories) and than check the absolute paths (URLs) of those files and compare them against guid column in wp_posts table. If your file is not there, WordPress doesn’t … Read more

WP-CLI Error Requesting CURL Extension

Though, curl appeared to be properly working from https://localhost.sitedomain.com/phpinfo.php , the true cause of the error was that curl was in fact disabled within the global php.ini file located at /etc/php/<php version #>/php.ini , which is different from local active php.ini located at /etc/php/7.3/apache2/php.ini . Now everything works properly.

Give WP-Cli User Home Directory Privileges

Yes, I will accept the “newbie” embarrassment and answer my basic questions . 😉 1.) www-data 2.) For fellow wp-cli newbies, follow this excellent tutorial to get wp-cli working in local dev, and remember NOT to forget the last step. 🙂 3.) One should never put the html directory in /home/ for the reason malicious … Read more

Mocking WP_CLI static methods in unit tests

So I am using PEST as my testing framework, and if I just define my mocks in the helpers, they won’t be called correctly, because the WPCLI will probably be autoloaded after that on each test. So I added beforeEach(function () { $wpCliMock = \Mockery::mock(‘alias:WP_CLI’); $wpCliMock ->shouldReceive(‘success’) ->andReturnArg(0); $wpCliMock ->shouldReceive(‘error’) ->andReturnArg(0); }); Inside my tests, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)