Skip to content

Commit 5cc1039

Browse files
committed
Code cleaning up
1 parent e4e7961 commit 5cc1039

File tree

7 files changed

+49
-46
lines changed

7 files changed

+49
-46
lines changed

doc/nginx-site.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
# .htaccess
1010
# boot.php
1111
# lib/
12-
# script/
1312
# usr/
1413
# www/
1514
# Deployment: /home/pi/deployment/
1615
# asset/
1716
# static/
1817
# upload/
18+
# var/
1919
#
2020

2121

@@ -52,15 +52,15 @@ server {
5252
}
5353
if (!-e $request_filename) {
5454
# Admin route
55-
rewrite ^/admin(/(.*)?)?$ /admin.php last;
55+
rewrite ^/admin(/(.*)?)?$ /admin.php last;
5656
# API route
5757
rewrite ^/api(/(.*)?)?$ /api.php last;
5858
# Feed route
5959
rewrite ^/feed(/(.*)?)?$ /feed.php last;
6060
# Widget route
6161
rewrite ^/widget(/(.*)?)?$ /widget.php last;
6262
# Default app route
63-
rewrite ^/(.+)$ /app.php last;
63+
rewrite ^/(.+)$ /app.php last;
6464
break;
6565
}
6666

lib/Pi/Mvc/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function setListeners(array $listeners = array())
4646
if ($listeners) {
4747
$this->defaultListeners = array_merge($this->defaultListeners, $listeners);
4848
}
49-
49+
5050
return $this;
5151
}
5252

@@ -142,7 +142,7 @@ protected function completeRequest(MvcEvent $event)
142142
*/
143143
if (Pi::service()->hasService('log')) {
144144
if ($this->getRouteMatch()) {
145-
Pi::service('log')->info(sprintf('Route: %s-%s-%s.', $this->getRouteMatch()->getParam('module'), $this->getRouteMatch()->getParam('controller'), $this->getRouteMatch()->getParam('action')));
145+
Pi::service('log')->info(sprintf('Route: %s:%s-%s-%s.', $this->getSection(), $this->getRouteMatch()->getParam('module'), $this->getRouteMatch()->getParam('controller'), $this->getRouteMatch()->getParam('action')));
146146
} else {
147147
Pi::service('log')->err($event->getError());
148148
}

var/config/host.demo.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
// If URI is a relative one then www root URI will be prepended
2626
'uri' => array(
2727
// WWW root URI
28-
'www' => 'http://pi-demo',
28+
'www' => 'http://pi-demo.org',
2929
// URI to access uploads directory
30-
'upload' => 'http://pi-demo/upload',
30+
'upload' => 'http://upload.pi-demo.org',
3131
// URI to access assets directory
32-
'asset' => 'http://pi-demo/asset',
32+
'asset' => 'http://asset.pi-demo.org',
3333
// URI to access static files directory
34-
'static' => 'http://pi-demo/static',
34+
'static' => 'http://static.pi-demo.org',
3535
),
3636

3737
// Paths to resources
@@ -40,26 +40,26 @@
4040
// User extension directory
4141
'usr' => '/path/to/pi-demo/usr',
4242
// Application module directory
43-
'module' => '/path/to/pi-demo/usr/module',
43+
'module' => '/path/to/pi-demo/module',
4444
// Theme directory
45-
'theme' => '/path/to/pi-demo/usr/theme',
45+
'theme' => '/path/to/pi-demo/theme',
4646
// Path to vendor library directory
47-
'vendor' => '/path/to/pi-demo/lib/vendor',
47+
'vendor' => '/path/to/pi-demo/vendor',
4848

4949
// Path to uploads directory
50-
'upload' => '/path/to/pi-demo-demo/upload',
50+
'upload' => '/path/to/pi-demo/upload',
5151
// Path to assets directory
52-
'asset' => '/path/to/pi-demo-demo/asset',
52+
'asset' => '/path/to/pi-demo/asset',
5353
// Path to static files directory
54-
'static' => '/path/to/pi-demo-demo/static',
54+
'static' => '/path/to/pi-demo/static',
5555

5656
// User data directory
57-
'var' => '/path/to/pi-demo-demo/var',
57+
'var' => '/path/to/pi-demo/var',
5858
// Path to global configuration directory
59-
'config' => '/path/to/pi-demo-demo/config',
59+
'config' => '/path/to/pi-demo/config',
6060
// Path to cache files directory
61-
'cache' => '/path/to/pi-demo-demo/cache',
61+
'cache' => '/path/to/pi-demo/cache',
6262
// Path to logs directory
63-
'log' => '/path/to/pi-demo-demo/log',
63+
'log' => '/path/to/pi-demo/log',
6464
)
6565
);

var/config/host.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
// If URI is a relative one then www root URI will be prepended
2626
'uri' => array(
2727
// WWW root URI
28-
'www' => 'http://siteurl.tld',
28+
'www' => 'http://pi-engine.org',
2929
// URI to access uploads directory
30-
'upload' => 'http://siteurl.tld/upload',
30+
'upload' => 'http://pi-engine.org/upload',
3131
// URI to access assets directory
32-
'asset' => 'http://siteurl.tld/asset',
32+
'asset' => 'http://pi-engine.org/asset',
3333
// URI to access static files directory
34-
'static' => 'http://siteurl.tld/static',
34+
'static' => 'http://pi-engine.org/static',
3535
),
3636

3737
// Paths to resources

var/config/hosts.php

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,51 @@
1212
* @copyright Copyright (c) Pi Engine http://www.xoopsengine.org
1313
* @license http://www.xoopsengine.org/license New BSD License
1414
* @author Taiwen Jiang <[email protected]>
15-
* @version $Id$
1615
*/
1716

1817
return array(
1918
// Alias of hosts
19+
// Root URL => identifier of specifications
2020
'alias' => array(
21-
'http://pi' => 'default',
22-
'http://www.pi' => 'default',
23-
'http://localhost/pi/www' => 'default',
24-
'http://pi-demo' => 'demo',
25-
'http://www.pi-demo' => 'demo',
21+
'http://pi-engine.org' => 'default',
22+
'http://www.pi-engine.org' => 'default',
23+
'http://pi-demo.org' => 'demo',
24+
'http://www.pi-demo.org' => 'demo',
25+
'http://pialog.org' => 'org',
26+
'http://www.pialog.org' => 'org',
2627
),
2728
// Host specifications
2829
'hosts' => array(
2930
// Specifications defined by files
30-
'default' => __DIR__ . '/host.php',
3131
'demo' => __DIR__ . '/host.demo.php',
32-
/*
32+
'org' => '/path/to/org/config/host.php',
33+
3334
// Specifications defined instantly
3435
'default' => array(
3536
// URIs to resources
3637
'uri' => array(
37-
'www' => 'http://pi',
38-
'upload' => 'http://pi/upload',
39-
'asset' => 'http://pi/asset',
40-
'static' => 'http://pi/static',
38+
'www' => 'http://pi-engine.org',
39+
'upload' => 'http://pi-engine.org/upload',
40+
'asset' => 'http://pi-engine.org/asset',
41+
'static' => 'http://pi-engine.org/static',
4142
),
4243
// Paths to resources
4344
'path' => array(
4445
'usr' => '/path/to/pi/usr',
4546
'var' => '/path/to/pi/var',
4647
'module' => '/path/to/pi/usr/module',
4748
'theme' => '/path/to/pi/usr/theme',
48-
'upload' => '/path/to/pi/www/upload',
49-
'asset' => '/path/to/pi/www/asset',
50-
'static' => '/path/to/pi/www/static',
51-
'vendor' => '/path/to/pi/lib/vendor',
52-
'config' => '/path/to/pi/var/config',
53-
'cache' => '/path/to/pi/var/cache',
54-
'log' => '/path/to/pi/var/log',
49+
50+
'upload' => '/path/to/pi/upload',
51+
'asset' => '/path/to/pi/asset',
52+
'static' => '/path/to/pi/static',
53+
54+
'vendor' => '/path/to/pi/vendor',
55+
56+
'config' => '/path/to/pi/config',
57+
'cache' => '/path/to/pi/cache',
58+
'log' => '/path/to/pi/log',
5559
),
5660
),
57-
*/
5861
),
5962
);

www/setup/dist/.htaccess.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ RewriteRule ^.*$ feed.php [NC,L]
3535
RewriteRule ^admin(/.*)?$ admin.php [NC,L]
3636

3737
# Application feed routes
38-
RewriteRule ^feed/[^/]+(/.*)?$ feed.php [NC,L]
38+
RewriteRule ^feed(/.*)?$ feed.php [NC,L]
3939

4040
# API routes
41-
RewriteRule ^api/[^/]+(/.*)?$ api.php [NC,L]
41+
RewriteRule ^api(/.*)?$ api.php [NC,L]
4242

4343
# Widget routes
44-
RewriteRule ^widget/[^/]+(/.*)?$ widget.php [NC,L]
44+
RewriteRule ^widget(/.*)?$ widget.php [NC,L]
4545

4646
# Otherwise, go through application routes
4747
RewriteRule ^.*$ app.php [NC,L]

www/static/image/logo.png

-1.45 KB
Loading

0 commit comments

Comments
 (0)