mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
rename:
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace Nexus\Client;
|
||||
|
||||
use Nexus\Core\Management;
|
||||
use Nexus\Database\DB;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class Client extends Management
|
||||
{
|
||||
@@ -460,4 +460,4 @@ JS;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Nexus\Database;
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
class DB
|
||||
class NexusDB
|
||||
{
|
||||
private $driver;
|
||||
|
||||
+14
-14
@@ -1,67 +1,67 @@
|
||||
<?php
|
||||
use Nexus\Database\DB;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
function mysql_connect($host, $username, $password, $database, $port)
|
||||
{
|
||||
return DB::getInstance()->connect($host, $username, $password, $database, $port);
|
||||
return NexusDB::getInstance()->connect($host, $username, $password, $database, $port);
|
||||
}
|
||||
|
||||
function mysql_errno()
|
||||
{
|
||||
return DB::getInstance()->errno();
|
||||
return NexusDB::getInstance()->errno();
|
||||
}
|
||||
|
||||
function mysql_error()
|
||||
{
|
||||
return DB::getInstance()->error();
|
||||
return NexusDB::getInstance()->error();
|
||||
}
|
||||
|
||||
function mysql_query(string $sql)
|
||||
{
|
||||
return DB::getInstance()->query($sql);
|
||||
return NexusDB::getInstance()->query($sql);
|
||||
}
|
||||
|
||||
function mysql_select_db($database)
|
||||
{
|
||||
return DB::getInstance()->select_db($database);
|
||||
return NexusDB::getInstance()->select_db($database);
|
||||
}
|
||||
|
||||
function mysql_num_rows($result)
|
||||
{
|
||||
return DB::getInstance()->numRows($result);
|
||||
return NexusDB::getInstance()->numRows($result);
|
||||
}
|
||||
|
||||
function mysql_fetch_array($result, $type = null)
|
||||
{
|
||||
return DB::getInstance()->fetchArray($result, $type);
|
||||
return NexusDB::getInstance()->fetchArray($result, $type);
|
||||
}
|
||||
|
||||
function mysql_fetch_assoc($result)
|
||||
{
|
||||
return DB::getInstance()->fetchAssoc($result);
|
||||
return NexusDB::getInstance()->fetchAssoc($result);
|
||||
}
|
||||
|
||||
function mysql_fetch_row($result)
|
||||
{
|
||||
return DB::getInstance()->fetchRow($result);
|
||||
return NexusDB::getInstance()->fetchRow($result);
|
||||
}
|
||||
|
||||
function mysql_affected_rows()
|
||||
{
|
||||
return DB::getInstance()->affectedRows();
|
||||
return NexusDB::getInstance()->affectedRows();
|
||||
}
|
||||
|
||||
function mysql_real_escape_string($string)
|
||||
{
|
||||
return DB::getInstance()->escapeString($string);
|
||||
return NexusDB::getInstance()->escapeString($string);
|
||||
}
|
||||
|
||||
function mysql_insert_id()
|
||||
{
|
||||
return DB::getInstance()->lastInsertId();
|
||||
return NexusDB::getInstance()->lastInsertId();
|
||||
}
|
||||
|
||||
function mysql_free_result($result)
|
||||
{
|
||||
return DB::getInstance()->freeResult($result);
|
||||
return NexusDB::getInstance()->freeResult($result);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Nexus\Field;
|
||||
|
||||
use Nexus\Database\DB;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class Field
|
||||
{
|
||||
@@ -207,10 +207,10 @@ HEAD;
|
||||
$attributes['updated_at'] = $now;
|
||||
$table = 'torrents_custom_fields';
|
||||
if (!empty($data['id'])) {
|
||||
$result = DB::update($table, $attributes, "id = " . sqlesc($data['id']));
|
||||
$result = NexusDB::update($table, $attributes, "id = " . sqlesc($data['id']));
|
||||
} else {
|
||||
$attributes['created_at'] = $now;
|
||||
$result = DB::insert($table, $attributes);
|
||||
$result = NexusDB::insert($table, $attributes);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ HEAD;
|
||||
public function renderOnUploadPage($torrentId = 0)
|
||||
{
|
||||
global $browsecatmode;
|
||||
$searchBox = DB::getOne('searchbox', "id = $browsecatmode");
|
||||
$searchBox = NexusDB::getOne('searchbox', "id = $browsecatmode");
|
||||
if (empty($searchBox)) {
|
||||
throw new \RuntimeException("Invalid search box: $browsecatmode");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Nexus\Install;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Nexus\Database\DB;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class Install
|
||||
{
|
||||
@@ -389,7 +389,7 @@ class Install
|
||||
'added' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
$this->doLog("[CREATE ADMINISTRATOR] " . json_encode($insert));
|
||||
return DB::insert('users', $insert);
|
||||
return NexusDB::insert('users', $insert);
|
||||
}
|
||||
|
||||
public function createEnvFile($data)
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\Models\Category;
|
||||
use App\Models\Icon;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Support\Str;
|
||||
use Nexus\Database\DB;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class Update extends Install
|
||||
{
|
||||
@@ -63,11 +63,11 @@ class Update extends Install
|
||||
'url' => $url,
|
||||
'info' => 'Manage custom fields',
|
||||
];
|
||||
$id = DB::insert($table, $insert);
|
||||
$id = NexusDB::insert($table, $insert);
|
||||
$this->doLog("[ADD CUSTOM FIELD MENU] insert: " . json_encode($insert) . " to table: $table, id: $id");
|
||||
}
|
||||
//since beta8
|
||||
if (WITH_LARAVEL && DB::schema()->hasColumn('categories', 'icon_id')) {
|
||||
if (WITH_LARAVEL && NexusDB::schema()->hasColumn('categories', 'icon_id')) {
|
||||
$this->doLog('[INIT CATEGORY ICON_ID]');
|
||||
$icon = Icon::query()->orderBy('id', 'asc')->first();
|
||||
if ($icon) {
|
||||
@@ -75,7 +75,7 @@ class Update extends Install
|
||||
}
|
||||
}
|
||||
//fix base url, since beta8
|
||||
if (WITH_LARAVEL && DB::schema()->hasTable('settings')) {
|
||||
if (WITH_LARAVEL && NexusDB::schema()->hasTable('settings')) {
|
||||
$settingBasic = get_setting('basic');
|
||||
if (isset($settingBasic['BASEURL']) && Str::startsWith($settingBasic['BASEURL'], 'localhost')) {
|
||||
$this->doLog('[RESET CONFIG basic.BASEURL]');
|
||||
@@ -89,7 +89,7 @@ class Update extends Install
|
||||
|
||||
//torrent support sticky second level
|
||||
if (WITH_LARAVEL) {
|
||||
$columnInfo = DB::getMysqlColumnInfo('torrents', 'pos_state');
|
||||
$columnInfo = NexusDB::getMysqlColumnInfo('torrents', 'pos_state');
|
||||
$this->doLog("[TORRENT POS_STATE], column info: " . json_encode($columnInfo));
|
||||
if ($columnInfo['DATA_TYPE'] == 'enum') {
|
||||
$sql = "alter table torrents modify `pos_state` varchar(32) NOT NULL DEFAULT 'normal'";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Nexus\Torrent;
|
||||
|
||||
use Nexus\Database\DB;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class Torrent
|
||||
{
|
||||
@@ -19,7 +19,7 @@ class Torrent
|
||||
$torrentIdStr = implode(',', $torrentIdArr);
|
||||
//seeding or leeching, from peers
|
||||
$whereStr = sprintf("userid = %s and torrent in (%s)", sqlesc($uid), $torrentIdStr);
|
||||
$peerList = DB::getAll('peers', $whereStr, 'torrent, to_go');
|
||||
$peerList = NexusDB::getAll('peers', $whereStr, 'torrent, to_go');
|
||||
$peerList = array_column($peerList,'to_go', 'torrent');
|
||||
//download progress, from snatched
|
||||
$sql = sprintf(
|
||||
@@ -64,4 +64,4 @@ class Torrent
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user