Code fragment
$application->Conn->Query('SELECT * FROM inp_MasterOnly');
- in Database Manager:
- create new database as copy/paste from database used in In-Portal
- in original database create inp_MasterOnly database table
- remember created database name
- in IDE:
- open /tools/cron.php file for editing
- after $application->Init(); line add code shown above test plan
- save changes
- open /tools/run_event.php file for editing
- after $application->Init(); line add code shown above test plan
- comment out exit_code(1, 'This script needs to be enabled manually !'); line
- save changes
- change /system/config.php file to:
- enable support for load balancing (see example in http://community.in-portal.org/x/Npkk and you can use same server as both slave & master)
- for slave connection add DBName key (even though it's not listed in Confluence) with above copied database name
- basically what we need is inp_MasterOnly table to be present on master (original) database only, but not on slave database
- in core/kernel/db/db_load_balancer.php file change \kDBLoadBalancer::reallyOpenConnection method change $this->servers[0]['DBName'] to $server['DBName'] (allows to use different DB name for slave, that was added in config.php file)
- in CLI (command line)
- go to folder, where In-Portal is located
- execute php tools/cron.php
- confirm, that no SQL error happened
- execute php tools/run_event.php adm:OnBuild b674006f3edb1d9cd4d838c150b0567d
- confirm, that no SQL error happened