Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nguyenanhung/codeigniter3-vercel-skeleton
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.0
Choose a base ref
...
head repository: nguyenanhung/codeigniter3-vercel-skeleton
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 10 commits
  • 12 files changed
  • 1 contributor

Commits on Aug 22, 2024

  1. Update cache path

    nguyenanhung committed Aug 22, 2024
    Copy the full SHA
    af1f930 View commit details

Commits on Sep 8, 2024

  1. Copy the full SHA
    31207f3 View commit details
  2. Copy the full SHA
    cfd769b View commit details

Commits on Sep 21, 2024

  1. Update README

    nguyenanhung committed Sep 21, 2024
    Copy the full SHA
    0701464 View commit details

Commits on Nov 14, 2024

  1. Add debug pgsql

    nguyenanhung committed Nov 14, 2024
    Copy the full SHA
    28297c8 View commit details

Commits on Nov 20, 2024

  1. Update error config

    nguyenanhung committed Nov 20, 2024
    Copy the full SHA
    ad6d655 View commit details

Commits on Nov 24, 2024

  1. Update nginx templates

    nguyenanhung committed Nov 24, 2024
    Copy the full SHA
    066c641 View commit details

Commits on Dec 27, 2024

  1. Update cache

    nguyenanhung committed Dec 27, 2024
    Copy the full SHA
    ec43bcd View commit details

Commits on Dec 31, 2024

  1. Update html templates

    nguyenanhung committed Dec 31, 2024
    Copy the full SHA
    5d64881 View commit details
  2. Update welcome page

    nguyenanhung committed Dec 31, 2024
    Copy the full SHA
    fcc9aec View commit details
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[![Latest Stable Version](http://poser.pugx.org/nguyenanhung/codeigniter3-vercel-skeleton/v)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton) [![Total Downloads](http://poser.pugx.org/nguyenanhung/codeigniter3-vercel-skeleton/downloads)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton) [![Latest Unstable Version](http://poser.pugx.org/nguyenanhung/codeigniter3-vercel-skeleton/v/unstable)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton) [![License](http://poser.pugx.org/nguyenanhung/codeigniter3-vercel-skeleton/license)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton) [![PHP Version Require](http://poser.pugx.org/nguyenanhung/codeigniter3-vercel-skeleton/require/php)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton)
[![Latest Stable Version](https://img.shields.io/packagist/v/nguyenanhung/codeigniter3-vercel-skeleton.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton)
[![Total Downloads](https://img.shields.io/packagist/dt/nguyenanhung/codeigniter3-vercel-skeleton.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton)
[![License](https://img.shields.io/packagist/l/nguyenanhung/codeigniter3-vercel-skeleton.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton)
[![PHP Version Require](https://img.shields.io/packagist/dependency-v/nguyenanhung/codeigniter3-vercel-skeleton/php)](https://packagist.org/packages/nguyenanhung/codeigniter3-vercel-skeleton)

# CodeIgniter v3 Framework - Skeleton Vercel Application

@@ -16,7 +19,7 @@ much difference compared to the `codeigniter3-skeleton` package.
"framework": null,
"functions": {
"api/**/*.php": {
"runtime": "vercel-php@0.7.1"
"runtime": "vercel-php@0.7.3"
}
},
"outputDirectory": "public",
@@ -40,11 +43,11 @@ much difference compared to the `codeigniter3-skeleton` package.

## 💯 Vercel PHP Runtime Versions

- `vercel-php@0.7.1` - Node 18.x / PHP 8.3.x (https://example-php-8-3.vercel.app)
- `vercel-php@0.6.2` - Node 18.x / PHP 8.2.x (https://example-php-8-2.vercel.app)
- `vercel-php@0.5.5` - Node 18.x / PHP 8.1.x (https://example-php-8-1.vercel.app)
- `vercel-php@0.4.5` - Node 18.x / PHP 8.0.x (https://example-php-8-0.vercel.app)
- `vercel-php@0.3.6` - Node 18.x / PHP 7.4.x (https://example-php-7-4.vercel.app)
- `vercel-php@0.7.3` - Node autodetect / PHP 8.3.x (https://example-php-8-3.vercel.app)
- `vercel-php@0.6.2` - Node autodetect / PHP 8.2.x (https://example-php-8-2.vercel.app)
- `vercel-php@0.5.5` - Node autodetect / PHP 8.1.x (https://example-php-8-1.vercel.app)
- `vercel-php@0.4.4` - Node autodetect / PHP 8.0.x (https://example-php-8-0.vercel.app)
- `vercel-php@0.3.6` - Node autodetect / PHP 7.4.x (https://example-php-7-4.vercel.app)

## Install

3 changes: 2 additions & 1 deletion app/config/config.php
Original file line number Diff line number Diff line change
@@ -300,7 +300,7 @@
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = __DIR__ . '/../../storage/cache_page/';
$config['cache_path'] = realpath(__DIR__ . '/../../storage/cache_page') . '/';

/*
|--------------------------------------------------------------------------
@@ -541,6 +541,7 @@

require_once __DIR__ . '/hmvc.php';
require_once __DIR__ . '/extend/admin_config.php';
require_once __DIR__ . '/extend/config_cache.php';
require_once __DIR__ . '/extend/config_site.php';
require_once __DIR__ . '/extend/config_template.php';
require_once __DIR__ . '/extend/config_hashids.php';
3 changes: 2 additions & 1 deletion app/config/constants.php
Original file line number Diff line number Diff line change
@@ -92,7 +92,8 @@
defined('EXIT__AUTO_MAX') or define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
// Custom Constants
defined('_PROCESS_TEST_') or define('_PROCESS_TEST_', false);
defined('CACHE_KEY') or define('CACHE_KEY', 'BEAR_CUTE33_');
defined('CACHE_KEY') or define('CACHE_KEY', 'Bear-CodeIgniter-v3-Skeleton-on-Vercel-Cache-');
defined('GLOBAL_CACHE_PREFIX') or define('GLOBAL_CACHE_PREFIX', CACHE_KEY);
defined('MY_TELEGRAM_ID') or define('MY_TELEGRAM_ID', '1234');
defined('TELEGRAM_JARVIS_BOT') or define('TELEGRAM_JARVIS_BOT', [
'telegram_messages' => [
4 changes: 3 additions & 1 deletion app/config/extend/admin_config.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@
* Time: 11:39
*/
$config['admin_config_basic_auth'] = [
'serviceId' => 'CodeIgniter skeleton on Vercel',
'framework' => 'CodeIgniter v' . CI_VERSION,
'username' => 'hungna',
'password' => 'xxx'
'password' => '20240908151234_3081d5b916d94eda017a273d720e116f1e622d67'
];
11 changes: 11 additions & 0 deletions app/config/extend/config_cache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

defined('BASEPATH') or exit('No direct script access allowed');

$xadb0VEa_MainCacheAdapter = extension_loaded('apcu') ? 'apcu' : 'file';
$xadb0VEa_MainCacheBackup = $xadb0VEa_MainCacheAdapter === 'file' ? 'dummy' : 'file';
$config['main_cache_adapter'] = [
'adapter' => $xadb0VEa_MainCacheAdapter,
'backup' => $xadb0VEa_MainCacheBackup,
'key_prefix' => GLOBAL_CACHE_PREFIX
];
50 changes: 50 additions & 0 deletions app/controllers/Hungna.php
Original file line number Diff line number Diff line change
@@ -8,4 +8,54 @@ public function test()
{
exit('nguyenanhung');
}

public function admin_cache(): void
{
$auth = config_item('admin_config_basic_auth');
$username = $this->input->get_post('username', true);
$password = $this->input->get_post('password', true);
$type = $this->input->get_post('type', true);
if ($username === null || $password === null) {
$response = [
'serviceId' => $auth['serviceId'] ?? '',
'result' => EXIT_USER_INPUT,
'desc' => 'Sai hoặc thiếu tham số'
];
} elseif (($username != $auth['username']) || ($password != $auth['password'])) {
$response = [
'serviceId' => $auth['serviceId'] ?? '',
'result' => EXIT_USER_INPUT,
'desc' => 'Sai chữ ký xác thực'
];
} else {
$this->load->driver('cache', config_item('main_cache_adapter'));
if ($type === 'info') {
$response = [
'result' => EXIT_SUCCESS,
'serviceId' => $auth['serviceId'],
'framework' => $auth['framework'],
'desc' => 'Lấy thông tin Cache',
'details' => [
'info' => $this->cache->cache_info()
]
];
} else {
$response = [
'result' => EXIT_SUCCESS,
'serviceId' => $auth['serviceId'],
'framework' => $auth['framework'],
'desc' => 'Xóa Cache',
'details' => [
'info' => $this->cache->cache_info(),
'clean' => $this->cache->clean()
]
];
}
}
$this->output
->set_content_type('application/json')
->set_output(json_encode($response, JSON_PRETTY_PRINT))
->_display();
exit();
}
}
32 changes: 31 additions & 1 deletion app/controllers/Welcome.php
Original file line number Diff line number Diff line change
@@ -28,7 +28,8 @@ public function index(): void
'request' => [
'ip' => getIPAddress(),
'user_agent' => $this->input->user_agent(true),
'php_version' => PHP_VERSION
'php_version' => PHP_VERSION,
'current_url' => current_url(),
]
];
$this->output
@@ -53,4 +54,33 @@ public function php()
{
phpinfo();
}

protected function pgsql_function_check($function_name = 'pg_connect'): string
{
if (function_exists($function_name)) {
return "function " . $function_name . " is already";
} else {
return "function " . $function_name . " is not available";
}
}

public function pgsql_check()
{
$data = array(
'function_check' => array(
'pg_connect' => $this->pgsql_function_check(),
'pg_close' => $this->pgsql_function_check('pg_close'),
'pg_query' => $this->pgsql_function_check('pg_query'),
'pg_escape_string' => $this->pgsql_function_check('pg_escape_string'),
'pg_last_error' => $this->pgsql_function_check('pg_last_error'),
)
);

$this->output
->set_status_header()
->set_content_type('application/json', 'utf-8')
->set_output(json_encode($data, JSON_PRETTY_PRINT))
->_display();
exit;
}
}
Loading