Learning with Texts - Fork
2.10.0-fork
Learn foreign languages with texts
|
Connects to the database and check its state. More...
Namespaces | |
Lwt | |
Functions | |
do_mysqli_query ($sql) | |
runsql ($sql, $m, $sqlerrdie=true) | |
get_first_value ($sql) | |
prepare_textdata ($s) | |
prepare_textdata_js ($s) | |
convert_string_to_sqlsyntax ($data) | |
convert_string_to_sqlsyntax_nonull ($data) | |
convert_string_to_sqlsyntax_notrim_nonull ($data) | |
convert_regexp_to_sqlsyntax ($input) | |
validateLang ($currentlang) | |
validateText ($currenttext) | |
validateTag ($currenttag, $currentlang) | |
validateArchTextTag ($currenttag, $currentlang) | |
validateTextTag ($currenttag, $currentlang) | |
getSettingZeroOrOne ($key, $dft) | |
getSetting ($key) | |
getSettingWithDefault ($key) | |
saveSetting ($k, $v) | |
LWTTableCheck () | |
LWTTableSet ($key, $val) | |
LWTTableGet ($key) | |
adjust_autoincr ($table, $key) | |
optimizedb () | |
update_japanese_word_count ($japid) | |
set_word_count () | |
parse_japanese_text ($text, $id) | |
save_processed_text_with_sql ($text, $id) | |
parse_standard_text ($text, $id, $lid) | |
prepare_text_parsing ($text, $id, $lid) | |
check_text_valid ($lid) | |
registerSentencesTextItems ($tid, $lid, $hasmultiword) | |
update_default_values ($id, $lid, $_sql) | |
displayTextStatistics ($lid, $rtlScript, $multiwords) | |
check_text ($sql, $rtlScript, $wl) | |
checkExpressions ($wl) | |
check_text_with_expressions ($id, $lid, $wl, $wl_max, $mw_sql) | |
splitCheckText ($text, $lid, $id) | |
reparse_all_texts () | |
update_database ($dbname) | |
prefixSQLQuery ($sql_line, $prefix) | |
check_update_db ($debug, $tbpref, $dbname) | |
connect_to_database ($server, $userid, $passwd, $dbname, $socket="") | |
getDatabasePrefix ($dbconnection) | |
get_database_prefixes (&$tbpref) | |
Variables | |
$DBCONNECTION | |
$tbpref = null | |
$fixed_tbpref = null | |
Connects to the database and check its state.
PHP version 8.1
adjust_autoincr | ( | $table, | |
$key | |||
) |
Adjust the auto-incrementation in the database.
@global string $tbpref Database table prefix
check_text | ( | $sql, | |
$rtlScript, | |||
$wl | |||
) |
Check a text and display statistics about it.
string | $sql | |
bool | $rtlScript | true if language is right-to-left |
int[] | $wl | Words lengths |
check_text_valid | ( | $lid | ) |
Echo the sentences in a text. Prepare JS data for words and word count.
int | $lid | Language ID |
@global string $tbpref Database table prefix
check_text_with_expressions | ( | $id, | |
$lid, | |||
$wl, | |||
$wl_max, | |||
$mw_sql | |||
) |
Check a language that contains expressions.
int | $id | Text ID |
int | $lid | Language ID |
int[] | $wl | Word length |
int | $wl_max | Maximum word length |
string | $mw_sql | SQL-formatted string |
@global string $tbpref Database table prefix
check_update_db | ( | $debug, | |
$tbpref, | |||
$dbname | |||
) |
Check and/or update the database.
@global mysqli $DBCONNECTION Connection to the database.
counter for cache rebuild
checkExpressions | ( | $wl | ) |
Check a language that contains expressions.
int[] | $wl | All the different expression length in the language. |
@global string $tbpref Database table prefix
connect_to_database | ( | $server, | |
$userid, | |||
$passwd, | |||
$dbname, | |||
$socket = "" |
|||
) |
Make the connection to the database.
string | $server | Server name |
string | $userid | Database user ID |
string | $passwd | User password |
string | $dbname | Database name |
string | $socket | Database socket |
@psalm-suppress UndefinedDocblockClass
convert_string_to_sqlsyntax | ( | $data | ) |
Prepares a string to be properly recognized as a string by SQL.
string | $data | Input string |
@global $DBDONNECTION
convert_string_to_sqlsyntax_nonull | ( | $data | ) |
Prepares a string to be properly recognized as a string by SQL.
string | $data | Input string |
convert_string_to_sqlsyntax_notrim_nonull | ( | $data | ) |
Prepares a string to be properly recognized as a string by SQL.
string | $data | Input string |
displayTextStatistics | ( | $lid, | |
$rtlScript, | |||
$multiwords | |||
) |
Display statistics about a text.
int | $lid | Language ID |
bool | $rtlScript | true if language is right-to-left |
bool | $multiwords | Display if text has multi-words |
@global $tbpref
do_mysqli_query | ( | $sql | ) |
Do a SQL query to the database. It is a wrapper for mysqli_query function.
string | $sql | Query using SQL syntax |
@global mysqli $DBCONNECTION Connection to the database
get_database_prefixes | ( | & | $tbpref | ) |
Get the prefixes for the database.
Is $tbpref set in connect.inc.php? Take it and $fixed_tbpref=1. If not: $fixed_tbpref=0. Is it set in table "_lwtgeneral"? Take it. If not: Use $tbpref = '' (no prefix, old/standard behaviour).
string | null | $tbpref | Temporary database table prefix |
get_first_value | ( | $sql | ) |
Return the record "value" in the first line of the database if found.
string | $sql | MySQL query |
getDatabasePrefix | ( | $dbconnection | ) |
Get the prefixes for the database.
Is $tbpref set in connect.inc.php? Take it and $fixed_tbpref=1. If not: $fixed_tbpref=0. Is it set in table "_lwtgeneral"? Take it. If not: Use $tbpref = '' (no prefix, old/standard behaviour).
string | null | $tbpref | Temporary database table prefix |
getSetting | ( | $key | ) |
Get a setting from the database. It can also check for its validity.
string | $key | Setting key. If $key is 'currentlanguage' or 'currenttext', we validate language/text. |
getSettingWithDefault | ( | $key | ) |
Get the settings value for a specific key. Return a default value when possible
string | $key | Settings key |
@global string $tbpref Table name prefix
getSettingZeroOrOne | ( | $key, | |
$dft | |||
) |
Convert a setting to 0 or 1
string | $key | The input value |
string | int | $dft | Default value to use, should be convertible to string |
@psalm-return 0|1
LWTTableCheck | ( | ) |
Check if the _lwtgeneral table exists, create it if not.
optimizedb | ( | ) |
Optimize the database.
@global string $trbpref Table prefix
parse_japanese_text | ( | $text, | |
$id | |||
) |
Parse a Japanese text using MeCab and add it to the database.
string | $text | Text to parse. |
int | $id | Text ID. If $id = -1 print results, if $id = -2 return splitted texts |
@global string $tbpref Database table prefix
@psalm-return non-empty-list<string>|null
parse_standard_text | ( | $text, | |
$id, | |||
$lid | |||
) |
Parse a text using the default tools. It is a not-japanese text.
string | $text | Text to parse |
int | $id | Text ID. If $id == -2, only split the text. |
int | $lid | Language ID. |
@global string $tbpref Database table prefix
@psalm-return non-empty-list<string>|null
prefixSQLQuery | ( | $sql_line, | |
$prefix | |||
) |
Add a prefix to table in a SQL query string.
string | $sql_line | SQL string to prefix. |
string | $prefix | Prefix to add |
prepare_text_parsing | ( | $text, | |
$id, | |||
$lid | |||
) |
Pre-parse the input text before a definitive parsing by a specialized parser.
@global string $tbpref Database table prefix
@psalm-return non-empty-list<string>|null
prepare_textdata | ( | $s | ) |
Replace Windows line return ("\r\n") by Linux ones ("\n").
string | $s | Input string |
registerSentencesTextItems | ( | $tid, | |
$lid, | |||
$hasmultiword | |||
) |
Append sentences and text items in the database.
int | $tid | ID of text from which insert data |
int | $lid | ID of the language of the text |
bool | $hasmultiword | Set to true to insert multi-words as well. |
@global string $tbpref Database table prefix
reparse_all_texts | ( | ) |
Reparse all texts in order.
@global string $tbpref Database table prefix
runsql | ( | $sql, | |
$m, | |||
$sqlerrdie = true |
|||
) |
Run a SQL query, you can specify its behavior and error message.
string | $sql | MySQL query |
string | $m | Success phrase to prepend to the number of affected rows |
bool | $sqlerrdie | To die on errors (default = TRUE) |
save_processed_text_with_sql | ( | $text, | |
$id | |||
) |
Insert a processed text in the data in pure SQL way.
string | $text | Preprocessed text to insert |
int | $id | Text ID |
@global string $tbpref Database table prefix
saveSetting | ( | $k, | |
$v | |||
) |
Save the setting identified by a key with a specific value.
string | $k | Setting key |
mixed | $v | Setting value, will get converted to string |
@global string $tbpref Table name prefix
set_word_count | ( | ) |
Initiate the number of words in terms for all languages
Only terms with a word count set to 0 are changed.
@global string $tbpref Database table prefix
splitCheckText | ( | $text, | |
$lid, | |||
$id | |||
) |
Parse the input text.
string | $text | Text to parse |
string | int | $lid | Language ID (LgID from languages table) |
int | $id | References whether the text is new to the database $id = -1 => Check, return protocol $id = -2 => Only return sentence array $id = TextID => Split: insert sentences/textitems entries in DB |
@global string $tbpref Database table prefix
@psalm-return non-empty-list<string>|null
update_database | ( | $dbname | ) |
Update the database if it is using an outdate version.
string | $dbname | Name of the database |
@global string $tbpref Database table prefix @global 0|1 $debug Output debug messages.
update_default_values | ( | $id, | |
$lid, | |||
$_sql | |||
) |
Append sentences and text items in the database.
int | $id | New default text ID |
int | $lid | New default language ID |
string | $_sql | Unnused since 2.10.0. Will be removed in 3.0.0. |
@global string $tbpref Database table prefix
update_japanese_word_count | ( | $japid | ) |
Update the word count for Japanese language (using MeCab only).
int | $japid | Japanese language ID |
@global string $tbpref Database table prefix.
validateLang | ( | $currentlang | ) |
Validate a language ID
string | $currentlang | Language ID to validate |
@global string $tbpref Table name prefix
validateText | ( | $currenttext | ) |
Validate a text ID
string | $currenttext | Text ID to validate |
@global string '' if the text is not valid, $currenttext otherwise
@global string $tbpref Table name prefix
$DBCONNECTION |