Download config.inc.php from edwagbb/php: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/edwagbb/php/resolve/main/config.inc.php
- Command line
-
hf download hf://spaces/edwagbb/php/config.inc.php
-
curl -L -o config.inc.php https://huggingface.co/spaces/edwagbb/php/resolve/main/config.inc.php
1.25 kB
| // site root path | |
| define('__TYPECHO_ROOT_DIR__', dirname(__FILE__)); | |
| // plugin directory (relative path) | |
| define('__TYPECHO_PLUGIN_DIR__', '/usr/plugins'); | |
| // theme directory (relative path) | |
| define('__TYPECHO_THEME_DIR__', '/usr/themes'); | |
| // admin directory (relative path) | |
| define('__TYPECHO_ADMIN_DIR__', '/admin/'); | |
| // register autoload | |
| require_once __TYPECHO_ROOT_DIR__ . '/var/Typecho/Common.php'; | |
| // init | |
| \Typecho\Common::init(); | |
| //DB_COON_STR = 'mysql://user:pass@x.x.x.x:3306/dbname' | |
| if(!getenv('DB_HOST')){ | |
| $matches = []; | |
| preg_match("/^(mysql:\/\/)?([^:]*?):(.*?)@([^@^:]*?):?(\d+)?\/([^\/]*?)$/", getenv('DB_COON_STR'), $matches); | |
| putenv('DB_USER='.$matches[2]); | |
| putenv('DB_PASS='.$matches[3]); | |
| putenv('DB_HOST='.$matches[4]); | |
| putenv('DB_PORT='.($matches[5] ? $matches[5] : '3306')); | |
| putenv('DB_NAME='.$matches[6]); | |
| } | |
| // config db | |
| $db = new \Typecho\Db('Pdo_Mysql', 'typecho_'); | |
| $db->addServer(array ( | |
| 'host' => getenv('DB_HOST'), | |
| 'port' => intval(getenv('DB_PORT')), | |
| 'user' => getenv('DB_USER'), | |
| 'password' => getenv('DB_PASS'), | |
| 'charset' => 'utf8mb4', | |
| 'database' => getenv('DB_NAME'), | |
| 'engine' => 'InnoDB', | |
| 'sslCa' => '', | |
| 'sslVerify' => true, | |
| ), \Typecho\Db::READ | \Typecho\Db::WRITE); | |
| \Typecho\Db::set($db); | |