改名
This commit is contained in:
+7
-7
@@ -43,11 +43,11 @@ if (!function_exists('storage')) {
|
|||||||
function storage($fileName = '', $path = '')
|
function storage($fileName = '', $path = '')
|
||||||
{
|
{
|
||||||
$basePath = Snowflake::getStoragePath();
|
$basePath = Snowflake::getStoragePath();
|
||||||
// if (empty($path)) {
|
if (empty($path)) {
|
||||||
// return $basePath . '/' . $fileName;
|
return $basePath . '/' . $fileName;
|
||||||
// } else if (empty($fileName)) {
|
} else if (empty($fileName)) {
|
||||||
// return initDir($basePath, $path);
|
return initDir($basePath, $path);
|
||||||
// }
|
}
|
||||||
return initDir($basePath, $path) . $fileName;
|
return initDir($basePath, $path) . $fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,10 +64,10 @@ if (!function_exists('storage')) {
|
|||||||
foreach ($explode as $value) {
|
foreach ($explode as $value) {
|
||||||
$path .= $value . '/';
|
$path .= $value . '/';
|
||||||
if (!is_dir($basePath . $path)) {
|
if (!is_dir($basePath . $path)) {
|
||||||
// mkdir($basePath . $path);
|
mkdir($basePath . $path);
|
||||||
}
|
}
|
||||||
if (!is_dir($basePath . $path)) {
|
if (!is_dir($basePath . $path)) {
|
||||||
// throw new Exception('System error, directory ' . $basePath . $path . ' is not writable');
|
throw new Exception('System error, directory ' . $basePath . $path . ' is not writable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return realpath($basePath . $path);
|
return realpath($basePath . $path);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use Snowflake\Di\Service;
|
|||||||
use Snowflake\Error\ErrorHandler;
|
use Snowflake\Error\ErrorHandler;
|
||||||
use Snowflake\Error\Logger;
|
use Snowflake\Error\Logger;
|
||||||
use Snowflake\Exception\ComponentException;
|
use Snowflake\Exception\ComponentException;
|
||||||
|
use Snowflake\Exception\InitException;
|
||||||
use Snowflake\Pool\Connection;
|
use Snowflake\Pool\Connection;
|
||||||
use Snowflake\Pool\RedisClient;
|
use Snowflake\Pool\RedisClient;
|
||||||
use Snowflake\Processes;
|
use Snowflake\Processes;
|
||||||
@@ -142,45 +143,17 @@ abstract class BaseApplication extends Service
|
|||||||
foreach ($config as $key => $value) {
|
foreach ($config as $key => $value) {
|
||||||
Config::set($key, $value);
|
Config::set($key, $value);
|
||||||
}
|
}
|
||||||
// if (isset($config['id'])) {
|
if ($storage = Config::get('storage', false, 'storage')) {
|
||||||
// $this->id = $config['id'];
|
if (strpos($storage, APP_PATH) === false) {
|
||||||
// unset($config['id']);
|
$storage = realpath(APP_PATH . $storage);
|
||||||
// }
|
}
|
||||||
// if (isset($config['storage'])) {
|
if (!is_dir($storage)) {
|
||||||
// $this->storage = $config['storage'];
|
mkdir($storage, 777);
|
||||||
// unset($config['storage']);
|
}
|
||||||
// }
|
if (!is_dir($storage) || !is_writeable($storage)) {
|
||||||
// if (!empty($this->runtimePath)) {
|
throw new InitException("Directory {$storage} does not have write permission");
|
||||||
// if (!is_dir($this->runtimePath)) {
|
}
|
||||||
// mkdir($this->runtimePath, 777);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (!is_dir($this->runtimePath) || !is_writeable($this->runtimePath)) {
|
|
||||||
// throw new InitException("Directory {$this->runtimePath} does not have write permission");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (isset($config['aliases'])) {
|
|
||||||
// $this->classAlias($config);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// foreach ($this->moreComponents() as $key => $val) {
|
|
||||||
// if (isset($config['components'][$key])) {
|
|
||||||
// $config['components'][$key] = array_merge($val, $config['components'][$key]);
|
|
||||||
// } else {
|
|
||||||
// $config['components'][$key] = $val;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
private function classAlias(array &$data)
|
|
||||||
{
|
|
||||||
foreach ($data['aliases'] as $key => $val) {
|
|
||||||
class_alias($val, $key, true);
|
|
||||||
}
|
}
|
||||||
unset($data['aliases']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Snowflake
|
|||||||
{
|
{
|
||||||
$path = realpath(static::$service->storage);
|
$path = realpath(static::$service->storage);
|
||||||
if (!is_dir($path)) {
|
if (!is_dir($path)) {
|
||||||
// mkdir($path);
|
mkdir($path);
|
||||||
}
|
}
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
@@ -128,11 +128,11 @@ class Snowflake
|
|||||||
public static function writeFile($fileName, $content, $is_append = FILE_APPEND)
|
public static function writeFile($fileName, $content, $is_append = FILE_APPEND)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
// if (self::inCoroutine()) {
|
if (self::inCoroutine()) {
|
||||||
// return Coroutine::writeFile($fileName, $content, $is_append);
|
return Coroutine::writeFile($fileName, $content, $is_append);
|
||||||
// } else {
|
} else {
|
||||||
// return file_put_contents($fileName, $content, $is_append);
|
return file_put_contents($fileName, $content, $is_append);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user