Usage of Revision with custom php files

mladen

New member
Hi,

is there any way i can use "revision" if i manipulate data through custom php files?

-----------------------------------------
You are using DaDaBIK version 11.1-Elba platinum, installed on 06-10-2021 (installation code: ), the latest version of DaDaBIK is 11.6-Elba released on 14-06-2022

System info​

PHP Version: 7.2.24

mysql version: 8.0.26

Web server: Apache/2.4.37 (rocky)

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
 

eugenio

Administrator
Staff member
Interesting question. This is not an intended use but maybe you can try to call the function register_revision in your files.

INSERT
register_revision($table_name, '', $last_inserted_ID, $current_user, 'insert');

UPDATE
register_revision($table_name, $ID_field, $ID_value, $current_user, 'update');

DELETE
register_revision($table_name, $ID_field, $ID_value, $current_user, 'delete');

I haven't tested it but it should work. Since there isn't a proper API for this and your are directly executing some DaDaBIK core code, the risk is that, if in the future the implementation of register_revision changes, your code will break.

Best,
 

mladen

New member
Hi,

i tried this and it returns below error.
Where is this function hidden? Since i am doing updates through custom 'headless' scripts in the background, i need to include it or require it.

Fatal error: Uncaught Error: Call to undefined function register_revision()
 

eugenio

Administrator
Staff member
Hi,
the function is defined so that message is very strange.
Are you sure you are using the platinum files (maybe you also had an enterprise license don't know)?
If you are not using the platinum files, the function is undefined.

Best,
 
Top