-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from phalcon-nucleon/1.3
1.3
- Loading branch information
Showing
119 changed files
with
3,089 additions
and
1,341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Release Note | ||
|
||
## v1.3.0 | ||
|
||
### Added | ||
- Own Preloader. | ||
Improved class compilation, removing "use", converting the long syntax "array" to the short syntax. | ||
Thanks to [nikic/php-parser](https://github.com/nikic/PHP-Parser). | ||
- Kernel HTTP : Routes cache | ||
- Volt : | ||
- Csrf Extension, add functions : csrf_field, csrf_token. | ||
- Function route(name, arguments, query) | ||
- Middleware : Auth\Middleware\Authenticate | ||
- Config : app->static_base_uri : configure url->static_base_uri | ||
- Console : Allow force enable / disable color. | ||
- Debug : add syntax highlight with ark4ne/highlight. | ||
- Migration : add pretend option Dump the SQL queries that would be run. | ||
- Migration : implement rename table function. | ||
- Crypt : Configurable cipher algorithm. | ||
- Session : Multiple backend adapter configuration | ||
- Improved debug tools (File highlight, improve exception/error format, improve variable verbose, ...) | ||
- App : Allow to configure base_url & static_url. | ||
- ServerTask : Allow to configure host and ip, insteadof only ip. | ||
- Process : Add watch method. | ||
|
||
### Changed | ||
- Config::Cache : Aggregate now all config files into one file, and keep file content. | ||
- Dotconst::PhpDir : Compile now relative path to basePath, from compilePath. | ||
- Str::normalizePath trigger E_USER_DEPRECATED. | ||
- Str::random : Use lib sodium. | ||
- Arr::isAssoc : Improve performance. | ||
- Arr::sortRecursive : Add $sort_flags | ||
- Middlewares : All middlewares define response insteadof throw Exception. | ||
- Config::Session : Allow to describe multiple store for session | ||
- Debug : Clean output before render error | ||
- Auth : Fixed session remember, and remember cookie deletion on logout. | ||
- HttpClient : Fixed methods arguments for post, put, patch. | ||
- HttpClient : Remove default timeout. | ||
- ListTask : Display an error if a command has a nonexistent method. | ||
- Migration : Fixed addition primary key to an existing table | ||
- Error\Writer\Json : Return now : [code: http_status_code, status: http_status_msg [, debug: error]] | ||
|
||
### Removed | ||
- classpreloader/classpreloader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# UPGRADING | ||
|
||
## 1.2 > 1.3 | ||
|
||
### Config | ||
You must modify all paths using "\_\_DIR__", so that it now uses "BASE_PATH". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Neutrino\Auth\Middleware; | ||
|
||
use Neutrino\Constants\Services; | ||
use Neutrino\Foundation\Middleware\Controller as ControllerMiddleware; | ||
use Neutrino\Interfaces\Middleware\BeforeInterface; | ||
use Phalcon\Events\Event; | ||
|
||
/** | ||
* Class Authenticate | ||
* | ||
* @package Neutrino\Auth\Middleware | ||
*/ | ||
class Authenticate extends ControllerMiddleware implements BeforeInterface | ||
{ | ||
|
||
/** | ||
* Called before the execution of handler | ||
* | ||
* @param \Phalcon\Events\Event $event | ||
* @param \Phalcon\Dispatcher|mixed $source | ||
* @param mixed|null $data | ||
* | ||
* @throws \Exception | ||
* @return bool | ||
*/ | ||
public function before(Event $event, $source, $data = null) | ||
{ | ||
if ($this->{Services::AUTH}->check()) { | ||
return true; | ||
} | ||
|
||
$this->response->setStatusCode(401, 'Unauthorized'); | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace Neutrino\Config; | ||
|
||
use Neutrino\PhpPreloader\Exceptions\DirConstantException; | ||
use Neutrino\PhpPreloader\Exceptions\FileConstantException; | ||
use Neutrino\PhpPreloader\Factory; | ||
use PhpParser\Node\Expr\Array_; | ||
use PhpParser\Node\Expr\Assign; | ||
use PhpParser\Node\Expr\Variable; | ||
use PhpParser\Node\Stmt\Return_; | ||
|
||
/** | ||
* Class ConfigPreloader | ||
* | ||
* @package Neutrino\Config | ||
*/ | ||
class ConfigPreloader | ||
{ | ||
private $preloader; | ||
private $returnConverter; | ||
|
||
public function __construct() | ||
{ | ||
$this->preloader = (new Factory())->create(); | ||
$this->returnConverter = new ReturnConverter('config'); | ||
$this->preloader->getTraverser()->addVisitor($this->returnConverter); | ||
} | ||
|
||
/** | ||
* @throws \Neutrino\PhpPreloader\Exceptions\DirConstantException | ||
* @throws \Neutrino\PhpPreloader\Exceptions\FileConstantException | ||
* @throws \Exception | ||
*/ | ||
public function compile() | ||
{ | ||
$outputFile = BASE_PATH . '/bootstrap/compile/config.php'; | ||
try { | ||
$r = $this->preloader->prepareOutput($outputFile); | ||
|
||
$nodes = [ | ||
new Assign( | ||
new Variable('config'), | ||
new Array_([], ['kind' => Array_::KIND_SHORT]) | ||
) | ||
]; | ||
|
||
foreach (glob(BASE_PATH . '/config/*.php') as $file) { | ||
$name = pathinfo($file, PATHINFO_FILENAME); | ||
|
||
if ($name === 'compile') { | ||
continue; | ||
} | ||
|
||
$this->returnConverter->setName($name); | ||
|
||
$stmts = $this->preloader->parse($file); | ||
$stmts = $this->preloader->traverse($stmts); | ||
|
||
$nodes = array_merge($nodes, $stmts); | ||
} | ||
|
||
$nodes[] = new Return_( | ||
new Variable('config') | ||
); | ||
|
||
fwrite($r, $this->preloader->prettyPrint($nodes)); | ||
|
||
} catch (DirConstantException $e) { | ||
throw new DirConstantException( | ||
"Usage of __DIR__ constant is prohibited. Use BASE_PATH . '/path_to_dir' instead.\nin : $file", | ||
$e->getCode() | ||
); | ||
} catch (FileConstantException $e) { | ||
throw new FileConstantException( | ||
"Usage of __FILE__ constant is prohibited. Use BASE_PATH . '/path_to_file' instead.\nin : $file", | ||
$e->getCode() | ||
); | ||
} finally { | ||
if (isset($r) && is_resource($r)) { | ||
fclose($r); | ||
} | ||
if (isset($e)) { | ||
@unlink($outputFile); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.