Subversion Repositories oidplus

Rev

Rev 1197 | Rev 1345 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1197 Rev 1224
Line 42... Line 42...
42
        public function log(OIDplusLogEvent $event): bool {
42
        public function log(OIDplusLogEvent $event): bool {
43
                $addr = $_SERVER['REMOTE_ADDR'] ?? '';
43
                $addr = $_SERVER['REMOTE_ADDR'] ?? '';
44
                OIDplus::dbIsolated()->query("insert into ###log (addr, unix_ts, event) values (?, ?, ?)", array($addr, time(), $event->getMessage())); // TODO: why unix_ts? Why not a database DATETIME field?!
44
                OIDplus::dbIsolated()->query("insert into ###log (addr, unix_ts, event) values (?, ?, ?)", array($addr, time(), $event->getMessage())); // TODO: why unix_ts? Why not a database DATETIME field?!
45
                $log_id = OIDplus::dbIsolated()->insert_id();
45
                $log_id = OIDplus::dbIsolated()->insert_id();
46
                if ($log_id === 0) {
46
                if ($log_id === 0) {
47
                        $res = OIDplus::dbIsolated()->query("select max(id) as last_id from ###log");
47
                        $log_id = OIDplus::dbIsolated()->getScalar("select max(id) as last_id from ###log");
48
                        if (!$res->any()) throw new OIDplusException(_L('Could not log event'));
-
 
49
                        $row = $res->fetch_array();
-
 
50
                        $log_id = $row['last_id'];
-
 
51
                        if ($log_id == 0) throw new OIDplusException(_L('Could not log event'));
48
                        if (!$log_id) throw new OIDplusException(_L('Could not log event'));
52
                }
49
                }
53
 
50
 
54
                $object_dupe_check = array();
51
                $object_dupe_check = array();
55
                $user_dupe_check = array();
52
                $user_dupe_check = array();
56
                foreach ($event->getTargets() as $target) {
53
                foreach ($event->getTargets() as $target) {