Commit 0c4672ff authored by Carsten  Rose's avatar Carsten Rose
Browse files

Dirty.php, FillStoreForm.php: support of different DBs implemented.

Link.php: SIP Links get automatically parameter '__dbIndexData'
Report.php: can select DB via 'dbIndex' directive (global)
AbstractBuildForm.php: dbIndexData now based on setting in Form (before on config.qfq.ini)
formEditor.sql: FormEditor update on Form 'form' and 'formElements'
parent 6b8db18b
......@@ -763,25 +763,27 @@ version, the system tables will be automatically installed or updated.
System tables
^^^^^^^^^^^^^
+-------------+------------+------+
| Name | Use | Note |
+=============+============+======+
| Clipboard | Temporary | |
+-------------+------------+------+
| Cron | Persistent | |
+-------------+------------+------+
| Dirty | Temporary | |
+-------------+------------+------+
| Form | Persistent | |
+-------------+------------+------+
| FormElement | Persistent | |
+-------------+------------+------+
| MailLog | Persistent | |
+-------------+------------+------+
| Period | Persistent | |
+-------------+------------+------+
| Split | Temporary | |
+-------------+------------+------+
+-------------+------------+------------+
| Name | Use | Database |
+=============+============+============+
| Clipboard | Temporary | QFQ |
+-------------+------------+------------+
| Cron | Persistent | QFQ |
+-------------+------------+------------+
| Dirty | Temporary | QFQ | Data |
+-------------+------------+------------+
| Form | Persistent | QFQ |
+-------------+------------+------------+
| FormElement | Persistent | QFQ |
+-------------+------------+------------+
| MailLog | Persistent | QFQ | Data |
+-------------+------------+------------+
| Period | Persistent | Data |
+-------------+------------+------------+
| Split | Persistent | Data |
+-------------+------------+------------+
* Check Bug #5459 - support of system tables in different DBs not supported.
Multi Databases
^^^^^^^^^^^^^^^
......
......@@ -91,7 +91,8 @@ abstract class AbstractBuildForm {
$this->feSpecAction = $feSpecAction;
$this->feSpecNative = $feSpecNative;
$this->store = Store::getInstance();
$this->dbIndexData = $this->store->getVar(SYSTEM_DB_INDEX_DATA, STORE_SYSTEM);
// $this->dbIndexData = $this->store->getVar(SYSTEM_DB_INDEX_DATA, STORE_SYSTEM);
$this->dbIndexData = $formSpec[F_DB_INDEX];
$this->dbIndexQfq = $this->store->getVar(SYSTEM_DB_INDEX_QFQ, STORE_SYSTEM);
$this->dbArray = $db;
......@@ -333,8 +334,6 @@ abstract class AbstractBuildForm {
/**
* Build MD5 from the current record. Return HTML Input element.
*
* @param bool $flagWithSpan
*
* @return string
* @throws \qfq\CodeException
* @throws \qfq\DbException
......@@ -2645,7 +2644,7 @@ abstract class AbstractBuildForm {
if (isset($control[SUBRECORD_COLUMN_LINK][$columnName])) {
if (!isset($link)) {
$link = new Link($this->sip);
$link = new Link($this->sip, $this->dbIndexData);
}
$cell = $link->renderLink($columnValue);
}
......@@ -2778,7 +2777,7 @@ abstract class AbstractBuildForm {
if (Support::isEnabled($formElement, FE_FILE_DOWNLOAD_BUTTON)) {
if (is_readable($value)) {
$link = new Link($this->sip);
$link = new Link($this->sip, $this->dbIndexData);
$value = $link->renderLink('s|M:file|d|F:' . $value . '|' . $formElement[FE_FILE_DOWNLOAD_BUTTON]);
} else {
// In case debugging is off: showing download button means 'never show the real pathfilename'
......
......@@ -796,6 +796,7 @@ const F_PARAMETER = 'parameter'; // valid for F_ and FE_
// Form columns: via parameter field
const F_DB_INDEX = 'dbIndex';
const DB_INDEX_DEFAULT = "1";
const PARAM_DB_INDEX_DATA = '__dbIndexData'; // Submitted via SIP to make record locking DB aware.
const F_LDAP_SERVER = 'ldapServer';
const F_LDAP_BASE_DN = 'ldapBaseDn';
......
......@@ -319,7 +319,7 @@ class QuickFormQuery {
// Check (and release) dirtyRecord.
if ($formMode === FORM_DELETE || $formMode === FORM_SAVE) {
$dirty = new Dirty();
$dirty = new Dirty(false, $this->dbIndexData, $this->dbIndexQfq);
$answer = $dirty->checkDirtyAndRelease($formMode, $this->formSpec[F_RECORD_LOCK_TIMEOUT_SECONDS],
$this->formSpec[F_DIRTY_MODE], $this->formSpec[F_TABLE_NAME], $recordId, true);
......@@ -334,7 +334,7 @@ class QuickFormQuery {
// FORM_LOAD: if there is an foreign exclusive record lock - show form in F_MODE_READONLY mode.
if ($formMode === FORM_LOAD) {
$dirty = new Dirty();
$dirty = new Dirty(false, $this->dbIndexData, $this->dbIndexQfq);
$recordDirty = array();
$rcLockFound = $dirty->getCheckDirty($this->formSpec[F_TABLE_NAME], $recordId, $recordDirty, $msg);
if (($rcLockFound == LOCK_FOUND_CONFLICT || $rcLockFound == LOCK_FOUND_OWNER) && $recordDirty[F_DIRTY_MODE] == DIRTY_MODE_EXCLUSIVE) {
......@@ -347,7 +347,8 @@ class QuickFormQuery {
$build = new Delete();
} else {
$this->store->fillStoreTableDefaultColumnType($this->formSpec[F_TABLE_NAME]);
$tableDefinition = $this->dbArray[$this->dbIndexData]->getTableDefinition($this->formSpec[F_TABLE_NAME]);
$this->store->fillStoreTableDefaultColumnType($tableDefinition);
switch ($this->formSpec['render']) {
case 'plain':
......@@ -668,25 +669,30 @@ class QuickFormQuery {
unset($form[FE_FILL_STORE_VAR]);
}
// this is needed for filling templateGroup records with their default values
// and for evaluating variables in the Form title
$this->fillStoreWithRecord($form[F_TABLE_NAME], $recordId, STORE_RECORD);
$formSpec = $this->eval->parseArray($form);
// Setting defaults later is too late.
if (!isset($formSpec[F_DB_INDEX])) {
$formSpec[F_DB_INDEX] = $this->dbIndexData;
if (empty($form[F_DB_INDEX])) {
$form[F_DB_INDEX] = $this->dbIndexData;
} else {
$form[F_DB_INDEX] = $this->eval->parse($form[F_DB_INDEX]);
}
// Some forms load/save the form data on extra defined databases.
if ($this->dbIndexData != $formSpec[F_DB_INDEX]) {
if (!isset($this->dbArray[$formSpec[F_DB_INDEX]])) {
$this->dbArray[$formSpec[F_DB_INDEX]] = new Database($formSpec[F_DB_INDEX]);
if ($this->dbIndexData != $form[F_DB_INDEX]) {
if (!isset($this->dbArray[$form[F_DB_INDEX]])) {
$this->dbArray[$form[F_DB_INDEX]] = new Database($form[F_DB_INDEX]);
}
$this->dbIndexData = $formSpec[F_DB_INDEX];
$this->dbIndexData = $form[F_DB_INDEX];
unset($this->eval);
$this->eval = new Evaluate($this->store, $this->dbArray[$this->dbIndexData]);
}
// This is needed for filling templateGroup records with their default values
// and for evaluating variables in the Form title
$this->fillStoreWithRecord($form[F_TABLE_NAME], $recordId, STORE_RECORD);
$formSpec = $this->eval->parseArray($form);
$parameterLanguageFieldName = $this->store->getVar(SYSTEM_PARAMETER_LANGUAGE_FIELD_NAME, STORE_SYSTEM);
$formSpec = HelperFormElement::setLanguage($formSpec, $parameterLanguageFieldName);
......
......@@ -44,7 +44,7 @@ class Save {
$this->feSpecNative = $feSpecNative;
$this->feSpecNativeRaw = $feSpecNativeRaw;
$this->store = Store::getInstance();
$this->db = new Database();
$this->db = new Database($formSpec[F_DB_INDEX]);
$this->evaluate = new Evaluate($this->store, $this->db);
}
......
......@@ -30,7 +30,10 @@ class Dirty {
/**
* @var Database instantiated class
*/
protected $db = null;
protected $dbArray = null;
private $dbIndexData = false;
private $dbIndexQfq = false;
/**
* @var array
......@@ -50,17 +53,34 @@ class Dirty {
/**
* Init class
*/
public function __construct($phpUnit = false) {
public function __construct($phpUnit = false, $dbIndexData = false, $dbIndexQfq = false) {
$this->session = Session::getInstance($phpUnit);
$this->client = Client::getParam();
if (!isset($this->client[DIRTY_RECORD_HASH_MD5])) {
$this->client[DIRTY_RECORD_HASH_MD5] = '';
}
// $this->store = Store::getInstance();
// $dbIndexQfq = $this->store->getVar(SYSTEM_DB_INDEX_QFQ, STORE_SYSTEM);
// $this->db = new Database($dbIndexQfq);
$this->db = new Database();
$this->doDbArray($dbIndexData, $dbIndexQfq);
}
/**
*
*/
private function doDbArray($dbIndexData, $dbIndexQfq) {
if ($dbIndexData !== false) {
$this->dbArray[$dbIndexData] = new Database($dbIndexData);
$this->dbIndexData = $dbIndexData;
}
if ($dbIndexQfq !== false) {
if ($dbIndexQfq != $dbIndexData) {
$this->dbArray[$dbIndexQfq] = new Database($dbIndexQfq);
}
$this->dbIndexQfq = $dbIndexQfq;
}
}
/**
......@@ -86,10 +106,16 @@ class Dirty {
if ($recordId == 0) {
// For r=0 (new) , 'dirty' will always succeed.
return [API_STATUS => 'success', API_MESSAGE => ''];
} else {
$tableVars = $this->db->sql("SELECT tableName, dirtyMode, recordLockTimeoutSeconds FROM Form AS f WHERE f.name=?", ROW_EXPECT_1, [$sipVars[SIP_FORM]], "Form not found: '" . $sipVars[SIP_FORM] . "'");
}
$this->store = Store::getInstance();
$this->dbIndexQfq = $this->store->getVar(SYSTEM_DB_INDEX_QFQ, STORE_SYSTEM);
$this->dbIndexData = empty($sipVars[PARAM_DB_INDEX_DATA]) ? $this->store->getVar(SYSTEM_DB_INDEX_DATA, STORE_SYSTEM) : $sipVars[PARAM_DB_INDEX_DATA];
$this->doDbArray($this->dbIndexData, $this->dbIndexQfq);
$tableVars = $this->dbArray[$this->dbIndexQfq]->sql("SELECT tableName, dirtyMode, recordLockTimeoutSeconds FROM Form AS f WHERE f.name=?", ROW_EXPECT_1, [$sipVars[SIP_FORM]], "Form not found: '" . $sipVars[SIP_FORM] . "'");
switch ($this->client[API_LOCK_ACTION]) {
case API_LOCK_ACTION_LOCK:
case API_LOCK_ACTION_EXTEND:
......@@ -158,7 +184,7 @@ class Dirty {
*/
private function getRecordDirty($tableName, $recordId) {
$recordDirty = $this->db->sql("SELECT * FROM Dirty AS d WHERE d.tableName LIKE ? AND recordId=? ",
$recordDirty = $this->dbArray[$this->dbIndexQfq]->sql("SELECT * FROM Dirty AS d WHERE d.tableName LIKE ? AND recordId=? ",
ROW_EXPECT_0_1, [$tableName, $recordId]);
// Check if the record is timed out - owner doesn't matter.
......@@ -229,11 +255,11 @@ class Dirty {
$tableName = $tableVars[F_TABLE_NAME];
$formDirtyMode = $tableVars[F_DIRTY_MODE];
$record = $this->db->sql("SELECT * FROM $tableName WHERE id=?", ROW_EXPECT_1, [$recordId], "Record to lock not found.");
$record = $this->dbArray[$this->dbIndexData]->sql("SELECT * FROM $tableName WHERE id=?", ROW_EXPECT_1, [$recordId], "Record to lock not found.");
$expire = date('Y-m-d H:i:s', strtotime("+" . $tableVars[F_RECORD_LOCK_TIMEOUT_SECONDS] . " seconds"));
// Write 'dirty' record
$this->db->sql("INSERT INTO Dirty (`sip`, `tableName`, `recordId`, `expire`, `recordHashMd5`, `feUser`, `qfqUserSessionCookie`, `dirtyMode`, `remoteAddress`, `created`) " .
$this->dbArray[$this->dbIndexQfq]->sql("INSERT INTO Dirty (`sip`, `tableName`, `recordId`, `expire`, `recordHashMd5`, `feUser`, `qfqUserSessionCookie`, `dirtyMode`, `remoteAddress`, `created`) " .
"VALUES ( ?,?,?,?,?,?,?,?,?,? )", ROW_REGULAR,
[$s, $tableName, $recordId, $expire, $recordHashMd5, $feUser, $this->client[CLIENT_COOKIE_QFQ], $formDirtyMode,
$this->client[CLIENT_REMOTE_ADDRESS], date('YmdHis')]);
......@@ -260,7 +286,7 @@ class Dirty {
return false; // If there is no recordHashMd5, the check is not possible. Always return 'not modified' (=ok)
}
$record = $this->db->sql("SELECT * FROM $tableName WHERE id=?", ROW_EXPECT_1, [$recordId], "Record to lock not found.");
$record = $this->dbArray[$this->dbIndexData]->sql("SELECT * FROM $tableName WHERE id=?", ROW_EXPECT_1, [$recordId], "Record to lock not found.");
$rcMd5 = OnArray::getMd5($record);
......@@ -410,7 +436,7 @@ class Dirty {
*/
private function deleteDirtyRecord($recordDirtyId) {
$cnt = $this->db->sql('DELETE FROM Dirty WHERE id=? LIMIT 1', ROW_REGULAR, [$recordDirtyId]);
$cnt = $this->dbArray[$this->dbIndexQfq]->sql('DELETE FROM Dirty WHERE id=? LIMIT 1', ROW_REGULAR, [$recordDirtyId]);
if ($cnt != 1) {
throw new CodeException("Failed to delete dirty record id=" . $recordDirtyId, ERROR_DIRTY_DELETE_RECORD);
}
......
......@@ -146,6 +146,8 @@ class Link {
*/
private $thumbnail = null;
private $dbIndexData = false;
private $phpUnit;
private $renderControl = array();
// private $linkClassSelector = array(TOKEN_CLASS_INTERNAL => "internal ", TOKEN_CLASS_EXTERNAL => "external ");
......@@ -235,7 +237,7 @@ class Link {
* @param Sip $sip
* @param bool $phpUnit
*/
public function __construct(Sip $sip, $phpUnit = false) {
public function __construct(Sip $sip, $dbIndexData = DB_INDEX_DEFAULT, $phpUnit = false) {
$this->phpUnit = $phpUnit;
if ($phpUnit) {
......@@ -247,7 +249,7 @@ class Link {
$this->cssLinkClassInternal = $this->store->getVar(SYSTEM_CSS_LINK_CLASS_INTERNAL, STORE_SYSTEM);
$this->cssLinkClassExternal = $this->store->getVar(SYSTEM_CSS_LINK_CLASS_EXTERNAL, STORE_SYSTEM);
$this->ttContentUid = $this->store->getVar(TYPO3_TT_CONTENT_UID, STORE_TYPO3);
$this->dbIndexData = $dbIndexData;
/*
* mode:
* 0: no output
......@@ -787,6 +789,15 @@ class Link {
if ($vars[NAME_MAIL] === '') {
if ($vars[NAME_SIP] === "1") {
// Only for SIP encoded Links: append the current $dbIndexData to make record locking work even for records in dbIndexQfq
if ($vars[NAME_URL_PARAM] != '') {
$vars[NAME_URL_PARAM] .= '&';
}
$vars[NAME_URL_PARAM] .= PARAM_DB_INDEX_DATA . '=' . $this->dbIndexData;
}
if (substr($vars[NAME_URL], 0, 1) === '?') {
$vars[NAME_URL] = INDEX_PHP . $vars[NAME_URL];
}
......@@ -795,6 +806,7 @@ class Link {
$urlNParam = Support::concatUrlParam($vars[NAME_URL] . $vars[NAME_PAGE], $vars[NAME_URL_PARAM]);
if ($vars[NAME_SIP] === "1") {
$paramArray = $this->sip->queryStringToSip($urlNParam, RETURN_ARRAY);
$urlNParam = $paramArray['_url'];
......
......@@ -84,6 +84,7 @@ class Report {
*/
private $db = null;
private $dbIndexData = false;
/**
* @var Thumbnail
*/
......@@ -126,8 +127,6 @@ class Report {
$_SERVER['REQUEST_URI'] = 'localhost';
}
$this->link = new Link($this->sip, $phpUnit);
$this->store = Store::getInstance();
$this->showDebugInfoFlag = (Support::findInSet(SYSTEM_SHOW_DEBUG_INFO_YES, $this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM)));
......@@ -151,11 +150,13 @@ class Report {
$this->pageDefaults[DEFAULT_BOOTSTRAP_BUTTON]["pages"] = TOKEN_BOOTSTRAP_BUTTON;
// Default should already set in QuickFormQuery() Constructor
$dbIndex = $this->store->getVar(TOKEN_DB_INDEX, STORE_TYPO3 . STORE_EMPTY);
$this->dbIndexData = $this->store->getVar(TOKEN_DB_INDEX, STORE_TYPO3 . STORE_EMPTY);
$this->db = new Database($dbIndex);
$this->db = new Database($this->dbIndexData);
$this->variables = new Variables($eval, $t3data["uid"]);
$this->link = new Link($this->sip, $this->dbIndexData, $phpUnit);
// Set static values, which won't change during this run.
$this->fr_error["pid"] = isset($this->variables->resultArray['global.']['page_id']) ? $this->variables->resultArray['global.']['page_id'] : 0;
$this->fr_error["uid"] = $t3data['uid'];
......
......@@ -22,9 +22,12 @@ class FillStoreForm {
private $store = null;
/**
* @var Database
* @var Database[]
*/
private $db = null;
private $dbArray = array();
private $dbIndexData = false;
private $dbIndexQfq = false;
/**
* @var array
......@@ -42,9 +45,20 @@ class FillStoreForm {
public function __construct() {
$this->store = Store::getInstance();
$this->db = new Database();
$this->dbIndexData = $this->store->getVar(PARAM_DB_INDEX_DATA, STORE_SIP);
if ($this->dbIndexData === false) {
$this->dbIndexData = DB_INDEX_DEFAULT; // Fallback for FORMs which are not called via SIP;
}
$this->dbArray[$this->dbIndexData] = new Database($this->dbIndexData);
$this->dbIndexQfq = $this->store->getVar(SYSTEM_DB_INDEX_QFQ, STORE_SYSTEM);
if ($this->dbIndexQfq != $this->dbIndexData) {
$this->dbArray[$this->dbIndexQfq] = new Database($this->dbIndexQfq);
}
$this->feSpecNative = $this->loadFormElementsBasedOnSIP();
$this->evaluate = new Evaluate($this->store, $this->db);
$this->evaluate = new Evaluate($this->store, $this->dbArray[$this->dbIndexData]);
}
......@@ -63,11 +77,11 @@ class FillStoreForm {
// Preparation for Log, Debug
$this->store->setVar(SYSTEM_FORM, $formName, STORE_SYSTEM);
$feSpecNative = $this->db->sql(SQL_FORM_ELEMENT_SIMPLE_ALL_CONTAINER, ROW_EXPECT_GE_1, [$formName],
$feSpecNative = $this->dbArray[$this->dbIndexQfq]->sql(SQL_FORM_ELEMENT_SIMPLE_ALL_CONTAINER, ROW_EXPECT_GE_1, [$formName],
'Form or FormElements not found: ' . ERROR_FORM_NOT_FOUND);
HelperFormElement::explodeParameterInArrayElements($feSpecNative, FE_PARAMETER);
$feSpecTemplateGroup = $this->db->sql(SQL_FORM_ELEMENT_CONTAINER_TEMPLATE_GROUP, ROW_REGULAR, [$formName]);
$feSpecTemplateGroup = $this->dbArray[$this->dbIndexQfq]->sql(SQL_FORM_ELEMENT_CONTAINER_TEMPLATE_GROUP, ROW_REGULAR, [$formName]);
HelperFormElement::explodeParameterInArrayElements($feSpecTemplateGroup, FE_PARAMETER);
$feSpecNative = $this->expandTemplateGroupFormElement($feSpecTemplateGroup, $feSpecNative);
......
......@@ -760,14 +760,12 @@ class Store {
/**
* Fills STORE_TABLE_DEFAULT and STORE_TABLE_COLUMN_TYPES
*
* @param $tableName
* @param array $tableDefinition
*
* @throws CodeException
* @throws UserFormException
*/
public static function fillStoreTableDefaultColumnType($tableName) {
$db = new qfq\Database();
$tableDefinition = $db->getTableDefinition($tableName);
public static function fillStoreTableDefaultColumnType(array $tableDefinition) {
self::setStore(array_column($tableDefinition, 'Default', 'Field'), STORE_TABLE_DEFAULT, true);
self::setStore(array_column($tableDefinition, 'Type', 'Field'), STORE_TABLE_COLUMN_TYPES, true);
......
......@@ -187,8 +187,8 @@ WHERE FIND_IN_SET(Form.name, 'form,formElement,copyForm,cron') > 0;
#
# FormEditor: Form
INSERT INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) VALUES
(1, 'form', 'Form Editor: {{SELECT id, " / ", name FROM Form WHERE id = {{r:S0}}}}', 'FormElement Editor',
'Form', 'sip', 'sip', 'bootstrap', '', 'maxVisiblePill=5\nclass=container-fluid');
(1, 'form', 'Form Editor: {{SELECT id, " / ", name FROM Form WHERE id = {{r:S0}}}} (DB: {{_dbNameQfq:Y}})', 'FormElement Editor',
'Form', 'sip', 'sip', 'bootstrap', '', 'maxVisiblePill=5\nclass=container-fluid\ndbIndex={{DB_INDEX_QFQ:Y}}');
# FormEditor: FormElements for 'form'
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
......@@ -264,9 +264,9 @@ VALUES
INSERT INTO Form (id, name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter, requiredParameterNew)
VALUES
(2, 'formElement',
'Form Element Editor. Form : {{SELECT f.id, " / ", f.name FROM Form AS f WHERE f.id = {{formId:S0}} }}',
'Form Element Editor. Form : {{SELECT f.id, " / ", f.name FROM Form AS f WHERE f.id = {{formId:S0}} }} (DB: {{_dbNameQfq:Y}})',
'Please secure the form',
'FormElement', 'sip', 'sip', 'bootstrap', '', 'maxVisiblePill=5\nclassBody=qfq-color-blue-1', 'formId');
'FormElement', 'sip', 'sip', 'bootstrap', '', 'maxVisiblePill=5\nclassBody=qfq-color-blue-1\ndbIndex={{DB_INDEX_QFQ:Y}}', 'formId');
# FormEditor: FormElements for 'formElement'
INSERT INTO FormElement (id, formId, name, label, mode, type, checkType, class, ord, size, note, clientJs, value,
......
......@@ -31,7 +31,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @expectedException \qfq\UserReportException
*/
public function testUnknownTokenException1() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$link->renderLink('x:hello world');
}
......@@ -40,7 +40,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @expectedException \qfq\UserReportException
*/
public function testUnknownTokenException2() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$link->renderLink('abc:hello world');
}
......@@ -48,7 +48,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
/**
*/
public function testLinkUrlBasic() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);
......@@ -76,7 +76,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
*
*/
public function testLinkUrlBasicExceptionDouble() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$link->renderLink('u:http://example.com|u:http://new.org');
}
......@@ -86,7 +86,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
*
*/
public function testLinkUrlBasicExceptionEmpty1() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$link->renderLink('u');
}
......@@ -96,7 +96,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
*
*/
public function testLinkUrlBasicExceptionEmpty2() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$link->renderLink('u:');
}
......@@ -104,7 +104,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
/**
*/
public function testLinkPageBasic() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);
$result = $link->renderLink('p');
......@@ -129,7 +129,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
/**
*/
public function testLinkMailBasic() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$result = $link->renderLink('m:john@doe.com');
$this->assertEquals('<a href="mailto:john@doe.com" >mailto:john@doe.com</a>', $result);
......@@ -143,7 +143,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
*
*/
public function testLinkMailBasicExceptionMissing1() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$link->renderLink('m');
}
......@@ -153,7 +153,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
*
*/
public function testLinkMailBasicExceptionMissing2() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$link->renderLink('m:');
}
......@@ -161,7 +161,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
/**
*/
public function testMailEncryption() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
//TODO: aktivieren sobald encrypted Mails implemented.
// $result = $link->renderLink('m:john@doe.com|e');
......@@ -181,7 +181,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @throws UserReportException
*/
public function testRenderModeUrl() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);
......@@ -267,7 +267,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @throws UserReportException
*/
public function testRenderModePage() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
Store::setVar(TYPO3_PAGE_ID, 'firstPage', STORE_TYPO3);
// r: default (0)
......@@ -375,7 +375,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @throws UserReportException
*/
public function testRenderModeMail() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
// r: default (0)
$result = $link->renderLink('m:john@doe.com');
......@@ -459,7 +459,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @throws UserReportException
*/
public function testRenderModeUrlPicture() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
// r: default (0)
$result = $link->renderLink('u:http://example.com|P:picture.gif');
......@@ -544,7 +544,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @throws UserReportException
*/
public function testRenderModeUrlButton() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
// r: default (0)
$result = $link->renderLink('u:http://example.com|B:yellow');
......@@ -627,7 +627,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase {
* @throws UserReportException
*/
public function testIcons() {
$link = new Link($this->sip, true);
$link = new Link($this->sip, DB_INDEX_DEFAULT, true);
$result