Helper class to export license reference bulk data as CSV or JSON from the DB.
More...
Helper class to export license reference bulk data as CSV or JSON from the DB.
Definition at line 21 of file BulkTextExport.php.
◆ __construct()
| Fossology\Lib\Application\BulkTextExport::__construct |
( |
DbManager |
$dbManager | ) |
|
Constructor
- Parameters
-
| DbManager | $dbManager | DB manager to use. |
Definition at line 37 of file BulkTextExport.php.
◆ createCsvContent()
| Fossology\Lib\Application\BulkTextExport::createCsvContent |
( |
|
$result, |
|
|
|
$includeLicenseText = false |
|
) |
| |
|
private |
Create CSV content, one row per text+license, compatible with CustomTextImport.
- Parameters
-
| array | $result | Database result array |
| bool | $includeLicenseText | Whether to include rf_text from license_ref |
- Returns
- string CSV content
Definition at line 178 of file BulkTextExport.php.
◆ createJson()
| Fossology\Lib\Application\BulkTextExport::createJson |
( |
|
$result, |
|
|
|
$includeLicenseText = false |
|
) |
| |
|
private |
Create JSON content, nested licenses format, compatible with CustomTextImport.
- Parameters
-
| array | $result | Database result array |
| bool | $includeLicenseText | Whether to include rf_text from license_ref |
- Returns
- string JSON content
Definition at line 245 of file BulkTextExport.php.
◆ exportBulkText()
| Fossology\Lib\Application\BulkTextExport::exportBulkText |
( |
|
$user_pk = 0, |
|
|
|
$group_pk = 0, |
|
|
|
$generateJson = false, |
|
|
|
$includeLicenseText = false |
|
) |
| |
Export license reference bulk data from the DB as CSV or JSON.
- Parameters
-
| int | $user_pk | Filter by user ID, set 0 to export all |
| int | $group_pk | Filter by group ID, set 0 to export all |
| bool | $generateJson | Whether to generate JSON format instead of CSV |
- Returns
- string CSV or JSON content
Definition at line 79 of file BulkTextExport.php.
◆ groupResultsByText()
| Fossology\Lib\Application\BulkTextExport::groupResultsByText |
( |
|
$result, |
|
|
|
$includeLicenseText = false |
|
) |
| |
|
private |
Group flat DB rows by rf_text into the nested licenses format.
- Parameters
-
| array | $result | Database result array |
| bool | $includeLicenseText | Whether to include rf_text from license_ref |
- Returns
- array keyed by rf_text
Definition at line 129 of file BulkTextExport.php.
◆ normalizeNewlinesForCsv()
| Fossology\Lib\Application\BulkTextExport::normalizeNewlinesForCsv |
( |
|
$value | ) |
|
|
private |
Convert CR/LF variants to literal
for line-safe CSV rows.
- Parameters
-
| string | null | $value | Value to normalize. |
- Returns
- string
Definition at line 234 of file BulkTextExport.php.
◆ setDelimiter()
| Fossology\Lib\Application\BulkTextExport::setDelimiter |
( |
|
$delimiter = ',' | ) |
|
Update the delimiter.
- Parameters
-
| string | $delimiter | New delimiter to use. |
Definition at line 46 of file BulkTextExport.php.
◆ setEnclosure()
| Fossology\Lib\Application\BulkTextExport::setEnclosure |
( |
|
$enclosure = '"' | ) |
|
Update the enclosure.
- Parameters
-
| string | $enclosure | New enclosure to use. |
Definition at line 61 of file BulkTextExport.php.
◆ $dbManager
| DbManager Fossology\Lib\Application\BulkTextExport::$dbManager |
|
protected |
◆ $delimiter
| string Fossology\Lib\Application\BulkTextExport::$delimiter = ',' |
|
protected |
◆ $enclosure
| string Fossology\Lib\Application\BulkTextExport::$enclosure = '"' |
|
protected |
The documentation for this class was generated from the following file: