Old sessions not deleted in Joomla session table - joomla

I am running Joomla 3.8.6. Number of entries in session table is excess of 25k. But there are only a dozen users online. What's happening?
Today is June 19. I have registered user sessions that are 3 days old in the table. I have guest sessions as old as April 2 in the table.
This was not the case in an older version of Joomla. On May 20, I upgraded to Joomla 3.8.6. I have using Database for managing sessions. Expiry is set to 60 minutes.
Edit (28 June), adding more details
Session settings (configuration.php):
public $lifetime = '60';
public $session_handler = 'database';
public $shared_session = '0';
Plugin (from database):
INSERT INTO `fkd5g_extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES
(480, 0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 0, 1, 0, '{"name":"plg_system_sessiongc","type":"plugin","creationDate":"February 2018","author":"Joomla! Project","copyright":"Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.","authorEmail":"admin#joomla.org","authorUrl":"www.joomla.org","version":"3.8.6","description":"PLG_SYSTEM_SESSIONGC_XML_DESCRIPTION","group":"","filename":"sessiongc"}', '', '', '', 0, '0000-00-00 00:00:00', 0, 0);

Related

Dynamic Date and Time Filter: After 5:00 PM In Previous Day

I am trying to creat a filter that will pull every account that has been set up after 5:00 PM from the previous day. The date and time exist in the same row. I have created a filter that works for the day but the next day, it pulls for two days. For example, here is what it looks like right now:
= Table.SelectRows(#"Sorted Rows", each [Driver ID] > #datetime(2021, 12, 29, 17, 0, 0))
I have tried changing it to the following so it would dynamically change as the days pass:
= Table.SelectRows(#"Sorted Rows", each DateTime.From([Driver ID]) > Date.AddDays(DateTime.From(Driver ID), -1))
But when I do this I get the following error:
Expression.Error: We cannot convert the value #datetime(2021, 12, 30, 0, 5, 0) to type Function.
Details:
Value=12/30/2021 12:05:00 AM
Type=[Type]
I have made sure the column type is in Date/Time format but that doesn’t seem to help.
Has anybody ran into this issue and know a good solution?
try
= Table.SelectRows(#"Sorted Rows", each Date.IsInPreviousNDays([DriverID], 1) and Time.From([DriverID])> #time( 17, 0, 0))

How to create a proper calculation of a due date in a dynamic manner in laravel

I been analyzing the proper calculation of the duedate for my app. I am working with a lending app where I need to display the due date for the borrower.
let say the approved date of their loan is 2019-10-27 and today is 11-5-2019. the payment scheme is dynamic. depending on what the admin set. in this example, the payment scheme weekly so I just need to say;
$duedate = date('M d Y', strtotime($loan_application->date_approval. ' + '.$loan_application->scheme->num_days.' days') );
from my example above the due date is supposedly on Nov 3, 2019. Now how can I make it say that the next due date is on Nov 10, 2019?
I really tried to analyze, here's my thought.
I get the difference between the approval date and NOW()
$diff = Carbon::createFromTimestamp(strtotime($loan_application->date_approval))->diff(Carbon::now())->days;
now I compared the $diff with $loan_application->scheme->num_days. so let say the $diff=9 and $loan_application->scheme->num_days = 7
now I created the condition
if ($diff > $loan_application->scheme->num_days) {
//should display
Nov 10, 2019
//because the current date is already Nov 5
}
and after Nov 10, + 7 days again, and + 7 days again and so on.
here is the complete code I already have;
$dateApproved = Carbon::parse($loan_application->date_approval)->toFormattedDateString();
$now = Carbon::today('M d Y');
$duedate = date('M d Y', strtotime($loan_application->date_approval. ' + '.$loan_application->scheme->num_days.' days') );
$diff = Carbon::createFromTimestamp(strtotime($loan_application->date_approval))->diff(Carbon::now())->days;
$numOfScheme = $loan_application->loanDuration->num_days / $loan_application->scheme->num_days;
if ($diff > $loan_application->scheme->num_days) {
}
I hope you understand my question. Please help. Thank you so much in advance.
this will add number of days from payment scheme. in my example 7 days. but how can I tell my code that today is already 2 days late, add additional 7 days
It took some time but I understood your question.
$date_approval = Carbon::createFromTimestamp(strtotime($loan_application->date_approval));
$scheme_numdays = $loan_application->scheme->num_days;
$days = (intdiv($date_approval->diff(Carbon::now())->days , $scheme_numdays) + 1) * $scheme_numdays
$due_date = $date_approval->addDays($days)->format('M d Y');
intdiv is just php's integer division.

Why is hbase returning row keys that should have all cells expired

We have a table that has a TTL of 30 days. There are no other TTL defined for columns or cells in the table.
hbase(main):001:0> desc 'server_based_data'
Table server_based_data is ENABLED
server_based_data
COLUMN FAMILIES DESCRIPTION
{NAME => 'raw_data', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'SNAPPY', MIN_VERSIONS => '0', TTL => '2592000 SECONDS (30 DAYS)'
, KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
However, when I run a scan on it, it seems that it's finding/running into rowkeys that should have all cells deleted due to the TTL expiring. I know this because the timestamp is a part of the key, e.g. hash_servername_timestamp or 65_app129041.iad1.mydomain.com_1476641940
1476641940 is Oct 16, 2016. I performed the scan for 6/26/2017 from 3pm-4pm
This is the snippet of my scan object/code to get the results to process.
Scan scan = new Scan();
scan.addColumn(Bytes.toBytes("raw_data"), Bytes.toBytes(fileType));
scan.setCaching(500);
scan.setCacheBlocks(false);
scan.setTimeRange(start, end);
TableMapReduceUtil.initTableMapperJob(tableName, scan, MTTRMapper.class, Text.class, IntWritable.class, job);
My job fails (I think) because too many map jobs fail/are killed. Below is a snippet from one of the logs of the failed map jobs.
Error: org.apache.hadoop.hbase.client.RetriesExhaustedException:
Failed after attempts=36, exceptions: Wed Jun 28 13:46:57 PDT 2017,
null, java.net.SocketTimeoutException: callTimeout=120000,
callDuration=120301: row '65_app129041.iad1.mydomain.com_1476641940'
on table 'server_based_data' at region=server_based_data
I tried manually getting the contents of a few of the rows but nothing returns (as expected)
get 'server_based_data', '65_app129041.iad1.mydomain.com_1476641940'
COLUMN CELL
0 row(s) in 0.2900 seconds
My questions are:
Why are these keys showing up in the scan? They shouldn't show up because they don't fall between the start and end times and because the TTL has expired.
How do I debug where these keys are coming from since getting the rowkey from the table yields 0 rows returned.
The problem rows aren't the same from test run to test run. I ran my program back to back to back and each time, the problem rows are different. There are some that are the same between each of the runs but they are not 100% the same.

How can I make time ranges for an iCal calendar from a database of entries?

I've got some Perl script that I'm using to scrape calendar events. I've got a database of events, and now I'd like to process these into an iCal file. I opened my university's academic iCal calendar and got the following:
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
X-WR-TIMEZONE;VALUE=TEXT:America/Los_Angeles
PRODID:-//MMISoftware\, //MMISoftware//EN
X-WR-CALNAME;VALUE=TEXT:spring14cal
X-WR-RELCALID;VALUE=TEXT:87FB4C57-1D7B-4B80-B200-AEED845CB3AF
VERSION:2.0
BEGIN:VEVENT
SEQUENCE:1
UID:41D26C6E-965B-4BFB-AEC0-F1614074A4AF
DTSTAMP:20140127T111052Z
DTSTART;VALUE=DATE:20140101
SUMMARY:FAFSA
DESCRIPTION:First day to obtain FAFSA financial aid applications for 201
4-15 academic year online at http://www.fafsa.ed.gov
DURATION:P1D
END:VEVENT
BEGIN:VEVENT
SEQUENCE:1
UID:DFE257FB-F475-43C2-9AEB-569EC4BA321D
DTSTAMP:20140127T111052Z
DTSTART;VALUE=DATE:20140106
SUMMARY:CA Dream
DESCRIPTION:First day to obtain California Dream Act financial aid appli
cations for 2014-15 academic year online at https://dream.csac.ca.gov
.
.
.
.
I see a start date, end date, and a time stamp, but I don't see a range... Not sure how to use my existing database to make an iCal file---you know, metaprogramming---with time ranges like the following:
http://musformation.com/pics/thg_sync_apple_ical.jpg
You could use Date::ICal to format the duration strings.
The duration itself ( in your case we can see only the duration of the first event, because the duration of the second event would be the first line you skipped ) is DURATION:P1D, where P1D is the Duration itself and DURATION is the property name.
Further information about ICals Duration can be found here.
When you want to parse ICal files, you can use ICal::Parser.
Creating ICal Files can be done easily with Data::ICal. An example:
use Data::ICal;
use Data::ICal::Entry::Event;
use strict;
use warnings;
my $calendar = Data::ICal->new;
my $vtodo = Data::ICal::Entry::Event->new;
$vtodo->add_properties(
summary => "read SO",
description => "reading cool SO posts",
dtstart => Date::ICal->new(
day => 4,
month => 6,
year => 2014,
hour => 8,
min => 30,
sec => 00
)->ical,
dtend => Date::ICal->new(
day => 5,
month => 6,
year => 2014,
hour => 9,
min => 50,
sec => 00
)->ical,
);
$calendar->add_entry($vtodo);
print $calendar->as_string;

Set time part of DateTime in ruby

Say I have a datetime object eg DateTime.now. I want to set hours and minutes to 0 (midnight). How can I do that?
Within a Rails environment:
Thanks to ActiveSupport you can use:
DateTime.now.midnight
DateTime.now.beginning_of_day
OR
DateTime.now.change({ hour: 0, min: 0, sec: 0 })
# More concisely
DateTime.now.change({ hour: 0 })
Within a purely Ruby environment:
now = DateTime.now
DateTime.new(now.year, now.month, now.day, 0, 0, 0, now.zone)
OR
now = DateTime.now
DateTime.parse(now.strftime("%Y-%m-%dT00:00:00%z"))
Nevermind, got it. Need to create a new DateTime:
DateTime.new(now.year, now.month, now.day, 0, 0, 0, 0)
Warning: DateTime.now.midnight and DateTime.now.beginning_of_day return the same value (which is the zero hour of the current day - midnight does not return 24:00:00 as you would expect from its name).
So I am adding this as further info for anyone who might use the accepted answer to calculate midnight x days in the future.
For example, a 14 day free trial that should expire at midnight on the 14th day:
DateTime.now.midnight + 14.days
is the morning of the 14th day, which equates to a 13.x day trial (x is the part of the day left over - if now is noon, then it's 13.5 day trial).
You would actually need to do this:
DateTime.now.midnight + 15.days
to get midnight on the 14th day.
For this reason I always prefer to use beginning_of_day, since that is 00:00:00. Using midnight can be misleading/misunderstood.
If you use it often consider install this gem to improve date parse:
https://github.com/mojombo/chronic
require 'chronic'
Chronic.parse('this 0:00')

Resources