Posts

Drupal 7 Quiz Questions Export with Quiz title, multichoice and answer

Image
  To get such output, just run the code in your phpmyadmin below: Select QUIZ . parent_nid , EXAM . title , SU . name AS SUBJECT , ND . NID , ND . title , FVB . Body_value , GROUP_CONCAT ( MCA . answer , ' ; ' ) AS OPTIONS , ANS . field_answer_value AS ANSWER from `node` as ND Inner join `quiz_multichoice_answers` as MCA on MCA . Question_NID = ND . NID AND MCA . question_vid = ND . VID Inner join `field_revision_body` as FVB on FVB . entity_ID = ND . NID AND FVB . revision_id = ND . VID AND FVB . Entity_type = "Node" Inner join `field_data_field_subject` AS SUB on SUB . entity_id = ND . NID AND SUB . revision_id = ND . VID Inner join `taxonomy_term_data` AS SU on SU . tid = SUB . field_subject_tid Inner join `field_data_field_answer` AS ANS on ANS . entity_id = ND . NID AND ANS . revision_id = ND . VID Inner join `quiz_node_relationship` AS QUIZ on QUIZ . child_nid = MCA . Question_NID Inner join `node` AS EX

Setup local timezone in the Koha Server with 3 commands

Image
 Sometimes our server and local time has difference, which makes the sytem behind the current time.  To solve this we previously used ntp servers, but now timedatectl is enough.  Let's do it:  Open koha root terminal:  Enter the command below:  Command 1:  timedatectl You will get output like this: This is not the right time as I am in Dhaka, my timezone is Asia/Dhaka and local time is 11:45.17 AM which is 6 hours ahead of the server time.  Enter the command below:  Command 2:  timedatectl list-timezones Let's see the list of timezones and pickup my zone. Going to bottom after several enter till my timezone appears.  Now we got our timezone "Asia/Dhaka". Let's set it up. Command 3:   timedatectl set-timezone Asia/Dhaka Let's check the configuration:  Also check in About koha:  Enjoy! 

Koha commands to check and fix all the biblio records automagically

Prepare system first:  export PERL5LIB="/usr/share/koha/lib" export KOHA_CONF="/etc/koha/sites/library/koha-conf.xml" Run:  /usr/share/koha/bin/maintenance/touch_all_biblios.pl -v Seat back and watch the output till  the end when you will see:  Touched biblio 25818 Good: 25092, Bad: 108 (of 25200) in 489 seconds Accuracy: 99.57% Average time per record: 0.019405 seconds

Necessary Debian Administration commands

 Cache server cache: Problem: Failed to flush caches: Unit dbus-org.freedesktop.resolve1.service not found. Solution:  Enable the systemd-resolve service systemd-resolve --flush-caches

Install git CLI gh commands in debian

Reference: https://github.com/cli/cli/blob/trunk/docs/install_linux.md https://github.com/cli/cli/releases wget https://github.com/cli/cli/releases/download/v2.12.1/gh_2.12.1_linux_amd64.deb dpkg -i gh_2.12.1_linux_amd64.deb apt -f install

Drupal Insert into new content type date only field from existing timestamp

CODE:  INSERT INTO node__field_date (entity_id, bundle, revision_id, langcode, field_date_value) SELECT nid, type, vid, langcode, FROM_UNIXTIME(created, '%Y-%m-%d') FROM node_field_data  Table comparison: node__field_data = node__field_date nid = entity_id type = bundle vid = revision_id langcode = langcode created = field_date_value Sample data: bundle:newsclips:type entity_id:123670 revision_id:123785 langcode:en field_date_value:2022-06-13