Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Monday, October 2, 2023

MySQL group by unix timestamp

Drupal CMS includes a webform where each form has an ID. An example to retrieve number of user access of a Drupal database for a given node id. The column ws.created is stored with a unix timestamp (looks like many digits number). Use MySQL function from_unixtime to format into something like 2023-10-02. The node in this example have an ID=940.

select count(ufd.name) submissions, DATE_FORMAT(from_unixtime(ws.created), "%Y-%m-%d")
from webform_submission ws 
left join users_field_data ufd 
on ws.uid = ufd.uid
left join node_field_data nfd 
on ws.entity_id = nfd.nid
where ws.in_draft = 0
and ws.entity_type like 'node'
and ws.entity_id = 940
group by DATE_FORMAT(from_unixtime(ws.created), "%Y-%m-%d")

Here is a query to list all the associated users who accessed the webform

select ufd.name name, ufd.mail email, from_unixtime(ws.created) accepted_at, from_unixtime(ws.changed) changed_at, ws.remote_addr 
,nfd.title, ws.uri URL
from webform_submission ws 
left join users_field_data ufd 
on ws.uid = ufd.uid
left join node_field_data nfd 
on ws.entity_id = nfd.nid 
where ws.in_draft = 0
and ws.entity_type like 'node'
and ws.entity_id = 940

Thursday, October 2, 2008

A CMS called Drupal

Content Management Systems (CMS) like Drupal have been popular as it provided a relatively powerful framework for customisation. As Drupal is upgraded, the user customised modules are protected to ensure that it can continue to work. Currently many CMS administrators fear upgrading their CMS as things will break due to extensive customisations.

Drupal version 5.x and 6.x currently supports PHP 5.2. This provides better security and performance. Did I mention performance? Currently due to Drupal modularity, it can be tweak for performance to the max. This depends on the web server, PHP and MySQL settings. By default, non registered visitors use Drupal cached pages which reduces load on Drupal.
See a typo3, Joomla and Drupal and part II comparison.

Drupal provides regular security updates at http://drupal.org/security and through mailing list.

Following are general precautions on installation of CMS, refer to http://tboxmy.blogspot.com/2008/08/cms-called-joomla.html
Additional precautions you can take:

Use only modules that is proven secure. Drupal security problems revolve mostly on poorly written additional modules.

Example of vulnerability:
Plugin Manager - Access Bypass, allowed any user to uninstall and remove modules.
Mail handler - SQL injection, allowed malicious users to gain administrator access.

Blog Archive