diff --git a/config/bootstrap.php b/config/bootstrap.php index 938d3c2..fbfa9d0 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -49,6 +49,7 @@ require __DIR__ . '/paths.php'; */ require CORE_PATH . 'config' . DS . 'bootstrap.php'; +use App\Application; use Cake\Cache\Cache; use Cake\Console\ConsoleErrorHandler; use Cake\Core\App; @@ -60,6 +61,7 @@ use Cake\Datasource\ConnectionManager; use Cake\Error\ErrorHandler; use Cake\Log\Log; use Cake\Mailer\Email; +use Cake\Mailer\TransportFactory; use Cake\Network\Request; use Cake\Utility\Inflector; use Cake\Utility\Security; @@ -150,10 +152,12 @@ if (!Configure::read('App.fullBaseUrl')) { Cache::setConfig(Configure::consume('Cache')); ConnectionManager::setConfig(Configure::consume('Datasources')); -Email::setConfigTransport(Configure::consume('EmailTransport')); +//Email::setConfigTransport(Configure::consume('EmailTransport')); +TransportFactory::setConfig(Configure::consume('EmailTransport')); Email::setConfig(Configure::consume('Email')); Log::setConfig(Configure::consume('Log')); -Security::salt(Configure::consume('Security.salt')); +//Security::salt(Configure::consume('Security.salt')); +Security::setSalt(Configure::consume('Security.salt')); /* * The default crypto extension in 3.0 is OpenSSL. @@ -218,8 +222,9 @@ Type::build('timestamp') * Debug Kit should not be installed on a production system */ if (Configure::read('debug')) { - Plugin::load('DebugKit', ['bootstrap' => true]); + //Plugin::load('DebugKit', ['bootstrap' => true]); + Application::addPlugin('DebugKit', ['bootstrap' => true]); } -Configure::load('lbry'); +Configure::load('lbry','lbry.default'); diff --git a/dev.sh b/dev.sh new file mode 100755 index 0000000..d617fd1 --- /dev/null +++ b/dev.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +PHPBIN=php7.2 + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + + +if [ ! -e "config/app.php" ]; then + cp "$DIR/config/app.default.php" "$DIR/config/app.php" +fi + +if ! which $PHPBIN 2>/dev/null; then + PHPBIN=php +fi + +#Composer update +composer update + +#$PHPBIN composer.phar install + +$PHPBIN --server localhost:8000 --docroot "$DIR/webroot" "$DIR/webroot/index.php" \ No newline at end of file diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index be8ad60..eae6609 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -102,7 +102,8 @@ class MainController extends AppController { $hashRate = $this->_formatHashRate($this->_gethashrate()); // recent claims - $claims = $this->Claims->find()->distinct(['Claims.claim_id'])->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->limit(5)->toArray(); + //$claims = $this->Claims->find()->distinct(['Claims.claim_id'])->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->limit(5)->toArray(); + $claims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->limit(5)->toArray(); $this->set('recentBlocks', $blocks); $this->set('recentClaims', $claims); @@ -141,8 +142,9 @@ class MainController extends AppController { } $offset = ($page - 1) * $pageLimit; - $claims = $this->Claims->find()->distinct(['Claims.claim_id'])->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->offset($offset)->limit($pageLimit)->toArray(); - + //$claims = $this->Claims->find()->distinct(['Claims.claim_id'])->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->offset($offset)->limit($pageLimit)->toArray(); + $claims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->order(['Claims.created_at' => 'DESC'])->offset($offset)->limit($pageLimit)->toArray(); + for ($i = 0; $i < count($claims); $i++) { if ($canConvert && $claims[$i]->fee > 0 && $claims[$i]->fee_currency == 'USD') { $claims[$i]->price = $claims[$i]->fee / $priceInfo->price;