Skip to content

Commit

Permalink
Laravel: upgrade from 5.0.16 to 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Jan 18, 2016
1 parent 1e5eba6 commit c7c8df9
Show file tree
Hide file tree
Showing 20 changed files with 1,484 additions and 280 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ application/configs/ci-*
*.DS_Store

config/identity.php


# local INEX dev stuff:
ixpmanager-dump.sql.bz2
7 changes: 0 additions & 7 deletions app/Commands/Command.php

This file was deleted.

87 changes: 60 additions & 27 deletions app/Http/Controllers/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,67 @@
use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

use IXP\User;
use Validator;

class AuthController extends Controller {

/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/

use AuthenticatesAndRegistersUsers;

/**
* Create a new authentication controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\Registrar $registrar
* @return void
*/
public function __construct(Guard $auth, Registrar $registrar)
{
$this->auth = $auth;
$this->registrar = $registrar;

$this->middleware('guest', ['except' => 'getLogout']);
}
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/

use AuthenticatesAndRegistersUsers;

/**
* Create a new authentication controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\Registrar $registrar
* @return void
*/
public function __construct()
{
$this->auth = $auth;
$this->registrar = $registrar;

$this->middleware('guest', ['except' => 'getLogout']);
}

/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
public function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]);
}

/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
public function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}

}
48 changes: 24 additions & 24 deletions app/Http/Controllers/Auth/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@

class PasswordController extends Controller {

/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/

use ResetsPasswords;
use ResetsPasswords;

/**
* Create a new password controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
* @return void
*/
public function __construct(Guard $auth, PasswordBroker $passwords)
{
$this->auth = $auth;
$this->passwords = $passwords;
/**
* Create a new password controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
* @return void
*/
public function __construct()
{
$this->auth = $auth;
$this->passwords = $passwords;

$this->middleware('guest');
}
$this->middleware('guest');
}

}
138 changes: 69 additions & 69 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,83 +4,83 @@

class Kernel extends HttpKernel {

/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession',
'Illuminate\View\Middleware\ShareErrorsFromSession',
'IXP\Http\Middleware\VerifyCsrfToken',
];
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\IXP\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\IXP\Http\Middleware\VerifyCsrfToken::class,
];

/**
* The application's route middleware.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => 'IXP\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'IXP\Http\Middleware\RedirectIfAuthenticated',
];
/**
* The application's route middleware.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => 'IXP\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'IXP\Http\Middleware\RedirectIfAuthenticated',
];


/**
* Zend Framework 1 fallback
*
* IXP Manager is transitioning from ZF1 to Laravel as a framework. It
* will take some time to move over everything and this will be done on
* an as needed basis. Realistically this means there may be some ZF1
* crud for the foreseeable future.
*
* We'll revert to ZF1 handling when Laravel throws a 404:
*/
public function handle( $request )
{
// remove CSRF middleware as it's not available in ZF1
$this->middleware = array_diff($this->middleware, ['IXP\Http\Middleware\VerifyCsrfToken'] );
/**
* Zend Framework 1 fallback
*
* IXP Manager is transitioning from ZF1 to Laravel as a framework. It
* will take some time to move over everything and this will be done on
* an as needed basis. Realistically this means there may be some ZF1
* crud for the foreseeable future.
*
* We'll revert to ZF1 handling when Laravel throws a 404:
*/
public function handle( $request )
{
// remove CSRF middleware as it's not available in ZF1
$this->middleware = array_diff($this->middleware, ['IXP\Http\Middleware\VerifyCsrfToken'] );

try
{
return $this->sendRequestThroughRouter($request);
}
catch( \Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e )
{
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath( __DIR__ . '/../../application' ) );
try
{
return $this->sendRequestThroughRouter($request);
}
catch( \Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e )
{
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath( __DIR__ . '/../../application' ) );

// Define application environment
if( php_sapi_name() == 'cli-server' ) {
// running under PHP's built in web server: php -S
// as such, .htaccess is not processed
include( __DIR__ . '/../../bin/utils.inc' );
define( 'APPLICATION_ENV', scriptutils_get_application_env() );
} else {
// probably Apache or other web server
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
}
// Define application environment
if( php_sapi_name() == 'cli-server' ) {
// running under PHP's built in web server: php -S
// as such, .htaccess is not processed
include( __DIR__ . '/../../bin/utils.inc' );
define( 'APPLICATION_ENV', scriptutils_get_application_env() );
} else {
// probably Apache or other web server
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
}

/** Zend_Application */
require_once 'Zend/Application.php';
/** Zend_Application */
require_once 'Zend/Application.php';

require_once( APPLICATION_PATH . '/../library/IXP/Version.php' );
require_once( APPLICATION_PATH . '/../library/IXP/Version.php' );

// Create application, bootstrap, and run
$application = new \Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
// Create application, bootstrap, and run
$application = new \Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);

$application->bootstrap()->run();
die();
}
}
$application->bootstrap()->run();
die();
}
}

}
17 changes: 17 additions & 0 deletions app/Http/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace IXP\Http\Middleware;

use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;

class EncryptCookies extends BaseEncrypter
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
19 changes: 19 additions & 0 deletions app/Jobs/Job.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Jobs;
use Illuminate\Bus\Queueable;

abstract class Job
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "onQueue" and "delay" queue helper methods.
|
*/
use Queueable;
}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c7c8df9

Please sign in to comment.