Skip to content

Commit

Permalink
Merge pull request #650 from CakeDC/feature/cakephp2.10
Browse files Browse the repository at this point in the history
Upgrade plugin to CakePHP 2.10 (latest Cake 2.x version)
  • Loading branch information
ajibarra authored Feb 2, 2018
2 parents 811d810 + 193206f commit 6b33627
Show file tree
Hide file tree
Showing 51 changed files with 2,075 additions and 1,982 deletions.
4 changes: 2 additions & 2 deletions .semver
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
:major: 2
:minor: 1
:patch: 3
:minor: 2
:patch: 0
:special: ''
32 changes: 12 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1

env:
global:
- PLUGIN_NAME=Users
- DB=mysql
- REQUIRE="phpunit/phpunit:3.7.31"
- REQUIRE="phpunit/phpunit:3.7.38"

matrix:
- DB=mysql CAKE_VERSION=2.6
- DB=mysql CAKE_VERSION=2.10

matrix:
include:
- php: 5.3
- php: 5.6
env:
- CAKE_VERSION=2.6
- php: 5.3
- CAKE_VERSION=2.10
- php: 7.0
env:
- CAKE_VERSION=2.7
- php: 5.4
- CAKE_VERSION=2.10
- php: 7.1
env:
- CAKE_VERSION=2.6
- php: 5.4
env:
- CAKE_VERSION=2.7
- php: 5.5
env:
- CAKE_VERSION=2.6
- php: 5.5
env:
- CAKE_VERSION=2.7
- CAKE_VERSION=2.10


before_script:
- git clone https://github.com/steinkel/travis.git --depth 1 ../travis
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

Release 2.2.0
-------------

https://github.com/CakeDC/users/tree/2.2.0

* Upgrade plugin for compatibility with CakePHP 2.10
* Remove deprecations

Release 2.1.3
-------------

Expand Down
81 changes: 43 additions & 38 deletions Config/Migration/001_initialize_users_schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,74 @@
/**
* Users CakePHP Plugin
*
* Copyright 2010 - 2014, Cake Development Corporation
* Copyright 2009 - 2018, Cake Development Corporation
* 1785 E. Sahara Avenue, Suite 490-423
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @Copyright 2010 - 2014, Cake Development Corporation
* @Copyright 2009 - 2018, Cake Development Corporation
* @link http://github.com/CakeDC/users
* @package plugins.users.config.migrations
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

class M49c3417a54874a9d276811502cedc421 extends CakeMigration {

/**
* Dependency array. Define what minimum version required for other part of db schema
*
* Migration defined like 'app.31' or 'plugin.PluginName.12'
*
* @var array $dependendOf
*/
public $dependendOf = array();
public $dependendOf = [];

/**
* Migration array
*
* @var array $migration
*/
public $migration = array(
'up' => array(
'create_table' => array(
'users' => array(
'id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36, 'key' => 'primary'),
'username' => array('type' => 'string', 'null' => false, 'default' => null),
'slug' => array('type' => 'string', 'null' => false, 'default' => null),
'password' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 128),
'password_token' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 128),
'email' => array('type' => 'string', 'null' => true, 'default' => null),
'email_verified' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
'email_token' => array('type' => 'string', 'null' => true, 'default' => null),
'email_token_expiry' => array('type' => 'datetime', 'null' => true, 'default' => null),
'tos' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
'active' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
'last_login' => array('type' => 'datetime', 'null' => true, 'default' => null),
'last_action' => array('type' => 'datetime', 'null' => true, 'default' => null),
'is_admin' => array('type' => 'boolean', 'null' => true, 'default' => '0'),
'role' => array('type' => 'string', 'null' => true, 'default' => null),
'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'BY_USERNAME' => array('column' => array('username'), 'unique' => 0),
'BY_EMAIL' => array('column' => array('email'), 'unique' => 0)
),
),
),
),
'down' => array(
'drop_table' => array('users'),
)
);
public $migration = [
'up' => [
'create_table' => [
'users' => [
'id' => ['type' => 'string', 'null' => false, 'default' => null, 'length' => 36, 'key' => 'primary'],
'username' => ['type' => 'string', 'null' => false, 'default' => null],
'slug' => ['type' => 'string', 'null' => false, 'default' => null],
'password' => ['type' => 'string', 'null' => true, 'default' => null, 'length' => 128],
'password_token' => ['type' => 'string', 'null' => true, 'default' => null, 'length' => 128],
'email' => ['type' => 'string', 'null' => true, 'default' => null],
'email_verified' => ['type' => 'boolean', 'null' => true, 'default' => '0'],
'email_token' => ['type' => 'string', 'null' => true, 'default' => null],
'email_token_expiry' => ['type' => 'datetime', 'null' => true, 'default' => null],
'tos' => ['type' => 'boolean', 'null' => true, 'default' => '0'],
'active' => ['type' => 'boolean', 'null' => true, 'default' => '0'],
'last_login' => ['type' => 'datetime', 'null' => true, 'default' => null],
'last_action' => ['type' => 'datetime', 'null' => true, 'default' => null],
'is_admin' => ['type' => 'boolean', 'null' => true, 'default' => '0'],
'role' => ['type' => 'string', 'null' => true, 'default' => null],
'created' => ['type' => 'datetime', 'null' => true, 'default' => null],
'modified' => ['type' => 'datetime', 'null' => true, 'default' => null],
'indexes' => [
'PRIMARY' => ['column' => 'id', 'unique' => 1],
'BY_USERNAME' => ['column' => ['username'], 'unique' => 0],
'BY_EMAIL' => ['column' => ['email'], 'unique' => 0]
],
],
],
],
'down' => [
'drop_table' => ['users'],
]
];

/**
* before migration callback
*
* @param string $direction, up or down direction of migration process
* @param string $direction up or down direction of migration process
* @return bool
*/
public function before($direction) {
return true;
Expand All @@ -74,7 +78,8 @@ public function before($direction) {
/**
* after migration callback
*
* @param string $direction, up or down direction of migration process
* @param string $direction up or down direction of migration process
* @return bool
*/
public function after($direction) {
return true;
Expand Down
43 changes: 24 additions & 19 deletions Config/Migration/002_renaming.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,57 @@
/**
* Users CakePHP Plugin
*
* Copyright 2010 - 2014, Cake Development Corporation
* Copyright 2009 - 2018, Cake Development Corporation
* 1785 E. Sahara Avenue, Suite 490-423
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @Copyright 2010 - 2014, Cake Development Corporation
* @Copyright 2009 - 2018, Cake Development Corporation
* @link http://github.com/CakeDC/users
* @package plugins.users.config.migrations
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

class M4ef8ba03ff504ab2b415980575f6eb26 extends CakeMigration {

/**
* Dependency array. Define what minimum version required for other part of db schema
*
* Migration defined like 'app.31' or 'plugin.PluginName.12'
*
* @var array $dependendOf
*/
public $dependendOf = array();
public $dependendOf = [];

/**
* Migration array
*
* @var array $migration
*/
public $migration = array(
'up' => array(
'rename_field' => array(
'users' => array(
public $migration = [
'up' => [
'rename_field' => [
'users' => [
'email_token_expiry' => 'email_token_expires'
),
),
),
'down' => array(
'rename_field' => array(
'users' => array(
],
],
],
'down' => [
'rename_field' => [
'users' => [
'email_token_expires' => 'email_token_expiry'
),
),
)
);
],
],
]
];

/**
* before migration callback
*
* @param string $direction, up or down direction of migration process
* @param string $direction up or down direction of migration process
* @return bool
*/
public function before($direction) {
return true;
Expand All @@ -57,7 +61,8 @@ public function before($direction) {
/**
* after migration callback
*
* @param string $direction, up or down direction of migration process
* @param string $direction up or down direction of migration process
* @return bool
*/
public function after($direction) {
return true;
Expand Down
12 changes: 6 additions & 6 deletions Config/Migration/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
/**
* Users CakePHP Plugin
*
* Copyright 2010 - 2014, Cake Development Corporation
* Copyright 2009 - 2018, Cake Development Corporation
* 1785 E. Sahara Avenue, Suite 490-423
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @Copyright 2010 - 2014, Cake Development Corporation
* @Copyright 2009 - 2018, Cake Development Corporation
* @link http://github.com/CakeDC/users
* @package plugins.users.config.migrations
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$map = array(
1 => array('001_initialize_users_schema' => 'M49c3417a54874a9d276811502cedc421'),
2 => array('002_renaming' => 'M4ef8ba03ff504ab2b415980575f6eb26')
);
$map = [
1 => ['001_initialize_users_schema' => 'M49c3417a54874a9d276811502cedc421'],
2 => ['002_renaming' => 'M4ef8ba03ff504ab2b415980575f6eb26']
];
Loading

0 comments on commit 6b33627

Please sign in to comment.