fix table name
This commit is contained in:
parent
56eec0f2e7
commit
ad98a0d9d8
@ -30,13 +30,13 @@ dcCore::app()->addBehavior('exportSingleV2', function ($exp, $blog_id) {
|
||||
$exp->export(
|
||||
'alias',
|
||||
'SELECT alias_url, alias_destination, alias_position ' .
|
||||
'FROM ' . dcCore::app()->prefix . 'alias A ' .
|
||||
'FROM ' . dcCore::app()->prefix . initAlias::ALIAS_TABLE_NAME . ' A ' .
|
||||
"WHERE A.blog_id = '" . $blog_id . "'"
|
||||
);
|
||||
});
|
||||
|
||||
dcCore::app()->addBehavior('importInitV2', function ($bk) {
|
||||
$bk->cur_alias = dcCore::app()->con->openCursor(dcCore::app()->prefix . 'alias');
|
||||
$bk->cur_alias = dcCore::app()->con->openCursor(dcCore::app()->prefix . initAlias::ALIAS_TABLE_NAME);
|
||||
$bk->alias = new dcAliases();
|
||||
$bk->aliases = $bk->alias->getAliases();
|
||||
});
|
||||
|
20
_init.php
Normal file
20
_init.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief alias, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author Olivier Meunier and contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
class initAlias
|
||||
{
|
||||
public const ALIAS_TABLE_NAME = 'alias';
|
||||
}
|
@ -23,7 +23,7 @@ if (version_compare(dcCore::app()->getVersion('alias'), $version, '>=')) {
|
||||
try {
|
||||
$s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
|
||||
|
||||
$s->alias
|
||||
$s->{initAlias::ALIAS_TABLE_NAME}
|
||||
->blog_id('varchar', 32, false)
|
||||
->alias_url('varchar', 255, false)
|
||||
->alias_destination('varchar', 255, false)
|
||||
|
@ -16,8 +16,6 @@ if (!defined('DC_RC_PATH')) {
|
||||
|
||||
class dcAliases
|
||||
{
|
||||
public const ALIAS_TABLE_NAME = 'alias';
|
||||
|
||||
protected $aliases;
|
||||
|
||||
public function __construct()
|
||||
@ -32,7 +30,7 @@ class dcAliases
|
||||
|
||||
$this->aliases = [];
|
||||
$sql = 'SELECT alias_url, alias_destination, alias_position ' .
|
||||
'FROM ' . dcCore::app()->prefix . dcAliases::ALIAS_TABLE_NAME . ' ' .
|
||||
'FROM ' . dcCore::app()->prefix . initAlias::ALIAS_TABLE_NAME . ' ' .
|
||||
"WHERE blog_id = '" . dcCore::app()->con->escape(dcCore::app()->blog->id) . "' " .
|
||||
'ORDER BY alias_position ASC ';
|
||||
$this->aliases = dcCore::app()->con->select($sql)->rows();
|
||||
@ -77,7 +75,7 @@ class dcAliases
|
||||
throw new Exception(__('Alias destination is empty.'));
|
||||
}
|
||||
|
||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcAliases::ALIAS_TABLE_NAME);
|
||||
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . initAlias::ALIAS_TABLE_NAME);
|
||||
$cur->blog_id = (string) dcCore::app()->blog->id;
|
||||
$cur->alias_url = (string) $url;
|
||||
$cur->alias_destination = (string) $destination;
|
||||
@ -88,7 +86,7 @@ class dcAliases
|
||||
public function deleteAlias($url)
|
||||
{
|
||||
dcCore::app()->con->execute(
|
||||
'DELETE FROM ' . dcCore::app()->prefix . dcAliases::ALIAS_TABLE_NAME . ' ' .
|
||||
'DELETE FROM ' . dcCore::app()->prefix . initAlias::ALIAS_TABLE_NAME . ' ' .
|
||||
"WHERE blog_id = '" . dcCore::app()->con->escape(dcCore::app()->blog->id) . "' " .
|
||||
"AND alias_url = '" . dcCore::app()->con->escape($url) . "' "
|
||||
);
|
||||
@ -97,7 +95,7 @@ class dcAliases
|
||||
public function deleteAliases()
|
||||
{
|
||||
dcCore::app()->con->execute(
|
||||
'DELETE FROM ' . dcCore::app()->prefix . dcAliases::ALIAS_TABLE_NAME . ' ' .
|
||||
'DELETE FROM ' . dcCore::app()->prefix . initAlias::ALIAS_TABLE_NAME . ' ' .
|
||||
"WHERE blog_id = '" . dcCore::app()->con->escape(dcCore::app()->blog->id) . "' "
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user