git.cweiske.de
/
phancap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
acd1fb6
)
Do not require phar extension
author
Christian Weiske
<cweiske@cweiske.de>
Mon, 18 Apr 2016 20:05:47 +0000
(22:05 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Mon, 18 Apr 2016 20:05:47 +0000
(22:05 +0200)
src/phancap/Config.php
patch
|
blob
|
history
diff --git
a/src/phancap/Config.php
b/src/phancap/Config.php
index b2d42b1dfefde141bfde8be217fd56002a68e296..e45f08b38042c7ff9f9dab36cc22517775a51e8c 100644
(file)
--- a/
src/phancap/Config.php
+++ b/
src/phancap/Config.php
@@
-158,12
+158,18
@@
class Config
*/
protected function loadConfigFilePaths()
{
*/
protected function loadConfigFilePaths()
{
- $pharFile = \Phar::running();
- if ($pharFile == '') {
- $this->cfgFiles[] = __DIR__ . '/../../data/phancap.config.php';
- } else {
+ $phar = false;
+ if (class_exists('\\Phar')) {
+ $pharFile = \Phar::running();
+ if ($pharFile != '') {
+ $phar = true;
+ }
+ }
+ if ($phar) {
//remove phar:// from the path
$this->cfgFiles[] = substr($pharFile, 7) . '.config.php';
//remove phar:// from the path
$this->cfgFiles[] = substr($pharFile, 7) . '.config.php';
+ } else {
+ $this->cfgFiles[] = __DIR__ . '/../../data/phancap.config.php';
}
//TODO: add ~/.config/phancap.php
}
//TODO: add ~/.config/phancap.php
@@
-235,7
+241,7
@@
class Config
if (substr($url, -1) != '/') {
$url = substr($url, 0, -strlen(basename($url)) - 1);
}
if (substr($url, -1) != '/') {
$url = substr($url, 0, -strlen(basename($url)) - 1);
}
- if (\Phar::running()) {
+ if (
class_exists('\\Phar') &&
\Phar::running()) {
//remove .phar file name
$url = substr($url, 0, -strlen(basename($url)) - 1);
}
//remove .phar file name
$url = substr($url, 0, -strlen(basename($url)) - 1);
}