WooCommerce maintaince mode by using php

You need to replace the following:

if ( ! current_user_can('administrator') ) {

with

if ( ! current_user_can('manage_options') ) {

This is because there’s no such capability as administrator. There are a couple of administrator-only capabilities, and manage_options is a reliable one to use.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)