Fixed some deprecation warnings.
Fixed a few claim queries that were using a distinct causing a group by to be performed with full table scan. Added `dev.sh` file to quickly startup the explorer.
This commit is contained in:
parent
17b0ef58a9
commit
262e90a2e1
3 changed files with 37 additions and 7 deletions
|
@ -49,6 +49,7 @@ require __DIR__ . '/paths.php';
|
||||||
*/
|
*/
|
||||||
require CORE_PATH . 'config' . DS . 'bootstrap.php';
|
require CORE_PATH . 'config' . DS . 'bootstrap.php';
|
||||||
|
|
||||||
|
use App\Application;
|
||||||
use Cake\Cache\Cache;
|
use Cake\Cache\Cache;
|
||||||
use Cake\Console\ConsoleErrorHandler;
|
use Cake\Console\ConsoleErrorHandler;
|
||||||
use Cake\Core\App;
|
use Cake\Core\App;
|
||||||
|
@ -60,6 +61,7 @@ use Cake\Datasource\ConnectionManager;
|
||||||
use Cake\Error\ErrorHandler;
|
use Cake\Error\ErrorHandler;
|
||||||
use Cake\Log\Log;
|
use Cake\Log\Log;
|
||||||
use Cake\Mailer\Email;
|
use Cake\Mailer\Email;
|
||||||
|
use Cake\Mailer\TransportFactory;
|
||||||
use Cake\Network\Request;
|
use Cake\Network\Request;
|
||||||
use Cake\Utility\Inflector;
|
use Cake\Utility\Inflector;
|
||||||
use Cake\Utility\Security;
|
use Cake\Utility\Security;
|
||||||
|
@ -150,10 +152,12 @@ if (!Configure::read('App.fullBaseUrl')) {
|
||||||
|
|
||||||
Cache::setConfig(Configure::consume('Cache'));
|
Cache::setConfig(Configure::consume('Cache'));
|
||||||
ConnectionManager::setConfig(Configure::consume('Datasources'));
|
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'));
|
Email::setConfig(Configure::consume('Email'));
|
||||||
Log::setConfig(Configure::consume('Log'));
|
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.
|
* 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
|
* Debug Kit should not be installed on a production system
|
||||||
*/
|
*/
|
||||||
if (Configure::read('debug')) {
|
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');
|
||||||
|
|
||||||
|
|
23
dev.sh
Executable file
23
dev.sh
Executable file
|
@ -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"
|
|
@ -102,7 +102,8 @@ class MainController extends AppController {
|
||||||
$hashRate = $this->_formatHashRate($this->_gethashrate());
|
$hashRate = $this->_formatHashRate($this->_gethashrate());
|
||||||
|
|
||||||
// recent claims
|
// 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('recentBlocks', $blocks);
|
||||||
$this->set('recentClaims', $claims);
|
$this->set('recentClaims', $claims);
|
||||||
|
@ -141,8 +142,9 @@ class MainController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$offset = ($page - 1) * $pageLimit;
|
$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++) {
|
for ($i = 0; $i < count($claims); $i++) {
|
||||||
if ($canConvert && $claims[$i]->fee > 0 && $claims[$i]->fee_currency == 'USD') {
|
if ($canConvert && $claims[$i]->fee > 0 && $claims[$i]->fee_currency == 'USD') {
|
||||||
$claims[$i]->price = $claims[$i]->fee / $priceInfo->price;
|
$claims[$i]->price = $claims[$i]->fee / $priceInfo->price;
|
||||||
|
|
Loading…
Reference in a new issue