Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat): general refactoring work for the DI
- Loading branch information
1 parent
009b98b
commit 68161bc
Showing
7 changed files
with
146 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* Controller class | ||
*/ | ||
|
||
namespace Minds\Components; | ||
|
||
class Controller { | ||
|
||
protected $di; | ||
protected $config; | ||
|
||
public function __construct() | ||
{ | ||
$this->di = Minds\Core\Di\Di::_(); | ||
$this->config = $this->di->get('Config'); | ||
} | ||
|
||
} |
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,30 @@ | ||
<?php | ||
/** | ||
* Minds Boost Provider | ||
*/ | ||
|
||
namespace Minds\Core\Boost; | ||
|
||
use Minds\Core\Di\Provider; | ||
|
||
class BoostProvider extends Provider | ||
{ | ||
|
||
public function register() | ||
{ | ||
$this->di->bind('Boost\Network', function($di){ | ||
return new Network(Data\Client::build('MongoDB'), new Data\Call('entities_by_time')); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Boost\Newsfeed', function($di){ | ||
return new Newsfeed(Data\Client::build('MongoDB'), new Data\Call('entities_by_time')); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Boost\Content', function($di){ | ||
return new Content(Data\Client::build('MongoDB'), new Data\Call('entities_by_time')); | ||
}, ['useFactory'=>true]); | ||
|
||
$this->di->bind('Boost\Peer', function($di){ | ||
return new Peer(); | ||
}, ['useFactory'=>true]); | ||
} | ||
|
||
} |
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,47 @@ | ||
<?php | ||
/** | ||
* Minds dataroot Provider | ||
*/ | ||
|
||
namespace Minds\Core\Data; | ||
|
||
use Minds\Core\Di\Provider; | ||
|
||
class DataProvider extends Provider | ||
{ | ||
|
||
public function register() | ||
{ | ||
/** | ||
* Cache bindings | ||
*/ | ||
$this->di->bind('Cache', function($di){ | ||
return $di->get('Cache\Redis'); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Cache\Redis', function($di){ | ||
return new Cache\Redis(); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Cache\Apcu', function($di){ | ||
return new Cache\Apcu(); | ||
}, ['useFactory'=>true]); | ||
/** | ||
* Database bindings | ||
*/ | ||
$this->di->bind('Database', function($di){ | ||
return $di->get('Database\Cassandra'); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Database\Cassandra', function($di){ | ||
return new Data\Call(); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Database\MongoDB', function($di){ | ||
return new Data\MongoDB\Client(); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Database\Neo4j', function($di){ | ||
return new Data\Neo4j\Client(); | ||
}, ['useFactory'=>true]); | ||
$this->di->bind('Database\ElasticSearch', function($di){ | ||
return new Data\ElasticSearch\Client(); | ||
}, ['useFactory'=>true]); | ||
} | ||
|
||
} |
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 @@ | ||
{ | ||
|
||
"cassandra": { | ||
"keyspace": "minds", | ||
"servers": [ "127.0.0.1" ], | ||
"cql_servers": [ "127.0.0.1:9042" ] | ||
}, | ||
|
||
"installed": true, | ||
|
||
"path": "/var/www/Minds/", | ||
"dataroot": "/data/", | ||
|
||
"default_site": "01", | ||
"site_id": "01", | ||
"__site_secret__": "abc123xyz789", | ||
|
||
"system_cache_path": "/tmp/elgg_system_cache/", | ||
|
||
"elasticsearch_server": "http://localhost:9200/", | ||
"elasticsearch_prefix": "mehmac_", | ||
|
||
"broken_mta": false, | ||
|
||
"min_password_length": 6, | ||
"minusername": 2, | ||
|
||
"icon_sizes": { | ||
"topbar": { "w": 16, "h": 16, "square": true, "upscale": true }, | ||
"tiny": { "w": 25, "h": 25, "square": true, "upscale": true }, | ||
"small": { "w": 40, "h": 40, "square": true, "upscale": true }, | ||
"medium": { "w": 100, "h": 100, "square": true, "upscale": true }, | ||
"large": { "w": 425, "h": 425, "square": false, "upscale": false }, | ||
"master": { "w": 550, "h": 550, "square": false, "upscale": false } | ||
} | ||
|
||
} | ||
|