Opencart Automatic Maintenance

Asked

Viewed 228 times

1

Does anyone know enough about opencart?

I need to put a store in maintenance mode automatically, in case every Saturday. I have already customized the maintenance page, I just need to leave automatic.

1 answer

3

Cronjob must be used.

Knowing that we can go to the code.

<?php
class ControllerToolMaintenance extends Controller {
    public function index() {
        //Aqui o OC vai verificar se a key está correta, isso vai ajudar a fazer com que terceiros não faça esse processo manual.
        if (isset($this->request->get['key']) && $this->request->get['key'] = 'SUA_KEY') {
            //Aqui o código vai ativar o modo manutenção.
            $this->db->query('UPDATE ' . DB_PREFIX . 'setting SET config_maintenance = 1 WHERE key = "config_maintenance"');
        }
    }
    public function normal() {
        //Aqui o OC vai verificar se a key está correta, isso vai ajudar a fazer com que terceiros não faça esse processo manual.
        if (isset($this->request->get['key']) && $this->request->get['key'] = 'SUA_KEY') {
            //Aqui o código vai ativar o modo manutenção.
            $this->db->query('UPDATE ' . DB_PREFIX . 'setting SET config_maintenance = 0 WHERE key = "config_maintenance"');
        }
    }
}

Just create this file in the Catalog/controller/tool folder and save as Maintenance.php

About the Cron: http://blog.thiagobelem.net/o-que-sao-e-como-usar-as-cron-jobs/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.