Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
dizys committed Jan 4, 2018
1 parent 3cc80a7 commit ace70a3
Show file tree
Hide file tree
Showing 30 changed files with 410 additions and 78 deletions.
2 changes: 1 addition & 1 deletion app/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/

/** Application Default Entrance */
require __DIR__."/common.php";
require __DIR__."/common.php";
1 change: 1 addition & 0 deletions app/index/controller/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace app\index\controller;


class Index
{
public function index(){
Expand Down
2 changes: 1 addition & 1 deletion config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
return [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'mvctest',
'database' => 'test',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
Expand Down
4 changes: 2 additions & 2 deletions config/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'xml_item_node' => 'item',
'xml_item_key' => 'id',

'enable_servers' => true,
'enable_servers' => false,
],

/**
Expand Down Expand Up @@ -108,7 +108,7 @@
* Task Queue System Settings
*/
'task' => [
'enable' => true,
'enable' => false,
'server_driver' => 'db',
'client_driver' => 'db',
'port' => 2073,
Expand Down
2 changes: 1 addition & 1 deletion config/vhost.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
* VHost Settings
*/
return [
'localhost' => 'localhost'
'localhost,127.0.0.1' => 'localhost'
];
2 changes: 1 addition & 1 deletion route/localhost.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

/** Routing rules for localhost */
return [
'/' => 'index/Index/index',
'/' => "index/Index/index"
];
5 changes: 2 additions & 3 deletions start.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
* Author: Dizy <derzart@gmail.com>
*/

/** Server CLI Entrance */
namespace think;

define('APP_PATH', __DIR__ . '/app/'); //Define the application directory
require __DIR__ . '/thinkworker/start.php'; //Require the bootstrap file
require __DIR__ . '/thinkworker/start.php'; //Require the bootstrap file
/** Server CLI Entrance */
33 changes: 30 additions & 3 deletions thinkworker/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ function think_core_shorten_filepath($filepath)
}
}

if(!function_exists("think_core_clean_hostname")) {
function think_core_clean_hostname($hostname)
{
$pos = strpos($hostname, ":");
if($pos===false){
return $hostname;
}
return substr($hostname, 0, $pos);
}
}

if(!function_exists("think_core_form_tracing_table_filepath")) {
function think_core_form_tracing_table_filepath($trace)
{
Expand Down Expand Up @@ -210,6 +221,22 @@ function think_core_get_all_extensions()
}
}

function think_core_rtrim($text, $niddle){
$text = trim($text);
$len = strlen($text);
$nlen = strlen($niddle);
$pos = strrpos($text, $niddle);
if($pos!==false){
if($len-$pos == $nlen){
return substr($text, 0, -$nlen);
}else{
return $text;
}
}else{
return $text;
}
}

if(!function_exists("think_core_charset_auto_revert")) {
function think_core_charset_auto_revert($msg)
{
Expand Down Expand Up @@ -289,7 +316,7 @@ function think_core_route_basic_path_match($pattern, $uri, &$isMatched, $suffix
$pattern = rtrim($pattern, "/")."/";
if(substr($uri, -strlen(".".$suffix)) == ".".$suffix){
if(substr($uri, -strlen(".".$suffix) -1, 1) != "/"){
$uri = rtrim($uri, ".".$suffix);
$uri = think_core_rtrim($uri, ".".$suffix);
}
}
$uri = rtrim(merge_slashes($uri), "/")."/";
Expand Down Expand Up @@ -348,7 +375,7 @@ function think_core_route_vars_path_match($pattern, $uri, &$isMatched, $suffix =
$pattern = rtrim($pattern, "/")."/";
if(substr($uri, -strlen(".".$suffix)) == ".".$suffix){
if(substr($uri, -strlen(".".$suffix) -1, 1) != "/"){
$uri = rtrim($uri, ".".$suffix);
$uri = think_core_rtrim($uri, ".".$suffix);
}
}
$uri = rtrim(merge_slashes($uri), "/")."/";
Expand Down Expand Up @@ -564,4 +591,4 @@ function think_tool_get_rand_sid() {
$TW_CORE_RAND_SID = rand();
return $TW_CORE_RAND_SID;
}
}
}
2 changes: 1 addition & 1 deletion thinkworker/lib/think/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function _init(){
{
$lastDsPos = strrpos($configFile, DS);
$rangeName = substr($configFile, $lastDsPos + 1);
$rangeName = strtolower(rtrim($rangeName, CONF_EXT));
$rangeName = strtolower(think_core_rtrim($rangeName, CONF_EXT));
self::$config[$rangeName] = include($configFile);
}
}
Expand Down
Loading

0 comments on commit ace70a3

Please sign in to comment.