From: <var...@us...> - 2014-11-18 16:26:59
|
Revision: 9330 http://sourceforge.net/p/phpwiki/code/9330 Author: vargenau Date: 2014-11-18 16:26:56 +0000 (Tue, 18 Nov 2014) Log Message: ----------- Get closer lib/AccessLog.php and lib/Request.php Modified Paths: -------------- trunk/lib/AccessLog.php trunk/lib/Request.php Modified: trunk/lib/AccessLog.php =================================================================== --- trunk/lib/AccessLog.php 2014-11-18 09:58:08 UTC (rev 9329) +++ trunk/lib/AccessLog.php 2014-11-18 16:26:56 UTC (rev 9330) @@ -12,7 +12,7 @@ * * PhpWiki is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along @@ -38,7 +38,7 @@ * @param string $logfile Log file name. * @param bool $do_sql */ - function Request_AccessLog($logfile, $do_sql = false) + function __construct($logfile, $do_sql = false) { //global $request; // request not yet initialized! @@ -171,13 +171,6 @@ } } - function read_sql($where = '') - { - if (empty($this->sqliter)) - $this->sqliter = $this->_read_sql_query($where); - return $this->sqliter->next(); - } - function _read_sql_query($where = '') { global $request; @@ -189,6 +182,13 @@ . ($where ? " WHERE $where" : "")); } + function read_sql($where = '') + { + if (empty($this->sqliter)) + $this->sqliter = $this->_read_sql_query($where); + return $this->sqliter->next(); + } + /* done in request->finish() before the db is closed */ function write_sql() { Modified: trunk/lib/Request.php =================================================================== --- trunk/lib/Request.php 2014-11-18 09:58:08 UTC (rev 9329) +++ trunk/lib/Request.php 2014-11-18 16:26:56 UTC (rev 9330) @@ -905,7 +905,11 @@ } /** - * Return iterator of referer items reverse sorted (latest first). + * Return iterator of referrer items reverse sorted (latest first). + * + * @param int $limit + * @param bool $external_only + * @return WikiDB_Array_generic_iter */ function get_referer($limit = 15, $external_only = false) { @@ -965,7 +969,8 @@ function _read_sql_query($where = '') { - $dbh =& $GLOBALS['request']->_dbi; + global $request; + $dbh =& $request->_dbi; $log_tbl =& $this->logtable; return $dbh->genericSqlIter("SELECT *,request_uri as request,request_time as time,remote_user as user," . "remote_host as host,agent as user_agent" @@ -983,7 +988,8 @@ /* done in request->finish() before the db is closed */ function write_sql() { - $dbh =& $GLOBALS['request']->_dbi; + global $request; + $dbh =& $request->_dbi; if (isset($this->entries) and $dbh and $dbh->isOpen()) foreach ($this->entries as $entry) { $entry->write_sql(); @@ -1183,7 +1189,7 @@ } /** - * Shutdown callback. + * Shutdown callback. Ensures that the file is written. * * @access private * @see Request_AccessLogEntry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |