Skip to content

Commit fa265cc

Browse files
committed
Add & Use generic PRAGMA_SET_CREATED_UPDATED_BY
1 parent 55e0ca3 commit fa265cc

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Pragma/Docs/Models/Document.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public function __construct(){
2020
$this->pushHook('after_open', 'initPublicState');
2121
$this->pushHook('before_save', 'checkPublicChanges');
2222
$this->pushHook('after_save', 'initPublicState');
23+
24+
if(defined('PRAGMA_SET_CREATED_UPDATED_BY')){
25+
$this->pushHook('before_save', PRAGMA_SET_CREATED_UPDATED_BY);
26+
}
27+
2328
return parent::__construct(self::getTableName());
2429
}
2530

Pragma/Docs/Models/Folder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public function __construct(){
1616
$this->pushHook('before_save', 'testFolderName');
1717
$this->pushHook('before_save', 'detectChangeFolder');
1818
$this->pushHook('before_delete', 'deleteFolder');
19+
20+
if(defined('PRAGMA_SET_CREATED_UPDATED_BY')){
21+
$this->pushHook('before_save', PRAGMA_SET_CREATED_UPDATED_BY);
22+
}
23+
1924
return parent::__construct(self::getTableName());
2025
}
2126

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ Options needed:
2222

2323
`DOC_STORE` directory need read/write access for www-data.
2424

25-
`EXTRA_PATH`is used in the Document::extract_text method. This method allows you to get the text content of a document and requires `textract` tool on the server. `EXTRA_PATH` is helpfull when the PATH accessible by PHP does not contain the directory where `textract` is.
25+
`PRAGMA_SET_CREATED_UPDATED_BY` is a generic method to define created_by & updated_by fields on documents and folders.
2626

27-
As you already know,tThis functionnality requires the `textract` tool on the server (https://github.com/dbashford/textract) and several dependencies based on your OS :
27+
`EXTRA_PATH` is used in the Document::extract_text method. This method allows you to get the text content of a document and requires `textract` tool on the server. `EXTRA_PATH` is helpfull when the PATH accessible by PHP does not contain the directory where `textract` is.
28+
29+
As you already know, this functionnality requires the `textract` tool on the server (https://github.com/dbashford/textract) and several dependencies based on your OS :
2830

2931
#### All OS :
3032

0 commit comments

Comments
 (0)