Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Friday 30 April 2021

How can we update Drupal version?

Easy way to update Drupal website, we just have to follow some steps.

Step 1: Please take website full backup(files + database). We can use Backup and Migrate module ( https://www.drupal.org/project/backup_migrate )

Step 2: Site should be in maintanance mode because it can be broken updation time.

Step 3: Please take care of your patch code that already applied in core.

Step 4: Take a backup of Important files like 'robots.txt', '.htaccess', 'settings.php', 'web.config'. We will not update these files otherwise you will not get your old website.

Step 5: Now upload or override New version of drupal files except of given Step 4 files and 'modules','profiles','themes' folder because in new version these 3 folders will be empty.

Step 6: After full upload of files override Step 4 files.

Step 7: Clear the cache of website.

Step 8: Run update.php file via https://yourserver.com/update.php But by default this file is blocked, you have to enable this feature by setting.php file, go to setting.php file and change the option $settings['update_free_access'] = FALSE; to $settings['update_free_access'] = TRUE;

Step 9: After that save setting.php file and clear cache and hit https://yourserver.com/update.php after completion of process you can check you finally updation of site via https://yourserver.com/admin/reports/updates.


Note: If have any suggestions or issue regarding 'How can we update Drupal version?' then you can ask by comments. 

What is the difference between upgrade and update in Drupal?

It's easy to understand, what is upgrade and update, please have a look.

Update: If Drupal gives minor change version like Drupal 8.0.1 to 8.2.0, so that is update.

Upgrade: If Drupal gives major changes version like Drupal 6 to Drupal 8 or from Drupal 7 to Drupal 8,  that is upgrade.


Note: If have any suggestions or issue regarding 'What is the difference between upgrade and update in Drupal?' then you can ask by comments. 


Friday 14 September 2018

What is right query structure for drupal 8?

Here we are defining our drupal 8 query structure with easy mode. You can find/search here INSERT, SELECT, UPDATE, DELETE.
We will explain in easy way with an examples, Please have a look..
That is our table `testing_form` structure..

id candidate_name candidate_mail candidate_number candidate_dob
1 John john@gmail.com 1236547890 2014-10-22
2 Mary mary@gmail.com 5698741230 2014-10-23
3 Karen karen@gmail.com 0123654789 2014-10-23

INSERT Query Structure:
According to php we will define INSERT Query as:

$insert_query = "INSERT INTO testing_form (candidate_name, candidate_mail, candidate_number, candidate_dob) VALUES ('sahil', 'sahil@gmail.com', '9874563210', '22-11-1990')";
mysqli_query($connection, $insert_query);

And now in case of drupal 8, our structure will be.

$fields = array(
    'candidate_name'   => 'sahil',
    'candidate_mail'   => 'sahil@gmail.com',
    'candidate_number' => '9874563210' ,
    'candidate_dob'    => '22-11-1990',           
);
db_insert('testing_form')
    ->fields($fields)
    ->execute();
   
Here 'testing_form' is table name and $fields variable is the data for fields of table.


SELECT Query Structure:
According to php we will define SELECT Query as:

$select_query = "SELECT * from testing_form where id = '2' and id != '3'";
mysqli_query($connection, $select_query);

And now in case of drupal 8, our structure will be.

$result = db_select('testing_form', 't')
    ->fields('t')
    ->condition('id', 2, '=')
    ->condition('id', 3, '!=')
    ->execute()
    ->fetchAll();
   
Here 'testing_form' is table name and our condition is all 2nd id candidate come but not come on 3rd id candidate.

We have some other method for SELECT query with connection in drupal 8..

$connection = \Drupal\Core\Database\Database::getConnection();
$results = $connection->query('select candidate_name, candidate_mail, candidate_number, candidate_dob')->fetchAll();


UPDATE Query Structure:
According to php we will define UPDATE Query as:

$update_query = "UPDATE `testing_form` set candidate_name='karen sood' where id='3'";
mysqli_query($connection, $update_query);

And now in case of drupal 8, our structure will be.

$update_query = \Drupal::database()->update('testing_form')
          ->fields(array('candidate_name' => 'karen sood', 'candidate_number' => '1236547890'))
          ->condition('id', '3')         
          ->execute();
   
Here 'testing_form' is table name and our condition is id number `2nd` of candidate data will update.

 
DELETE Query Structure:
According to php we will define DELETE Query as:

$delete_query = "DELETE from `testing_form` where id='3'";
mysqli_query($connection, $delete_query);

And now in case of drupal 8, our structure will be.

$delete_query = \Drupal::database()->delete('testing_form');
      ->condition('id', '3');   
      ->execute();
   
Here 'testing_form' is table name and our condition is id number `3rd` of candidate data will delete.


So these all are INSERT, SELECT, UPDATE, DELETE queries structure for Drupal 8. Next time we will come with `JOINS`, like how to use `joins` in drupal 8 query with many of conditions.



Note: If have any suggestions or issue regarding 'What is right query structure for drupal 8?' then you can ask by comments.  

How to resolve max execution time error in drupal ?

When you found error regarding 'max_execution_time' exceed, then you can follow steps for resolve this error: Steps:   You can put t...