Skip to content

Commit

Permalink
Merge pull request #15 from oc-group/release_8
Browse files Browse the repository at this point in the history
Fix max url length
  • Loading branch information
padvincenzo authored Dec 9, 2024
2 parents e3586f8 + 4653948 commit 6e80c15
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
38 changes: 20 additions & 18 deletions classes/Form/class.ilNolejCreationFormGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ protected function setSources($mediaSource): void
// Source web URL.
$url = new ilUriInputGUI($this->plugin->txt("prop_" . self::PROP_URL), self::PROP_URL);
$url->setRequired(true);
$url->setMaxLength(65000);
$mediaWeb->addSubItem($url);

// Source web type.
Expand Down Expand Up @@ -710,7 +711,7 @@ protected function saveMob($content = null)
$media_item->setPurpose("Standard");

// Save file to its path.
$path = $mob_dir . "/" . $filename;
$path = "{$mob_dir}/{$filename}";
if ($content == null) {
ilFileUtils::moveUploadedFile(
$_FILES[self::PROP_INPUT_FILE]["tmp_name"],
Expand Down Expand Up @@ -813,26 +814,27 @@ public function runCreation(
return sprintf($this->plugin->txt("err_doc_response"), $message);
}

$this->db->manipulateF(
"UPDATE " . ilNolejPlugin::TABLE_DATA . " SET document_id = %s WHERE id = %s;",
["text", "integer"],
[$result->id, $this->obj_gui->getObject()->getId()]
$this->db->update(
ilNolejPlugin::TABLE_DATA,
[
"document_id" => ["text", $result->id],
],
[
"id" => ["integer", $this->obj_gui->getObject()->getId()],
]
);

$this->db->manipulateF(
"INSERT INTO " . ilNolejPlugin::TABLE_DOC
. " (title, status, consumed_credit, doc_url, media_type, automatic_mode, language, document_id)"
. "VALUES (%s, %s, %s, %s, %s, %s, %s, %s);",
["text", "integer", "integer", "text", "text", "text", "text", "text"],
$this->db->insert(
ilNolejPlugin::TABLE_DOC,
[
$this->obj_gui->getObject()->getTitle(),
ilNolejManagerGUI::STATUS_CREATION_PENDING,
$decrementedCredit,
$url,
$format,
ilUtil::tf2yn($automaticMode),
$language,
$result->id,
"title" => ["text", $this->obj_gui->getObject()->getTitle()],
"status" => ["integer", ilNolejManagerGUI::STATUS_CREATION_PENDING],
"consumed_credit" => ["integer", $decrementedCredit],
"doc_url" => ["blob", $url],
"media_type" => ["text", $format],
"automatic_mode" => ["text", ilUtil::tf2yn($automaticMode)],
"language" => ["text", $language],
"document_id" => ["text", $result->id],
]
);

Expand Down
2 changes: 1 addition & 1 deletion classes/class.ilNolejWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function checkTranscription()
$this->plugin->log("Result: ko");

$db->manipulateF(
"UPDATE " . ilNolejPlugin::TABLE_DOC . " consumed_credit = %s WHERE document_id = %s;",
"UPDATE " . ilNolejPlugin::TABLE_DOC . " SET consumed_credit = %s WHERE document_id = %s;",
["integer", "text"],
[$this->data["consumedCredit"], $documentId]
);
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

$id = "xnlj";
$version = "2.3";
$version = "2.4";

$ilias_min_version = "8.0";
$ilias_max_version = "9.999";
Expand Down
18 changes: 18 additions & 0 deletions sql/dbupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,21 @@
}

?>

<#5>
<?php

if ($ilDB->tableColumnExists("rep_robj_xnlj_doc", "doc_url")) {
$ilDB->modifyTableColumn(
"rep_robj_xnlj_doc",
"doc_url",
[
"type" => "blob",
"length" => 65000,
"notnull" => true,
"default" => null,
]
);
}

?>

0 comments on commit 6e80c15

Please sign in to comment.