Ver Fonte

调整文件的目录结构

Zhu Jinhui há 7 anos atrás
pai
commit
c51722c326
100 ficheiros alterados com 180 adições e 14 exclusões
  1. 4 4
      README.md
  2. 3 3
      _cli.php
  3. 0 0
      demo/private/Bootstrap.php
  4. 0 0
      demo/private/configure/app.ini
  5. 0 0
      demo/private/configure/db.ini
  6. 0 0
      demo/private/configure/router.config.php
  7. 0 0
      demo/private/controller/index.php
  8. 0 0
      demo/private/controller/test.php
  9. 0 0
      demo/private/controller/view/index.tpl
  10. 2 1
      demo/private/plugins/loger.php
  11. 1 0
      demo/private/tmp/2017-06-28.loger.log
  12. 1 0
      demo/private/tmp/2017-07-03.loger.log
  13. 26 0
      demo/private/tmp/compile/b541b7081a689b2c42974c2e59535e792944d246_0.file.index.tpl.php
  14. 108 0
      demo/private/tmp/product.app.ini.php
  15. 32 0
      demo/private/tmp/product.db.ini.php
  16. 0 0
      demo/private/view/index.tpl
  17. 0 0
      demo/public/.htaccess
  18. 3 2
      demo/public/index.php
  19. 0 4
      src/Application.php
  20. 0 0
      src/Autoloader/Factory.php
  21. 0 0
      src/Autoloader/Helper.php
  22. 0 0
      src/Autoloader/Import.php
  23. 0 0
      src/Autoloader/Instance.php
  24. 0 0
      src/Autoloader/Loader.php
  25. 0 0
      src/Autoloader/Psr4.php
  26. 0 0
      src/Base/Action.php
  27. 0 0
      src/Base/Bootstrap.php
  28. 0 0
      src/Base/Controller.php
  29. 0 0
      src/Base/Dispatcher.php
  30. 0 0
      src/Base/Request.php
  31. 0 0
      src/Base/Response.php
  32. 0 0
      src/Base/Rules.php
  33. 0 0
      src/Cache/File.php
  34. 0 0
      src/Cache/Intf.php
  35. 0 0
      src/Cache/Loader.php
  36. 0 0
      src/Cache/Memcached.php
  37. 0 0
      src/Cache/Redis.php
  38. 0 0
      src/Cache/Redis/Client.php
  39. 0 0
      src/Cache/Redis/Cluster.php
  40. 0 0
      src/Cache/Redis/Sentinel.php
  41. 0 0
      src/Cache/XCache.php
  42. 0 0
      src/Config/Arrays.php
  43. 0 0
      src/Config/Consts.php
  44. 0 0
      src/Config/Register.php
  45. 0 0
      src/Config/Setting.php
  46. 0 0
      src/Driver/Base.php
  47. 0 0
      src/Driver/ConnBase.php
  48. 0 0
      src/Driver/ConnIntf.php
  49. 0 0
      src/Driver/Easy.php
  50. 0 0
      src/Driver/Fields.php
  51. 0 0
      src/Driver/Intf.php
  52. 0 0
      src/Driver/Model.php
  53. 0 0
      src/Driver/Mysql/Connection.php
  54. 0 0
      src/Driver/Mysql/Driver.php
  55. 0 0
      src/Driver/Mysqli/Connection.php
  56. 0 0
      src/Driver/Mysqli/Driver.php
  57. 0 0
      src/Driver/Observer.php
  58. 0 0
      src/Driver/Pdo/Connection.php
  59. 0 0
      src/Driver/Pdo/Driver.php
  60. 0 0
      src/Driver/Response.php
  61. 0 0
      src/Driver/Rules.php
  62. 0 0
      src/Exceptions/AccessDenied.php
  63. 0 0
      src/Exceptions/Cache.php
  64. 0 0
      src/Exceptions/CallUndefinedClass.php
  65. 0 0
      src/Exceptions/ClassInstanceof.php
  66. 0 0
      src/Exceptions/ClassNotFound.php
  67. 0 0
      src/Exceptions/Error.php
  68. 0 0
      src/Exceptions/Errors.php
  69. 0 0
      src/Exceptions/FileNotFound.php
  70. 0 0
      src/Exceptions/FolderDoesNotExist.php
  71. 0 0
      src/Exceptions/InvalidFormat.php
  72. 0 0
      src/Exceptions/MethodNotFound.php
  73. 0 0
      src/Exceptions/NotAllowed.php
  74. 0 0
      src/Exceptions/Overwrite.php
  75. 0 0
      src/Exceptions/Response.php
  76. 0 0
      src/Exceptions/TableException.php
  77. 0 0
      src/Exceptions/Unsupport.php
  78. 0 0
      src/Exceptions/Variable.php
  79. 0 0
      src/Exceptions/View/404.php
  80. 0 0
      src/Exceptions/View/error.php
  81. 0 0
      src/Exceptions/View/example.php
  82. 0 0
      src/Exceptions/View/footer.php
  83. 0 0
      src/Exceptions/View/message.php
  84. 0 0
      src/Exceptions/View/style.php
  85. 0 0
      src/Functions/Funcs.php
  86. 0 0
      src/Language/Loader.php
  87. 0 0
      src/Language/i18n/CN/error.php
  88. 0 0
      src/Language/i18n/CN/exception.php
  89. 0 0
      src/Language/i18n/CN/resource.php
  90. 0 0
      src/Language/i18n/EN/error.php
  91. 0 0
      src/Language/i18n/EN/exception.php
  92. 0 0
      src/Language/i18n/EN/resource.php
  93. 0 0
      src/Language/i18n/language.php
  94. 0 0
      src/Library/Arrays.php
  95. 0 0
      src/Library/Cookie.php
  96. 0 0
      src/Library/Crypt.php
  97. 0 0
      src/Library/Device.php
  98. 0 0
      src/Library/Download.php
  99. 0 0
      src/Library/Flexihash.php
  100. 0 0
      src/Library/Http.php

+ 4 - 4
README.md

@@ -61,7 +61,7 @@
 			}
 		}
 		第二步,使用user_model
-		class user_controler extends Qii_Controller_Abstract
+		class user_controler extends \Qii\Controller\Abstract
 		{
 			public function __construct()
 			{
@@ -186,7 +186,7 @@
 		}
 		第三步,使用user_model:
 		
-		class index_controller extends Qii_Controller_Abstract
+		class index_controller extends \Qii\Controller\Abstract
 		{
 			public function __construct()
 			{
@@ -197,7 +197,7 @@
 		}
 	7) View的支持
 		view支持smarty及php
-		class index_controller extends Qii_Controller_Abstract
+		class index_controller extends \Qii\Controller\Abstract
 		{
 			public function __construct()
 			{
@@ -206,7 +206,7 @@
 			}
 		}
 	8) Controller的使用
-	class test_controller extends Qii_Controller_Abstract
+	class test_controller extends \Qii\Controller\Abstract
 	{
 		//为了避免Controller逻辑过于复杂,可以将Action拆到单独的文件
 		//当在调用dummy方法的时候会自动执行actions/dummy_action.php中的execute方法

+ 3 - 3
_cli.php

@@ -74,7 +74,7 @@ class cmd
                 //创建目录工作区目录
                 if(!is_dir($param['workspace'] . '/public'))
                 {
-                    mkdir($param['workspace'] . '/public', 0755);
+                    mkdir($param['workspace'] . '/public', 0777);
                 }
                 foreach ($this->dir AS $d) {
                     $path = $param['workspace'] . '/private/' . $d;
@@ -126,7 +126,7 @@ class cmd
                 //--获取文件的相对路径
                 $realPath = $this->getRealPath($param['workspace']);
                 $this->stdout("真实路径 " . $realPath . "\n");
-                $QiiPath = $this->getRelatePath($realPath . "/index.php", dirname(__FILE__) . "/Qii/Qii.php");
+                $QiiPath = $this->getRelatePath($realPath . "/index.php", dirname(__FILE__) . "/src/Qii.php");
                 $this->stdout("Qii 路径 " . $QiiPath . "\n");
                 $date = date("Y/m/d H:i:s");
                 $indexPage = array();
@@ -292,7 +292,7 @@ class cmd
      */
     public function stdout($string)
     {
-        if(OS == 'WIN') $string = iconv('utf-8', 'gbk', $string);
+        if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') $string = iconv('utf-8', 'gbk', $string);
         fwrite(\STDOUT, $string);
     }
 }

+ 0 - 0
private/Bootstrap.php → demo/private/Bootstrap.php


+ 0 - 0
private/configure/app.ini → demo/private/configure/app.ini


+ 0 - 0
private/configure/db.ini → demo/private/configure/db.ini


+ 0 - 0
private/configure/router.config.php → demo/private/configure/router.config.php


+ 0 - 0
private/controllers/index.php → demo/private/controller/index.php


+ 0 - 0
private/controllers/test.php → demo/private/controller/test.php


+ 0 - 0
private/controllers/view/index.tpl → demo/private/controller/view/index.tpl


+ 2 - 1
private/plugins/loger.php → demo/private/plugins/loger.php

@@ -1,5 +1,6 @@
 <?php
-namespace Plugins;
+namespace plugins;
+
 class loger implements \Qii\Loger\Writer
 {
 	public $logerPath = 'tmp';

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 0
demo/private/tmp/2017-06-28.loger.log


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 0
demo/private/tmp/2017-07-03.loger.log


+ 26 - 0
demo/private/tmp/compile/b541b7081a689b2c42974c2e59535e792944d246_0.file.index.tpl.php

@@ -0,0 +1,26 @@
+<?php
+/* Smarty version 3.1.30, created on 2017-06-28 15:56:16
+  from "E:\WebRoot\Qii\private\Controller\view\index.tpl" */
+
+/* @var Smarty_Internal_Template $_smarty_tpl */
+if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
+  'version' => '3.1.30',
+  'unifunc' => 'content_59536120543292_82164805',
+  'has_nocache_code' => false,
+  'file_dependency' => 
+  array (
+    'b541b7081a689b2c42974c2e59535e792944d246' => 
+    array (
+      0 => 'E:\\WebRoot\\Qii\\private\\Controller\\view\\index.tpl',
+      1 => 1498636237,
+      2 => 'file',
+    ),
+  ),
+  'includes' => 
+  array (
+  ),
+),false)) {
+function content_59536120543292_82164805 (Smarty_Internal_Template $_smarty_tpl) {
+?>
+This is tpl from controller dir<?php }
+}

+ 108 - 0
demo/private/tmp/product.app.ini.php

@@ -0,0 +1,108 @@
+<?php 
+ return array (
+  'namespace' => 
+  array (
+    'use' => '1',
+    'list' => 
+    array (
+      'controller' => '1',
+      'model' => '1',
+      'library' => '1',
+      'action' => '1',
+    ),
+  ),
+  'rewriteMethod' => 'Short',
+  'rewriteRules' => 'Normal',
+  'admin' => 
+  array (
+    'user' => 'admin',
+    'password' => '119328118',
+  ),
+  'debug' => '1',
+  'errorPage' => 'Error:Index',
+  'timezone' => 'Asia/Shanghai',
+  'contentType' => 'text/html',
+  'charset' => 'UTF-8',
+  'view' => 
+  array (
+    'engine' => 'smarty',
+    'path' => 'view',
+    'smarty' => 
+    array (
+      'view' => 'view',
+      'path' => 'view',
+      'ldelimiter' => '{#',
+      'rdelimiter' => '#}',
+      'compile' => 'tmp/compile',
+      'cache' => 'tmp/cache',
+      'lifetime' => '300',
+    ),
+  ),
+  'cache' => 'memcache',
+  'security' => 
+  array (
+    'enable' => '1',
+    'name' => 'security_sid',
+    'expired' => '3600',
+    'key' => '4cd780a986d5c30e03bdcb67d16c8320',
+  ),
+  'memcache' => 
+  array (
+    'servers' => '127.0.0.1',
+    'ports' => '11211',
+  ),
+  'xpath' => 
+  array (
+    0 => 'controller',
+    1 => 'model',
+    2 => 'class',
+    3 => 'plugin',
+  ),
+  'query' => 
+  array (
+    0 => 'controller',
+    1 => 'action',
+    2 => 'param',
+  ),
+  'controller' => 
+  array (
+    'name' => 'controller',
+    'prefix' => 'controller',
+    'default' => 'index',
+  ),
+  'action' => 
+  array (
+    'name' => 'action',
+    'suffix' => 'Action',
+    'default' => 'index',
+  ),
+  'password' => '119328118',
+  'uri' => 
+  array (
+    'mode' => 'short',
+    'controllerName' => 'controller',
+    'actionName' => 'action',
+    'normal' => 
+    array (
+      'mode' => 'normal',
+      'trim' => '0',
+      'symbol' => '&',
+      'extenstion' => '.html',
+    ),
+    'middle' => 
+    array (
+      'mode' => 'middle',
+      'trim' => '1',
+      'symbol' => '/',
+      'extenstion' => '.html',
+    ),
+    'short' => 
+    array (
+      'mode' => 'short',
+      'trim' => '1',
+      'symbol' => '/',
+      'extenstion' => '.html',
+    ),
+  ),
+)
+?>

+ 32 - 0
demo/private/tmp/product.db.ini.php

@@ -0,0 +1,32 @@
+<?php 
+ return array (
+  'readOrWriteSeparation' => '0',
+  'driver' => 'pdo',
+  'debug' => '1',
+  'use_db_driver' => 'mysql',
+  'master' => 
+  array (
+    'db' => 'wecv',
+    'host' => '127.0.0.1',
+    'user' => 'root',
+    'password' => 'A119328118a',
+  ),
+  'slave' => 
+  array (
+    0 => 
+    array (
+      'db' => 'istudy',
+      'host' => '127.0.0.1',
+      'user' => 'wecv',
+      'password' => 'A119328118a',
+    ),
+    1 => 
+    array (
+      'db' => 'istudy',
+      'host' => '127.0.0.1',
+      'user' => 'wecv',
+      'password' => 'A119328118a',
+    ),
+  ),
+)
+?>

+ 0 - 0
private/view/index.tpl → demo/private/view/index.tpl


+ 0 - 0
public/.htaccess → demo/public/.htaccess


+ 3 - 2
public/index.php → demo/public/index.php

@@ -1,11 +1,12 @@
 <?php
-require_once('../Qii/Qii.php');
+require_once('../../src/Qii.php');
+
 $app = \Qii::getInstance();
 $app->setWorkspace('../private')
 ->setCachePath('tmp')
 ->setAppConfigure('configure/app.ini')
 ->setUseNamespace('Bootstrap', false)
-->setLoger('Plugins\loger')
+->setLoger('plugins\loger')
 ->setDB('configure/db.ini')
 ->setRouter('configure/router.config.php')
 ->setBootstrap()

+ 0 - 4
Qii/Application.php → src/Application.php

@@ -270,10 +270,6 @@ class Application
      */
     public function setLoger($logerCls)
     {
-        if (!class_exists($logerCls, false)) {
-            throw new \Qii_Exceptions_ClassNotFound(Qii::i(1405, $logerCls), __LINE__);
-        }
-
         $this->logerWriter = Instance::instance(
             '\Qii\Loger\Instance',
             Instance::instance($logerCls)

+ 0 - 0
Qii/Autoloader/Factory.php → src/Autoloader/Factory.php


+ 0 - 0
Qii/Autoloader/Helper.php → src/Autoloader/Helper.php


+ 0 - 0
Qii/Autoloader/Import.php → src/Autoloader/Import.php


+ 0 - 0
Qii/Autoloader/Instance.php → src/Autoloader/Instance.php


+ 0 - 0
Qii/Autoloader/Loader.php → src/Autoloader/Loader.php


+ 0 - 0
Qii/Autoloader/Psr4.php → src/Autoloader/Psr4.php


+ 0 - 0
Qii/Base/Action.php → src/Base/Action.php


+ 0 - 0
Qii/Base/Bootstrap.php → src/Base/Bootstrap.php


+ 0 - 0
Qii/Base/Controller.php → src/Base/Controller.php


+ 0 - 0
Qii/Base/Dispatcher.php → src/Base/Dispatcher.php


+ 0 - 0
Qii/Base/Request.php → src/Base/Request.php


+ 0 - 0
Qii/Base/Response.php → src/Base/Response.php


+ 0 - 0
Qii/Base/Rules.php → src/Base/Rules.php


+ 0 - 0
Qii/Cache/File.php → src/Cache/File.php


+ 0 - 0
Qii/Cache/Intf.php → src/Cache/Intf.php


+ 0 - 0
Qii/Cache/Loader.php → src/Cache/Loader.php


+ 0 - 0
Qii/Cache/Memcached.php → src/Cache/Memcached.php


+ 0 - 0
Qii/Cache/Redis.php → src/Cache/Redis.php


+ 0 - 0
Qii/Cache/Redis/Client.php → src/Cache/Redis/Client.php


+ 0 - 0
Qii/Cache/Redis/Cluster.php → src/Cache/Redis/Cluster.php


+ 0 - 0
Qii/Cache/Redis/Sentinel.php → src/Cache/Redis/Sentinel.php


+ 0 - 0
Qii/Cache/XCache.php → src/Cache/XCache.php


+ 0 - 0
Qii/Config/Arrays.php → src/Config/Arrays.php


+ 0 - 0
Qii/Config/Consts.php → src/Config/Consts.php


+ 0 - 0
Qii/Config/Register.php → src/Config/Register.php


+ 0 - 0
Qii/Config/Setting.php → src/Config/Setting.php


+ 0 - 0
Qii/Driver/Base.php → src/Driver/Base.php


+ 0 - 0
Qii/Driver/ConnBase.php → src/Driver/ConnBase.php


+ 0 - 0
Qii/Driver/ConnIntf.php → src/Driver/ConnIntf.php


+ 0 - 0
Qii/Driver/Easy.php → src/Driver/Easy.php


+ 0 - 0
Qii/Driver/Fields.php → src/Driver/Fields.php


+ 0 - 0
Qii/Driver/Intf.php → src/Driver/Intf.php


+ 0 - 0
Qii/Driver/Model.php → src/Driver/Model.php


+ 0 - 0
Qii/Driver/Mysql/Connection.php → src/Driver/Mysql/Connection.php


+ 0 - 0
Qii/Driver/Mysql/Driver.php → src/Driver/Mysql/Driver.php


+ 0 - 0
Qii/Driver/Mysqli/Connection.php → src/Driver/Mysqli/Connection.php


+ 0 - 0
Qii/Driver/Mysqli/Driver.php → src/Driver/Mysqli/Driver.php


+ 0 - 0
Qii/Driver/Observer.php → src/Driver/Observer.php


+ 0 - 0
Qii/Driver/Pdo/Connection.php → src/Driver/Pdo/Connection.php


+ 0 - 0
Qii/Driver/Pdo/Driver.php → src/Driver/Pdo/Driver.php


+ 0 - 0
Qii/Driver/Response.php → src/Driver/Response.php


+ 0 - 0
Qii/Driver/Rules.php → src/Driver/Rules.php


+ 0 - 0
Qii/Exceptions/AccessDenied.php → src/Exceptions/AccessDenied.php


+ 0 - 0
Qii/Exceptions/Cache.php → src/Exceptions/Cache.php


+ 0 - 0
Qii/Exceptions/CallUndefinedClass.php → src/Exceptions/CallUndefinedClass.php


+ 0 - 0
Qii/Exceptions/ClassInstanceof.php → src/Exceptions/ClassInstanceof.php


+ 0 - 0
Qii/Exceptions/ClassNotFound.php → src/Exceptions/ClassNotFound.php


+ 0 - 0
Qii/Exceptions/Error.php → src/Exceptions/Error.php


+ 0 - 0
Qii/Exceptions/Errors.php → src/Exceptions/Errors.php


+ 0 - 0
Qii/Exceptions/FileNotFound.php → src/Exceptions/FileNotFound.php


+ 0 - 0
Qii/Exceptions/FolderDoesNotExist.php → src/Exceptions/FolderDoesNotExist.php


+ 0 - 0
Qii/Exceptions/InvalidFormat.php → src/Exceptions/InvalidFormat.php


+ 0 - 0
Qii/Exceptions/MethodNotFound.php → src/Exceptions/MethodNotFound.php


+ 0 - 0
Qii/Exceptions/NotAllowed.php → src/Exceptions/NotAllowed.php


+ 0 - 0
Qii/Exceptions/Overwrite.php → src/Exceptions/Overwrite.php


+ 0 - 0
Qii/Exceptions/Response.php → src/Exceptions/Response.php


+ 0 - 0
Qii/Exceptions/TableException.php → src/Exceptions/TableException.php


+ 0 - 0
Qii/Exceptions/Unsupport.php → src/Exceptions/Unsupport.php


+ 0 - 0
Qii/Exceptions/Variable.php → src/Exceptions/Variable.php


+ 0 - 0
Qii/Exceptions/View/404.php → src/Exceptions/View/404.php


+ 0 - 0
Qii/Exceptions/View/error.php → src/Exceptions/View/error.php


+ 0 - 0
Qii/Exceptions/View/example.php → src/Exceptions/View/example.php


+ 0 - 0
Qii/Exceptions/View/footer.php → src/Exceptions/View/footer.php


+ 0 - 0
Qii/Exceptions/View/message.php → src/Exceptions/View/message.php


+ 0 - 0
Qii/Exceptions/View/style.php → src/Exceptions/View/style.php


+ 0 - 0
Qii/Functions/Funcs.php → src/Functions/Funcs.php


+ 0 - 0
Qii/Language/Loader.php → src/Language/Loader.php


+ 0 - 0
Qii/Language/i18n/CN/error.php → src/Language/i18n/CN/error.php


+ 0 - 0
Qii/Language/i18n/CN/exception.php → src/Language/i18n/CN/exception.php


+ 0 - 0
Qii/Language/i18n/CN/resource.php → src/Language/i18n/CN/resource.php


+ 0 - 0
Qii/Language/i18n/EN/error.php → src/Language/i18n/EN/error.php


+ 0 - 0
Qii/Language/i18n/EN/exception.php → src/Language/i18n/EN/exception.php


+ 0 - 0
Qii/Language/i18n/EN/resource.php → src/Language/i18n/EN/resource.php


+ 0 - 0
Qii/Language/i18n/language.php → src/Language/i18n/language.php


+ 0 - 0
Qii/Library/Arrays.php → src/Library/Arrays.php


+ 0 - 0
Qii/Library/Cookie.php → src/Library/Cookie.php


+ 0 - 0
Qii/Library/Crypt.php → src/Library/Crypt.php


+ 0 - 0
Qii/Library/Device.php → src/Library/Device.php


+ 0 - 0
Qii/Library/Download.php → src/Library/Download.php


+ 0 - 0
Qii/Library/Flexihash.php → src/Library/Flexihash.php


+ 0 - 0
Qii/Library/Http.php → src/Library/Http.php


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff