first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
include_once 'Cronjob_controller.php';
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* Backup Code Cronjob Controller
|
||||
* @copyright 2019 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
class Backup_code_cronjob_controller extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index ()
|
||||
{
|
||||
$date = date('Y-m-d');
|
||||
$this->project_backup($date);
|
||||
// $this->send_backup($date);
|
||||
}
|
||||
|
||||
private function project_backup($date)
|
||||
{
|
||||
$this->load->library('zip');
|
||||
$this->zip->read_dir(FCPATH, FALSE);
|
||||
$this->zip->archive("project_backup_{$date}.zip");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
include_once 'Cronjob_controller.php';
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* Backup Database Cronjob Controller
|
||||
* @copyright 2019 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
class Backup_db_cronjob_controller extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index ()
|
||||
{
|
||||
$date = date('Y-m-d');
|
||||
$this->database_backup($date);
|
||||
// $this->send_backup($date);
|
||||
}
|
||||
|
||||
private function database_backup($date)
|
||||
{
|
||||
$this->load->helper('file');
|
||||
$this->load->dbutil();
|
||||
@$backup = $this->dbutil->backup();
|
||||
write_file("database_backup_{$date}.zip", $backup);
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* Cronjob Abstract Controller
|
||||
* @copyright 2019 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
class Cronjob_controller extends CI_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Debug Controller to error_log and turn off in production
|
||||
*
|
||||
* @param mixed $data
|
||||
* @return void
|
||||
*/
|
||||
public function dl($key, $data)
|
||||
{
|
||||
if (ENVIRONMENT == 'development')
|
||||
{
|
||||
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug json Controller to error_log and turn off in production
|
||||
*
|
||||
* @param mixed $data
|
||||
* @return void
|
||||
*/
|
||||
public function dj($key, $data)
|
||||
{
|
||||
if (ENVIRONMENT == 'development')
|
||||
{
|
||||
error_log($key . ' CONTROLLER : ' . json_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to send Emails given slug, payload and email
|
||||
*
|
||||
* @param string $slug
|
||||
* @param mixed $payload
|
||||
* @param string $email
|
||||
* @return void
|
||||
*/
|
||||
protected function _send_email_notification($slug, $payload, $email)
|
||||
{
|
||||
$this->load->model('email_model');
|
||||
$this->load->library('mail_service');
|
||||
$this->mail_service->set_adapter('smtp');
|
||||
$email_template = $this->email_model->get_template($slug, $payload);
|
||||
|
||||
if ($email_template)
|
||||
{
|
||||
$from = $this->config->item('from_email');
|
||||
return $this->mail_service->send($from, $email, $email_template->subject, $email_template->html);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to send Sms given slug, payload and phone #
|
||||
*
|
||||
* @param string $slug
|
||||
* @param mixed $payload
|
||||
* @param string $to
|
||||
* @return void
|
||||
*/
|
||||
protected function _send_sms_notification($slug, $payload, $to)
|
||||
{
|
||||
$this->load->model('sms_model');
|
||||
$this->load->library('sms_service');
|
||||
$this->sms_service->set_adapter('sms');
|
||||
$sms_template = $this->sms_model->get_template($slug, $payload);
|
||||
|
||||
if ($sms_template)
|
||||
{
|
||||
return $this->sms_service->send($to, $sms_template->content);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to send Push notification
|
||||
*
|
||||
* @param string $slug
|
||||
* @param mixed $payload
|
||||
* @param string $to
|
||||
* @return void
|
||||
*/
|
||||
protected function _send_push_notification($device_type, $device_id, $title, $message, $image)
|
||||
{
|
||||
$this->load->library('push_notification_service');
|
||||
$this->push_notification_service->init();
|
||||
return $this->push_notification_service->send($device_type, $device_id, $title, $message, $image);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* Abstract Controller
|
||||
*
|
||||
* @copyright 2019 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
class Migration_cron_controller extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('migration');
|
||||
|
||||
if ($this->migration->current() === FALSE)
|
||||
{
|
||||
print_r($this->migration->error_string());
|
||||
} else {
|
||||
echo 'Complete';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
include_once 'Cronjob_controller.php';
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* Token Cronjob Controller
|
||||
* @copyright 2019 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
class Token_cronjob_controller extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index ()
|
||||
{
|
||||
$this->load->database();
|
||||
$this->load->model('token_model');
|
||||
$reset_token_status = $this->token_model->raw_query("UPDATE `token` SET status=0 WHERE `expire_at` < NOW();");
|
||||
$remove_expired_tokens = $this->token_model->raw_query("DELETE FROM `token` WHERE status=0");
|
||||
}
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user