Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f77809

Browse files
committed
[NF] - customer notes/mailing list/user preferences
1 parent f94b2f7 commit 0f77809

38 files changed

Lines changed: 1049 additions & 1678 deletions

.idea/php.xml

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/Console/Commands/MailingList/GetSubscribers.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<?php namespace IXP\Console\Commands\MailingList;
1+
<?php
2+
3+
namespace IXP\Console\Commands\MailingList;
24

35
/*
4-
* Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee.
6+
* Copyright (C) 2009 - 2021 Internet Neutral Exchange Association Company Limited By Guarantee.
57
* All Rights Reserved.
68
*
79
* This file is part of IXP Manager.
@@ -27,13 +29,14 @@
2729
* Artisan command to export subscribers to a mailing list
2830
*
2931
* @author Barry O'Donovan <[email protected]>
30-
* @category MailingList
31-
* @package IXP\Console\Commands
32-
* @copyright Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee
32+
* @author Yann Robin <[email protected]>
33+
* @category IXP
34+
* @package IXP\Console\Commands\MailingList
35+
* @copyright Copyright (C) 2009 - 2021 Internet Neutral Exchange Association Company Limited By Guarantee
3336
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
3437
*/
35-
class GetSubscribers extends MailingList {
36-
38+
class GetSubscribers extends MailingList
39+
{
3740
/**
3841
* The name and signature of the console command.
3942
*
@@ -56,23 +59,26 @@ class GetSubscribers extends MailingList {
5659
* Execute the console command.
5760
*
5861
* @return mixed
62+
*
63+
* @throws
5964
*/
60-
public function handle(): int {
61-
65+
public function handle(): int
66+
{
6267
if( !config( 'mailinglists.enabled' ) ) {
6368
die( "Mailing list functionality is disabled. See: http://docs.ixpmanager.org/features/mailing-lists/\n" );
6469
}
6570

66-
$ml = new ML( $this->argument('list') );
71+
$ml = new ML( $this->argument('list' ) );
72+
73+
$subscriberEmails = $ml->getSubscriberEmails( !$this->option( 'unsubscribed' ) );
6774

68-
if( $this->option('format') == 'json' ) {
69-
echo json_encode( $ml->getSubscriberEmails( !$this->option( 'unsubscribed' ) ) );
75+
if( $this->option('format') === 'json' ) {
76+
echo json_encode( $subscriberEmails, JSON_THROW_ON_ERROR );
7077
} else {
71-
echo implode( "\n", $ml->getSubscriberEmails( !$this->option( 'unsubscribed' ) ) );
78+
echo implode( "\n", $subscriberEmails );
7279
}
7380

7481
echo "\n";
7582
return 0;
7683
}
77-
78-
}
84+
}

app/Console/Commands/MailingList/Init.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<?php namespace IXP\Console\Commands\MailingList;
1+
<?php
2+
3+
namespace IXP\Console\Commands\MailingList;
24

35
/*
4-
* Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee.
6+
* Copyright (C) 2009 - 2021 Internet Neutral Exchange Association Company Limited By Guarantee.
57
* All Rights Reserved.
68
*
79
* This file is part of IXP Manager.
@@ -31,11 +33,11 @@
3133
* @author Barry O'Donovan <[email protected]>
3234
* @category MailingList
3335
* @package IXP\Console\Commands
34-
* @copyright Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee
36+
* @copyright Copyright (C) 2009 - 2021 Internet Neutral Exchange Association Company Limited By Guarantee
3537
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
3638
*/
37-
class Init extends MailingList {
38-
39+
class Init extends MailingList
40+
{
3941
/**
4042
* The name and signature of the console command.
4143
*
@@ -66,17 +68,19 @@ class Init extends MailingList {
6668
* but set those without a setting to on / off as appropriate.
6769
*
6870
* @return mixed
71+
*
72+
* @throws
6973
*/
70-
public function handle(): int {
71-
74+
public function handle(): int
75+
{
7276
if( !config( 'mailinglists.enabled' ) ) {
7377
die( "Mailing list functionality is disabled. See: http://docs.ixpmanager.org/features/mailing-lists/\n" );
7478
}
7579

7680
$ml = new ML( $this->argument('list') );
7781

7882
$stdin = fopen( "php://stdin","r" );
79-
$addresses = new Set;
83+
$addresses = collect();
8084

8185
while( $address = strtolower( trim( fgets( $stdin ) ) ) ) {
8286
if( !$addresses->contains( $address ) ) {
@@ -90,9 +94,9 @@ public function handle(): int {
9094

9195
$result = $ml->init( $addresses );
9296

93-
if( $this->isVerbosityVerbose() || $this->option('format') == 'json' ) {
94-
if( $this->option( 'format' ) == 'json' ) {
95-
echo json_encode( $result );
97+
if( $this->isVerbosityVerbose() || $this->option('format') === 'json' ) {
98+
if( $this->option( 'format' ) === 'json' ) {
99+
echo json_encode( $result, JSON_THROW_ON_ERROR );
96100
} else {
97101
foreach( $result as $k => $v ) {
98102
foreach( $v as $e ) {
@@ -105,5 +109,4 @@ public function handle(): int {
105109
echo "\n";
106110
return 0;
107111
}
108-
109-
}
112+
}

app/Console/Commands/MailingList/MailingList.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<?php namespace IXP\Console\Commands\MailingList;
1+
<?php
2+
3+
namespace IXP\Console\Commands\MailingList;
24

35
/*
4-
* Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee.
6+
* Copyright (C) 2009 - 2021 Internet Neutral Exchange Association Company Limited By Guarantee.
57
* All Rights Reserved.
68
*
79
* This file is part of IXP Manager.
@@ -21,12 +23,6 @@
2123
* http://www.gnu.org/licenses/gpl-2.0.html
2224
*/
2325

24-
use IXP\Services\Grapher as Grapher;
25-
2626
use IXP\Console\Commands\Command as IXPCommand;
27-
use IXP\Console\Commands\Command;
28-
29-
30-
abstract class MailingList extends IXPCommand {
3127

32-
}
28+
abstract class MailingList extends IXPCommand {}

app/Console/Commands/MailingList/SyncScript.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<?php namespace IXP\Console\Commands\MailingList;
1+
<?php
2+
3+
namespace IXP\Console\Commands\MailingList;
24

35
/*
4-
* Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee.
6+
* Copyright (C) 2009 - 2021 Internet Neutral Exchange Association Company Limited By Guarantee.
57
* All Rights Reserved.
68
*
79
* This file is part of IXP Manager.
@@ -21,18 +23,18 @@
2123
* http://www.gnu.org/licenses/gpl-2.0.html
2224
*/
2325

24-
use IXP\Utils\MailingList as ML;
25-
2626
/**
2727
* Artisan command to export subscribers to a mailing list
2828
*
2929
* @author Barry O'Donovan <[email protected]>
30-
* @category MailingList
31-
* @package IXP\Console\Commands
32-
* @copyright Copyright (C) 2009 - 2019 Internet Neutral Exchange Association Company Limited By Guarantee
30+
* @author Yann Robin <[email protected]>
31+
* @category IXP
32+
* @package IXP\Console\Commands\MailingList
33+
* @copyright Copyright (C) 2009 - 2021 Internet Neutral Exchange Association Company Limited By Guarantee
3334
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
3435
*/
35-
class SyncScript extends MailingList {
36+
class SyncScript extends MailingList
37+
{
3638

3739
/**
3840
* The name and signature of the console command.
@@ -49,7 +51,6 @@ class SyncScript extends MailingList {
4951
*/
5052
protected $description = 'Generate a sample mailing list syncronisation script';
5153

52-
5354
/**
5455
* Mailing list initialisation script
5556
*
@@ -64,8 +65,8 @@ class SyncScript extends MailingList {
6465
*
6566
* @return mixed
6667
*/
67-
public function handle(): int {
68-
68+
public function handle(): int
69+
{
6970
if( !config( 'mailinglists.enabled' ) ) {
7071
die( "Mailing list functionality is disabled. See: http://docs.ixpmanager.org/features/mailing-lists/\n" );
7172
}
@@ -78,10 +79,9 @@ public function handle(): int {
7879
}
7980

8081
echo view( 'console/commands/mailing-list/sync-' . ( $this->option( 'sh' ) ? 'sh' : 'apiv4' ) )
81-
->with([ 'lists' => config( 'mailinglists.lists' ) ])
82+
->with( [ 'lists' => config( 'mailinglists.lists' ) ] )
8283
->render();
8384

8485
return 0;
8586
}
86-
87-
}
87+
}

app/Console/Commands/Upgrade/Customer2Users.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ public function handle()
9797
$c2u->last_login_from = null;
9898
$c2u->extra_attributes = [ "created_by" => [ "type" => "migration-script" ] ];
9999
$c2u->save();
100-
/** FIXME FIXME-YR */
101-
102-
// ->setLastLoginAt( $u->getPreference( 'auth.last_login_at' ) ? new \DateTime( date( 'Y-m-d H:i:s' , $u->getPreference( 'auth.last_login_at' ) ) ) : null )
103-
// ->setLastLoginFrom( $u->getPreference( 'auth.last_login_from' ) )
104-
//
105100

106101
UserLoginHistory::where( 'user_id', $u->id )->update( ['customer_to_user_id' => $c2u->id ] );
107102

0 commit comments

Comments
 (0)