use shorter table name constant

This commit is contained in:
Jean-Christian Denis 2022-12-12 23:09:12 +01:00
parent a41edabd8a
commit 8b7d0afabc
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
5 changed files with 10 additions and 10 deletions

View file

@ -16,5 +16,5 @@ if (!defined('DC_RC_PATH')) {
class initEnhancePostContent
{
public const EPC_TABLE_NAME = 'epc';
public const TABLE_NAME = 'epc';
}

View file

@ -25,7 +25,7 @@ try {
# Database
$s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$s->{initEnhancePostContent::EPC_TABLE_NAME}
$s->{initEnhancePostContent::TABLE_NAME}
->epc_id('bigint', 0, false)
->blog_id('varchar', 32, false)
->epc_type('varchar', 32, false, "'epc'")

View file

@ -31,7 +31,7 @@ $this->addUserAction(
/* action */
'delete',
/* ns */
initEnhancePostContent::EPC_TABLE_NAME,
initEnhancePostContent::TABLE_NAME,
/* desc */
__('delete table')
);
@ -75,7 +75,7 @@ $this->addDirectAction(
/* action */
'delete',
/* ns */
initEnhancePostContent::EPC_TABLE_NAME,
initEnhancePostContent::TABLE_NAME,
/* desc */
sprintf(__('delete %s table'), 'enhancePostContent')
);

View file

@ -19,7 +19,7 @@ class epcRecords
public function __construct()
{
$this->con = dcCore::app()->con;
$this->table = dcCore::app()->prefix . initEnhancePostContent::EPC_TABLE_NAME;
$this->table = dcCore::app()->prefix . initEnhancePostContent::TABLE_NAME;
$this->blog = dcCore::app()->con->escape(dcCore::app()->blog->id);
}

View file

@ -23,10 +23,10 @@ if ($old_version && version_compare('0.6.6', $old_version, '>=')) {
$curlist = @unserialize($f->setting_value);
if (is_array($curlist)) {
foreach ($curlist as $k => $v) {
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . initEnhancePostContent::EPC_TABLE_NAME);
dcCore::app()->con->writeLock(dcCore::app()->prefix . initEnhancePostContent::EPC_TABLE_NAME);
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . initEnhancePostContent::TABLE_NAME);
dcCore::app()->con->writeLock(dcCore::app()->prefix . initEnhancePostContent::TABLE_NAME);
$cur->epc_id = dcCore::app()->con->select('SELECT MAX(epc_id) FROM ' . dcCore::app()->prefix . initEnhancePostContent::EPC_TABLE_NAME . ' ')->f(0) + 1;
$cur->epc_id = dcCore::app()->con->select('SELECT MAX(epc_id) FROM ' . dcCore::app()->prefix . initEnhancePostContent::TABLE_NAME . ' ')->f(0) + 1;
$cur->blog_id = $f->blog_id;
$cur->epc_filter = strtolower($m[1]);
$cur->epc_key = $k;
@ -42,9 +42,9 @@ if ($old_version && version_compare('0.6.6', $old_version, '>=')) {
# Move old filter name to filter id
} elseif ($old_version && version_compare('2021.10.05', $old_version, '>=')) {
$rs = dcCore::app()->con->select('SELECT epc_id, epc_filter FROM ' . dcCore::app()->prefix . initEnhancePostContent::EPC_TABLE_NAME);
$rs = dcCore::app()->con->select('SELECT epc_id, epc_filter FROM ' . dcCore::app()->prefix . initEnhancePostContent::TABLE_NAME);
while ($rs->fetch()) {
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . initEnhancePostContent::EPC_TABLE_NAME);
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . initEnhancePostContent::TABLE_NAME);
$cur->epc_filter = strtolower($rs->epc_filter);