WordUploadService
in package
Facade for term import operations.
Delegates to ImportUtilities, SimpleImportService, and CompleteImportService. Preserves the original public API for all callers.
Tags
Table of Contents
Properties
- $completeImport : CompleteImportService
- $simpleImport : SimpleImportService
- $utilities : ImportUtilities
Methods
- __construct() : mixed
- countImportedTerms() : int
- Count imported terms.
- createTempFile() : string
- Create a temporary file from text input.
- getDelimiter() : string
- Get delimiter character from tab type.
- getImportedTerms() : array<string|int, mixed>
- Get imported terms for display.
- getLanguageData() : array<string|int, mixed>|null
- Get language data for a specific language.
- getLastWordUpdate() : string|null
- Get the last word status change timestamp.
- getSqlDelimiter() : string
- Get delimiter for SQL LOAD DATA statement.
- handleMultiwords() : void
- Handle multi-word expressions after import.
- importComplete() : void
- Import terms with complete processing (handles tags, overwrite modes).
- importSimple() : void
- Import terms using simple import (no tags, no overwrite).
- importTagsOnly() : void
- Import tags only (no terms).
- isLocalInfileEnabled() : bool
- Check if local infile is enabled in MySQL and PHP.
- isRightToLeft() : bool
- Get right-to-left setting for a language.
- linkWordsToTextItems() : void
- Link imported words to text items.
-
parseColumnMapping()
: array{columns: array
, fields: array{txt: int, tr: int, ro: int, se: int, tl: int}} - Parse column mapping from request.
Properties
$completeImport
private
CompleteImportService
$completeImport
$simpleImport
private
SimpleImportService
$simpleImport
$utilities
private
ImportUtilities
$utilities
Methods
__construct()
public
__construct() : mixed
countImportedTerms()
Count imported terms.
public
countImportedTerms(string $lastUpdate) : int
Parameters
- $lastUpdate : string
-
Last update timestamp
Return values
int —Number of imported terms
createTempFile()
Create a temporary file from text input.
public
createTempFile(string $content) : string
Parameters
- $content : string
-
Text content to write
Return values
string —Path to temporary file
getDelimiter()
Get delimiter character from tab type.
public
getDelimiter(string $tabType) : string
Parameters
- $tabType : string
-
Tab type (c, t, h)
Return values
string —Delimiter character
getImportedTerms()
Get imported terms for display.
public
getImportedTerms(string $lastUpdate, int $offset, int $limit) : array<string|int, mixed>
Parameters
- $lastUpdate : string
-
Last update timestamp
- $offset : int
-
Offset for pagination
- $limit : int
-
Limit for pagination
Return values
array<string|int, mixed> —Imported terms data
getLanguageData()
Get language data for a specific language.
public
getLanguageData(int $langId) : array<string|int, mixed>|null
Parameters
- $langId : int
-
Language ID
Return values
array<string|int, mixed>|null —Language data or null if not found
getLastWordUpdate()
Get the last word status change timestamp.
public
getLastWordUpdate() : string|null
Return values
string|null —Last update timestamp
getSqlDelimiter()
Get delimiter for SQL LOAD DATA statement.
public
getSqlDelimiter(string $tabType) : string
Parameters
- $tabType : string
-
Tab type (c, t, h)
Return values
string —SQL delimiter string
handleMultiwords()
Handle multi-word expressions after import.
public
handleMultiwords(int $langId, string $lastUpdate) : void
Parameters
- $langId : int
-
Language ID
- $lastUpdate : string
-
Last update timestamp
importComplete()
Import terms with complete processing (handles tags, overwrite modes).
public
importComplete(int $langId, array{txt: int, tr: int, ro: int, se: int, tl: int} $fields, string $columnsClause, string $delimiter, string $fileName, int $status, int $overwrite, bool $ignoreFirst, string $translDelim, string $tabType) : void
Parameters
- $langId : int
-
Language ID
- $fields : array{txt: int, tr: int, ro: int, se: int, tl: int}
-
Field indexes
- $columnsClause : string
-
SQL columns clause
- $delimiter : string
-
Field delimiter
- $fileName : string
-
Path to input file
- $status : int
-
Word status
- $overwrite : int
-
Overwrite mode
- $ignoreFirst : bool
-
Ignore first line
- $translDelim : string
-
Translation delimiter
- $tabType : string
-
Tab type (c, t, h)
importSimple()
Import terms using simple import (no tags, no overwrite).
public
importSimple(int $langId, array{txt: int, tr: int, ro: int, se: int, tl?: int} $fields, string $columnsClause, string $delimiter, string $fileName, int $status, bool $ignoreFirst) : void
Parameters
- $langId : int
-
Language ID
- $fields : array{txt: int, tr: int, ro: int, se: int, tl?: int}
-
Field indexes
- $columnsClause : string
-
SQL columns clause
- $delimiter : string
-
Field delimiter
- $fileName : string
-
Path to input file
- $status : int
-
Word status
- $ignoreFirst : bool
-
Ignore first line
importTagsOnly()
Import tags only (no terms).
public
importTagsOnly(array{tl: int} $fields, string $tabType, string $fileName, bool $ignoreFirst) : void
Parameters
- $fields : array{tl: int}
-
Field indexes
- $tabType : string
-
Tab type (c, t, h)
- $fileName : string
-
Path to input file
- $ignoreFirst : bool
-
Ignore first line
isLocalInfileEnabled()
Check if local infile is enabled in MySQL and PHP.
public
isLocalInfileEnabled() : bool
Return values
bool —True if local_infile is enabled on both server and client
isRightToLeft()
Get right-to-left setting for a language.
public
isRightToLeft(int $langId) : bool
Parameters
- $langId : int
-
Language ID
Return values
bool —True if language is RTL
linkWordsToTextItems()
Link imported words to text items.
public
linkWordsToTextItems() : void
parseColumnMapping()
Parse column mapping from request.
public
parseColumnMapping(array<string|int, mixed> $columns, bool $removeSpaces) : array{columns: array, fields: array{txt: int, tr: int, ro: int, se: int, tl: int}}
Parameters
- $columns : array<string|int, mixed>
-
Column assignments from form (Col1-Col5)
- $removeSpaces : bool
-
Whether language removes spaces