Batch interface to WordPress
Components
oik-wp
oik-batch
Allows you to run parts of WordPress in batch mode
No connection to the database
Performs bootstrap logic preparing a [wp] client environment.
Supports direct invocation of batch processes.
Sub component: oik-git
Run under oik-batch, checks the status of Git repositories for changes that need to be committed
Syntax: batch oik-git.php from the plugin or theme directory
Sub component: oik-innodb
Converts MyISAM tables to InnoDB to enable in situ PHPUnit tests
Syntax: oikwp oik-innodb.php
Sub component: oik-sqldump
Syntax: oikwp oik-sqldump.php
Creates a backup of your MySQL database
Target directory hardcoded as C:/backups-qw/qw/sqldumps
Super component: oik-phpunit
Syntax: php oik-phpunit.php PHPUnit parms url=domain path=site-path
Supports invocation of in situ PHP testing for WordPress MultiSite
Calls PHPUnit having previously saved the parameters required to start WordPress MultiSite in a batch environment
oik-batch.php and oik-wp.php
As of v0.8.7 oik-batch is no longer dependent upon the oik base plugin's files for batch processing.
If you activate either oik-batch or oik-wp then it will report a dependency on the oik base plugin.
For other routines, such as createapi2.php, which is used for listing and defining the APIs implemented by a WordPress plugin, theme or WordPress core itself, you will need the following:
Create a batch file for each of the main routines
oikwp.bat for invoking oik-wp.php
rem Run oik-wp in batch mode so that you can test some code outwith the browser
php c:\apache\htdocs\wordpress\wp-content\plugins\oik-batch\oik-wp.php %*
Run the routine from the required installation's folder where the php file exists. This allows oik-wp to determine the correct wp-config file to use. eg
cd \apache\htdocs\oikcom\wp-content\plugins\oik-shortcodes
oikwp
batch.bat for invoking oik-batch.php
php c:\apache\htdocs\wordpress\wp-content\plugins\oik-batch\oik-batch.php %*
pass the name of the PHP file to invoke as the first parameter
e.g. To invoke listapis2 use:
batch listapis2 <i>plugin</i>
Alternatively oik-batch.php can be included in the main routine.
php c:\apache\htdocs\wordpress\wp-content\plugins\oik-batch\createapi2.php --plugin=%1 --site=https://oik-plugins.co.uk --apikey=apikey
wu.bat for invoking oik-phpunit.php
set PRE_PHPUNIT_CD=%CD%
set PHPUNIT=c:\apache\htdocs\phpLibraries\phpunit\phpunit-8.4.1.phar
php C:\apache\htdocs\wordpress\wp-content\plugins\oik-batch\oik-phpunit.php "--verbose" "--disallow-test-output" "--stop-on-error" "--stop-on-failure" "--log-junit=phpunit.json" %*
Update for support for PHP 8.1 and PHP 8.2.