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:
Mark Beamer Jr 2018-12-21 23:41:30 -05:00
parent 17b0ef58a9
commit 262e90a2e1
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973
3 changed files with 37 additions and 7 deletions

View file

@ -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');

23
dev.sh Executable file
View 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"

View file

@ -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;