Upgrading from Drupal 7 to Drupal 10
Submitted by system on Tue, 01/09/2024 - 12:08Create a new D10 portal. Enable migrate modules.
Enable https://www.drupal.org/project/migrate_upgrade to allow migrations via Drush.
Set up a Migrate Database
FOSS CMS
Create a new D10 portal. Enable migrate modules.
Enable https://www.drupal.org/project/migrate_upgrade to allow migrations via Drush.
Set up a Migrate Database
1. Install Upgrade Status[https://www.drupal.org/project/upgrade_status] module to check issues contrib and custom modules compatibility.
2. Remove Upgrade Status when all checks are green and ready to go. Uninstall Upgrade status and remove it from Composer.
composer remove drupal/upgrade_status
3. Temporarily add write access to protected files and directories
With the advent of Drupal 8 and composer integration, there is a better way of installing Drush.
Install Composer:
curl -sS https://getcomposer.org/installer | php
Enable Composer access for All Users:
mv composer.phar /usr/local/bin/composer
ln -s /usr/local/bin/composer /usr/bin/composer
Install Drush:
For Drupal6 , it is recommended to use menu_get_object()
<?php
/**
* Convert the HTML into a PDF and store it in a particular location.
* In this example, the dompdf library is stored under libraries folder in Drupal.
*/
function ji_custom_convert_pdf($user_html){
//Get path of dompdf folder under libraries
set_include_path(libraries_get_path('dompdf'));
require_once "dompdf_config.inc.php";
$dompdf = new DOMPDF();
$dompdf->load_html($user_html);
$dompdf->render();
$output = $dompdf->output();
file_put_contents("sites/default/files/resume/".$user->name."_resume.pdf", $output);
}
?>
--
<?php
/*
* Part of Rules condition code that returns true if the current time during cron is between 6 am and 7 am
*/
$ji_daily_status = variable_get("ji_daily_report","1"); //Check if the variable is set, if not set it to 1 [First Time]
/*
* This fragment checks if the time is between 6 and 7, if so enables the flag
* If any other time, sets the ji_daily_report so that next time it executes when cron runs between 6 and 7
*/
$time = date('H'); // Get the current time
/* Any arbitrary time - Checks if the time is not between 6 am and 7 am */
if($time < 6 || $time > 7){
Improving Site Performance:
1. Disable all caching in the site and do benchmark for anon user
2. Benchmark for auth user for a particular page
3. Check logs to see if any notice or error is happening in the site. Solve the issue and notice BM
4. Disable unwanted modules if any and do another benchmark. Note the diff.
5. Modify or update apache or mysql setting minor if any to see noticiable change in benchmark
6. Optimize PHP and see if noticeable difference occurs
7. Install Devel and check queries and page rendering times
During custom form submission we would want to remember the previous selection. There are many ways to do that, which includes using Sessions and variable_set to set the default value but this is an overkill if you wanted to simply preserve/remember the selection in the next page or after submission. The best way is to use $form_state['storage'] in your submit handler to hoard values between steps.
Consider an example:
<?php
function custom_form_submit($form, &$form_state) {
$start_date = $form_state['values']['startdate'];
$end_date = $form_state['values']['enddate'];
Accessing a view programmatically
<?php
$view = views_get_view('view_name');
$view->init();
$view->set_display('default'); // or display id like page_1, block_1
$view->set_arguments(array($ARGS));
//display_name = 'default' or 'page' and so on
//filter_name is the name of the filter
//debug($view->display['display_name']->handler->options['filters']['filter_name']);
$view->display['default']->handler->options['filters']['date_filter']['value']['min']='2012-05-01';
$view->display['default']->handler->options['filters']['date_filter']['value']['max']='2012-06-30';
Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project. Its major features include powerful full-text search, hit highlighting, faceted search, dynamic clustering, database integration, rich document (e.g., Word, PDF) handling, and geospatial search. Solr is highly scalable, providing distributed search and index replication, and it powers the search and navigation features of many of the world's largest internet sites.
--
Source: http://lucene.apache.org/solr/