diff --git a/Tina4/DataSQLite3.php b/Tina4/DataSQLite3.php index ae67c949..21207819 100644 --- a/Tina4/DataSQLite3.php +++ b/Tina4/DataSQLite3.php @@ -70,8 +70,7 @@ public function native_fetch($sql="", $noOfRecords=10, $offSet=0) { $recordCursor = $this->dbh->query($sql); $records = []; - for ($i = 0; $i < $noOfRecords; $i++ ) { - $recordArray = $recordCursor->fetchArray(SQLITE3_ASSOC); + while ($recordArray = $recordCursor->fetchArray(SQLITE3_ASSOC)) { if (!empty($recordArray)) { $records[] = (new DataRecord($recordArray)); } diff --git a/Tina4Php.php b/Tina4Php.php index 0e1c2116..5a71b296 100644 --- a/Tina4Php.php +++ b/Tina4Php.php @@ -53,9 +53,21 @@ function __construct($config = null) if (!defined("TINA4_PUT")) define("TINA4_PUT", "PUT"); if (!defined("TINA4_PATCH")) define("TINA4_PATCH", "PATCH"); if (!defined("TINA4_DELETE")) define("TINA4_DELETE", "DELETE"); + if (!defined("TINA4_DOCUMENT_ROOT")) define ("TINA4_DOCUMENT_ROOT", null); + + $debugBackTrace = debug_backtrace(); + $callerFile = $debugBackTrace[0]["file"]; //calling file /.../.../index.php + $callerDir = str_replace("index.php", "", $callerFile); + + //root of the website - $this->documentRoot = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR); + if (defined ("TINA4_DOCUMENT_ROOT") && empty(TINA4_DOCUMENT_ROOT)) { + $this->documentRoot = $callerDir; + //$this->documentRoot = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR); + } else { + $this->documentRoot = TINA4_DOCUMENT_ROOT; + } if (file_exists("Tina4Php.php")) { $this->documentRoot = realpath(dirname(__FILE__)); @@ -65,7 +77,7 @@ function __construct($config = null) //root of tina4 $this->webRoot = realpath(dirname(__FILE__)); - error_log("TINA4: web root " . $this->webRoot); + error_log("TINA4: web path " . $this->webRoot); //check for composer defines if (file_exists($this->webRoot . "/vendor/autoload.php")) { diff --git a/documentation/classes/Tina4.Any.html b/documentation/classes/Tina4.Any.html index f8db021e..9028e25b 100644 --- a/documentation/classes/Tina4.Any.html +++ b/documentation/classes/Tina4.Any.html @@ -114,12 +114,12 @@ @@ -207,7 +209,8 @@

\Tina4Any

-

The Any route intercepts any type of call that can be made to the web server

+

Class Any Sets the $method variable in Class Route to ANY using the definition in Class Tina4Php +The Any route intercepts any type of call that can be made to the web server e.g. Any::add()

@@ -300,13 +303,13 @@

Properties

$method

-
$method : 
+
$method : string

Type

- -
+ string + — Sets $method to ANY