function redirector_log_404() { if ( $error404 = Redirector404s::findByURL($_SERVER['REQUEST_URI']) ) { $error404->hits++; $error404->updated = date('Y-m-d H:i:s'); $error404->save(); } else { $error404 = new Redirector404s(array( 'url' => $_SERVER['REQUEST_URI'], 'hits' => 1, 'created' => date('Y-m-d H:i:s'), 'updated' => date('Y-m-d H:i:s') )); $error404->save(); } }