From 9adb197b2ff09922c90b6cc225542063343a020e Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 23 Apr 2023 12:52:34 +0200 Subject: [PATCH] use latest dotclear namespace (database) --- src/Install.php | 18 +++++++++--------- src/Utils.php | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Install.php b/src/Install.php index 4ae6e1e..c159c54 100644 --- a/src/Install.php +++ b/src/Install.php @@ -14,9 +14,9 @@ declare(strict_types=1); namespace Dotclear\Plugin\filesAlias; -use dbStruct; use dcCore; use dcNsProcess; +use Dotclear\Database\Structure; use Exception; class Install extends dcNsProcess @@ -35,21 +35,21 @@ class Install extends dcNsProcess } try { - $s = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); + $s = new Structure(dcCore::app()->con, dcCore::app()->prefix); - $s->{My::ALIAS_TABLE_NAME} - ->blog_id('varchar', 32, false) - ->filesalias_url('varchar', 255, false) - ->filesalias_destination('varchar', 255, false) - ->filesalias_password('varchar', 32, true, null) - ->filesalias_disposable('smallint', 0, false, 0) + $s->__get(My::ALIAS_TABLE_NAME) + ->field('blog_id', 'varchar', 32, false) + ->field('filesalias_url', 'varchar', 255, false) + ->field('ilesalias_destination', 'varchar', 255, false) + ->field('filesalias_password', 'varchar', 32, true, null) + ->field('filesalias_disposable', 'smallint', 0, false, 0) ->primary('pk_filesalias', 'blog_id', 'filesalias_url') ->index('idx_filesalias_blog_id', 'btree', 'blog_id') ->reference('fk_filesalias_blog', 'blog_id', 'blog', 'blog_id', 'cascade', 'cascade') ; - $si = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); + $si = new Structure(dcCore::app()->con, dcCore::app()->prefix); $changes = $si->synchronize($s); return true; diff --git a/src/Utils.php b/src/Utils.php index a54f1ff..ecb7ae4 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -16,7 +16,7 @@ namespace Dotclear\Plugin\filesAlias; use dcCore; use dcMedia; -use dcRecord; +use Dotclear\Database\MetaRecord; use Dotclear\Database\Statement\{ DeleteStatement, SelectStatement @@ -31,9 +31,9 @@ class Utils /** * Get aliases records. * - * @return dcRecord The file alias records + * @return MetaRecord The file alias records */ - public static function getAliases(): dcRecord + public static function getAliases(): MetaRecord { // nullsafe $blog_id = is_null(dcCore::app()->blog) ? '' : dcCore::app()->blog->id; @@ -50,15 +50,15 @@ class Utils ->order('filesalias_url ASC') ->select(); - return is_null($rs) ? dcRecord::newFromArray([]) : $rs; + return is_null($rs) ? MetaRecord::newFromArray([]) : $rs; } /** * Get alias record. * - * @return dcRecord The alias record + * @return MetaRecord The alias record */ - public static function getAlias(string $url): dcRecord + public static function getAlias(string $url): MetaRecord { // nullsafe $blog_id = is_null(dcCore::app()->blog) ? '' : dcCore::app()->blog->id; @@ -76,7 +76,7 @@ class Utils ->order('filesalias_url ASC') ->select(); - return is_null($rs) ? dcRecord::newFromArray([]) : $rs; + return is_null($rs) ? MetaRecord::newFromArray([]) : $rs; } /**