• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revision607a766d4946a37c7793301e0cd07274dc77b5d2 (tree)
Time2009-01-12 12:50:33
Authorhenoheno <henoheno>
Commiterhenoheno

Log Message

load_once()

Change Summary

Incremental Difference

--- a/bin/pkwk14.php
+++ b/bin/pkwk14.php
@@ -1,6 +1,6 @@
11 <?php
22 // PukiWiki - Yet another WikiWikiWeb clone.
3-// $Id: pkwk14.php,v 1.3 2009/01/12 02:58:07 henoheno Exp $
3+// $Id: pkwk14.php,v 1.4 2009/01/12 03:50:33 henoheno Exp $
44 // Copyright (C) 2009 PukiWiki Developers Team
55 // License: GPL v2 or (at your option) any later version
66 //
@@ -9,6 +9,7 @@
99
1010 # Name and Usage --------------------------------------------
1111 define('PKWK_CLI_NAME', $argv[0]);
12+//define('CLI_PATH', rtrim(getcwd(), '/\\'));
1213
1314 function usage()
1415 {
@@ -32,7 +33,7 @@ error_reporting(E_ALL); // Debug purpose
3233 function warn($string = ''){ fwrite(STDERR, $string . "\n"); }
3334 function err( $string = ''){ warn($string); exit(1); }
3435
35-function load($filepath)
36+function load_once($filepath)
3637 {
3738 if (strpos($filepath, ':') !== FALSE) {
3839 err('load: Error: URL-like string');
@@ -48,51 +49,50 @@ function load($filepath)
4849
4950 // PKWK_ROOT
5051 if (isset($_ENV['PKWK_ROOT'])) {
51- $pkwk_root = rtrim($_ENV['PKWK_ROOT'], '/') . '/';
52+ $pkwk_root = rtrim($_ENV['PKWK_ROOT'], '/\\') . '/';
5253 if (! file_exists($pkwk_root)) {
5354 err('Error: [PKWK_ROOT] No such directory: ' . $pkwk_root);
5455 }
55-
5656 } else {
5757 $pkwk_root = './';
5858 }
5959 define('PKWK_ROOT', $pkwk_root);
6060 unset($pkwk_root);
6161
62-// LIB_DIR
63-define('LIB_DIR', PKWK_ROOT . 'lib/');
6462
65-// DATA_HOME
66-define('DATA_HOME', './');
67-// Where to
68-// * pukiwiki.ini.php
63+# Load libraries --------------------------------------------
6964
65+define('LIB_DIR', PKWK_ROOT . 'lib' . '/');
66+if (! file_exists(LIB_DIR)) {
67+ err('Error: LIB_DIR not found: ' . LIB_DIR);
68+}
7069
71-# Load libraries --------------------------------------------
72-// From pukiwiki.php
73-
74-load(LIB_DIR . 'func.php');
75-load(LIB_DIR . 'file.php');
76-load(LIB_DIR . 'html.php');
77-load(LIB_DIR . 'backup.php');
78-
79-load(LIB_DIR . 'convert_html.php');
80-load(LIB_DIR . 'make_link.php');
81-load(LIB_DIR . 'diff.php');
82-load(LIB_DIR . 'config.php');
83-load(LIB_DIR . 'link.php');
84-load(LIB_DIR . 'auth.php');
85-load(LIB_DIR . 'proxy.php');
70+load_once(LIB_DIR . 'func.php');
71+load_once(LIB_DIR . 'file.php');
72+load_once(LIB_DIR . 'html.php');
73+load_once(LIB_DIR . 'backup.php');
74+
75+load_once(LIB_DIR . 'convert_html.php');
76+load_once(LIB_DIR . 'make_link.php');
77+load_once(LIB_DIR . 'diff.php');
78+load_once(LIB_DIR . 'config.php');
79+load_once(LIB_DIR . 'link.php');
80+load_once(LIB_DIR . 'auth.php');
81+load_once(LIB_DIR . 'proxy.php');
8682 if (! extension_loaded('mbstring')) {
87- load(LIB_DIR . 'mbstring.php');
83+ load_once(LIB_DIR . 'mbstring.php');
8884 }
8985
90-load(LIB_DIR . 'mail.php');
91-load(LIB_DIR . 'spam.php');
86+load_once(LIB_DIR . 'mail.php');
87+load_once(LIB_DIR . 'spam.php');
9288
9389
9490 # Default variables 2 ---------------------------------------
95-// From pukiwiki.ini.php
91+
92+define('DATA_HOME', './');
93+// Where to
94+// * pukiwiki.ini.php
95+// * xxx_DIR
9696
9797 if (! defined('LANG')) define('LANG', 'ja');
9898 if (! defined('UI_LANG')) define('UI_LANG', LANG);